1
0
mirror of https://github.com/sethm/symon.git synced 2024-06-02 14:41:33 +00:00

implement overrun flag for 6850 ACIA

This commit is contained in:
Maik Merten 2014-07-16 22:26:06 +02:00
parent 0d0fddc365
commit 8f52e1da1e
2 changed files with 32 additions and 0 deletions

View File

@ -86,6 +86,20 @@ public class Acia6850 extends Acia {
throw new MemoryAccessException("No register.");
}
}
@Override
public synchronized int rxRead() {
overrun = false;
return super.rxRead();
}
@Override
public synchronized void rxWrite(int data) {
if(rxFull) {
overrun = true;
}
super.rxWrite(data);
}
private void setCommandRegister(int data) {

View File

@ -125,6 +125,24 @@ public class AciaTest6850 {
assertEquals(0x01, acia.read(CMD_STAT_REG) & 0x03);
}
@Test
public void aciaShouldOverrunAndReadShouldReset()
throws Exception {
Acia acia = newAcia();
// overrun ACIA
acia.rxWrite('a');
acia.rxWrite('b');
assertEquals(0x20, acia.read(CMD_STAT_REG) & 0x20);
// read should reset
acia.rxRead();
assertEquals(0x00, acia.read(CMD_STAT_REG) & 0x20);
}
@Test
public void readingBuffersShouldResetStatus()