mirror of
https://github.com/sethm/symon.git
synced 2025-08-06 07:25:14 +00:00
This is something of a "Work in Progress" checkpoint of several features that are all half baked: 1. Allow loading of 16KB ROM files at address $C000 at run-time, not just at startup. See the "Load ROM..." File menu item. 2. Introduces the notion of "CPU Behaviors", so the core 6502 CPU implementation can match the behavior of either an early NMOS 6502, late NMOS 6502, or CMOS 65C02. Very little of this is actually implemented so far. 3. Adds a completely bogus implementation of the 6522 VIA (it does absolutely nothing right now). 4. Changes the address of the ACIA in the simulated system to match a real hardware implementation I put together.
37 lines
1005 B
NASM
37 lines
1005 B
NASM
;;
|
|
;; Read input from the keyboard, and echo to console.
|
|
;;
|
|
|
|
|
|
.alias iobase $8000
|
|
.alias iostatus [iobase + 1]
|
|
.alias iocmd [iobase + 2]
|
|
.alias ioctrl [iobase + 3]
|
|
|
|
.org $0300
|
|
|
|
start: cli
|
|
lda #$09
|
|
sta iocmd ; Set command status
|
|
lda #$1a
|
|
sta ioctrl ; 0 stop bits, 8 bit word, 2400 baud
|
|
|
|
;; Load a character from the keyboard and store it into
|
|
;; the accumulator
|
|
|
|
getkey: lda iostatus ; Read the ACIA status
|
|
and #$08 ; Is the rx register empty?
|
|
beq getkey ; Yes, wait for it to fill
|
|
lda iobase ; Otherwise, read into accumulator
|
|
|
|
;; Write the current char in the accumulator to the console
|
|
|
|
write: pha ; Save accumulator
|
|
writel: lda iostatus ; Read the ACIA status
|
|
and #$10 ; Is the tx register empty?
|
|
beq writel ; No, wait for it to empty
|
|
pla ; Otherwise, load saved accumulator
|
|
sta iobase ; and write to output.
|
|
|
|
jmp getkey ; Repeat
|