2012-10-11 23:08:04 +00:00
|
|
|
;;
|
|
|
|
;; Read input from the keyboard, and echo to console.
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2012-12-06 07:19:34 +00:00
|
|
|
.alias iobase $8800
|
2012-10-11 23:08:04 +00:00
|
|
|
.alias iostatus [iobase + 1]
|
|
|
|
.alias iocmd [iobase + 2]
|
|
|
|
.alias ioctrl [iobase + 3]
|
|
|
|
|
|
|
|
.org $0300
|
|
|
|
|
|
|
|
start: cli
|
2012-12-06 07:19:34 +00:00
|
|
|
lda #$0b
|
2012-10-11 23:08:04 +00:00
|
|
|
sta iocmd ; Set command status
|
2012-10-15 00:56:19 +00:00
|
|
|
lda #$1a
|
|
|
|
sta ioctrl ; 0 stop bits, 8 bit word, 2400 baud
|
2012-10-11 23:08:04 +00:00
|
|
|
|
|
|
|
;; 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
|
CPU bug fixes and Simulator enhancements.
Bug Fixes:
- Fixed several bugs in the CPU that caused processor status flags to
be set incorrectly. Instructions affected were: STA, STX, STY, CMP,
CPX, CPY, BIT.
- Made some internal-use-only methods on the CPU class private.
- Fixed incorrect disassembly of (Indirect,X) and (Indirect),Y
instructions. Although this didn't affect behavior, it certainly
caused me some confusion in debugging.
- Added missing "BCS" instruction to instruction table.
Enhancements:
- Now includes a full version of Lee Davison's Enhanced 6502 BASIC
bundled as source code and a ROM image. Get that REAL COMPUTER
EXPERIENCE!(tm)
- If a file named "rom.bin" exists in the same directory where the
simulator is executed, it will be loaded at addresses $d000-$ffff.
- Gave the CPU an idle loop to make simulated timing a little more
realistic (but this is still an area needing major improvement)
- Changed the CPU's toString() method to give better debugging output.
- Added a small typeahead buffer to the Console.
- Better exception messaging.
Misc:
- Bumped version to 0.5, updated README.
2012-10-22 03:05:05 +00:00
|
|
|
writel: lda iostatus ; Read the ACIA status
|
2012-10-11 23:08:04 +00:00
|
|
|
and #$10 ; Is the tx register empty?
|
CPU bug fixes and Simulator enhancements.
Bug Fixes:
- Fixed several bugs in the CPU that caused processor status flags to
be set incorrectly. Instructions affected were: STA, STX, STY, CMP,
CPX, CPY, BIT.
- Made some internal-use-only methods on the CPU class private.
- Fixed incorrect disassembly of (Indirect,X) and (Indirect),Y
instructions. Although this didn't affect behavior, it certainly
caused me some confusion in debugging.
- Added missing "BCS" instruction to instruction table.
Enhancements:
- Now includes a full version of Lee Davison's Enhanced 6502 BASIC
bundled as source code and a ROM image. Get that REAL COMPUTER
EXPERIENCE!(tm)
- If a file named "rom.bin" exists in the same directory where the
simulator is executed, it will be loaded at addresses $d000-$ffff.
- Gave the CPU an idle loop to make simulated timing a little more
realistic (but this is still an area needing major improvement)
- Changed the CPU's toString() method to give better debugging output.
- Added a small typeahead buffer to the Console.
- Better exception messaging.
Misc:
- Bumped version to 0.5, updated README.
2012-10-22 03:05:05 +00:00
|
|
|
beq writel ; No, wait for it to empty
|
2012-10-11 23:08:04 +00:00
|
|
|
pla ; Otherwise, load saved accumulator
|
|
|
|
sta iobase ; and write to output.
|
|
|
|
|
|
|
|
jmp getkey ; Repeat
|