aboutsummaryrefslogtreecommitdiff
path: root/src/vectors.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2025-12-10 14:41:35 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2025-12-15 15:31:06 +0100
commit74b1003ab8abad2f8220de4f2f18a3b118f23f01 (patch)
treeb7f2d491d708fa900d4dd9649eb5bd7fab3e8686 /src/vectors.s
parente6d9bd9f7acfd0e40025b2d579a7faff0d04ef0a (diff)
downloadjetpac.nes-74b1003ab8abad2f8220de4f2f18a3b118f23f01.tar.gz
jetpac.nes-74b1003ab8abad2f8220de4f2f18a3b118f23f01.zip
Adapt the code to play well with nasm's asan
The address sanitizer from nasm provides quite a few goodies, so let's adapt the code more to it to benefit from those. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src/vectors.s')
-rw-r--r--src/vectors.s40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/vectors.s b/src/vectors.s
index af343a7..e5d1a58 100644
--- a/src/vectors.s
+++ b/src/vectors.s
@@ -5,8 +5,8 @@
;; Debug utilities.
.scope Debug
- ;; Counter for frame drops.
- zp_frame_drops = $90
+ ;; Counter for frame drops. Only touched when PARTIAL is defined.
+ zp_frame_drops = $90 ; asan:ignore
.endscope
;; Pretty standard reset function, nothing crazy.
@@ -17,7 +17,7 @@
;; Disable APU frame counter.
ldx #$40
- stx APU::FRAME_COUNTER
+ stx APU::m_frame_counter
;; Setup the stack.
ldx #$FF
@@ -25,14 +25,14 @@
;; Disable NMIs and the APU's DMC.
inx
- stx PPU::CONTROL
- stx PPU::MASK
- stx APU::DMC
+ stx PPU::m_control
+ stx PPU::m_mask
+ stx APU::m_dmc
;; First PPU wait.
- bit PPU::STATUS
+ bit PPU::m_status
@vblankwait1:
- bit PPU::STATUS
+ bit PPU::m_status
bpl @vblankwait1
;; Initialize the counter for frame drops before any NMIs can come in.
@@ -45,7 +45,7 @@
lda #$EF
ldx #0
@sprite_reset_loop:
- sta $200, x
+ sta OAM::m_sprites, x
inx
inx
inx
@@ -54,13 +54,13 @@
;; DMA setup for sprite reset.
lda #$00
- sta OAM::ADDRESS
+ sta OAM::m_address
lda #$02
- sta OAM::DMA
+ sta OAM::m_dma
;; Second PPU wait. After that the PPU is stable.
@vblankwait2:
- bit PPU::STATUS
+ bit PPU::m_status
bpl @vblankwait2
;; NOTE: palettes are not initialized here as it's going to be one of the
@@ -89,9 +89,9 @@
;; Sprite DMA.
lda #$00
- sta OAM::ADDRESS
+ sta OAM::m_address
lda #$02
- sta OAM::DMA
+ sta OAM::m_dma
;; Are we paused? If so skip timers, PAL handler and the likes.
lda #%00001000
@@ -126,20 +126,20 @@
and Globals::zp_flags
sta Globals::zp_flags
- bit PPU::STATUS
+ bit PPU::m_status
;; Update the PPU control/mask registers with shadowed values.
lda PPU::zp_mask
- sta PPU::MASK
+ sta PPU::m_mask
lda PPU::zp_control
- sta PPU::CONTROL
+ sta PPU::m_control
@scroll:
;; Always reset the scroll just in case.
- bit PPU::STATUS
+ bit PPU::m_status
lda #$00
- sta PPU::SCROLL
- sta PPU::SCROLL
+ sta PPU::m_scroll
+ sta PPU::m_scroll
;; Unblock the main code.
lda #%01111111