-
Notifications
You must be signed in to change notification settings - Fork 1
/
leveldata.asm
192 lines (147 loc) · 2.66 KB
/
leveldata.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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;
.module LEV
levelup:
ld a,(level)
inc a
cp 8
jr nz,{+}
ld a,7
+: ld (level),a
ret
;-------------------------------------------------------------------------------
displaylevel:
ld a,(level) ; level to HL, caps at 8
and 3 ; cycle of 4 levels, stick on level 4 after 2 cycles
rlca
ld hl,leveldata
call tableget
ld de,dfile
call decrunch
call displayscore
call displayhi
call displaymen
displaylvl:
ld a,(level)
add a,ONEZ
ld hl,dfile+LVL_OFFS
ld (hl),a
ret
;-------------------------------------------------------------------------------
displaymen:
ld a,(lives)
add a,ZEROZ
ld hl,dfile+MEN_OFFS
ld (hl),a
ret
;-------------------------------------------------------------------------------
displayscoreline:
ld hl,scoreline ; render the scoreline
ld de,dfile+23*33+1
ld bc,32
ldir
ret
;-------------------------------------------------------------------------------
createmap:
ld hl,dfile
ld de,offscreenmap
ld bc,33*5
ldir
ld bc,33*19
_scryit:
ld a,(hl)
cp 0
jr z,_storeit
cp DOT
jr z,_storeit
cp $76
jr z,_storeit
ld a,128
_storeit:
ld (de),a
inc hl
inc de
dec bc
ld a,b
or c
jr nz,_scryit
ret
;-------------------------------------------------------------------------------
countdots:
ld hl,dfile+6*33
ld de,16*33
ld c,0
-: ld a,(hl)
cp DOT
jr nz,{+}
inc c
+: inc hl
dec de
ld a,d
or e
jr nz,{-}
ld a,c
or a
ret
;-------------------------------------------------------------------------------
detectdot:
ld hl,dfile+6*33
ld bc,16*33
ld a,DOT
cpir
ret
;-------------------------------------------------------------------------------
;# self-modifying
initentrances:
ld hl,entrances
_c1:
xor a
ld (entrancecount),a
ld (_adval1),a
inc a
ld (_adval0),a
ld a,enemyanimL2R
ld (_animnum),a
ld de,dfile+$c7-33 ; start checking at row 5
call checkcolumn
_c2:
ld a,$ff
ld (_adval0),a
ld (_adval1),a
ld a,enemyanimR2L
ld (_animnum),a
ld de,dfile+$e6-33
checkcolumn:
ld b,17
_nextrow:
push hl
ld hl,33
add hl,de
ex de,hl
pop hl
ld a,(de)
cp DOT
call z,_add
djnz _nextrow
ret
_add:
ld (hl),e
inc hl
ld (hl),d
inc hl
_adval0 = $+1
ld (hl),0
inc hl
_adval1 = $+1
ld (hl),0
inc hl
_animnum = $+1
ld (hl),0
inc hl
inc hl
inc hl
inc hl
ld a,(entrancecount)
inc a
ld (entrancecount),a
ret