forked from CaitSith2/z3randomizer
-
Notifications
You must be signed in to change notification settings - Fork 4
/
capacityupgrades.asm
44 lines (38 loc) · 1.28 KB
/
capacityupgrades.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
;================================================================================
; Capacity Logic
;================================================================================
!BOMB_UPGRADES = "$7EF370"
!BOMB_CURRENT = "$7EF343"
;--------------------------------------------------------------------------------
IncrementBombs:
LDA !BOMB_UPGRADES ; get bomb upgrades
!ADD.l StartingMaxBombs : DEC
CMP.b #$FF : BEQ + ; if max bombs is 0, it underflows to $FF. Don't add bombs
CMP !BOMB_CURRENT
!BLT +
LDA !BOMB_CURRENT
CMP.b #99 : !BGE +
INC : STA !BOMB_CURRENT
+
RTL
;--------------------------------------------------------------------------------
!ARROW_UPGRADES = "$7EF371"
!ARROW_CURRENT = "$7EF377"
;--------------------------------------------------------------------------------
IncrementArrows:
LDA !ARROW_UPGRADES ; get arrow upgrades
!ADD.l StartingMaxArrows : DEC
CMP !ARROW_CURRENT
!BLT +
LDA !ARROW_CURRENT
CMP.b #99 : !BGE +
INC : STA !ARROW_CURRENT
+
RTL
;--------------------------------------------------------------------------------
CompareBombsToMax:
LDA !BOMB_UPGRADES ; get bomb upgrades
!ADD.l StartingMaxBombs
CMP !BOMB_CURRENT
RTL
;--------------------------------------------------------------------------------