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

 

.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