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:
1 parent
6c0ff5a5b2
commit
c1caf8c6b4
9 files changed
+272
-128
No files matched your search
+2
-2
@@ -13,8 +13,8 @@
|
||||
start: cli
|
||||
lda #$09
|
||||
sta iocmd ; Set command status
|
||||
lda #$16
|
||||
sta ioctrl ; 0 stop bits, 8 bit word, 300 baud
|
||||
lda #$1a
|
||||
sta ioctrl ; 0 stop bits, 8 bit word, 2400 baud
|
||||
|
||||
;; Load a character from the keyboard and store it into
|
||||
;; the accumulator
|
||||
|
||||
Binary file not shown.
+11
-12
@@ -13,20 +13,19 @@
|
||||
start: cli
|
||||
lda #$09
|
||||
sta iocmd ; Set command status
|
||||
lda #$16
|
||||
sta ioctrl ; 0 stop bits, 8 bit word, 300 baud
|
||||
ldx #$00 ; Initialize index
|
||||
lda #$1a
|
||||
sta ioctrl ; 0 stop bits, 8 bit word, 2400 baud
|
||||
|
||||
loop: lda string,x
|
||||
beq start ; If A is 0, loop back and start again
|
||||
init: ldx #$00 ; Initialize index
|
||||
|
||||
write: lda iostatus
|
||||
and #$10 ; Load ACIA status. Is output buffer empty?
|
||||
beq write ; If not, loop back and try again,
|
||||
lda string,x
|
||||
sta iobase ; Otherwise, write to output.
|
||||
loop: lda iostatus
|
||||
and #$10 ; Is the tx register empty?
|
||||
beq loop ; No, wait for it to empty
|
||||
lda string,x ; Otherwise, load the string pointer
|
||||
beq init ; If the char is 0, re-init
|
||||
sta iobase ; Otherwise, transmit
|
||||
|
||||
inx
|
||||
jmp loop ; Repeat.
|
||||
inx ; Increment string pointer.
|
||||
jmp loop ; Repeat write.
|
||||
|
||||
string: .byte "Hello, 6502 world! ", 0
|
||||
Binary file not shown.
Reference in new issue
Block a user