This repository has been archived by the owner on Oct 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
NCHEFHIT.S
176 lines (127 loc) · 4.74 KB
/
NCHEFHIT.S
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
; CHEFHIT.S
; THIS ROUTINE TESTS TO SEE IF CHUCK HAS DIED DUE TO HITTING A CHEF.
GLBL HEROKILL
GLBL MKDIE
GLBL MKAREJOY
GLBL CHEFHIT
GLBL SCRAPALL,TUNIN
GLBL FALLING,DYHERO,DXHERO,CHEFSTRT
GLBL STATDIE,AFDERASE,NULLCHAR
GLBL CSTAMP,CCRUNL,CINFO
GLBL PL0LIVES
GLBL IRCHTIME,IRDXHERO,IRDYHERO
GLBL HELDFOOD,CARRYING
GLBL HYCENTER,DYHCHAR
DXHCHEF EQU $02
DYHCHEF EQU $06
DRIPSTRT EQU $1F
RAMDEF ; ZERO PAGE
RSEG CODE2
PRINT GEN
CHEFHIT
LDX #12 ; #CHEFSTRT + #NUMCHEFS - 3
LDY #3 ; INDEX TO CENTER AND DELTA TABLES
LDA CSTATE If the hero is falling, no
CMP #FALLING intersection with chefs
BMI ZCHEFH0
RTS
ZCHEFH0 LDA CSTATE,X ; CHEF'S STATE
CMP #FALLING ; IF RISING OR FALLING, IGNORE
BPL NXTCHTST
LDA #0 ; TELLS ME THIS IS THE NEARNESS TEST
STA TEMP2
AAAA LDA #IRDXHERO ; NEARNESS TEST FIRST
STA TEMP0
LDA #IRDYHERO
STA TEMP1
JMP IRLOOP2
IRLOOP1 LDA #DXHERO+DXHCHEF ; COME HERE IF NEARNESS TEST IS
STA TEMP0 ; SUCCESSFUL-- TEST FOR REAL
LDA DYHCHAR,Y
STA TEMP1
IRLOOP2 LDA CYPOS,X ; TEST Y COORD.
BEQ NXTCHTST ; IF HE'S NOT ON SCREEN
SEC
SBC CYPOS ; HERO'S Y
SEC
SBC HYCENTER,Y ; CHEFS ARE SHORTER- ADD TO NORMALIZE
BPL CHHYPOS ; Y DIFF POSITIVE
EOR #$FF ; ELSE, 2'S COMPLEMENT
CLC
ADC #1
CHHYPOS CMP TEMP1 ; IR CLOSENESS OR CHEF
BMI CHXTST ; TEST X DIFFERENCE
JMP NXTCHTST ; ELSE, GO ON TO NEXT CHEF
CHXTST LDA CXPOS,X
SEC
SBC CXPOS ; HERO'S X
BPL CHHXPOS ; POSITIVE X DIFFERENCE
EOR #$FF ; ELSE, 2'S COMPLEMENT
CLC
ADC #1
CHHXPOS CMP TEMP0
BMI CHNEAR
JMP NXTCHTST
CHNEAR LDA TEMP2
BNE CHKILL
INC IRCHTIME
INC TEMP2
JMP IRLOOP1
CHKILL JSR HEROKILL
JMP CHHITBYE
NXTCHTST DEX
DEX
DEX
DEY ; DELTA TABLE INDEX
BPL ZCHEFH0
CHHITBYE RTS
*************** END OF CHEFHIT ROUTINE ************************
; THIS ROUTINE IS CALLED FROM "CHEFHIT", "HOLEHIT", AND "FOODHIT"
; IF THE HERO IS KILLED BY ONE OF THESE THINGS.
; IT SETS THE HERO APPROPRIATELY AND DOES SUITABLE ANIMATIONS.
HEROKILL LDA #STATDIE
STA STATUS
JSR SCRAPALL
LDA CXPOS ; USED BY "FOODMOVE" TO GO FOR CHUCK
STA GOALX
LDA CYPOS
STA GOALY
LDA CYCLECNT
CLC
ADC #02
STA CINFO ; ANIMATE TIMER
LDA #70
STA SYSCOUNT
JSR MKDIE ; HANDLE DEATH STUFF
LDX CURRENT
LDA PL0LIVES,X
CMP #1
BEQ ZHKLASTS ; LAST DEATH THIS GAME
LDA #1
JSR TUNIN
LDA #2
JMP TUNIN jsr followed by rts
ZHKLASTS LDA #10
JSR TUNIN
LDA #11
JMP TUNIN jsr followed by rts
; THIS ROUTINE IS CALLED FROM "MKHFALL" AND "HEROKILL"
MKDIE
LDA #1
STA MAXCYCLE
LDA #0 ; MAKE CONE DRIP GO AWAY
STA CYPOS+DRIPSTRT
LDA CSTATE
CMP #CARRYING
BNE MKSKIP
LDA #0
STA CYPOS+2
LDX HELDFOOD
STA CYPOS,X
MKSKIP
LDA CCRUNL ; GIVE CHUCK A BODY
STA CSTAMP+1
; FOR FINAL VERSION, MOVE "MKAREJOY" INTO THIS ROUTINE--
JSR MKAREJOY ; IN "HOLEHIT.S"
RTS
END