mirror of
https://github.com/sethm/symon.git
synced 2025-04-14 05:37:39 +00:00
implement overrun status flag for the 6551 ACIA
This commit is contained in:
parent
4a37dd7463
commit
252ebe0569
@ -181,7 +181,7 @@ public class Acia6551 extends Acia {
|
||||
*/
|
||||
@Override
|
||||
public int statusReg() {
|
||||
// TODO: Overrun, Parity Error, Framing Error, DTR, DSR, and Interrupt flags.
|
||||
// TODO: Parity Error, Framing Error, DTR, DSR, and Interrupt flags.
|
||||
int stat = 0;
|
||||
if (rxFull && System.nanoTime() >= (lastRxRead + baudRateDelay)) {
|
||||
stat |= 0x08;
|
||||
@ -189,6 +189,9 @@ public class Acia6551 extends Acia {
|
||||
if (txEmpty && System.nanoTime() >= (lastTxWrite + baudRateDelay)) {
|
||||
stat |= 0x10;
|
||||
}
|
||||
if (overrun) {
|
||||
stat |= 0x04;
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -112,6 +112,25 @@ public class AciaTest {
|
||||
|
||||
assertEquals(0x08, acia.read(0x0001));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aciaShouldOverrunAndReadShouldReset()
|
||||
throws Exception {
|
||||
|
||||
Acia acia = new Acia6551(0x0000);
|
||||
|
||||
// overrun ACIA
|
||||
acia.rxWrite('a');
|
||||
acia.rxWrite('b');
|
||||
|
||||
assertEquals(0x04, acia.read(0x0001) & 0x04);
|
||||
|
||||
// read should reset
|
||||
acia.rxRead();
|
||||
assertEquals(0x00, acia.read(0x0001) & 0x04);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void readingBuffersShouldResetStatus()
|
||||
|
Loading…
x
Reference in New Issue
Block a user