Fix bmi/bpl branch bug

This commit is contained in:
Lucas Scharenbroich 2023-05-22 00:05:51 -05:00
parent b40bc0dd2b
commit 61cf1d49c8

View File

@ -3728,12 +3728,12 @@ FrenzyIDData
AreaFrenzy ldy $00 ;use area object identifier bit as offset AreaFrenzy ldy $00 ;use area object identifier bit as offset
lda FrenzyIDData-8,y ;note that it starts at 8, thus weird address here lda FrenzyIDData-8,y ;note that it starts at 8, thus weird address here
ldx #$05 ldx #$05
FreCompLoop dex ;check regular slots of enemy object buffer :FreCompLoop dex ;check regular slots of enemy object buffer
bmi ExitAFrenzy ;if all slots checked and enemy object not found, branch to store bmi :ExitAFrenzy ;if all slots checked and enemy object not found, branch to store
cmp Enemy_ID,x ;check for enemy object in buffer versus frenzy object cmp Enemy_ID,x ;check for enemy object in buffer versus frenzy object
bne FreCompLoop bne :FreCompLoop
lda #$00 ;if enemy object already present, nullify queue and leave lda #$00 ;if enemy object already present, nullify queue and leave
ExitAFrenzy sta EnemyFrenzyQueue ;store enemy into frenzy queue :ExitAFrenzy sta EnemyFrenzyQueue ;store enemy into frenzy queue
phx ; GTE swap registers back phx ; GTE swap registers back
tyx tyx
@ -7226,13 +7226,13 @@ FindEmptyMiscSlot
;UseMiscS sty JumpCoinMiscOffset ;store offset of misc object buffer here (residual) ;UseMiscS sty JumpCoinMiscOffset ;store offset of misc object buffer here (residual)
phx phx
ldx #$08 ;start at end of misc objects buffer ldx #$08 ;start at end of misc objects buffer
FMiscLoop lda Misc_State,x ;get misc object state :FMiscLoop lda Misc_State,x ;get misc object state
beq UseMiscS ;branch if none found to use current offset beq :UseMiscS ;branch if none found to use current offset
dex ;decrement offset dex ;decrement offset
cpx #$05 ;do this for three slots cpx #$05 ;do this for three slots
bne FMiscLoop ;do this until all slots are checked bne :FMiscLoop ;do this until all slots are checked
ldx #$08 ;if no empty slots found, use last slot ldx #$08 ;if no empty slots found, use last slot
UseMiscS stx JumpCoinMiscOffset ;store offset of misc object buffer here (residual) :UseMiscS stx JumpCoinMiscOffset ;store offset of misc object buffer here (residual)
txy txy
plx plx
rts rts
@ -11196,14 +11196,19 @@ DrawEraseRope
phx phx
tyx tyx
lda Enemy_Y_Speed,x lda Enemy_Y_Speed,x
plx bmi EraseR1 ;to do something else
bmi EraseR1 ;to do something else
plx ; GTE
lda #$a2 lda #$a2
sta VRAM_Buffer1+3,x ;otherwise put tile numbers for left sta VRAM_Buffer1+3,x ;otherwise put tile numbers for left
lda #$a3 ;and right sides of rope in vram buffer lda #$a3 ;and right sides of rope in vram buffer
sta VRAM_Buffer1+4,x sta VRAM_Buffer1+4,x
jmp OtherRope ;jump to skip this part jmp OtherRope ;jump to skip this part
EraseR1 lda #$24 ;put blank tiles in vram buffer EraseR1
plx ; GTE
lda #$24 ;put blank tiles in vram buffer
sta VRAM_Buffer1+3,x ;to erase rope sta VRAM_Buffer1+3,x ;to erase rope
sta VRAM_Buffer1+4,x sta VRAM_Buffer1+4,x