implement overrun status flag for the 6551 ACIA
This commit is contained in:
1 parent
4a37dd7463
commit
252ebe0569
2 files changed
+23
-1
No files matched your search
@@ -181,7 +181,7 @@ public class Acia6551 extends Acia {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int statusReg() {
|
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;
|
int stat = 0;
|
||||||
if (rxFull && System.nanoTime() >= (lastRxRead + baudRateDelay)) {
|
if (rxFull && System.nanoTime() >= (lastRxRead + baudRateDelay)) {
|
||||||
stat |= 0x08;
|
stat |= 0x08;
|
||||||
@@ -189,6 +189,9 @@ public class Acia6551 extends Acia {
|
|||||||
if (txEmpty && System.nanoTime() >= (lastTxWrite + baudRateDelay)) {
|
if (txEmpty && System.nanoTime() >= (lastTxWrite + baudRateDelay)) {
|
||||||
stat |= 0x10;
|
stat |= 0x10;
|
||||||
}
|
}
|
||||||
|
if (overrun) {
|
||||||
|
stat |= 0x04;
|
||||||
|
}
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,25 @@ public class AciaTest {
|
|||||||
assertEquals(0x08, acia.read(0x0001));
|
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
|
@Test
|
||||||
public void readingBuffersShouldResetStatus()
|
public void readingBuffersShouldResetStatus()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|||||||
Reference in new issue
Block a user