Implement the code to compare and update the high score. Add a todo for a high score list with initials. Remove the border colour performance debug.

This commit is contained in:
Jeremy Rand 2020-11-20 00:31:09 -05:00
parent 868f4a3199
commit 34d16c9944
4 changed files with 39 additions and 57 deletions

View File

@ -48,12 +48,6 @@ gameLoop anop
_drawDirtyGameRow 13 _drawDirtyGameRow 13
_drawDirtyGameRow 14 _drawDirtyGameRow 14
short i,m
lda >BORDER_COLOUR_REGISTER
and #$f7
sta >BORDER_COLOUR_REGISTER
long i,m
jsl drawScorpion jsl drawScorpion
_drawDirtyGameRow 15 _drawDirtyGameRow 15
@ -67,44 +61,11 @@ gameLoop anop
_drawDirtyGameRow 23 _drawDirtyGameRow 23
_drawDirtyGameRow 24 _drawDirtyGameRow 24
short i,m
lda >BORDER_COLOUR_REGISTER
and #$f3
sta >BORDER_COLOUR_REGISTER
long i,m
jsl drawSpider jsl drawSpider
short i,m
lda >BORDER_COLOUR_REGISTER
and #$f1
sta >BORDER_COLOUR_REGISTER
long i,m
jsl drawFlea jsl drawFlea
short i,m
lda >BORDER_COLOUR_REGISTER
ora #$08
sta >BORDER_COLOUR_REGISTER
long i,m
jsl drawSegments jsl drawSegments
short i,m
lda >BORDER_COLOUR_REGISTER
ora #$04
sta >BORDER_COLOUR_REGISTER
long i,m
jsl drawDirtyNonGameTiles jsl drawDirtyNonGameTiles
short i,m
lda >BORDER_COLOUR_REGISTER
ora #$02
sta >BORDER_COLOUR_REGISTER
long i,m
jsl updatePlayer jsl updatePlayer
jsl updateShot jsl updateShot
jsl updateScorpion jsl updateScorpion
@ -112,6 +73,7 @@ gameLoop anop
jsl updateFlea jsl updateFlea
jsl updateSegments jsl updateSegments
jsl updateLevel jsl updateLevel
jsl checkKeyboard jsl checkKeyboard
jsl waitForVbl jsl waitForVbl
@ -178,6 +140,12 @@ setupScreen entry
long i,m long i,m
and #$000f and #$000f
sta borderColour sta borderColour
short i,m
lda >BORDER_COLOUR_REGISTER
and #$f0
sta >BORDER_COLOUR_REGISTER
long i,m
sei sei
phd phd
@ -289,6 +257,7 @@ checkKey_loop2 anop
beq checkKey_game beq checkKey_game
checkKey_done anop checkKey_done anop
long i,m
rtl rtl
checkKey_pause anop checkKey_pause anop
@ -315,11 +284,6 @@ waitForKey_loop anop
waitForVbl entry waitForVbl entry
short i,m
lda >BORDER_COLOUR_REGISTER
and #$f0
sta >BORDER_COLOUR_REGISTER
long i,m
vblLoop anop vblLoop anop
lda >VERTICAL_COUNTER ; load the counter value lda >VERTICAL_COUNTER ; load the counter value
and #$80ff ; mask out the VBL bits and #$80ff ; mask out the VBL bits

View File

@ -9,11 +9,6 @@
macro macro
_drawDirtyGameRow &rowNum _drawDirtyGameRow &rowNum
short i,m
lda >BORDER_COLOUR_REGISTER
and #$f0
sta >BORDER_COLOUR_REGISTER
long i,m
_drawDirtyGameRow_wait&rowNum anop _drawDirtyGameRow_wait&rowNum anop
; This code loads into the accumulator the line currently being drawn to the ; This code loads into the accumulator the line currently being drawn to the
; screen by HW. It allows code to race just behind the beam and redraw the ; screen by HW. It allows code to race just behind the beam and redraw the
@ -41,12 +36,6 @@ _drawDirtyGameRow_wait&rowNum anop
cmp #&scanLineNum cmp #&scanLineNum
blt _drawDirtyGameRow_wait&rowNum blt _drawDirtyGameRow_wait&rowNum
short i,m
lda >BORDER_COLOUR_REGISTER
ora #$0f
sta >BORDER_COLOUR_REGISTER
long i,m
lcla &tileOffset lcla &tileOffset
&tileOffset seta &rowNum*50 &tileOffset seta &rowNum*50
lcla &lastTileOffset lcla &lastTileOffset

View File

@ -260,7 +260,36 @@ scoreAddOneThousand_skipZeroHundreds anop
checkHighScore entry checkHighScore entry
; TODO - Write this code lda gameScore+2
cmp highScore+2
blt checkHighScore_done
bne checkHighScore_isHighScore
lda gameScore
cmp highScore
blt checkHighScore_done
checkHighScore_isHighScore anop
sta highScore
lda gameScore+2
sta highScore+2
ldy #P1_SCORE_ONES_OFFSET
ldx #HIGH_SCORE_ONES_OFFSET
checkHighScore_loop anop
lda tileType,y
sta tileType,x
phy
_dirtyNonGameTile
ply
dex
dex
dey
dey
cpy #P1_SCORE_FIRST_OFFSET
bne checkHighScore_loop
checkHighScore_done anop
rtl rtl
highScore dc i4'0' highScore dc i4'0'

View File

@ -1,7 +1,7 @@
TODO TODO
======= =======
* At the end of the game, the score should be compared to the high score. If larger, store the high score. * Implement a high score list and save the high scores across restarts
* When the player dies, the mushrooms need to be reset and the score incremented for damaged and poisoned mushrooms. * When the player dies, the mushrooms need to be reset and the score incremented for damaged and poisoned mushrooms.
* Implement the code to support pausing the game * Implement the code to support pausing the game
* Implement the code for supporting a two player game * Implement the code for supporting a two player game