diff options
Diffstat (limited to 'space/src/vectors/nmi.s')
| -rw-r--r-- | space/src/vectors/nmi.s | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/space/src/vectors/nmi.s b/space/src/vectors/nmi.s index 4bc3dde..e049239 100644 --- a/space/src/vectors/nmi.s +++ b/space/src/vectors/nmi.s @@ -1,14 +1,32 @@ -;; Non-Maskable Interrupts handler. +;; See `basics/sprite.s` for more info. I'm not doing anything fancier here. nmi: - ;; As mentioned on the `main` subroutine, rendering will be skipped until - ;; the proper flag is set. bit $20 bpl @next + ;; Save registers. + pha + txa + pha + tya + pha + ;; We can start rendering stuff. OAM_WRITE_SPRITES + ;; Reset scroll. + bit $2002 ; PPUSTATUS + lda #$00 + sta $2005 ; PPUSCROLL + sta $2005 ; PPUSCROLL + ;; And unset the render flag so the `main` code is unblocked. UNSET_RENDER_FLAG + + ;; Restore registers. + pla + tay + pla + tax + pla @next: rti |
