romdevtools 0.71.0 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +19 -16
- package/CHANGELOG.md +196 -0
- package/README.md +5 -5
- package/examples/README.md +1 -0
- package/examples/gametank/templates/gt_draw.h +91 -0
- package/examples/gametank/templates/gt_hud.h +89 -0
- package/examples/gametank/templates/gt_palette.h +59 -0
- package/examples/gametank/templates/gt_sound.h +90 -0
- package/examples/gametank/templates/gt_sprites.h +53 -0
- package/examples/gametank/templates/platformer.c +318 -0
- package/examples/gametank/templates/puzzle.c +295 -0
- package/examples/gametank/templates/racing.c +139 -0
- package/examples/gametank/templates/shmup.c +277 -0
- package/examples/gametank/templates/sports.c +119 -0
- package/package.json +23 -22
- package/src/cores/capabilities.js +24 -0
- package/src/cores/registry.js +7 -1
- package/src/host/LibretroHost.js +90 -17
- package/src/host/callbacks.js +20 -2
- package/src/host/cpu-state.js +17 -0
- package/src/host/gametank-acp-state.js +53 -0
- package/src/http/skill-doc.js +10 -6
- package/src/mcp/tools/audio.js +1 -1
- package/src/mcp/tools/cart-parts.js +76 -0
- package/src/mcp/tools/lifecycle.js +1 -1
- package/src/mcp/tools/platform-tools.js +9 -1
- package/src/mcp/tools/platforms.js +46 -10
- package/src/mcp/tools/toolchain.js +35 -10
- package/src/platforms/gametank/lib/gt/audio/acp_image.bin +0 -0
- package/src/platforms/gametank/lib/gt/audio/audio_coprocessor.c +55 -0
- package/src/platforms/gametank/lib/gt/audio/audio_coprocessor.h +34 -0
- package/src/platforms/gametank/lib/gt/audio/audio_fw.asm +223 -0
- package/src/platforms/gametank/lib/gt/audio/audio_fw_blob.s +8 -0
- package/src/platforms/gametank/lib/gt/audio/instruments.c +79 -0
- package/src/platforms/gametank/lib/gt/audio/instruments.h +25 -0
- package/src/platforms/gametank/lib/gt/audio/music.c +370 -0
- package/src/platforms/gametank/lib/gt/audio/music.h +35 -0
- package/src/platforms/gametank/lib/gt/audio/note_numbers.h +132 -0
- package/src/platforms/gametank/lib/gt/audio/scaled_sines.raw +0 -0
- package/src/platforms/gametank/lib/gt/audio/sine_256_-63_63.bin +0 -0
- package/src/platforms/gametank/lib/gt/banking.c +29 -0
- package/src/platforms/gametank/lib/gt/banking.h +8 -0
- package/src/platforms/gametank/lib/gt/banking2.s +41 -0
- package/src/platforms/gametank/lib/gt/crt0.s +102 -0
- package/src/platforms/gametank/lib/gt/draw_logo.s +55 -0
- package/src/platforms/gametank/lib/gt/feature/persist/persist.c +103 -0
- package/src/platforms/gametank/lib/gt/feature/persist/persist.h +13 -0
- package/src/platforms/gametank/lib/gt/feature/random/random.c +40 -0
- package/src/platforms/gametank/lib/gt/feature/random/random.h +18 -0
- package/src/platforms/gametank/lib/gt/feature/text/text.c +111 -0
- package/src/platforms/gametank/lib/gt/feature/text/text.h +25 -0
- package/src/platforms/gametank/lib/gt/gametank.c +12 -0
- package/src/platforms/gametank/lib/gt/gametank.h +80 -0
- package/src/platforms/gametank/lib/gt/gametank_logo.inc +393 -0
- package/src/platforms/gametank/lib/gt/gen/assets/assets_index.h +9 -0
- package/src/platforms/gametank/lib/gt/gen/assets/sdk_default.h +5 -0
- package/src/platforms/gametank/lib/gt/gen/bank_nums.h +11 -0
- package/src/platforms/gametank/lib/gt/gen/modules_enabled.h +4 -0
- package/src/platforms/gametank/lib/gt/gen/modules_enabled.inc +4 -0
- package/src/platforms/gametank/lib/gt/gfx/draw_direct.c +132 -0
- package/src/platforms/gametank/lib/gt/gfx/draw_direct.h +75 -0
- package/src/platforms/gametank/lib/gt/gfx/draw_queue.c +177 -0
- package/src/platforms/gametank/lib/gt/gfx/draw_queue.h +35 -0
- package/src/platforms/gametank/lib/gt/gfx/draw_util.s +157 -0
- package/src/platforms/gametank/lib/gt/gfx/gfx_sys.c +43 -0
- package/src/platforms/gametank/lib/gt/gfx/gfx_sys.h +46 -0
- package/src/platforms/gametank/lib/gt/gfx/sprites.c +216 -0
- package/src/platforms/gametank/lib/gt/gfx/sprites.h +41 -0
- package/src/platforms/gametank/lib/gt/init.c +9 -0
- package/src/platforms/gametank/lib/gt/input.c +26 -0
- package/src/platforms/gametank/lib/gt/input.h +20 -0
- package/src/platforms/gametank/lib/gt/interrupt.s +67 -0
- package/src/platforms/gametank/lib/gt/vectors.s +14 -0
- package/src/platforms/gametank/lib/gt/wait.s +53 -0
- package/src/platforms/gba/MENTAL_MODEL.md +22 -1
- package/src/playtest/playtest.js +174 -26
- package/src/playtest/resampler/build.sh +19 -0
- package/src/playtest/resampler/index.mjs +75 -0
- package/src/playtest/resampler/resampler.c +129 -0
- package/src/playtest/resampler/resampler.mjs +2 -0
- package/src/playtest/resampler/resampler.wasm +0 -0
- package/src/toolchains/arm-none-eabi-gcc/gcc.js +39 -188
- package/src/toolchains/asar/asar.js +10 -15
- package/src/toolchains/cc65/cc65.js +82 -92
- package/src/toolchains/cc65/da65.js +12 -17
- package/src/toolchains/cc65/preset-resolver.js +13 -2
- package/src/toolchains/cc65/presets/gametank/gametank.h +80 -0
- package/src/toolchains/cc65/presets/gametank/sdk.cfg +32 -0
- package/src/toolchains/cc65/presets/gametank/sdk.crt0.s +61 -0
- package/src/toolchains/cc65/presets/gametank/sdk.vectors.s +11 -0
- package/src/toolchains/cc65/presets/gametank/single-bank.cfg +28 -0
- package/src/toolchains/cc65/presets/gametank/single-bank.crt0.s +71 -0
- package/src/toolchains/cc65/presets/gametank/single-bank.vectors.s +12 -0
- package/src/toolchains/common/c-build.js +109 -0
- package/src/toolchains/common/gcc-toolchain.js +164 -0
- package/src/toolchains/common/wasm-tool.js +101 -0
- package/src/toolchains/dasm/dasm.js +12 -18
- package/src/toolchains/gba-c/gba-c.js +253 -305
- package/src/toolchains/genesis-c/genesis-c.js +196 -225
- package/src/toolchains/index.js +58 -4
- package/src/toolchains/m68k-elf-gcc/gcc.js +39 -202
- package/src/toolchains/mips-c/mips-c.js +68 -78
- package/src/toolchains/mips-elf-gcc/gcc.js +55 -118
- package/src/toolchains/rgbds/rgbds.js +7 -19
- package/src/toolchains/sdcc/sdcc.js +35 -26
- package/src/toolchains/sh-c/sh-c.js +44 -52
- package/src/toolchains/sh-elf-gcc/gcc.js +55 -110
- package/src/toolchains/sjasm/sjasm.js +10 -14
- package/src/toolchains/snes-c/snes-c.js +125 -150
- package/src/toolchains/tcc816/tcc816.js +10 -15
- package/src/toolchains/vasm68k/vasm68k.js +11 -16
- package/src/toolchains/wladx/wladx.js +5 -17
- package/src/toolchains/z80/binutils.js +5 -11
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
LogoXVals:
|
|
2
|
+
.byte $00
|
|
3
|
+
.byte 22
|
|
4
|
+
.byte 33
|
|
5
|
+
.byte 43
|
|
6
|
+
.byte 55
|
|
7
|
+
.byte 65
|
|
8
|
+
.byte 75
|
|
9
|
+
.byte 85
|
|
10
|
+
.byte 92
|
|
11
|
+
.byte 96
|
|
12
|
+
.byte 103
|
|
13
|
+
.byte $00
|
|
14
|
+
.byte 22
|
|
15
|
+
.byte 33
|
|
16
|
+
.byte 43
|
|
17
|
+
.byte 55
|
|
18
|
+
.byte 65
|
|
19
|
+
.byte 75
|
|
20
|
+
.byte 85
|
|
21
|
+
.byte 92
|
|
22
|
+
.byte 96
|
|
23
|
+
.byte 102
|
|
24
|
+
.byte $00
|
|
25
|
+
.byte 22
|
|
26
|
+
.byte 33
|
|
27
|
+
.byte 43
|
|
28
|
+
.byte 55
|
|
29
|
+
.byte 65
|
|
30
|
+
.byte 75
|
|
31
|
+
.byte 85
|
|
32
|
+
.byte 92
|
|
33
|
+
.byte 96
|
|
34
|
+
.byte 102
|
|
35
|
+
.byte $00
|
|
36
|
+
.byte 22
|
|
37
|
+
.byte 33
|
|
38
|
+
.byte 43
|
|
39
|
+
.byte 55
|
|
40
|
+
.byte 65
|
|
41
|
+
.byte 75
|
|
42
|
+
.byte 85
|
|
43
|
+
.byte 92
|
|
44
|
+
.byte 96
|
|
45
|
+
.byte 101
|
|
46
|
+
.byte $00
|
|
47
|
+
.byte 22
|
|
48
|
+
.byte 33
|
|
49
|
+
.byte 39
|
|
50
|
+
.byte 43
|
|
51
|
+
.byte 55
|
|
52
|
+
.byte 65
|
|
53
|
+
.byte 75
|
|
54
|
+
.byte 81
|
|
55
|
+
.byte 85
|
|
56
|
+
.byte 92
|
|
57
|
+
.byte 96
|
|
58
|
+
.byte 100
|
|
59
|
+
.byte $00
|
|
60
|
+
.byte 22
|
|
61
|
+
.byte 33
|
|
62
|
+
.byte 39
|
|
63
|
+
.byte 43
|
|
64
|
+
.byte 55
|
|
65
|
+
.byte 65
|
|
66
|
+
.byte 75
|
|
67
|
+
.byte 81
|
|
68
|
+
.byte 85
|
|
69
|
+
.byte 92
|
|
70
|
+
.byte 96
|
|
71
|
+
.byte $00
|
|
72
|
+
.byte 22
|
|
73
|
+
.byte 27
|
|
74
|
+
.byte 33
|
|
75
|
+
.byte 43
|
|
76
|
+
.byte 47
|
|
77
|
+
.byte 51
|
|
78
|
+
.byte 55
|
|
79
|
+
.byte 67
|
|
80
|
+
.byte 75
|
|
81
|
+
.byte 85
|
|
82
|
+
.byte 96
|
|
83
|
+
.byte $00
|
|
84
|
+
.byte 22
|
|
85
|
+
.byte 28
|
|
86
|
+
.byte 33
|
|
87
|
+
.byte 43
|
|
88
|
+
.byte 47
|
|
89
|
+
.byte 51
|
|
90
|
+
.byte 55
|
|
91
|
+
.byte 67
|
|
92
|
+
.byte 75
|
|
93
|
+
.byte 85
|
|
94
|
+
.byte 96
|
|
95
|
+
.byte $00
|
|
96
|
+
.byte 22
|
|
97
|
+
.byte 28
|
|
98
|
+
.byte 33
|
|
99
|
+
.byte 39
|
|
100
|
+
.byte 43
|
|
101
|
+
.byte 48
|
|
102
|
+
.byte 51
|
|
103
|
+
.byte 55
|
|
104
|
+
.byte 67
|
|
105
|
+
.byte 75
|
|
106
|
+
.byte 81
|
|
107
|
+
.byte 85
|
|
108
|
+
.byte 89
|
|
109
|
+
.byte 96
|
|
110
|
+
.byte $00
|
|
111
|
+
.byte 22
|
|
112
|
+
.byte 28
|
|
113
|
+
.byte 33
|
|
114
|
+
.byte 39
|
|
115
|
+
.byte 43
|
|
116
|
+
.byte 51
|
|
117
|
+
.byte 55
|
|
118
|
+
.byte 67
|
|
119
|
+
.byte 75
|
|
120
|
+
.byte 81
|
|
121
|
+
.byte 85
|
|
122
|
+
.byte 89
|
|
123
|
+
.byte 96
|
|
124
|
+
.byte $00
|
|
125
|
+
.byte 22
|
|
126
|
+
.byte 28
|
|
127
|
+
.byte 33
|
|
128
|
+
.byte 39
|
|
129
|
+
.byte 43
|
|
130
|
+
.byte 51
|
|
131
|
+
.byte 55
|
|
132
|
+
.byte 67
|
|
133
|
+
.byte 75
|
|
134
|
+
.byte 81
|
|
135
|
+
.byte 85
|
|
136
|
+
.byte 90
|
|
137
|
+
.byte 96
|
|
138
|
+
.byte $00
|
|
139
|
+
.byte 22
|
|
140
|
+
.byte 28
|
|
141
|
+
.byte 33
|
|
142
|
+
.byte 39
|
|
143
|
+
.byte 43
|
|
144
|
+
.byte 51
|
|
145
|
+
.byte 55
|
|
146
|
+
.byte 67
|
|
147
|
+
.byte 75
|
|
148
|
+
.byte 81
|
|
149
|
+
.byte 85
|
|
150
|
+
.byte 90
|
|
151
|
+
.byte 96
|
|
152
|
+
.byte 100
|
|
153
|
+
.byte $00
|
|
154
|
+
.byte 22
|
|
155
|
+
.byte 33
|
|
156
|
+
.byte 39
|
|
157
|
+
.byte 43
|
|
158
|
+
.byte 51
|
|
159
|
+
.byte 55
|
|
160
|
+
.byte 67
|
|
161
|
+
.byte 75
|
|
162
|
+
.byte 81
|
|
163
|
+
.byte 85
|
|
164
|
+
.byte 91
|
|
165
|
+
.byte 96
|
|
166
|
+
.byte 101
|
|
167
|
+
.byte $00
|
|
168
|
+
.byte 22
|
|
169
|
+
.byte 33
|
|
170
|
+
.byte 39
|
|
171
|
+
.byte 43
|
|
172
|
+
.byte 51
|
|
173
|
+
.byte 55
|
|
174
|
+
.byte 67
|
|
175
|
+
.byte 75
|
|
176
|
+
.byte 81
|
|
177
|
+
.byte 85
|
|
178
|
+
.byte 91
|
|
179
|
+
.byte 96
|
|
180
|
+
.byte 102
|
|
181
|
+
.byte $00
|
|
182
|
+
.byte 22
|
|
183
|
+
.byte 33
|
|
184
|
+
.byte 39
|
|
185
|
+
.byte 43
|
|
186
|
+
.byte 51
|
|
187
|
+
.byte 55
|
|
188
|
+
.byte 67
|
|
189
|
+
.byte 75
|
|
190
|
+
.byte 81
|
|
191
|
+
.byte 85
|
|
192
|
+
.byte 92
|
|
193
|
+
.byte 96
|
|
194
|
+
.byte 103
|
|
195
|
+
.byte $00
|
|
196
|
+
.byte $00
|
|
197
|
+
LogoWVals:
|
|
198
|
+
.byte $00
|
|
199
|
+
.byte 10
|
|
200
|
+
.byte 9
|
|
201
|
+
.byte 11
|
|
202
|
+
.byte 9
|
|
203
|
+
.byte 9
|
|
204
|
+
.byte 9
|
|
205
|
+
.byte 3
|
|
206
|
+
.byte 3
|
|
207
|
+
.byte 3
|
|
208
|
+
.byte 2
|
|
209
|
+
.byte $00
|
|
210
|
+
.byte 10
|
|
211
|
+
.byte 9
|
|
212
|
+
.byte 11
|
|
213
|
+
.byte 9
|
|
214
|
+
.byte 9
|
|
215
|
+
.byte 9
|
|
216
|
+
.byte 4
|
|
217
|
+
.byte 3
|
|
218
|
+
.byte 3
|
|
219
|
+
.byte 3
|
|
220
|
+
.byte $00
|
|
221
|
+
.byte 10
|
|
222
|
+
.byte 9
|
|
223
|
+
.byte 11
|
|
224
|
+
.byte 9
|
|
225
|
+
.byte 9
|
|
226
|
+
.byte 9
|
|
227
|
+
.byte 4
|
|
228
|
+
.byte 3
|
|
229
|
+
.byte 3
|
|
230
|
+
.byte 3
|
|
231
|
+
.byte $00
|
|
232
|
+
.byte 10
|
|
233
|
+
.byte 9
|
|
234
|
+
.byte 11
|
|
235
|
+
.byte 9
|
|
236
|
+
.byte 9
|
|
237
|
+
.byte 9
|
|
238
|
+
.byte 5
|
|
239
|
+
.byte 3
|
|
240
|
+
.byte 3
|
|
241
|
+
.byte 4
|
|
242
|
+
.byte $00
|
|
243
|
+
.byte 10
|
|
244
|
+
.byte 3
|
|
245
|
+
.byte 3
|
|
246
|
+
.byte 11
|
|
247
|
+
.byte 4
|
|
248
|
+
.byte 9
|
|
249
|
+
.byte 3
|
|
250
|
+
.byte 3
|
|
251
|
+
.byte 6
|
|
252
|
+
.byte 3
|
|
253
|
+
.byte 3
|
|
254
|
+
.byte 4
|
|
255
|
+
.byte $00
|
|
256
|
+
.byte 4
|
|
257
|
+
.byte 3
|
|
258
|
+
.byte 3
|
|
259
|
+
.byte 11
|
|
260
|
+
.byte 4
|
|
261
|
+
.byte 9
|
|
262
|
+
.byte 3
|
|
263
|
+
.byte 3
|
|
264
|
+
.byte 6
|
|
265
|
+
.byte 3
|
|
266
|
+
.byte 7
|
|
267
|
+
.byte $00
|
|
268
|
+
.byte 4
|
|
269
|
+
.byte 5
|
|
270
|
+
.byte 9
|
|
271
|
+
.byte 3
|
|
272
|
+
.byte 3
|
|
273
|
+
.byte 3
|
|
274
|
+
.byte 4
|
|
275
|
+
.byte 4
|
|
276
|
+
.byte 9
|
|
277
|
+
.byte 10
|
|
278
|
+
.byte 7
|
|
279
|
+
.byte $00
|
|
280
|
+
.byte 4
|
|
281
|
+
.byte 4
|
|
282
|
+
.byte 9
|
|
283
|
+
.byte 3
|
|
284
|
+
.byte 3
|
|
285
|
+
.byte 3
|
|
286
|
+
.byte 9
|
|
287
|
+
.byte 4
|
|
288
|
+
.byte 9
|
|
289
|
+
.byte 10
|
|
290
|
+
.byte 6
|
|
291
|
+
.byte $00
|
|
292
|
+
.byte 4
|
|
293
|
+
.byte 4
|
|
294
|
+
.byte 3
|
|
295
|
+
.byte 3
|
|
296
|
+
.byte 3
|
|
297
|
+
.byte 1
|
|
298
|
+
.byte 3
|
|
299
|
+
.byte 9
|
|
300
|
+
.byte 4
|
|
301
|
+
.byte 3
|
|
302
|
+
.byte 3
|
|
303
|
+
.byte 3
|
|
304
|
+
.byte 6
|
|
305
|
+
.byte 6
|
|
306
|
+
.byte $00
|
|
307
|
+
.byte 4
|
|
308
|
+
.byte 4
|
|
309
|
+
.byte 3
|
|
310
|
+
.byte 3
|
|
311
|
+
.byte 3
|
|
312
|
+
.byte 3
|
|
313
|
+
.byte 4
|
|
314
|
+
.byte 4
|
|
315
|
+
.byte 3
|
|
316
|
+
.byte 3
|
|
317
|
+
.byte 3
|
|
318
|
+
.byte 6
|
|
319
|
+
.byte 7
|
|
320
|
+
.byte $00
|
|
321
|
+
.byte 4
|
|
322
|
+
.byte 4
|
|
323
|
+
.byte 3
|
|
324
|
+
.byte 3
|
|
325
|
+
.byte 3
|
|
326
|
+
.byte 3
|
|
327
|
+
.byte 4
|
|
328
|
+
.byte 4
|
|
329
|
+
.byte 3
|
|
330
|
+
.byte 3
|
|
331
|
+
.byte 3
|
|
332
|
+
.byte 5
|
|
333
|
+
.byte 7
|
|
334
|
+
.byte $00
|
|
335
|
+
.byte 4
|
|
336
|
+
.byte 4
|
|
337
|
+
.byte 3
|
|
338
|
+
.byte 3
|
|
339
|
+
.byte 3
|
|
340
|
+
.byte 3
|
|
341
|
+
.byte 4
|
|
342
|
+
.byte 4
|
|
343
|
+
.byte 3
|
|
344
|
+
.byte 3
|
|
345
|
+
.byte 3
|
|
346
|
+
.byte 5
|
|
347
|
+
.byte 3
|
|
348
|
+
.byte 4
|
|
349
|
+
.byte $00
|
|
350
|
+
.byte 10
|
|
351
|
+
.byte 3
|
|
352
|
+
.byte 3
|
|
353
|
+
.byte 3
|
|
354
|
+
.byte 3
|
|
355
|
+
.byte 9
|
|
356
|
+
.byte 4
|
|
357
|
+
.byte 3
|
|
358
|
+
.byte 3
|
|
359
|
+
.byte 3
|
|
360
|
+
.byte 4
|
|
361
|
+
.byte 3
|
|
362
|
+
.byte 4
|
|
363
|
+
.byte $00
|
|
364
|
+
.byte 10
|
|
365
|
+
.byte 3
|
|
366
|
+
.byte 3
|
|
367
|
+
.byte 3
|
|
368
|
+
.byte 3
|
|
369
|
+
.byte 9
|
|
370
|
+
.byte 4
|
|
371
|
+
.byte 3
|
|
372
|
+
.byte 3
|
|
373
|
+
.byte 3
|
|
374
|
+
.byte 4
|
|
375
|
+
.byte 3
|
|
376
|
+
.byte 3
|
|
377
|
+
.byte $00
|
|
378
|
+
.byte 10
|
|
379
|
+
.byte 3
|
|
380
|
+
.byte 3
|
|
381
|
+
.byte 3
|
|
382
|
+
.byte 3
|
|
383
|
+
.byte 9
|
|
384
|
+
.byte 4
|
|
385
|
+
.byte 3
|
|
386
|
+
.byte 3
|
|
387
|
+
.byte 3
|
|
388
|
+
.byte 3
|
|
389
|
+
.byte 3
|
|
390
|
+
.byte 2
|
|
391
|
+
.byte $00
|
|
392
|
+
.byte $00
|
|
393
|
+
; 178 runs emitted
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// romdev single-bank GameTank: no asset pipeline. Stub the sfx tables music.c
|
|
2
|
+
// indexes (play_sound_effect needs them); set_note / load_instrument don't, so
|
|
3
|
+
// games drive audio note-by-note with those. Empty tables = play_sound_effect is
|
|
4
|
+
// harmless (the engine reads zeros).
|
|
5
|
+
#ifndef GEN_ASSETS_INDEX_H
|
|
6
|
+
#define GEN_ASSETS_INDEX_H
|
|
7
|
+
static const unsigned char ASSET__sfx_bank_table[1] = { 0 };
|
|
8
|
+
static const unsigned int ASSET__sfx_ptr_table[1] = { 0 };
|
|
9
|
+
#endif
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// romdev single-bank GameTank: there is ONE fixed ROM bank ($FF). The SDK runtime
|
|
2
|
+
// change_rom_bank()s into asset banks (LOADERS/COMMON/PROG/SAVE) to fetch sprite/
|
|
3
|
+
// text/audio data; with everything in the single 32K bank, they all resolve to the
|
|
4
|
+
// same bank, so the banking is effectively a no-op. (BANK_PROG0 is the alias some
|
|
5
|
+
// modules use for the program bank.)
|
|
6
|
+
#define BANK_ROM 0xFF
|
|
7
|
+
#define BANK_LOADERS 0xFF
|
|
8
|
+
#define BANK_COMMON 0xFF
|
|
9
|
+
#define BANK_PROG 0xFF
|
|
10
|
+
#define BANK_PROG0 0xFF
|
|
11
|
+
#define BANK_SAVE 0xFE
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#include "draw_direct.h"
|
|
2
|
+
#define MODULE_DRAWQUEUE_INTERNAL_USE
|
|
3
|
+
#include "draw_queue.h"
|
|
4
|
+
#include "gametank.h"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
char direct_sprite_offset_x = 0;
|
|
8
|
+
char direct_sprite_offset_y = 0;
|
|
9
|
+
|
|
10
|
+
void direct_prepare_sprite_mode(SpriteSlot sprite) {
|
|
11
|
+
await_draw_queue(); //Make sure we don't intersect with the queued system.
|
|
12
|
+
await_drawing();
|
|
13
|
+
flagsMirror |= DMA_ENABLE | DMA_IRQ | DMA_GCARRY;
|
|
14
|
+
flagsMirror &= ~(DMA_COLORFILL_ENABLE | DMA_OPAQUE);
|
|
15
|
+
*dma_flags = flagsMirror;
|
|
16
|
+
banksMirror &= ~(BANK_RAM_MASK | BANK_SECOND_FRAMEBUFFER | BANK_GRAM_MASK);
|
|
17
|
+
banksMirror |= bankflip | (sprite & BANK_GRAM_MASK) | BANK_CLIP_X | BANK_CLIP_Y;
|
|
18
|
+
*bank_reg = banksMirror;
|
|
19
|
+
direct_sprite_offset_x = SPRITE_OFFSET_X(sprite);
|
|
20
|
+
direct_sprite_offset_y = SPRITE_OFFSET_Y(sprite);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void direct_quick_select_sprite(SpriteSlot sprite) {
|
|
24
|
+
banksMirror &= ~BANK_GRAM_MASK;
|
|
25
|
+
banksMirror |= sprite & BANK_GRAM_MASK;
|
|
26
|
+
*bank_reg = banksMirror;
|
|
27
|
+
direct_sprite_offset_x = SPRITE_OFFSET_X(sprite);
|
|
28
|
+
direct_sprite_offset_y = SPRITE_OFFSET_Y(sprite);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
void direct_prepare_box_mode() {
|
|
32
|
+
await_draw_queue(); //Make sure we don't intersect with the queued system.
|
|
33
|
+
await_drawing();
|
|
34
|
+
flagsMirror |= DMA_ENABLE | DMA_OPAQUE | DMA_IRQ | DMA_COLORFILL_ENABLE | DMA_OPAQUE;
|
|
35
|
+
*dma_flags = flagsMirror;
|
|
36
|
+
banksMirror &= ~(BANK_RAM_MASK | BANK_SECOND_FRAMEBUFFER);
|
|
37
|
+
banksMirror |= bankflip | BANK_CLIP_X | BANK_CLIP_Y;
|
|
38
|
+
*bank_reg = banksMirror;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
void direct_prepare_array_mode() {
|
|
42
|
+
await_draw_queue();
|
|
43
|
+
await_drawing();
|
|
44
|
+
flagsMirror |= DMA_CPU_TO_VRAM;
|
|
45
|
+
flagsMirror &= ~DMA_ENABLE;
|
|
46
|
+
*dma_flags = flagsMirror;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void direct_prepare_sprite_ram_array_mode(SpriteSlot sprite) {
|
|
50
|
+
await_draw_queue();
|
|
51
|
+
await_drawing();
|
|
52
|
+
|
|
53
|
+
flagsMirror |= DMA_ENABLE | DMA_IRQ | DMA_GCARRY | DMA_COLORFILL_ENABLE;
|
|
54
|
+
flagsMirror &= ~(DMA_COLORFILL_ENABLE | DMA_OPAQUE);
|
|
55
|
+
*dma_flags = flagsMirror;
|
|
56
|
+
banksMirror &= ~(BANK_RAM_MASK | BANK_SECOND_FRAMEBUFFER | BANK_GRAM_MASK);
|
|
57
|
+
banksMirror |= bankflip | (sprite & BANK_GRAM_MASK) | BANK_CLIP_X | BANK_CLIP_Y;
|
|
58
|
+
*bank_reg = banksMirror;
|
|
59
|
+
direct_sprite_offset_x = SPRITE_OFFSET_X(sprite);
|
|
60
|
+
direct_sprite_offset_y = SPRITE_OFFSET_Y(sprite);
|
|
61
|
+
|
|
62
|
+
DIRECT_SET_COLOR(0);
|
|
63
|
+
DIRECT_DRAW_SPRITE(0, 0, 0, 0, 0, 0);
|
|
64
|
+
|
|
65
|
+
flagsMirror &= ~DMA_ENABLE;
|
|
66
|
+
*dma_flags = flagsMirror;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
void direct_tiled_mode(bool enabled) {
|
|
70
|
+
if(enabled) {
|
|
71
|
+
flagsMirror &= ~DMA_GCARRY;
|
|
72
|
+
} else {
|
|
73
|
+
flagsMirror |= DMA_GCARRY;
|
|
74
|
+
}
|
|
75
|
+
*dma_flags = flagsMirror;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void direct_transparent_mode(bool enabled) {
|
|
79
|
+
if(enabled) {
|
|
80
|
+
flagsMirror &= ~DMA_OPAQUE;
|
|
81
|
+
} else {
|
|
82
|
+
flagsMirror |= DMA_OPAQUE;
|
|
83
|
+
}
|
|
84
|
+
*dma_flags = flagsMirror;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void direct_clip_mode(clip_mode_t mode) {
|
|
88
|
+
banksMirror &= ~CLIP_MODE_XY;
|
|
89
|
+
banksMirror |= mode;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void direct_draw_sprite_frame(SpriteSlot sprite, char x, char y, char frame, char flip) {
|
|
93
|
+
asm("SEI");
|
|
94
|
+
sprite_fetch_frame(sprite, frame);
|
|
95
|
+
|
|
96
|
+
if(flip & SPRITE_FLIP_X) {
|
|
97
|
+
rect.x = (x - sprite_temp_frame.w - sprite_temp_frame.x - 1);
|
|
98
|
+
} else {
|
|
99
|
+
rect.x = (sprite_temp_frame.x + x);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if(flip & SPRITE_FLIP_Y) {
|
|
103
|
+
rect.y = (y - sprite_temp_frame.h - sprite_temp_frame.y - 1);
|
|
104
|
+
} else {
|
|
105
|
+
rect.y = (sprite_temp_frame.y + y);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
rect.gx = sprite_temp_frame.gx;
|
|
109
|
+
if(sprite & SPRITE_OFFSET_X_MASK) { rect.gx |= 128; }
|
|
110
|
+
if(flip & SPRITE_FLIP_X) {
|
|
111
|
+
rect.gx ^= 0xFF;
|
|
112
|
+
rect.gx -= sprite_temp_frame.w - 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
rect.gy = sprite_temp_frame.gy;
|
|
116
|
+
if(sprite & SPRITE_OFFSET_Y_MASK) { rect.gy |= 128; }
|
|
117
|
+
if(flip & SPRITE_FLIP_Y) {
|
|
118
|
+
rect.gy ^= 0xFF;
|
|
119
|
+
rect.gy -= sprite_temp_frame.h - 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
await_drawing();
|
|
123
|
+
direct_quick_select_sprite(sprite);
|
|
124
|
+
vram[VX] = rect.x;
|
|
125
|
+
vram[VY] = rect.y;
|
|
126
|
+
vram[GX] = rect.gx;
|
|
127
|
+
vram[GY] = rect.gy;
|
|
128
|
+
vram[WIDTH] = sprite_temp_frame.w | (flip & SPRITE_FLIP_X ? 128 : 0);
|
|
129
|
+
vram[HEIGHT] = sprite_temp_frame.h | (flip & SPRITE_FLIP_Y ? 128 : 0);
|
|
130
|
+
|
|
131
|
+
DIRECT_DRAW_START();
|
|
132
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#ifndef DRAW_DIRECT_H
|
|
2
|
+
#define DRAW_DIRECT_H
|
|
3
|
+
#include "gametank.h"
|
|
4
|
+
#include "gfx_sys.h"
|
|
5
|
+
#include "sprites.h"
|
|
6
|
+
|
|
7
|
+
typedef char clip_mode_t;
|
|
8
|
+
|
|
9
|
+
extern char direct_sprite_offset_x;
|
|
10
|
+
extern char direct_sprite_offset_y;
|
|
11
|
+
|
|
12
|
+
//Setup registers to draw sprites in direct mode
|
|
13
|
+
//Also checks for and awaits queued drawing operations
|
|
14
|
+
void direct_prepare_sprite_mode(SpriteSlot sprite);
|
|
15
|
+
|
|
16
|
+
//Both this and direct_prepare_sprite_mode select the sprite slot to use
|
|
17
|
+
//but this skips other register settings and ONLY selects the sprite slot
|
|
18
|
+
void direct_quick_select_sprite(SpriteSlot sprite);
|
|
19
|
+
|
|
20
|
+
//Setup registers to draw colored boxes in direct mode
|
|
21
|
+
//Also checks for and awaits queued drawing operations
|
|
22
|
+
void direct_prepare_box_mode();
|
|
23
|
+
|
|
24
|
+
//Setup registers to access the framebuffer as an array
|
|
25
|
+
void direct_prepare_array_mode();
|
|
26
|
+
|
|
27
|
+
//Setup registers to access Sprite RAM as an array
|
|
28
|
+
void direct_prepare_sprite_ram_array_mode(SpriteSlot sprite);
|
|
29
|
+
|
|
30
|
+
//If enabled, sprite draws will repeat the same 16x16 grid from the source data
|
|
31
|
+
void direct_tiled_mode(bool enabled);
|
|
32
|
+
|
|
33
|
+
//If enabled, sprite draws will treat color 0 as transparent instead of black
|
|
34
|
+
void direct_transparent_mode(bool enabled);
|
|
35
|
+
|
|
36
|
+
//Set whether drawings will be clipped at screen edges or wrap around
|
|
37
|
+
void direct_clip_mode(clip_mode_t mode);
|
|
38
|
+
|
|
39
|
+
void direct_draw_sprite_frame(SpriteSlot sprite, char x, char y, char frame, char flip);
|
|
40
|
+
|
|
41
|
+
#define DIRECT_DRAW_START() draw_busy = 1; \
|
|
42
|
+
vram[START] = 1;
|
|
43
|
+
|
|
44
|
+
#define DIRECT_DRAW_CLEAR_IRQ() vram[START] = 0;
|
|
45
|
+
|
|
46
|
+
#define DIRECT_SET_DEST_X(x) vram[VX] = (x);
|
|
47
|
+
#define DIRECT_SET_DEST_Y(y) vram[VY] = (y);
|
|
48
|
+
#define DIRECT_SET_SOURCE_X(x) vram[GX] = (x) | direct_sprite_offset_x
|
|
49
|
+
#define DIRECT_SET_SOURCE_Y(y) vram[GY] = (y) | direct_sprite_offset_y
|
|
50
|
+
#define DIRECT_SET_WIDTH(w) vram[WIDTH] = (w);
|
|
51
|
+
#define DIRECT_SET_HEIGHT(h) vram[HEIGHT] = (h);
|
|
52
|
+
#define DIRECT_SET_COLOR(c) vram[COLOR] = ~(c);
|
|
53
|
+
|
|
54
|
+
//If you do consecutive draws that will cause redundant register sets
|
|
55
|
+
// then you can skip the macro and just set the registers directly.
|
|
56
|
+
// eg. for tilemaps you'd only need to set WIDTH, HEIGHT once and
|
|
57
|
+
// set VY once per row
|
|
58
|
+
#define DIRECT_DRAW_SPRITE(dst_x, dst_y, w, h, src_gx, src_gy) \
|
|
59
|
+
vram[VX] = dst_x; \
|
|
60
|
+
vram[VY] = dst_y; \
|
|
61
|
+
vram[GX] = src_gx + direct_sprite_offset_x; \
|
|
62
|
+
vram[GY] = src_gy + direct_sprite_offset_y; \
|
|
63
|
+
vram[WIDTH] = w; \
|
|
64
|
+
vram[HEIGHT] = h; \
|
|
65
|
+
DIRECT_DRAW_START();
|
|
66
|
+
|
|
67
|
+
#define DIRECT_DRAW_COLOR(dst_x, dst_y, w, h, c) \
|
|
68
|
+
vram[VX] = dst_x; \
|
|
69
|
+
vram[VY] = dst_y; \
|
|
70
|
+
vram[WIDTH] = w; \
|
|
71
|
+
vram[HEIGHT] = h; \
|
|
72
|
+
vram[COLOR] = ~(c); \
|
|
73
|
+
DIRECT_DRAW_START();
|
|
74
|
+
|
|
75
|
+
#endif
|