diff --git a/BuGS.xcodeproj/project.pbxproj b/BuGS.xcodeproj/project.pbxproj index 8f6ea7c..0677173 100644 --- a/BuGS.xcodeproj/project.pbxproj +++ b/BuGS.xcodeproj/project.pbxproj @@ -81,6 +81,8 @@ 9D62AF3B249871A300348F45 /* colour.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = colour.s; sourceTree = ""; }; 9D62AF3F2499CD1E00348F45 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 9D62AF402499CD3A00348F45 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + 9D8AF0B72535542400C10E3C /* level.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = level.s; sourceTree = ""; }; + 9D8AF0B82535543000C10E3C /* score.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = score.s; sourceTree = ""; }; 9D8FFC602491CA28005C9327 /* game.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = game.s; sourceTree = ""; }; 9D8FFC612491CAF0005C9327 /* game.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = game.h; sourceTree = ""; }; 9DB1505024C3801100558B87 /* gameFlea.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameFlea.s; sourceTree = ""; }; @@ -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 */, diff --git a/BuGS.xcodeproj/xcuserdata/jrand.xcuserdatad/xcschemes/xcschememanagement.plist b/BuGS.xcodeproj/xcuserdata/jrand.xcuserdatad/xcschemes/xcschememanagement.plist index 1f9303c..0d0faee 100644 --- a/BuGS.xcodeproj/xcuserdata/jrand.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/BuGS.xcodeproj/xcuserdata/jrand.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ Binary.xcscheme_^#shared#^_ orderHint - 2 + 3 BuGS.xcscheme_^#shared#^_ @@ -17,12 +17,12 @@ DiskImage.xcscheme_^#shared#^_ orderHint - 3 + 1 doNotBuild.xcscheme_^#shared#^_ orderHint - 1 + 2 diff --git a/BuGS/gameFlea.s b/BuGS/gameFlea.s index c1cef89..f81c522 100644 --- a/BuGS/gameFlea.s +++ b/BuGS/gameFlea.s @@ -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 diff --git a/BuGS/gameScorpion.s b/BuGS/gameScorpion.s index ff9b12d..e18454e 100644 --- a/BuGS/gameScorpion.s +++ b/BuGS/gameScorpion.s @@ -314,7 +314,7 @@ shootScorpion entry inc a inc a sta scorpionScreenOffset -; TODO - Increment the score + jmp scoreAddOneThousand shootScorpion_done anop rtl diff --git a/BuGS/gameSegments.s b/BuGS/gameSegments.s index 26ff4d1..59119d6 100644 --- a/BuGS/gameSegments.s +++ b/BuGS/gameSegments.s @@ -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 diff --git a/BuGS/gameSpider.s b/BuGS/gameSpider.s index cdaf33d..cd9a200 100644 --- a/BuGS/gameSpider.s +++ b/BuGS/gameSpider.s @@ -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 diff --git a/BuGS/global.macros b/BuGS/global.macros index 0c7a89b..1da1d1a 100644 --- a/BuGS/global.macros +++ b/BuGS/global.macros @@ -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 diff --git a/BuGS/level.s b/BuGS/level.s new file mode 100644 index 0000000..a2c3c82 --- /dev/null +++ b/BuGS/level.s @@ -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 diff --git a/BuGS/make/config.txt b/BuGS/make/config.txt index 4cf9182..6e02df5 100644 --- a/BuGS/make/config.txt +++ b/BuGS/make/config.txt @@ -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 diff --git a/BuGS/score.s b/BuGS/score.s new file mode 100644 index 0000000..063375f --- /dev/null +++ b/BuGS/score.s @@ -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