From 889515f2c5d93f8901a636a48e7da3e864798cf5 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 30 Jan 2013 01:29:14 -0500 Subject: [PATCH] snes: missiles die when off end of screen --- tb1_snes/checksum.inc | 4 ++-- tb1_snes/level_1.s | 24 +++++++++--------------- tb1_snes/svmwgraph.s | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/tb1_snes/checksum.inc b/tb1_snes/checksum.inc index b18eab8..852afff 100644 --- a/tb1_snes/checksum.inc +++ b/tb1_snes/checksum.inc @@ -1,2 +1,2 @@ - .word $7233 ; Complement of checksum - .word $8dcc ; Unsigned 16-bit sum of ROM + .word $60fc ; Complement of checksum + .word $9f03 ; Unsigned 16-bit sum of ROM diff --git a/tb1_snes/level_1.s b/tb1_snes/level_1.s index dcbb117..4ceeafb 100644 --- a/tb1_snes/level_1.s +++ b/tb1_snes/level_1.s @@ -1811,24 +1811,18 @@ move_missiles: ply -; iny ; move to missile.y -; iny -; clc ; clear carry -; lda (MISSILE_PL),Y ; get missile.y -; adc #$FF ; move up (subtract 1) -; sta (MISSILE_PL),Y ; store missile.y -; bpl missile_collision_detection ; if not off screen, contine + cmp #200 -; dey ; back up to missile.out -; dey -; lda #$0 -; sta (MISSILE_PL),Y ; set missile.out=0 + ; bge + bcc missile_collision_detection ; if not off screen, contine -; lda #<(~PERFECT_AIM) ; shot missed! -; and BONUS_FLAGS ; clear perfect shot flag -; sta BONUS_FLAGS + jsr deactivate_sprite -; jmp loop_move_missiles ; continue + lda #<(~PERFECT_AIM) ; shot missed! + and BONUS_FLAGS ; clear perfect shot flag + sta BONUS_FLAGS + + jmp loop_move_missiles ; continue missile_collision_detection: diff --git a/tb1_snes/svmwgraph.s b/tb1_snes/svmwgraph.s index 83d2b0b..0523cdc 100644 --- a/tb1_snes/svmwgraph.s +++ b/tb1_snes/svmwgraph.s @@ -358,3 +358,43 @@ activate_sprite: plx plp rts + + +;=========================== +;=========================== +; deactivate_sprite +;=========================== +;=========================== +; assumes high sprite table at $0400 +; sets carry if active +; clears carry if not +; sprite number in X +deactivate_sprite: + + php + phx + phy + + lda #$0 + xba + + tyx + + ; address=$0400 + Y/4 + txa + lsr + lsr + tay + + txa + and #$3 + tax + lda SPRITE_HIGH_LOOKUP,X + + ora $0400,Y ; sprite off screen when bit is 1 + sta $0400,Y + + ply + plx + plp + rts