Start adding the infrastructure for levels and score.

This commit is contained in:
Jeremy Rand 2020-10-13 00:09:37 -04:00
parent a7d1db68e2
commit b85000b4ed
10 changed files with 203 additions and 7 deletions

View File

@ -81,6 +81,8 @@
9D62AF3B249871A300348F45 /* colour.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = colour.s; sourceTree = "<group>"; };
9D62AF3F2499CD1E00348F45 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
9D62AF402499CD3A00348F45 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
9D8AF0B72535542400C10E3C /* level.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = level.s; sourceTree = "<group>"; };
9D8AF0B82535543000C10E3C /* score.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = score.s; sourceTree = "<group>"; };
9D8FFC602491CA28005C9327 /* game.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = game.s; sourceTree = "<group>"; };
9D8FFC612491CAF0005C9327 /* game.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = game.h; sourceTree = "<group>"; };
9DB1505024C3801100558B87 /* gameFlea.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameFlea.s; sourceTree = "<group>"; };
@ -139,6 +141,8 @@
9DB1505124C6875C00558B87 /* gameScorpion.s */,
9DB1505324C9E54C00558B87 /* gameSpider.s */,
9DB1505424D3BF6C00558B87 /* gameSegments.s */,
9D8AF0B72535542400C10E3C /* level.s */,
9D8AF0B82535543000C10E3C /* score.s */,
9D62AF3B249871A300348F45 /* colour.s */,
9D2FF6DA24C4C79A000181E5 /* random.s */,
9DB1505224C7495400558B87 /* globals.s */,

View File

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

View File

@ -208,7 +208,6 @@ setFleaSpeed_fast anop
shootFlea entry
; TODO - Increment the score
lda fleaState
cmp #FLEA_STATE_FALLING
bne shootFlea_done
@ -223,7 +222,7 @@ shootFlea entry
lda #EXPLOSION_LAST_OFFSET
sta fleaSprite
rtl
jmp scoreAddTwoHundred
shootFlea_faster anop
jsl setFleaSpeed_fast

View File

@ -314,7 +314,7 @@ shootScorpion entry
inc a
inc a
sta scorpionScreenOffset
; TODO - Increment the score
jmp scoreAddOneThousand
shootScorpion_done anop
rtl

View File

@ -1642,6 +1642,14 @@ addFastHeadSegment entry
; Call this with the segment num * 2 in the X register
shootSegment entry
dec numSegments
lda segmentStates,x
cmp #SEGMENT_STATE_BODY
beq shootSegment_body
jsl scoreAddOneHundred
bra shootSegment_doneScore
shootSegment_body anop
jsl scoreAddTen
shootSegment_doneScore anop
lda #SEGMENT_STATE_EXPLODING
sta segmentStates,x
ldy segmentPosOffset,x

View File

@ -696,6 +696,7 @@ shootSpider entry
; 300, 600 or 900 points depending on the distance from the player.
lda #SPIDER_SCORE_900
sta spiderScoreType
jmp scoreAddNineHundred
shootSpider_done anop
rtl

View File

@ -118,3 +118,23 @@ _dirtyGameTile_nonGame&SYSCNT anop
_dirtyGameTile_skip&SYSCNT anop
mend
; Pass the tile offset to mark as dirty in the X register
macro
_dirtyNonGameTile
lda tileDirty,x
bne _dirtyNonGameTile_skip&SYSCNT
lda #TILE_STATE_DIRTY
sta tileDirty,x
ldy numDirtyNonGameTiles
txa
sta dirtyNonGameTiles,y
iny
iny
sty numDirtyNonGameTiles
_dirtyNonGameTile_skip&SYSCNT anop
mend

16
BuGS/level.s Normal file
View File

@ -0,0 +1,16 @@
;
; level.s
; BuGS
;
; Created by Jeremy Rand on 2020-10-12.
;Copyright © 2020 Jeremy Rand. All rights reserved.
;
case on
mcopy level.macros
keep level
level start
using globalData
rtl
end

View File

@ -8,7 +8,7 @@ s6d2 =
s7d1 = /Users/jrand/Library/Developer/Xcode/DerivedData/BuGS-bffpexoblaghkzcbtjtzxeulnuto/Build/Products/Debug/BuGS.2mg
g_limit_speed = 3
g_limit_speed = 0
bram1[00] = 00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00

148
BuGS/score.s Normal file
View File

@ -0,0 +1,148 @@
;
; score.s
; BuGS
;
; Created by Jeremy Rand on 2020-10-12.
;Copyright © 2020 Jeremy Rand. All rights reserved.
;
case on
mcopy score.macros
keep score
score start
using globalData
TILE_SCORE_ONES equ 4*LHS_NUM_TILES_WIDE+LHS_FIRST_TILE-2
TILE_SCORE_ONES_OFFSET equ TILE_SCORE_ONES*SIZEOF_TILE_INFO
TILE_SCORE_TENS_OFFSET equ TILE_SCORE_ONES-SIZEOF_TILE_INFO
TILE_SCORE_HUNDREDS_OFFSET equ TILE_SCORE_TENS_OFFSET-SIZEOF_TILE_INFO
TILE_SCORE_THOUSANDS_OFFSET equ TILE_SCORE_HUNDREDS_OFFSET-SIZEOF_TILE_INFO
scoreStartGame entry
stz gameScore
stz gameScore+2
lda #1
sta gameIsHighScore
ldx #TILE_SCORE_ONES_OFFSET
lda #TILE_NUMBER_0
sta tileType,x
_dirtyNonGameTile
; Tens
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
; Hundreds
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
; Thousands
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
; Tens of Thousands
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
; Hundreds of Thousands
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
; Millions
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
; Tens of Millions
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
; Hundreds of Millions
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
; Billions
dex
dex
lda #TILE_EMPTY
sta tileType,x
_dirtyNonGameTile
rtl
scoreAddOne entry
; TODO - Write this code...
rtl
scoreAddFive entry
; TODO - Write this code...
rtl
scoreAddTen entry
; TODO - Write this code...
rtl
scoreAddOneHundred entry
; TODO - Write this code...
rtl
scoreAddTwoHundred entry
; TODO - Write this code...
rtl
scoreAddThreeHundred entry
; TODO - Write this code...
rtl
scoreAddSixHundred entry
; TODO - Write this code...
rtl
scoreAddNineHundred entry
; TODO - Write this code...
rtl
scoreAddOneThousand entry
; TODO - Write this code...
rtl
highScore dc i4'0'
gameScore dc i4'0'
gameIsHighScore dc i2'1'
end