snes: attempt to fix issue when top of B/A is not zero

Still not working
This commit is contained in:
Vince Weaver 2013-02-05 15:56:47 -05:00
parent 0711e7fffd
commit 5f10b61fa8

View File

@ -280,42 +280,54 @@ found_keypress:
; assumes high sprite table at $0400 ; assumes high sprite table at $0400
; sets carry if active ; sets carry if active
; clears carry if not ; clears carry if not
; sprite number in X ; sprite number in Y
is_sprite_active: is_sprite_active:
; php php ; save status
phx
phy
lda #$0 rep #$30
xba .i16
.a16
tyx phx ; save X
phy ; save Y
tyx ; copy Y to X
; address=$0400 + Y/4 ; address=$0400 + Y/4
txa tya ; copy Y to A
lsr
lsr
tay
txa lsr ; divide by 4
and #$3 lsr
tax tay ; copy back to Y
txa ; copy original Y to A
and #$3 ; mask to get low 2 bits
tax ; copy back to X
sep #$20 ; A=8bit
.a8
lda SPRITE_HIGH_LOOKUP,X lda SPRITE_HIGH_LOOKUP,X
; get bitmask for X
and $0400,Y ; sprite on screen when bit is 0 and $0400,Y ; sprite on screen when bit is 0
rep #$20
.a16
beq sprite_is_active beq sprite_is_active
clc sprite_is_not_active:
bra done_sprite_is_active
sprite_is_active:
sec
done_sprite_is_active:
ply ply
plx plx
; plp plp
clc
rts
sprite_is_active:
ply
plx
plp
sec
rts rts