mirror of
https://github.com/deater/tb1.git
synced 2024-06-26 10:29:27 +00:00
snes: make activate sprite 16-bit accumulator clean
now things are working again
This commit is contained in:
parent
b61b08fa60
commit
5e938abc53
|
@ -1,2 +1,2 @@
|
||||||
.word $9ae ; Complement of checksum
|
.word $a3e ; Complement of checksum
|
||||||
.word $f651 ; Unsigned 16-bit sum of ROM
|
.word $f5c1 ; Unsigned 16-bit sum of ROM
|
||||||
|
|
|
@ -289,8 +289,8 @@ is_sprite_active:
|
||||||
.i16
|
.i16
|
||||||
.a16
|
.a16
|
||||||
|
|
||||||
phx ; save X
|
phx ; save X on stack
|
||||||
phy ; save Y
|
phy ; save Y on stack
|
||||||
|
|
||||||
tyx ; copy Y to X
|
tyx ; copy Y to X
|
||||||
|
|
||||||
|
@ -312,8 +312,6 @@ is_sprite_active:
|
||||||
|
|
||||||
and $0400,Y ; sprite on screen when bit is 0
|
and $0400,Y ; sprite on screen when bit is 0
|
||||||
|
|
||||||
rep #$20 ; A=16 bit
|
|
||||||
.a16
|
|
||||||
beq sprite_is_active
|
beq sprite_is_active
|
||||||
|
|
||||||
sprite_is_not_active:
|
sprite_is_not_active:
|
||||||
|
@ -339,37 +337,40 @@ sprite_is_active:
|
||||||
; 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
|
||||||
activate_sprite:
|
activate_sprite:
|
||||||
|
|
||||||
php
|
php ; store status
|
||||||
phx
|
phx ; store X on stack
|
||||||
phy
|
phy ; store Y on stack
|
||||||
|
|
||||||
lda #$0
|
rep #$20 ; make A 16-bit
|
||||||
xba
|
.a16
|
||||||
|
|
||||||
tyx
|
tyx ; copy Y to X
|
||||||
|
|
||||||
; address=$0400 + Y/4
|
; address=$0400 + Y/4
|
||||||
txa
|
tya ; copy Y to A
|
||||||
|
lsr ; divide by 4
|
||||||
lsr
|
lsr
|
||||||
lsr
|
tay ; transfer back to Y
|
||||||
tay
|
|
||||||
|
|
||||||
txa
|
txa ; get saved copy of Y
|
||||||
and #$3
|
and #$3 ; mask to get low bits
|
||||||
tax
|
tax ; transfer back to X
|
||||||
lda SPRITE_HIGH_LOOKUP,X
|
|
||||||
eor #$ff
|
sep #$20 ; make A 8-bit
|
||||||
|
.a8
|
||||||
|
lda SPRITE_HIGH_LOOKUP,X ; load from lookup table
|
||||||
|
eor #$ff ; negate it
|
||||||
|
|
||||||
and $0400,Y ; sprite on screen when bit is 0
|
and $0400,Y ; sprite on screen when bit is 0
|
||||||
sta $0400,Y
|
sta $0400,Y ; store it back out
|
||||||
|
|
||||||
ply
|
ply ; restore values from stack
|
||||||
plx
|
plx
|
||||||
plp
|
plp
|
||||||
rts
|
rts ; return
|
||||||
|
|
||||||
|
|
||||||
;===========================
|
;===========================
|
||||||
|
|
Loading…
Reference in New Issue
Block a user