BIOS Calls
BIOS calls are indexed into a “jump table” allowing higher level code to call them without knowing the underlying addresses. This allows the ROM routine implementations to move around without needing to re-assemble/compile code that accesses them. These are only used for code that is assembled outside of the rom_image folder. This is very much in flux, as I haven’t used it for anything but some testing yet.
BIOSJMPTABLE = $FF00
write_bufferln = $00
write_buffer = $02
write_char = $04
read_char = $06
get_line = $08
char_avail = $0A
read_char_nonblocking = $0C
Interrupt Vectors
- Reset: Points to the BIOS initialization routine
- IRQ: Right now is a dummy routine
- NMI: I use the NMI on these systems as a last ditch effort troubleshooting measure. Triggering an NMI will cause the system to dump the current processor registers and return from the interrupt. This is remniscent of the message that is printed when an Apple IIe “crashes” to its monitor. Disclaimer: This wasn’t my idea, it likely came from 6502.org or Garth Wilson’s page.
.export nmi_handler
.proc nmi_handler
cld
pha ; Preserve registers
phx
phy
tsx ; Preserve stack pointer
putsln ""
putsln "NMI received"
puts "SP:"
txa ; Print stack pointer
adc #5
jsr print_byte_as_hex_chars
puts " Y:"
inx
lda $0100,x
jsr print_byte_as_hex_chars
puts " X:"
inx
lda $0100,x
jsr print_byte_as_hex_chars
puts " A:"
inx
lda $0100,x
jsr print_byte_as_hex_chars
inx
inx
puts " PC:"
inx
lda $0100,x
jsr print_byte_as_hex_chars
dex
lda $0100,x
jsr print_byte_as_hex_chars
putsln ""
ply ; Restore registers
plx
pla
rti
.endproc