Introduce NMIs

This commit is contained in:
Greg Shuflin 2022-06-16 14:33:46 -07:00
parent a5d8084260
commit 1c6fdd3468

View File

@ -7,6 +7,10 @@
.include "header.asm" .include "header.asm"
.segment "ZEROPAGE"
nmi_count: .res 2
.segment "CODE" .segment "CODE"
VRAM_CHARS = $0000 VRAM_CHARS = $0000
@ -93,10 +97,18 @@ start:
lda #$0f lda #$0f
sta INIDISP sta INIDISP
lda #$01 lda #%10000001
sta NMITIMEN sta NMITIMEN
mainloop: mainloop:
lda nmi_count
nmi_check:
wai
cmp nmi_count
beq nmi_check
lda JOY1L lda JOY1L
bit #JOYL_L bit #JOYL_L
beq down_not_pressed beq down_not_pressed
@ -117,6 +129,7 @@ busywait:
nmi: nmi:
bit RDNMI bit RDNMI
inc nmi_count
_rti: _rti:
rti rti