-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgems.asm
95 lines (81 loc) · 1.45 KB
/
gems.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.effectGems
{
.gemEntry:
; First, see if we need to do anything
LDA playerGems
CMP #(_bitGemRed OR _bitGemBlue)
BNE notDoneYet
LDA #0
STA &a56 ; patch collision
JMP drawGems
.notDoneYet:
LDA playerPosY
CMP #192
BNE drawGems
LDA playerPosX
CMP #16*5
BCC drawGems ; Player must be at x>80 y=192 for us to consider gem use
LDA keyFlags
AND #_keyFire
BEQ checkDebounce
STA wasPressedFlagGems
RTS
.checkDebounce:
LDA wasPressedFlagGems
BEQ drawGems
.actionHit:
LDA #0
STA wasPressedFlagGems
LDA playerUsingItem
CMP #_itemGemRed
BNE checkGemBlue
LDA #_bitGemRed
JMP checksDone
.checkGemBlue:
CMP #_itemGemBlue
BNE drawGems
LDA #_bitGemBlue
.checksDone:
TAX
EOR #$ff
AND playerInventory
STA playerInventory
TXA
ORA playerGems
STA playerGems
; We have placed a gem - set player's item to rope
.placedGem:
LDA #_itemRope
STA playerUsingItem
JSR drawItem
; And play a sound
LDA #LO(itemUseSound)
STA notereq
LDA #HI(itemUseSound)
STA notereq+1
.drawGems:
LDA #_bitGemRed
BIT playerGems
BEQ nextGem
.redGem:
LDA #&12 ; red/blue
STA &6fd0-(8*3)+3
STA &6fd0-(8*3)+4
LDA #&21 ; blue/red
STA &6fd0-(8*3)+3-8
STA &6fd0-(8*3)+4-8
.nextGem:
LDA #_bitGemBlue
BIT playerGems
BEQ gemsOut
.blueGem:
LDA #&38 ; cyan/blue
STA &6fd0-(8*1)+3
STA &6fd0-(8*1)+4
LDA #&34 ; blue/cyan
STA &6fd0-(8*1)+3-8
STA &6fd0-(8*1)+4-8
.gemsOut:
RTS
}
PRINT "* Gems size: ", P%-effectGems