Timing and UI enhancements.

This change introduces simulated baud rates in the ACIA. Baud rate is controlled just as in the real 6551, by writing to the ACIA's control register. Baud rates between 50 and 19,200 baud are selectable. A baud rate of 0 has special meaning, and turns off all simulated baud rate delays (on a real 6551, this means to use an external clock instead of the internal baud rate generator)

A busy-wait loop between steps in the simulator control program has also been added. This uses the high-resolution 'System.nanoTime()' call to wait a specific number of nanoseconds before continuing. Symon now waits at least 1uS between clock cycles, trying to approach a real 1MHz 6502 in performance. It is far from perfect, but it's better than it was.

 Also refactored the status panel to use a BoxLayout, and DRY-up some of the code.
This commit is contained in:
Seth Morabito committed 2012-10-14 17:56:19 -07:00
1 parent 6c0ff5a5b2
commit c1caf8c6b4
9 files changed
+272 -128

No files matched your search

+36 -37
View File
@@ -8,55 +8,54 @@ import com.loomcom.symon.exceptions.FifoUnderrunException;
import static org.junit.Assert.*;
public class AciaTest {
@Test
public void newAciaShouldHaveTxEmptyStatus() throws Exception {
Acia acia = new Acia(0x000);
@Test
public void newAciaShouldHaveTxEmptyStatus() throws Exception {
Acia acia = new Acia(0x000);
assertEquals(0x10, acia.read(0x0001));
}
assertEquals(0x10, acia.read(0x0001));
}
@Test
public void aciaShouldHaveTxEmptyStatusOffIfTxHasData() throws Exception {
Acia acia = new Acia(0x000);
@Test
public void aciaShouldHaveTxEmptyStatusOffIfTxHasData() throws Exception {
Acia acia = new Acia(0x000);
acia.txWrite('a');
assertEquals(0x00, acia.read(0x0001));
}
acia.txWrite('a');
assertEquals(0x00, acia.read(0x0001));
}
@Test
public void aciaShouldHaveRxFullStatusOffIfRxHasData() throws Exception {
Acia acia = new Acia(0x000);
@Test
public void aciaShouldHaveRxFullStatusOffIfRxHasData() throws Exception {
Acia acia = new Acia(0x000);
acia.rxWrite('a');
assertEquals(0x18, acia.read(0x0001));
}
acia.rxWrite('a');
assertEquals(0x18, acia.read(0x0001));
}
@Test
public void aciaShouldHaveTxEmptyAndRxFullStatusOffIfRxAndTxHaveData()
throws Exception {
Acia acia = new Acia(0x000);
@Test
public void aciaShouldHaveTxEmptyAndRxFullStatusOffIfRxAndTxHaveData()
throws Exception {
Acia acia = new Acia(0x000);
acia.rxWrite('a');
acia.txWrite('b');
acia.rxWrite('a');
acia.txWrite('b');
assertEquals(0x08, acia.read(0x0001));
}
assertEquals(0x08, acia.read(0x0001));
}
@Test
public void readingBuffersShouldResetStatus()
throws Exception {
Acia acia = new Acia(0x0000);
@Test
public void readingBuffersShouldResetStatus()
throws Exception {
Acia acia = new Acia(0x0000);
acia.rxWrite('a');
acia.txWrite('b');
acia.rxWrite('a');
acia.txWrite('b');
assertEquals(0x08, acia.read(0x0001));
assertEquals(0x08, acia.read(0x0001));
assertEquals('a', acia.rxRead());
assertEquals('b', acia.txRead());
assertEquals(0x10, acia.read(0x0001));
}
assertEquals('a', acia.rxRead());
assertEquals('b', acia.txRead());
assertEquals(0x10, acia.read(0x0001));
}
}