-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtileinit.asm
346 lines (296 loc) · 5.38 KB
/
tileinit.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
;
; load tile sets in vram
tile_init:
ld a,(next_level)
ld l,a
ld h,0
add hl,hl
ld bc,clr_tab
add hl,bc
ld c,(hl)
inc hl
ld b,(hl)
ld (clr_table),bc
l1_15_init:
; set meta pnt tables
ld hl,meta_pnt_table_u_miz
ld de,meta_pnt_table_u
call mom_depack_rom
ld hl,meta_pnt_table_d_miz
ld de,meta_pnt_table_d
call mom_depack_rom
; fake meta-tile for explosion
ld hl,meta_pnt_table_u+254
ld b,8
1: ld (hl),254
inc h
djnz 1b
ld a,(toshiba_switch)
and a
jp nz,toshiba_vram_layout
; TMS
ld hl,chr_tileset1_common
ld de,miz_buffer
call mom_depack_rom
ld hl,chr_tileset1_up
ld de,miz_buffer+n_common_tiles1*8
call mom_depack_rom
ld de,0x0800
call write_2k
ld hl,chr_tileset1_dw
ld de,miz_buffer+n_common_tiles1*8
call mom_depack_rom
ld de,0x1000
call write_2k
ld de,0x0800+255*8
call set_star_shape
ld de,0x1000+255*8
call set_star_shape
ld hl,chr_tileset2_common
ld de,miz_buffer
call mom_depack_rom
ld hl,chr_tileset2_up
ld de,miz_buffer+n_common_tiles2*8
call mom_depack_rom
ld de,0x2800
call write_2k
ld hl,chr_tileset2_dw
ld de,miz_buffer+n_common_tiles2*8
call mom_depack_rom
ld de,0x3000
call write_2k
ld de,0x2800+255*8
call set_star_shape
ld de,0x3000+255*8
call set_star_shape
ld hl,clr_tileset2_common
ld de,miz_buffer
call mom_depack_rom
ld hl,clr_tileset2
ld de,miz_buffer+n_common_tiles2*8
call mom_depack_rom
call clr_map
ld de,0x0000
call write_2k
ld de,0x0000+255*8
call set_star_color
ld hl,clr_tileset1_common
ld de,miz_buffer
call mom_depack_rom
ld hl,clr_tileset1
ld de,miz_buffer+n_common_tiles1*8
call mom_depack_rom
call clr_map
ld de,0x2000
call write_2k
ld de,0x2000+255*8
call set_star_color
ret
toshiba_vram_layout:
; Toshiba
ld hl,chr_tileset1_common
ld de,miz_buffer
call mom_depack_rom
ld hl,chr_tileset1_up
ld de,miz_buffer+n_common_tiles1*8
call mom_depack_rom
ld de,0x0800
call write_2k
ld hl,chr_tileset1_dw
ld de,miz_buffer+n_common_tiles1*8
call mom_depack_rom
ld de,0x1000
call write_2k
ld de,0x0800+255*8
call set_star_shape
ld de,0x1000+255*8
call set_star_shape
ld hl,clr_tileset1_common
ld de,miz_buffer
call mom_depack_rom
ld hl,clr_tileset1
ld de,miz_buffer+n_common_tiles1*8
call mom_depack_rom
call clr_map
ld de,0x2800
call write_2k
ld de,0x3000
call write_2k
ld de,0x2800+255*8
call set_star_color
ld de,0x3000+255*8
call set_star_color
ret
shuttle_init:
; set meta pnt tables
ld hl,meta_pnt_table_u_ms_miz
ld de,meta_pnt_table_u
call mom_depack_rom
ld hl,meta_pnt_table_d_ms_miz
ld de,meta_pnt_table_d
call mom_depack_rom
; fake meta-tile for explosion
ld hl,meta_pnt_table_u+254
ld b,8
1: ld (hl),254
inc h
djnz 1b
; set patterns
ld hl,chr_tileset0_u_ms
ld de,miz_buffer
call mom_depack_rom
ld de,0x0800
call write_2k
ld hl,chr_tileset0_d_ms
ld de,miz_buffer
call mom_depack_rom
ld de,0x1000
call write_2k
ld hl,chr_tileset1_u_ms
ld de,miz_buffer
call mom_depack_rom
ld de,0x2800
call write_2k
ld hl,chr_tileset1_d_ms
ld de,miz_buffer
call mom_depack_rom
ld de,0x3000
call write_2k
; set colours
ld hl,clr_table1
ld (clr_table),hl
ld hl,clr_tileset1_ms
ld de,miz_buffer
call mom_depack_rom
call clr_map
ld de,0x0000
call write_2k
ld de,0x0000+255*8
call set_star_color
ld hl,clr_tileset0_ms
ld de,miz_buffer
call mom_depack_rom
call clr_map
ld de,0x2000
call write_2k
ld de,0x2000+255*8
call set_star_color
ld a,(toshiba_switch)
and a
jp z,1f
; Toshiba
ld de,0x2800
call write_2k
ld de,0x3000
call write_2k
ld de,0x2800+255*8
call set_star_color
ld de,0x3000+255*8
call set_star_color
1:
ld de,0x0800+255*8
call set_star_shape
ld de,0x1000+255*8
call set_star_shape
ld a,(toshiba_switch)
and a
ret nz
ld de,0x2800+255*8
call set_star_shape
ld de,0x3000+255*8
call set_star_shape
ret
_out:
out (c),a
ret
set_star_shape:
di
ld a,e
out (0x99),a
ld a,d
or 0x40
out (0x99),a
ld c,0x98
ld a,2
call _out
ld a,7
call _out
ld a,2
call _out
xor a
[5] call _out
ei
ret
set_star_color:
di
ld a,e
out (0x99),a
ld a,d
or 0x40
out (0x99),a
ld c,0x98
ld a,0x70
call _out
ld a,0xf0
call _out
ld a,0x70
call _out
xor a
[5] call _out
ei
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; *** tile set data in rom ***
chr_tileset1_common:
incbin chr1_common.miz
chr_tileset2_common:
incbin chr2_common.miz
clr_tileset1_common:
incbin clr1_common.miz
clr_tileset2_common:
incbin clr2_common.miz
chr_tileset1_up:
incbin chr1_up.miz
chr_tileset1_dw:
incbin chr1_dw.miz
clr_tileset1:
incbin clr1_ud.miz
chr_tileset2_up:
incbin chr2_up.miz
chr_tileset2_dw:
incbin chr2_dw.miz
clr_tileset2:
incbin clr2_ud.miz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; *** shuttle tile set data in rom ***
;code page 0,1
chr_tileset0_u_ms:
incbin chr_plain1u_ms.miz
;code page 0,1
chr_tileset0_d_ms:
incbin chr_plain1d_ms.miz
;code page 0,1
chr_tileset1_u_ms:
incbin chr_plain2u_ms.miz
;code page 0,1
chr_tileset1_d_ms:
incbin chr_plain2d_ms.miz
;code page 0,1
clr_tileset0_ms:
incbin clr_plain1_ms.miz
;code page 0,1
clr_tileset1_ms:
incbin clr_plain2_ms.miz
;code page 0,1
meta_pnt_table_u_miz:
incbin meta_pnt_table_u.miz
;code page 0,1
meta_pnt_table_d_miz:
incbin meta_pnt_table_d.miz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;code page 0,1
meta_pnt_table_u_ms_miz:
incbin meta_pnt_table_u_ms.miz
;code page 0,1
meta_pnt_table_d_ms_miz:
incbin meta_pnt_table_d_ms.miz