Fix a bug where the collision and collisionAddr writes went to the wrong bank, leading to memory corruption and crashes.

This commit is contained in:
Jeremy Rand 2021-01-06 22:21:31 -05:00
parent e2e4da9e37
commit 4700bd9cff
9 changed files with 31 additions and 28 deletions

View File

@ -4,6 +4,7 @@ BUGS
This is a list of the software bugs (as opposed to the bugs in the game that you shoot) that still need attention:
* The sound is muddy at times on real HW. Especially when lots of stuff is going on, the sound ends up coming out garbled. This isn't happening on emulators where everything is always quite clear. Perhaps I am reaching some limit of the Ensoniq. Do I need to reduce some sampling frequencies perhaps?
* It seems to be possible to both shoot and be killed by the spider in a single frame. Either the spider should be killed by the shot or the spider should kill the player but not both.
FIXED

View File

@ -17,12 +17,12 @@
<key>DiskImage.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>2</integer>
</dict>
<key>doNotBuild.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>1</integer>
</dict>
</dict>
</dict>

View File

@ -153,7 +153,7 @@ setupScreen entry
sei
phd
tsc
sta >backupStack
sta backupStack
lda >STATE_REGISTER ; Direct Page and Stack in Bank 01/
ora #$0030
sta >STATE_REGISTER
@ -171,7 +171,7 @@ nextWord anop
lda >STATE_REGISTER
and #$ffcf
sta >STATE_REGISTER
lda >backupStack
lda backupStack
tcs
pld
cli

View File

@ -439,7 +439,6 @@ updatePlayer_shift anop
sta mouseAddress
tay
jsl drawShipShift
bra updatePlayer_dirty
updatePlayer_dirty anop
bne updatePlayer_collision

View File

@ -158,6 +158,9 @@ mouseX dc i2'0'
mouseY dc i2'0'
mouseAddress dc i2'0'
backupStack dc i2'0'
collision dc i2'0'
collisionAddr dc i2'0'
tileJumpTable dc a4'solid0'
dc a4'mushroom4'

View File

@ -16,7 +16,7 @@ resource rVersion (1) {
{
0, /* Major version number in BCD */
9, /* Minor version number in BCD */
1, /* Bug version number in BCD */
2, /* Bug version number in BCD */
development,/* Development phase */
0 /* Release number */
},

View File

@ -29,7 +29,8 @@ drawShip entry
; ..OO|O...
; ..OO|O...
stz collision
lda #0
sta >collision
lda $0,s
_collision #$0c00,#$0
@ -133,8 +134,9 @@ drawShip entry
_spriteFooter
ldx collisionAddr
lda collision
lda >collisionAddr
tax
lda >collision
rtl
@ -154,7 +156,8 @@ drawShipShift entry
; ...O|OO..
; ...O|OO..
stz collision
lda #0
sta >collision
lda $2,s
_collision #$00c0,#$2
@ -258,8 +261,9 @@ drawShipShift entry
_spriteFooter
ldx collisionAddr
lda collision
lda >collisionAddr
tax
lda >collision
rtl
; This differs from the above by being a tile draw routine for drawing the number of lives left.
@ -342,8 +346,4 @@ drawPlayer entry
_spriteFooter
rtl
collision dc i2'0'
collisionAddr dc i2'0'
end

View File

@ -97,7 +97,8 @@ drawShot entry
; ....
; ....
stz collision
lda #0
sta >collision
lda $0,s
_collision #$00ff,#$0
@ -155,8 +156,9 @@ drawShot entry
_spriteFooter
ldx collisionAddr
lda collision
lda >collisionAddr
tax
lda >collision
rtl
@ -176,7 +178,8 @@ drawShotShift entry
; ....
; ....
stz collision
lda #0
sta >collision
lda $0,s
_collision #$00ff,#$0
@ -234,12 +237,9 @@ drawShotShift entry
_spriteFooter
ldx collisionAddr
lda collision
lda >collisionAddr
tax
lda >collision
rtl
collision dc i2'0'
collisionAddr dc i2'0'
end

View File

@ -708,11 +708,11 @@
tax
and &mask
beq _noCollision_&SYSCNT
sta collision
sta >collision
tsc
clc
adc &addr
sta collisionAddr
sta >collisionAddr
_noCollision_&SYSCNT anop
txa
mend