From 5f10b61fa82fe70764f5c08782f06777a84ea4e8 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 5 Feb 2013 15:56:47 -0500 Subject: [PATCH] snes: attempt to fix issue when top of B/A is not zero Still not working --- tb1_snes/svmwgraph.s | 58 ++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/tb1_snes/svmwgraph.s b/tb1_snes/svmwgraph.s index 0523cdc..a18a3fa 100644 --- a/tb1_snes/svmwgraph.s +++ b/tb1_snes/svmwgraph.s @@ -280,42 +280,54 @@ found_keypress: ; assumes high sprite table at $0400 ; sets carry if active ; clears carry if not -; sprite number in X +; sprite number in Y is_sprite_active: -; php - phx - phy + php ; save status - lda #$0 - xba + rep #$30 +.i16 +.a16 - tyx + phx ; save X + phy ; save Y + + tyx ; copy Y to X ; address=$0400 + Y/4 - txa - lsr - lsr - tay + tya ; copy Y to A - txa - and #$3 - tax + lsr ; divide by 4 + lsr + 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 + ; 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 - clc - bra done_sprite_is_active - -sprite_is_active: - sec - -done_sprite_is_active: +sprite_is_not_active: ply plx -; plp + plp + clc + rts + +sprite_is_active: + ply + plx + plp + sec rts