Skip to content

Commit b0bb52b

Browse files
Merge pull request #53 from zohassadar/faster_oam_reset
Faster oam reset
2 parents 1f25585 + 16ffe35 commit b0bb52b

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/gamemodestate/pause.asm

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ pause:
3838

3939
@pauseSetupPart2:
4040
jsr updateAudioAndWaitForNmi
41-
lda #$FF
42-
ldx #$02
43-
ldy #$02
44-
jsr memset_page
41+
jsr resetOAMStaging
4542

4643
@pauseLoop:
4744
lda qualFlag

src/util/core.asm

100644100755
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,21 @@ updateAudioWaitForNmiAndResetOamStaging:
5959
@checkForNmi:
6060
lda verticalBlankingInterval
6161
beq @checkForNmi
62+
63+
resetOAMStaging:
64+
; Hide a sprite by moving it down offscreen, by writing any values between #$EF-#$FF here.
65+
; Sprites are never displayed on the first line of the picture, and it is impossible to place
66+
; a sprite partially off the top of the screen.
67+
; https://www.nesdev.org/wiki/PPU_OAM
68+
ldx #$00
6269
lda #$FF
63-
ldx #$02
64-
ldy #$02
65-
jsr memset_page
70+
@hideY:
71+
sta oamStaging,x
72+
inx
73+
inx
74+
inx
75+
inx
76+
bne @hideY
6677
rts
6778

6879
updateAudioAndWaitForNmi:

0 commit comments

Comments
 (0)