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