RosettaCodeData/Task/Map-range/6502-Assembly/map-range-2.6502

27 lines
703 B
Plaintext

;runs during non-maskable interrupt.
PrintChar:
;a = char to print
SEC
SBC #$32 ;subtract ascii offset to map the index to the correct tile graphics data.
;everything below this comment is hardware-specific mumbo-jumbo, feel free to ignore it if you don't care.
;ideally you'd want to do this before getting here so that the only thing that happens during NMI is the write to vram.
pha
LDA Cursor_Y
ASL
ASL
ASL
ASL
ASL
STA tempY ;row * 32
LDA #$20
ADC Cursor_X
STA tempX
LDA $2002 ;reset picture processor high-low latch
LDA tempX
STA $2006 ;this register is big-endian for some reason. Which is why I had to store Cursor_Y << 5 into tempY rather than here directly.
LDA tempY
STA $2006
PLA
STA $2007