From db9cb2118e7b2575ed3b0f535e50dd85c24df25a Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 12 Nov 2023 09:39:05 +0100 Subject: space: Simplify the code and its goals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally this was supposed to be a sort of mini game, but that would have probably made it too complex for newcomers. Thus, let's just keep it to subpixel movement and shooting bullets, which is already a big step from the `basics/sprite.s` example. Signed-off-by: Miquel Sabaté Solà --- space/src/vectors/nmi.s | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'space/src/vectors/nmi.s') 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 -- cgit v1.2.3