romdev-mcp 0.1.1
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 +726 -0
- package/LICENSE +45 -0
- package/NOTICE +86 -0
- package/README.md +46 -0
- package/examples/README.md +36 -0
- package/examples/art-first-workflow/README.md +205 -0
- package/examples/atari2600/main.asm +143 -0
- package/examples/atari2600/templates/default.asm +183 -0
- package/examples/atari2600/templates/mini_invaders.asm +381 -0
- package/examples/atari2600/templates/music_demo.asm +322 -0
- package/examples/atari2600/templates/paddle.asm +345 -0
- package/examples/atari2600/templates/single_screen.asm +242 -0
- package/examples/atari7800/main.c +88 -0
- package/examples/atari7800/templates/default.c +183 -0
- package/examples/atari7800/templates/hello_sprite.c +141 -0
- package/examples/atari7800/templates/music_demo.c +123 -0
- package/examples/atari7800/templates/platformer.c +159 -0
- package/examples/atari7800/templates/puzzle.c +164 -0
- package/examples/atari7800/templates/racing.c +139 -0
- package/examples/atari7800/templates/shmup.c +148 -0
- package/examples/atari7800/templates/sports.c +207 -0
- package/examples/c64/main.c +63 -0
- package/examples/c64/templates/hello_sprite.c +117 -0
- package/examples/c64/templates/music_demo.c +131 -0
- package/examples/c64/templates/platformer.c +194 -0
- package/examples/c64/templates/puzzle.c +178 -0
- package/examples/c64/templates/racing.c +140 -0
- package/examples/c64/templates/shmup.c +201 -0
- package/examples/c64/templates/sports.c +109 -0
- package/examples/c64/templates/tile_engine.c +174 -0
- package/examples/gb/main.asm +106 -0
- package/examples/gb/main.c +49 -0
- package/examples/gb/templates/default.c +58 -0
- package/examples/gb/templates/hello_sprite.c +130 -0
- package/examples/gb/templates/music_demo.c +52 -0
- package/examples/gb/templates/platformer.c +178 -0
- package/examples/gb/templates/puzzle.c +217 -0
- package/examples/gb/templates/racing.c +158 -0
- package/examples/gb/templates/shmup.c +172 -0
- package/examples/gb/templates/sports.c +136 -0
- package/examples/gb/templates/tile_engine.c +280 -0
- package/examples/gba/templates/gba_hello.c +64 -0
- package/examples/gba/templates/maxmod_demo.c +105 -0
- package/examples/gba/templates/platformer.c +215 -0
- package/examples/gba/templates/puzzle.c +237 -0
- package/examples/gba/templates/racing.c +175 -0
- package/examples/gba/templates/shmup.c +197 -0
- package/examples/gba/templates/sports.c +177 -0
- package/examples/gba/templates/tonc_hello.c +72 -0
- package/examples/gba/templates/tonc_hello_sprite.c +109 -0
- package/examples/gbc/main.asm +123 -0
- package/examples/gbc/templates/default.c +61 -0
- package/examples/gbc/templates/hello_sprite.c +140 -0
- package/examples/gbc/templates/music_demo.c +63 -0
- package/examples/gbc/templates/platformer.c +181 -0
- package/examples/gbc/templates/puzzle.c +217 -0
- package/examples/gbc/templates/racing.c +164 -0
- package/examples/gbc/templates/shmup.c +188 -0
- package/examples/gbc/templates/sports.c +142 -0
- package/examples/gbc/templates/tile_engine.c +280 -0
- package/examples/genesis/main.s +161 -0
- package/examples/genesis/templates/hello_sprite.c +75 -0
- package/examples/genesis/templates/platformer.c +166 -0
- package/examples/genesis/templates/puzzle.c +240 -0
- package/examples/genesis/templates/racing.c +170 -0
- package/examples/genesis/templates/sgdk_hello.c +41 -0
- package/examples/genesis/templates/shmup.c +188 -0
- package/examples/genesis/templates/shmup_2p.c +244 -0
- package/examples/genesis/templates/sports.c +172 -0
- package/examples/genesis/templates/tile_engine.c +135 -0
- package/examples/genesis/templates/xgm2_demo.c +53 -0
- package/examples/genesis/templates/xgm2_demo_data.s +27 -0
- package/examples/gg/main.c +10 -0
- package/examples/gg/templates/default.c +156 -0
- package/examples/gg/templates/hello_sprite.c +90 -0
- package/examples/gg/templates/music_demo.c +156 -0
- package/examples/gg/templates/platformer.c +220 -0
- package/examples/gg/templates/puzzle.c +204 -0
- package/examples/gg/templates/racing.c +161 -0
- package/examples/gg/templates/shmup.c +188 -0
- package/examples/gg/templates/sports.c +137 -0
- package/examples/gg/templates/tile_engine.c +137 -0
- package/examples/lynx/main.c +4 -0
- package/examples/lynx/templates/default.c +41 -0
- package/examples/lynx/templates/hello_sprite.c +39 -0
- package/examples/lynx/templates/music_demo.c +37 -0
- package/examples/lynx/templates/platformer.c +72 -0
- package/examples/lynx/templates/puzzle.c +142 -0
- package/examples/lynx/templates/racing.c +94 -0
- package/examples/lynx/templates/shmup.c +132 -0
- package/examples/lynx/templates/sports.c +59 -0
- package/examples/nes/main.c +143 -0
- package/examples/nes/space-shooter/README.md +68 -0
- package/examples/nes/space-shooter/main.c +441 -0
- package/examples/nes/space-shooter/nes_runtime.c +347 -0
- package/examples/nes/space-shooter/nes_runtime.h +141 -0
- package/examples/nes/templates/default.c +41 -0
- package/examples/nes/templates/hello_sprite.c +104 -0
- package/examples/nes/templates/music_demo.c +80 -0
- package/examples/nes/templates/platformer.c +171 -0
- package/examples/nes/templates/puzzle.c +232 -0
- package/examples/nes/templates/racing.c +203 -0
- package/examples/nes/templates/shmup.c +228 -0
- package/examples/nes/templates/sports.c +205 -0
- package/examples/nes/templates/tile_engine.c +224 -0
- package/examples/porting-across-platforms/README.md +59 -0
- package/examples/sms/main.c +129 -0
- package/examples/sms/templates/default.c +110 -0
- package/examples/sms/templates/hello_sprite.c +90 -0
- package/examples/sms/templates/music_demo.c +151 -0
- package/examples/sms/templates/platformer.c +215 -0
- package/examples/sms/templates/puzzle.c +204 -0
- package/examples/sms/templates/racing.c +161 -0
- package/examples/sms/templates/shmup.c +167 -0
- package/examples/sms/templates/shmup_2p.c +219 -0
- package/examples/sms/templates/sports.c +147 -0
- package/examples/sms/templates/tile_engine.c +137 -0
- package/examples/snes/main.asm +70 -0
- package/examples/snes/templates/c-hello-data.asm +28 -0
- package/examples/snes/templates/c-hello.c +71 -0
- package/examples/snes/templates/default-data.asm +36 -0
- package/examples/snes/templates/default.c +74 -0
- package/examples/snes/templates/hello_sprite-data.asm +45 -0
- package/examples/snes/templates/hello_sprite.c +76 -0
- package/examples/snes/templates/music_demo-data.asm +20 -0
- package/examples/snes/templates/music_demo.c +83 -0
- package/examples/snes/templates/platformer-data.asm +27 -0
- package/examples/snes/templates/platformer.c +142 -0
- package/examples/snes/templates/puzzle-data.asm +14 -0
- package/examples/snes/templates/puzzle.c +199 -0
- package/examples/snes/templates/racing-data.asm +33 -0
- package/examples/snes/templates/racing.c +146 -0
- package/examples/snes/templates/shmup-data.asm +61 -0
- package/examples/snes/templates/shmup.c +199 -0
- package/examples/snes/templates/sports-data.asm +28 -0
- package/examples/snes/templates/sports.c +144 -0
- package/package.json +83 -0
- package/src/cli/smoke.js +283 -0
- package/src/cores/registry.js +95 -0
- package/src/host/LibretroHost.js +502 -0
- package/src/host/callbacks.js +444 -0
- package/src/host/chafa-render.js +170 -0
- package/src/host/coreLoader.js +57 -0
- package/src/host/cpu-state.js +422 -0
- package/src/host/dsp-state.js +188 -0
- package/src/host/framebuffer.js +115 -0
- package/src/host/gpgx-state.js +309 -0
- package/src/host/index.js +4 -0
- package/src/host/retroConstants.js +72 -0
- package/src/host/snes9x-state.js +35 -0
- package/src/host/types.js +280 -0
- package/src/mcp/disclosure.js +250 -0
- package/src/mcp/log.js +87 -0
- package/src/mcp/server.js +433 -0
- package/src/mcp/state.js +83 -0
- package/src/mcp/tools/address-to-symbol.js +151 -0
- package/src/mcp/tools/art-loaders.js +740 -0
- package/src/mcp/tools/assets.js +89 -0
- package/src/mcp/tools/audio.js +173 -0
- package/src/mcp/tools/cart-parts.js +649 -0
- package/src/mcp/tools/diff-roms.js +412 -0
- package/src/mcp/tools/disasm.js +980 -0
- package/src/mcp/tools/find-references.js +361 -0
- package/src/mcp/tools/font-map.js +353 -0
- package/src/mcp/tools/frame.js +249 -0
- package/src/mcp/tools/free-space.js +95 -0
- package/src/mcp/tools/index.js +351 -0
- package/src/mcp/tools/input-layout.js +215 -0
- package/src/mcp/tools/input.js +142 -0
- package/src/mcp/tools/lifecycle.js +110 -0
- package/src/mcp/tools/lospec.js +156 -0
- package/src/mcp/tools/memory.js +169 -0
- package/src/mcp/tools/metasprite-tools.js +261 -0
- package/src/mcp/tools/platform-docs.js +102 -0
- package/src/mcp/tools/platform-tools.js +1063 -0
- package/src/mcp/tools/platforms.js +86 -0
- package/src/mcp/tools/playtest.js +280 -0
- package/src/mcp/tools/preview-tile.js +360 -0
- package/src/mcp/tools/project.js +1885 -0
- package/src/mcp/tools/record.js +131 -0
- package/src/mcp/tools/rendering-context.js +700 -0
- package/src/mcp/tools/rom-id.js +256 -0
- package/src/mcp/tools/run-until.js +173 -0
- package/src/mcp/tools/snippets.js +235 -0
- package/src/mcp/tools/splice-chr.js +215 -0
- package/src/mcp/tools/sprite-pipeline.js +614 -0
- package/src/mcp/tools/state.js +99 -0
- package/src/mcp/tools/symbols.js +277 -0
- package/src/mcp/tools/tile-inspect.js +206 -0
- package/src/mcp/tools/toolchain.js +680 -0
- package/src/mcp/tools/watch-memory.js +212 -0
- package/src/mcp/tools/which-tiles.js +193 -0
- package/src/mcp/util.js +85 -0
- package/src/observer/bus.js +127 -0
- package/src/observer/livestream.html +589 -0
- package/src/observer/server.js +66 -0
- package/src/observer/tool-wrap.js +115 -0
- package/src/platforms/atari2600/MENTAL_MODEL.md +185 -0
- package/src/platforms/atari2600/TROUBLESHOOTING.md +155 -0
- package/src/platforms/atari2600/UPSTREAM_SOURCES.md +49 -0
- package/src/platforms/atari2600/lib/README.md +67 -0
- package/src/platforms/atari2600/lib/cc65-src/crt0.s +49 -0
- package/src/platforms/atari2600/lib/cc65-src/ctype.s +5 -0
- package/src/platforms/atari2600/lib/kernel_skeleton.asm +85 -0
- package/src/platforms/atari2600/lib/player_kernel.asm +87 -0
- package/src/platforms/atari2600/lib/playfield_kernel.asm +63 -0
- package/src/platforms/atari2600/lib/read_joystick.asm +76 -0
- package/src/platforms/atari2600/lib/score_kernel.asm +141 -0
- package/src/platforms/atari2600/lib/vcs_constants.h +97 -0
- package/src/platforms/atari2600/lib/vectors.asm +16 -0
- package/src/platforms/atari2600/tia.js +355 -0
- package/src/platforms/atari7800/MENTAL_MODEL.md +306 -0
- package/src/platforms/atari7800/TROUBLESHOOTING.md +195 -0
- package/src/platforms/atari7800/UPSTREAM_SOURCES.md +43 -0
- package/src/platforms/atari7800/lib/README.md +45 -0
- package/src/platforms/atari7800/lib/c/atari7800_music.c +215 -0
- package/src/platforms/atari7800/lib/c/atari7800_music.h +33 -0
- package/src/platforms/atari7800/lib/c/atari7800_sfx.c +74 -0
- package/src/platforms/atari7800/lib/c/atari7800_sfx.h +45 -0
- package/src/platforms/atari7800/lib/cc65-src/clock.s +69 -0
- package/src/platforms/atari7800/lib/cc65-src/clocks_per_sec.s +34 -0
- package/src/platforms/atari7800/lib/cc65-src/clrscr.s +27 -0
- package/src/platforms/atari7800/lib/cc65-src/conio.s +226 -0
- package/src/platforms/atari7800/lib/cc65-src/conio_font.s +278 -0
- package/src/platforms/atari7800/lib/cc65-src/cputc.s +139 -0
- package/src/platforms/atari7800/lib/cc65-src/crt0.s +71 -0
- package/src/platforms/atari7800/lib/cc65-src/ctype.s +5 -0
- package/src/platforms/atari7800/lib/cc65-src/exehdr.s +46 -0
- package/src/platforms/atari7800/lib/cc65-src/extra/mono.s +28 -0
- package/src/platforms/atari7800/lib/cc65-src/extzp.inc +15 -0
- package/src/platforms/atari7800/lib/cc65-src/extzp.s +15 -0
- package/src/platforms/atari7800/lib/cc65-src/get_tv.s +65 -0
- package/src/platforms/atari7800/lib/cc65-src/irq.s +36 -0
- package/src/platforms/atari7800/lib/cc65-src/joy/atari7800-stdjoy.s +197 -0
- package/src/platforms/atari7800/lib/cc65-src/joy_stat_stddrv.s +14 -0
- package/src/platforms/atari7800/lib/cc65-src/libref.s +8 -0
- package/src/platforms/atari7800/lib/cc65-src/mono_clrscr.s +27 -0
- package/src/platforms/atari7800/lib/cc65-src/mono_conio.s +231 -0
- package/src/platforms/atari7800/lib/cc65-src/mono_cputc.s +102 -0
- package/src/platforms/atari7800/lib/cc65-src/mono_font.s +2065 -0
- package/src/platforms/atari7800/lib/cc65-src/mono_setcursor.s +214 -0
- package/src/platforms/atari7800/lib/cc65-src/setcursor.s +214 -0
- package/src/platforms/atari7800/lib/cc65-src/textcolor.s +53 -0
- package/src/platforms/atari7800/lib/cc65-src/wherex.s +19 -0
- package/src/platforms/atari7800/lib/cc65-src/wherey.s +19 -0
- package/src/platforms/atari7800/lib/display_list.asm +53 -0
- package/src/platforms/atari7800/lib/maria_init.asm +48 -0
- package/src/platforms/atari7800/lib/maria_registers.h +61 -0
- package/src/platforms/atari7800/lib/palette_load.asm +53 -0
- package/src/platforms/atari7800/lib/read_pad.asm +57 -0
- package/src/platforms/atari7800/lib/vblank_wait.asm +16 -0
- package/src/platforms/atari7800/maria.js +220 -0
- package/src/platforms/c64/MENTAL_MODEL.md +175 -0
- package/src/platforms/c64/TROUBLESHOOTING.md +130 -0
- package/src/platforms/c64/UPSTREAM_SOURCES.md +35 -0
- package/src/platforms/c64/image-to-tilemap.js +190 -0
- package/src/platforms/c64/lib/README.md +52 -0
- package/src/platforms/c64/lib/basic_stub.s +25 -0
- package/src/platforms/c64/lib/c/c64_music.c +248 -0
- package/src/platforms/c64/lib/c/c64_music.h +36 -0
- package/src/platforms/c64/lib/c/c64_sfx.c +94 -0
- package/src/platforms/c64/lib/c/c64_sfx.h +37 -0
- package/src/platforms/c64/lib/c64_registers.h +108 -0
- package/src/platforms/c64/lib/cc65-src/_scrsize.s +12 -0
- package/src/platforms/c64/lib/cc65-src/acc_c128_speed.s +5 -0
- package/src/platforms/c64/lib/cc65-src/acc_c64dtv_speed.s +64 -0
- package/src/platforms/c64/lib/cc65-src/acc_c65_speed.s +69 -0
- package/src/platforms/c64/lib/cc65-src/acc_chameleon_speed.s +100 -0
- package/src/platforms/c64/lib/cc65-src/acc_detect_c128.s +33 -0
- package/src/platforms/c64/lib/cc65-src/acc_detect_c64dtv.s +44 -0
- package/src/platforms/c64/lib/cc65-src/acc_detect_c65.s +55 -0
- package/src/platforms/c64/lib/cc65-src/acc_detect_chameleon.s +39 -0
- package/src/platforms/c64/lib/cc65-src/acc_detect_scpu.s +34 -0
- package/src/platforms/c64/lib/cc65-src/acc_detect_turbomaster.s +45 -0
- package/src/platforms/c64/lib/cc65-src/acc_scpu_speed.s +59 -0
- package/src/platforms/c64/lib/cc65-src/acc_turbomaster_speed.s +56 -0
- package/src/platforms/c64/lib/cc65-src/bordercolor.s +17 -0
- package/src/platforms/c64/lib/cc65-src/break.s +108 -0
- package/src/platforms/c64/lib/cc65-src/cgetc.s +62 -0
- package/src/platforms/c64/lib/cc65-src/clrscr.s +11 -0
- package/src/platforms/c64/lib/cc65-src/color.s +24 -0
- package/src/platforms/c64/lib/cc65-src/conio.s +10 -0
- package/src/platforms/c64/lib/cc65-src/cputc.s +105 -0
- package/src/platforms/c64/lib/cc65-src/crt0.s +117 -0
- package/src/platforms/c64/lib/cc65-src/devnum.s +7 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-65816.s +377 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-c256k.s +508 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-dqbb.s +447 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-georam.s +355 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-isepic.s +276 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-kerberos.s +281 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-ram.s +270 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-ramcart.s +297 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-reu.s +286 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-rrr.s +363 -0
- package/src/platforms/c64/lib/cc65-src/emd/c64-vdc.s +405 -0
- package/src/platforms/c64/lib/cc65-src/emd/dtv-himem.s +251 -0
- package/src/platforms/c64/lib/cc65-src/extra/soft80.s +71 -0
- package/src/platforms/c64/lib/cc65-src/extra/soft80mono.s +74 -0
- package/src/platforms/c64/lib/cc65-src/extra/tgimousedata.s +21 -0
- package/src/platforms/c64/lib/cc65-src/get_ostype.s +43 -0
- package/src/platforms/c64/lib/cc65-src/get_tv.s +20 -0
- package/src/platforms/c64/lib/cc65-src/gettime.s +83 -0
- package/src/platforms/c64/lib/cc65-src/irq.s +49 -0
- package/src/platforms/c64/lib/cc65-src/joy/c64-hitjoy.s +218 -0
- package/src/platforms/c64/lib/cc65-src/joy/c64-numpad.s +155 -0
- package/src/platforms/c64/lib/cc65-src/joy/c64-ptvjoy.s +146 -0
- package/src/platforms/c64/lib/cc65-src/joy/c64-stdjoy.s +111 -0
- package/src/platforms/c64/lib/cc65-src/joy_stat_stddrv.s +14 -0
- package/src/platforms/c64/lib/cc65-src/joy_stddrv.s +14 -0
- package/src/platforms/c64/lib/cc65-src/kbhit.s +23 -0
- package/src/platforms/c64/lib/cc65-src/kbrepeat.s +14 -0
- package/src/platforms/c64/lib/cc65-src/kernal.s +53 -0
- package/src/platforms/c64/lib/cc65-src/kplot.s +22 -0
- package/src/platforms/c64/lib/cc65-src/libref.s +16 -0
- package/src/platforms/c64/lib/cc65-src/mainargs.s +137 -0
- package/src/platforms/c64/lib/cc65-src/mcbdefault.s +146 -0
- package/src/platforms/c64/lib/cc65-src/mcbspritedata.s +4 -0
- package/src/platforms/c64/lib/cc65-src/mou/c64-1351.s +467 -0
- package/src/platforms/c64/lib/cc65-src/mou/c64-inkwell.s +446 -0
- package/src/platforms/c64/lib/cc65-src/mou/c64-joy.s +451 -0
- package/src/platforms/c64/lib/cc65-src/mou/c64-pot.s +409 -0
- package/src/platforms/c64/lib/cc65-src/mouse_stat_stddrv.s +14 -0
- package/src/platforms/c64/lib/cc65-src/mouse_stddrv.s +14 -0
- package/src/platforms/c64/lib/cc65-src/mouseref.s +23 -0
- package/src/platforms/c64/lib/cc65-src/pencalib.c +94 -0
- package/src/platforms/c64/lib/cc65-src/randomize.s +18 -0
- package/src/platforms/c64/lib/cc65-src/revers.s +27 -0
- package/src/platforms/c64/lib/cc65-src/ser/c64-swlink.s +484 -0
- package/src/platforms/c64/lib/cc65-src/ser_stat_stddrv.s +14 -0
- package/src/platforms/c64/lib/cc65-src/ser_stddrv.s +13 -0
- package/src/platforms/c64/lib/cc65-src/settime.s +84 -0
- package/src/platforms/c64/lib/cc65-src/soft80.inc +46 -0
- package/src/platforms/c64/lib/cc65-src/soft80_cgetc.s +85 -0
- package/src/platforms/c64/lib/cc65-src/soft80_charset.s +182 -0
- package/src/platforms/c64/lib/cc65-src/soft80_color.s +159 -0
- package/src/platforms/c64/lib/cc65-src/soft80_conio.s +157 -0
- package/src/platforms/c64/lib/cc65-src/soft80_cpeekc.s +148 -0
- package/src/platforms/c64/lib/cc65-src/soft80_cpeekcolor.s +19 -0
- package/src/platforms/c64/lib/cc65-src/soft80_cpeekrevers.s +15 -0
- package/src/platforms/c64/lib/cc65-src/soft80_cpeeks.s +71 -0
- package/src/platforms/c64/lib/cc65-src/soft80_cputc.s +521 -0
- package/src/platforms/c64/lib/cc65-src/soft80_kclrscr.s +76 -0
- package/src/platforms/c64/lib/cc65-src/soft80_kplot.s +63 -0
- package/src/platforms/c64/lib/cc65-src/soft80_scrsize.s +14 -0
- package/src/platforms/c64/lib/cc65-src/soft80mono_cgetc.s +67 -0
- package/src/platforms/c64/lib/cc65-src/soft80mono_color.s +65 -0
- package/src/platforms/c64/lib/cc65-src/soft80mono_conio.s +168 -0
- package/src/platforms/c64/lib/cc65-src/soft80mono_cpeekcolor.s +17 -0
- package/src/platforms/c64/lib/cc65-src/soft80mono_cputc.s +204 -0
- package/src/platforms/c64/lib/cc65-src/soft80mono_kclrscr.s +63 -0
- package/src/platforms/c64/lib/cc65-src/soft80mono_kplot.s +52 -0
- package/src/platforms/c64/lib/cc65-src/status.s +15 -0
- package/src/platforms/c64/lib/cc65-src/sysuname.s +37 -0
- package/src/platforms/c64/lib/cc65-src/tgi/c64-hi.s +881 -0
- package/src/platforms/c64/lib/cc65-src/tgi_stat_stddrv.s +14 -0
- package/src/platforms/c64/lib/cc65-src/tgi_stddrv.s +13 -0
- package/src/platforms/c64/lib/cc65-src/tmcommon.s +67 -0
- package/src/platforms/c64/lib/cc65-src/waitvsync.s +18 -0
- package/src/platforms/c64/lib/read_joystick.s +28 -0
- package/src/platforms/c64/lib/sid_play.s +48 -0
- package/src/platforms/c64/lib/sprite_table.s +73 -0
- package/src/platforms/c64/lib/vic_init.s +47 -0
- package/src/platforms/c64/sid.js +128 -0
- package/src/platforms/c64/vic.js +273 -0
- package/src/platforms/common/default-palette.js +139 -0
- package/src/platforms/common/image-to-tiles.js +407 -0
- package/src/platforms/common/intent.js +111 -0
- package/src/platforms/common/metasprite-adapters.js +279 -0
- package/src/platforms/common/metasprite-codegen.js +192 -0
- package/src/platforms/common/metasprite-core.js +201 -0
- package/src/platforms/common/metasprite.js +89 -0
- package/src/platforms/common/platform-palette.js +137 -0
- package/src/platforms/common/registers.js +329 -0
- package/src/platforms/common/render-tiles.js +86 -0
- package/src/platforms/common/screenshot-sprite.js +153 -0
- package/src/platforms/common/tile-decode.js +149 -0
- package/src/platforms/gb/MENTAL_MODEL.md +252 -0
- package/src/platforms/gb/TROUBLESHOOTING.md +221 -0
- package/src/platforms/gb/UPSTREAM_SOURCES.md +43 -0
- package/src/platforms/gb/image-to-tilemap.js +173 -0
- package/src/platforms/gb/lib/README.md +115 -0
- package/src/platforms/gb/lib/c/LICENSE-HUGEDRIVER +25 -0
- package/src/platforms/gb/lib/c/README.md +120 -0
- package/src/platforms/gb/lib/c/SDCC_GOTCHAS.md +189 -0
- package/src/platforms/gb/lib/c/gb_crt0.s +163 -0
- package/src/platforms/gb/lib/c/gb_hardware.h +113 -0
- package/src/platforms/gb/lib/c/gb_runtime.c +284 -0
- package/src/platforms/gb/lib/c/gb_runtime.h +145 -0
- package/src/platforms/gb/lib/c/hUGEDriver.c +191 -0
- package/src/platforms/gb/lib/c/hUGEDriver.h +95 -0
- package/src/platforms/gb/lib/c/hUGEDriver.upstream.asm +1908 -0
- package/src/platforms/gb/lib/c/lcd_init.c +19 -0
- package/src/platforms/gb/lib/c/patch-header.js +154 -0
- package/src/platforms/gb/lib/c/song_data.c +88 -0
- package/src/platforms/gb/lib/c/unroll.h +52 -0
- package/src/platforms/gb/lib/c/wait_vblank.c +14 -0
- package/src/platforms/gb/lib/dma_oam.asm +51 -0
- package/src/platforms/gb/lib/header.asm +56 -0
- package/src/platforms/gb/lib/joypad_read.asm +47 -0
- package/src/platforms/gb/lib/lcd_init.asm +44 -0
- package/src/platforms/gb/lib/load_palette.asm +25 -0
- package/src/platforms/gb/lib/load_tiles.asm +29 -0
- package/src/platforms/gb/lib/vblank_wait.asm +31 -0
- package/src/platforms/gb/ppu.js +574 -0
- package/src/platforms/gba/MENTAL_MODEL.md +203 -0
- package/src/platforms/gba/TROUBLESHOOTING.md +250 -0
- package/src/platforms/gba/UPSTREAM_SOURCES.md +41 -0
- package/src/platforms/gba/lib/arm-archives/libc.a +0 -0
- package/src/platforms/gba/lib/arm-archives/libgcc.a +0 -0
- package/src/platforms/gba/lib/arm-archives/libnosys.a +0 -0
- package/src/platforms/gba/lib/c/gba_sfx.c +81 -0
- package/src/platforms/gba/lib/c/gba_sfx.h +48 -0
- package/src/platforms/gba/lib/libgba/crtbegin.o +0 -0
- package/src/platforms/gba/lib/libgba/crtend.o +0 -0
- package/src/platforms/gba/lib/libgba/crti.o +0 -0
- package/src/platforms/gba/lib/libgba/crtn.o +0 -0
- package/src/platforms/gba/lib/libgba/gba_cart.ld +319 -0
- package/src/platforms/gba/lib/libgba/gba_crt0.s +258 -0
- package/src/platforms/gba/lib/libgba/include/BoyScout.h +128 -0
- package/src/platforms/gba/lib/libgba/include/disc.h +36 -0
- package/src/platforms/gba/lib/libgba/include/disc_io.h +64 -0
- package/src/platforms/gba/lib/libgba/include/dldi.h +112 -0
- package/src/platforms/gba/lib/libgba/include/erapi.h +195 -0
- package/src/platforms/gba/lib/libgba/include/fade.h +76 -0
- package/src/platforms/gba/lib/libgba/include/gba.h +47 -0
- package/src/platforms/gba/lib/libgba/include/gba_affine.h +83 -0
- package/src/platforms/gba/lib/libgba/include/gba_base.h +122 -0
- package/src/platforms/gba/lib/libgba/include/gba_compression.h +66 -0
- package/src/platforms/gba/lib/libgba/include/gba_console.h +55 -0
- package/src/platforms/gba/lib/libgba/include/gba_dma.h +100 -0
- package/src/platforms/gba/lib/libgba/include/gba_input.h +127 -0
- package/src/platforms/gba/lib/libgba/include/gba_interrupt.h +146 -0
- package/src/platforms/gba/lib/libgba/include/gba_multiboot.h +72 -0
- package/src/platforms/gba/lib/libgba/include/gba_sio.h +124 -0
- package/src/platforms/gba/lib/libgba/include/gba_sound.h +356 -0
- package/src/platforms/gba/lib/libgba/include/gba_sprites.h +195 -0
- package/src/platforms/gba/lib/libgba/include/gba_systemcalls.h +194 -0
- package/src/platforms/gba/lib/libgba/include/gba_timers.h +63 -0
- package/src/platforms/gba/lib/libgba/include/gba_types.h +60 -0
- package/src/platforms/gba/lib/libgba/include/gba_video.h +307 -0
- package/src/platforms/gba/lib/libgba/include/mappy.h +72 -0
- package/src/platforms/gba/lib/libgba/include/mbv2.h +90 -0
- package/src/platforms/gba/lib/libgba/include/xcomms.h +93 -0
- package/src/platforms/gba/lib/libgba/include/xcomms_cmd.h +53 -0
- package/src/platforms/gba/lib/libgba/libgba.seed.a +0 -0
- package/src/platforms/gba/lib/libgba/libgba.seed.hash +1 -0
- package/src/platforms/gba/lib/libgba/src/AffineSet.c +42 -0
- package/src/platforms/gba/lib/libgba/src/ArcTan.s +41 -0
- package/src/platforms/gba/lib/libgba/src/BoyScout/BoyScout.c +1242 -0
- package/src/platforms/gba/lib/libgba/src/BoyScout/GBASoundRegs.h +200 -0
- package/src/platforms/gba/lib/libgba/src/Compression.c +84 -0
- package/src/platforms/gba/lib/libgba/src/CpuSet.c +41 -0
- package/src/platforms/gba/lib/libgba/src/Div.s +58 -0
- package/src/platforms/gba/lib/libgba/src/DivArm.s +50 -0
- package/src/platforms/gba/lib/libgba/src/InterruptDispatcher.s +113 -0
- package/src/platforms/gba/lib/libgba/src/IntrWait.c +35 -0
- package/src/platforms/gba/lib/libgba/src/MultiBoot.s +33 -0
- package/src/platforms/gba/lib/libgba/src/Reset.s +49 -0
- package/src/platforms/gba/lib/libgba/src/Sound.s +48 -0
- package/src/platforms/gba/lib/libgba/src/Sqrt.s +34 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/disc.c +58 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/dldi.c +189 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/dldi_stub.s +78 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_cf_common.c +260 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_cf_common.h +72 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_m3_common.c +60 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_m3_common.h +48 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_m3cf.c +83 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_m3cf.h +45 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_m3sd.c +508 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_m3sd.h +45 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_mpcf.c +87 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_mpcf.h +42 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_sc_common.c +47 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_sc_common.h +43 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_sccf.c +83 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_sccf.h +45 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_scsd.c +385 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_scsd.h +48 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_scsd_s.s +139 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_sd_common.c +203 -0
- package/src/platforms/gba/lib/libgba/src/disc_io/io_sd_common.h +108 -0
- package/src/platforms/gba/lib/libgba/src/fade.c +185 -0
- package/src/platforms/gba/lib/libgba/src/input.c +127 -0
- package/src/platforms/gba/lib/libgba/src/interrupt.c +116 -0
- package/src/platforms/gba/lib/libgba/src/mappy_print.c +74 -0
- package/src/platforms/gba/lib/libgba/src/mb2print.c +69 -0
- package/src/platforms/gba/lib/libgba/src/mbv2.c +230 -0
- package/src/platforms/gba/lib/libgba/src/mbv2.txt +119 -0
- package/src/platforms/gba/lib/libgba/src/xcomms.c +203 -0
- package/src/platforms/gba/lib/libgba/src/xcomms_print.c +56 -0
- package/src/platforms/gba/lib/libgba/sysinclude/_ansi.h +82 -0
- package/src/platforms/gba/lib/libgba/sysinclude/_newlib_version.h +11 -0
- package/src/platforms/gba/lib/libgba/sysinclude/_syslist.h +41 -0
- package/src/platforms/gba/lib/libgba/sysinclude/alloca.h +21 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ar.h +65 -0
- package/src/platforms/gba/lib/libgba/sysinclude/argz.h +33 -0
- package/src/platforms/gba/lib/libgba/sysinclude/assert.h +50 -0
- package/src/platforms/gba/lib/libgba/sysinclude/complex.h +150 -0
- package/src/platforms/gba/lib/libgba/sysinclude/cpio.h +30 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ctype.h +183 -0
- package/src/platforms/gba/lib/libgba/sysinclude/devctl.h +78 -0
- package/src/platforms/gba/lib/libgba/sysinclude/dirent.h +85 -0
- package/src/platforms/gba/lib/libgba/sysinclude/elf.h +3147 -0
- package/src/platforms/gba/lib/libgba/sysinclude/envlock.h +15 -0
- package/src/platforms/gba/lib/libgba/sysinclude/envz.h +16 -0
- package/src/platforms/gba/lib/libgba/sysinclude/errno.h +11 -0
- package/src/platforms/gba/lib/libgba/sysinclude/fastmath.h +13 -0
- package/src/platforms/gba/lib/libgba/sysinclude/fcntl.h +1 -0
- package/src/platforms/gba/lib/libgba/sysinclude/fenv.h +42 -0
- package/src/platforms/gba/lib/libgba/sysinclude/float.h +631 -0
- package/src/platforms/gba/lib/libgba/sysinclude/fnmatch.h +55 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ftw.h +66 -0
- package/src/platforms/gba/lib/libgba/sysinclude/getopt.h +185 -0
- package/src/platforms/gba/lib/libgba/sysinclude/glob.h +90 -0
- package/src/platforms/gba/lib/libgba/sysinclude/grp.h +86 -0
- package/src/platforms/gba/lib/libgba/sysinclude/iconv.h +63 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ieeefp.h +295 -0
- package/src/platforms/gba/lib/libgba/sysinclude/inttypes.h +345 -0
- package/src/platforms/gba/lib/libgba/sysinclude/iso646.h +45 -0
- package/src/platforms/gba/lib/libgba/sysinclude/langinfo.h +332 -0
- package/src/platforms/gba/lib/libgba/sysinclude/libgen.h +37 -0
- package/src/platforms/gba/lib/libgba/sysinclude/limits.h +168 -0
- package/src/platforms/gba/lib/libgba/sysinclude/locale.h +96 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/_arc4random.h +1 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/_default_types.h +250 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/_endian.h +39 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/_time.h +3 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/_types.h +8 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/ansi.h +1 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/endian.h +69 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/fastmath.h +98 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/ieee.h +127 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/ieeefp.h +533 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/malloc.h +8 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/param.h +8 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/setjmp-dj.h +43 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/setjmp.h +524 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/stdlib.h +8 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/termios.h +1 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/time.h +15 -0
- package/src/platforms/gba/lib/libgba/sysinclude/machine/types.h +13 -0
- package/src/platforms/gba/lib/libgba/sysinclude/malloc.h +173 -0
- package/src/platforms/gba/lib/libgba/sysinclude/math.h +645 -0
- package/src/platforms/gba/lib/libgba/sysinclude/memory.h +4 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ndbm.h +91 -0
- package/src/platforms/gba/lib/libgba/sysinclude/newlib.h +427 -0
- package/src/platforms/gba/lib/libgba/sysinclude/paths.h +9 -0
- package/src/platforms/gba/lib/libgba/sysinclude/pthread.h +456 -0
- package/src/platforms/gba/lib/libgba/sysinclude/pwd.h +83 -0
- package/src/platforms/gba/lib/libgba/sysinclude/reent.h +190 -0
- package/src/platforms/gba/lib/libgba/sysinclude/regdef.h +7 -0
- package/src/platforms/gba/lib/libgba/sysinclude/regex.h +103 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sched.h +112 -0
- package/src/platforms/gba/lib/libgba/sysinclude/search.h +64 -0
- package/src/platforms/gba/lib/libgba/sysinclude/setjmp.h +25 -0
- package/src/platforms/gba/lib/libgba/sysinclude/signal.h +35 -0
- package/src/platforms/gba/lib/libgba/sysinclude/spawn.h +111 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ssp/ssp.h +76 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ssp/stdio.h +101 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ssp/stdlib.h +30 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ssp/string.h +115 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ssp/strings.h +55 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ssp/unistd.h +93 -0
- package/src/platforms/gba/lib/libgba/sysinclude/ssp/wchar.h +97 -0
- package/src/platforms/gba/lib/libgba/sysinclude/stdarg.h +135 -0
- package/src/platforms/gba/lib/libgba/sysinclude/stdatomic.h +409 -0
- package/src/platforms/gba/lib/libgba/sysinclude/stdbool.h +51 -0
- package/src/platforms/gba/lib/libgba/sysinclude/stddef.h +463 -0
- package/src/platforms/gba/lib/libgba/sysinclude/stdint.h +466 -0
- package/src/platforms/gba/lib/libgba/sysinclude/stdio.h +807 -0
- package/src/platforms/gba/lib/libgba/sysinclude/stdio_ext.h +79 -0
- package/src/platforms/gba/lib/libgba/sysinclude/stdlib.h +345 -0
- package/src/platforms/gba/lib/libgba/sysinclude/string.h +183 -0
- package/src/platforms/gba/lib/libgba/sysinclude/strings.h +80 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_default_fcntl.h +241 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_intsup.h +199 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_locale.h +12 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_pthreadtypes.h +233 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_sigset.h +43 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_stdint.h +90 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_timespec.h +52 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_timeval.h +60 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_types.h +228 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/_tz_structs.h +24 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/cdefs.h +754 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/config.h +314 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/custom_file.h +2 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/dir.h +10 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/dirent.h +13 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/endian.h +207 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/errno.h +198 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/fcntl.h +12 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/features.h +551 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/fenv.h +90 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/file.h +2 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/iconvnls.h +77 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/iosupport.h +143 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/lock.h +75 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/param.h +35 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/queue.h +919 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/reent.h +913 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/resource.h +24 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/sched.h +69 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/select.h +94 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/signal.h +388 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/stat.h +179 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/statvfs.h +41 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/stdio.h +27 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/string.h +2 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/syslimits.h +61 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/time.h +448 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/timeb.h +40 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/times.h +32 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/timespec.h +63 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/tree.h +864 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/types.h +228 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/unistd.h +591 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/utime.h +22 -0
- package/src/platforms/gba/lib/libgba/sysinclude/sys/wait.h +44 -0
- package/src/platforms/gba/lib/libgba/sysinclude/tar.h +43 -0
- package/src/platforms/gba/lib/libgba/sysinclude/termios.h +7 -0
- package/src/platforms/gba/lib/libgba/sysinclude/tgmath.h +127 -0
- package/src/platforms/gba/lib/libgba/sysinclude/threads.h +93 -0
- package/src/platforms/gba/lib/libgba/sysinclude/time.h +313 -0
- package/src/platforms/gba/lib/libgba/sysinclude/unctrl.h +42 -0
- package/src/platforms/gba/lib/libgba/sysinclude/unistd.h +6 -0
- package/src/platforms/gba/lib/libgba/sysinclude/utime.h +12 -0
- package/src/platforms/gba/lib/libgba/sysinclude/utmp.h +8 -0
- package/src/platforms/gba/lib/libgba/sysinclude/varargs.h +7 -0
- package/src/platforms/gba/lib/libgba/sysinclude/wchar.h +339 -0
- package/src/platforms/gba/lib/libgba/sysinclude/wctype.h +74 -0
- package/src/platforms/gba/lib/libgba/sysinclude/wordexp.h +53 -0
- package/src/platforms/gba/lib/libtonc/crtbegin.o +0 -0
- package/src/platforms/gba/lib/libtonc/crtend.o +0 -0
- package/src/platforms/gba/lib/libtonc/crti.o +0 -0
- package/src/platforms/gba/lib/libtonc/crtn.o +0 -0
- package/src/platforms/gba/lib/libtonc/gba_cart.ld +319 -0
- package/src/platforms/gba/lib/libtonc/gba_crt0.s +258 -0
- package/src/platforms/gba/lib/libtonc/include/tonc.h +72 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_asminc.h +132 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_bios.h +555 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_core.h +573 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_input.h +184 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_irq.h +121 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_legacy.h +481 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_libgba.h +537 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_math.h +692 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_memdef.h +962 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_memmap.h +583 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_nocash.h +51 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_oam.h +186 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_surface.h +461 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_text.h +270 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_tte.h +748 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_types.h +376 -0
- package/src/platforms/gba/lib/libtonc/include/tonc_video.h +615 -0
- package/src/platforms/gba/lib/libtonc/libtonc.seed.a +0 -0
- package/src/platforms/gba/lib/libtonc/libtonc.seed.hash +1 -0
- package/src/platforms/gba/lib/libtonc/src/asm/clr_blend_fast.s +72 -0
- package/src/platforms/gba/lib/libtonc/src/asm/clr_fade_fast.s +74 -0
- package/src/platforms/gba/lib/libtonc/src/asm/div_lut.s +54 -0
- package/src/platforms/gba/lib/libtonc/src/asm/sin_lut.s +90 -0
- package/src/platforms/gba/lib/libtonc/src/asm/tonc_bios.s +289 -0
- package/src/platforms/gba/lib/libtonc/src/asm/tonc_bios_ex.s +97 -0
- package/src/platforms/gba/lib/libtonc/src/asm/tonc_isr_master.s +92 -0
- package/src/platforms/gba/lib/libtonc/src/asm/tonc_isr_nest.s +98 -0
- package/src/platforms/gba/lib/libtonc/src/asm/tonc_memcpy.s +126 -0
- package/src/platforms/gba/lib/libtonc/src/asm/tonc_memset.s +123 -0
- package/src/platforms/gba/lib/libtonc/src/asm/tonc_nocash.s +73 -0
- package/src/platforms/gba/lib/libtonc/src/font/sys8.png +0 -0
- package/src/platforms/gba/lib/libtonc/src/font/sys8.s +46 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana10.png +0 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana10.s +293 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana9.png +0 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana9.s +167 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana9_b4.png +0 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana9_b4.s +545 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana9b.png +0 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana9b.s +167 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana9i.png +0 -0
- package/src/platforms/gba/lib/libtonc/src/font/verdana9i.s +167 -0
- package/src/platforms/gba/lib/libtonc/src/pre1.3/tonc_bitmap.c +289 -0
- package/src/platforms/gba/lib/libtonc/src/pre1.3/tonc_text.c +81 -0
- package/src/platforms/gba/lib/libtonc/src/pre1.3/tonc_text_bm.c +244 -0
- package/src/platforms/gba/lib/libtonc/src/pre1.3/tonc_text_map.c +122 -0
- package/src/platforms/gba/lib/libtonc/src/pre1.3/tonc_text_oam.c +113 -0
- package/src/platforms/gba/lib/libtonc/src/pre1.3/toncfont.s +43 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_bg.c +61 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_bg_affine.c +112 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_bmp16.c +240 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_bmp8.c +314 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_color.c +368 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_core.c +237 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_input.c +118 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_irq.c +271 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_math.c +54 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_oam.c +76 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_obj_affine.c +146 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_sbmp16.c +369 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_sbmp8.c +405 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_schr4c.c +588 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_schr4r.c +462 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_surface.c +105 -0
- package/src/platforms/gba/lib/libtonc/src/tonc_video.c +33 -0
- package/src/platforms/gba/lib/libtonc/src/tte/ase_drawg.c +83 -0
- package/src/platforms/gba/lib/libtonc/src/tte/bmp16_drawg.c +72 -0
- package/src/platforms/gba/lib/libtonc/src/tte/bmp16_drawg_b1cs.c +92 -0
- package/src/platforms/gba/lib/libtonc/src/tte/bmp8_drawg.c +71 -0
- package/src/platforms/gba/lib/libtonc/src/tte/bmp8_drawg_b1cs.c +104 -0
- package/src/platforms/gba/lib/libtonc/src/tte/bmp8_drawg_b1cts_fast.s +115 -0
- package/src/platforms/gba/lib/libtonc/src/tte/chr4c_drawg_b1cts.c +76 -0
- package/src/platforms/gba/lib/libtonc/src/tte/chr4c_drawg_b1cts_fast.s +128 -0
- package/src/platforms/gba/lib/libtonc/src/tte/chr4c_drawg_b4cts.c +67 -0
- package/src/platforms/gba/lib/libtonc/src/tte/chr4c_drawg_b4cts_fast.s +127 -0
- package/src/platforms/gba/lib/libtonc/src/tte/chr4r_drawg_b1cts.c +80 -0
- package/src/platforms/gba/lib/libtonc/src/tte/chr4r_drawg_b1cts_fast.s +145 -0
- package/src/platforms/gba/lib/libtonc/src/tte/obj_drawg.c +61 -0
- package/src/platforms/gba/lib/libtonc/src/tte/se_drawg.c +110 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_init_ase.c +87 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_init_bmp.c +118 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_init_chr4c.c +86 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_init_chr4r.c +87 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_init_obj.c +84 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_init_se.c +96 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_iohook.c +264 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_main.c +756 -0
- package/src/platforms/gba/lib/libtonc/src/tte/tte_types.s +119 -0
- package/src/platforms/gba/lib/maxmod/LICENSE-MAXMOD +23 -0
- package/src/platforms/gba/lib/maxmod/asm_include/mp_defs.inc +117 -0
- package/src/platforms/gba/lib/maxmod/asm_include/mp_format_mas.inc +108 -0
- package/src/platforms/gba/lib/maxmod/asm_include/mp_macros.inc +195 -0
- package/src/platforms/gba/lib/maxmod/asm_include/mp_mas.inc +40 -0
- package/src/platforms/gba/lib/maxmod/asm_include/mp_mas_structs.inc +189 -0
- package/src/platforms/gba/lib/maxmod/asm_include/mp_mixer_ds.inc +46 -0
- package/src/platforms/gba/lib/maxmod/asm_include/mp_mixer_gba.inc +42 -0
- package/src/platforms/gba/lib/maxmod/asm_include/swi_gba.inc +23 -0
- package/src/platforms/gba/lib/maxmod/include/maxmod.h +412 -0
- package/src/platforms/gba/lib/maxmod/include/mm_types.h +333 -0
- package/src/platforms/gba/lib/maxmod/maxmod.seed.a +0 -0
- package/src/platforms/gba/lib/maxmod/maxmod.seed.hash +1 -0
- package/src/platforms/gba/lib/maxmod/music/chiptune.xm +0 -0
- package/src/platforms/gba/lib/maxmod/music/chiptune_soundbank.bin +0 -0
- package/src/platforms/gba/lib/maxmod/music/chiptune_soundbank.h +4 -0
- package/src/platforms/gba/lib/maxmod/music/make_chiptune_xm.js +203 -0
- package/src/platforms/gba/lib/maxmod/source/mm_effect.s +767 -0
- package/src/platforms/gba/lib/maxmod/source/mm_main.s +115 -0
- package/src/platforms/gba/lib/maxmod/source/mm_mas.s +4990 -0
- package/src/platforms/gba/lib/maxmod/source/mm_mas_arm.s +612 -0
- package/src/platforms/gba/lib/maxmod/source_gba/mm_init_default.s +98 -0
- package/src/platforms/gba/lib/maxmod/source_gba/mm_main_gba.s +292 -0
- package/src/platforms/gba/lib/maxmod/source_gba/mm_mixer_gba.s +1367 -0
- package/src/platforms/gba/lib/sysbase/gba_iosupport.c +138 -0
- package/src/platforms/gbc/MENTAL_MODEL.md +165 -0
- package/src/platforms/gbc/TROUBLESHOOTING.md +142 -0
- package/src/platforms/gbc/UPSTREAM_SOURCES.md +60 -0
- package/src/platforms/gbc/lib/c/LICENSE-HUGEDRIVER +25 -0
- package/src/platforms/gbc/lib/c/README.md +120 -0
- package/src/platforms/gbc/lib/c/SDCC_GOTCHAS.md +189 -0
- package/src/platforms/gbc/lib/c/gb_crt0.s +163 -0
- package/src/platforms/gbc/lib/c/gb_hardware.h +113 -0
- package/src/platforms/gbc/lib/c/gb_runtime.c +284 -0
- package/src/platforms/gbc/lib/c/gb_runtime.h +145 -0
- package/src/platforms/gbc/lib/c/hUGEDriver.c +191 -0
- package/src/platforms/gbc/lib/c/hUGEDriver.h +95 -0
- package/src/platforms/gbc/lib/c/hUGEDriver.upstream.asm +1908 -0
- package/src/platforms/gbc/lib/c/lcd_init.c +19 -0
- package/src/platforms/gbc/lib/c/patch-header.js +154 -0
- package/src/platforms/gbc/lib/c/song_data.c +88 -0
- package/src/platforms/gbc/lib/c/unroll.h +52 -0
- package/src/platforms/gbc/lib/c/wait_vblank.c +14 -0
- package/src/platforms/genesis/MENTAL_MODEL.md +223 -0
- package/src/platforms/genesis/TROUBLESHOOTING.md +193 -0
- package/src/platforms/genesis/UPSTREAM_SOURCES.md +52 -0
- package/src/platforms/genesis/image-to-tilemap.js +333 -0
- package/src/platforms/genesis/lib/README.md +157 -0
- package/src/platforms/genesis/lib/c/crtbegin.o +0 -0
- package/src/platforms/genesis/lib/c/crtend.o +0 -0
- package/src/platforms/genesis/lib/c/genesis.ld +44 -0
- package/src/platforms/genesis/lib/c/genesis_sfx.c +51 -0
- package/src/platforms/genesis/lib/c/genesis_sfx.h +49 -0
- package/src/platforms/genesis/lib/c/libc.a +0 -0
- package/src/platforms/genesis/lib/c/libgcc.a +0 -0
- package/src/platforms/genesis/lib/c/libm.a +0 -0
- package/src/platforms/genesis/lib/c/sega.s +71 -0
- package/src/platforms/genesis/lib/header.s +96 -0
- package/src/platforms/genesis/lib/nmi_safe.s +79 -0
- package/src/platforms/genesis/lib/pad_read.s +104 -0
- package/src/platforms/genesis/lib/sgdk/COPYING.RUNTIME +73 -0
- package/src/platforms/genesis/lib/sgdk/LICENSE +12 -0
- package/src/platforms/genesis/lib/sgdk/include/asm.h +52 -0
- package/src/platforms/genesis/lib/sgdk/include/asm_mac.i +9 -0
- package/src/platforms/genesis/lib/sgdk/include/bmp.h +690 -0
- package/src/platforms/genesis/lib/sgdk/include/config.h +208 -0
- package/src/platforms/genesis/lib/sgdk/include/dma.h +542 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/console.h +387 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/everdrive.h +116 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/fat16.h +84 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/flash-save/flash.h +164 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/flash-save/saveman.h +177 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/link_cable.h +316 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/minimusic/minimus.h +29 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/16c550.h +221 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/comm.h +93 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/gamejolt.h +541 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/jsmn.h +471 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/json.h +122 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/lsd.h +172 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/megawifi.h +984 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/mw-msg.h +392 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/ssf_ed_pro.h +38 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/mw/ssf_ed_x7.h +73 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/serial/buffer.h +8 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/serial/serial.h +133 -0
- package/src/platforms/genesis/lib/sgdk/include/ext/stb/stb_sprintf.h +1864 -0
- package/src/platforms/genesis/lib/sgdk/include/genesis.h +92 -0
- package/src/platforms/genesis/lib/sgdk/include/joy.h +482 -0
- package/src/platforms/genesis/lib/sgdk/include/kdebug.h +21 -0
- package/src/platforms/genesis/lib/sgdk/include/map.h +409 -0
- package/src/platforms/genesis/lib/sgdk/include/mapper.h +186 -0
- package/src/platforms/genesis/lib/sgdk/include/maths.h +1071 -0
- package/src/platforms/genesis/lib/sgdk/include/maths3D.h +480 -0
- package/src/platforms/genesis/lib/sgdk/include/memory.h +346 -0
- package/src/platforms/genesis/lib/sgdk/include/memory_base.h +37 -0
- package/src/platforms/genesis/lib/sgdk/include/object.h +171 -0
- package/src/platforms/genesis/lib/sgdk/include/pal.h +500 -0
- package/src/platforms/genesis/lib/sgdk/include/pool.h +171 -0
- package/src/platforms/genesis/lib/sgdk/include/psg.h +153 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/pcm/snd_dpcm2.h +79 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/pcm/snd_pcm.h +98 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/pcm/snd_pcm4.h +125 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/pcm/tab_vol.h +6 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/smp_null.h +6 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/smp_null_dpcm.h +6 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/sound.h +70 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/xgm.h +399 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/xgm2.h +389 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/z80_def.i80 +41 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/z80_fct.i80 +83 -0
- package/src/platforms/genesis/lib/sgdk/include/snd/z80_mac.i80 +1476 -0
- package/src/platforms/genesis/lib/sgdk/include/sprite_eng.h +1095 -0
- package/src/platforms/genesis/lib/sgdk/include/sprite_eng_legacy.h +1030 -0
- package/src/platforms/genesis/lib/sgdk/include/sram.h +110 -0
- package/src/platforms/genesis/lib/sgdk/include/string.h +349 -0
- package/src/platforms/genesis/lib/sgdk/include/sys.h +511 -0
- package/src/platforms/genesis/lib/sgdk/include/tab_cnv.h +19 -0
- package/src/platforms/genesis/lib/sgdk/include/task.h +77 -0
- package/src/platforms/genesis/lib/sgdk/include/task_cst.h +33 -0
- package/src/platforms/genesis/lib/sgdk/include/timer.h +132 -0
- package/src/platforms/genesis/lib/sgdk/include/tools.h +450 -0
- package/src/platforms/genesis/lib/sgdk/include/types.h +320 -0
- package/src/platforms/genesis/lib/sgdk/include/vdp.h +1150 -0
- package/src/platforms/genesis/lib/sgdk/include/vdp_bg.h +723 -0
- package/src/platforms/genesis/lib/sgdk/include/vdp_pal.h +101 -0
- package/src/platforms/genesis/lib/sgdk/include/vdp_spr.h +448 -0
- package/src/platforms/genesis/lib/sgdk/include/vdp_tile.h +1136 -0
- package/src/platforms/genesis/lib/sgdk/include/vram.h +270 -0
- package/src/platforms/genesis/lib/sgdk/include/ym2612.h +87 -0
- package/src/platforms/genesis/lib/sgdk/include/z80_ctrl.h +420 -0
- package/src/platforms/genesis/lib/sgdk/libmd.seed.a +0 -0
- package/src/platforms/genesis/lib/sgdk/libmd.seed.hash +1 -0
- package/src/platforms/genesis/lib/sgdk/md.ld +120 -0
- package/src/platforms/genesis/lib/sgdk/music/demo.vgm +0 -0
- package/src/platforms/genesis/lib/sgdk/music/demo.xgc +0 -0
- package/src/platforms/genesis/lib/sgdk/music/demo.xgm +0 -0
- package/src/platforms/genesis/lib/sgdk/res/image/font_default.png +0 -0
- package/src/platforms/genesis/lib/sgdk/res/image/sgdk_logo.png +0 -0
- package/src/platforms/genesis/lib/sgdk/res/libres.h +10 -0
- package/src/platforms/genesis/lib/sgdk/res/libres.res +5 -0
- package/src/platforms/genesis/lib/sgdk/res/libres.s +166 -0
- package/src/platforms/genesis/lib/sgdk/res/sound/stop_xgm.bin +0 -0
- package/src/platforms/genesis/lib/sgdk/rom_header.c +33 -0
- package/src/platforms/genesis/lib/sgdk/sega.preprocessed.s +364 -0
- package/src/platforms/genesis/lib/sgdk/sega.s +365 -0
- package/src/platforms/genesis/lib/sgdk/src/bmp.c +1539 -0
- package/src/platforms/genesis/lib/sgdk/src/bmp_a.s +3477 -0
- package/src/platforms/genesis/lib/sgdk/src/boot/rom_header.c +33 -0
- package/src/platforms/genesis/lib/sgdk/src/boot/sega.s +365 -0
- package/src/platforms/genesis/lib/sgdk/src/dma.c +782 -0
- package/src/platforms/genesis/lib/sgdk/src/dma_a.s +23 -0
- package/src/platforms/genesis/lib/sgdk/src/error_a.s +376 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/console.c +490 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/everdrive.c +285 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/fat16.c +610 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/flash-save/README.md +112 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/flash-save/flash.c +300 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/flash-save/saveman.c +641 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/link_cable.c +1758 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/CHANGELOG.md +31 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/LICENSE.txt +17 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/README.md +18 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/data.z80 +148 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/define.z80 +173 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/doc/api-c.md +80 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/doc/format.md +132 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/doc/teradrive.md +33 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/fm.z80 +363 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/main.z80 +433 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/minimus.c +129 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/minimus_drv.s80 +17 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/psg.z80 +231 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/track.z80 +398 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/minimusic/util.z80 +98 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/16c550.c +84 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/README.md +849 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/comm.c +141 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/gamejolt.c +758 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/json.c +153 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/lsd.c +364 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/megawifi.c +1501 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/ssf_ed_pro.c +98 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/mw/ssf_ed_x7.c +67 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/serial/buffer.c +69 -0
- package/src/platforms/genesis/lib/sgdk/src/ext/serial/serial.c +158 -0
- package/src/platforms/genesis/lib/sgdk/src/joy.c +1361 -0
- package/src/platforms/genesis/lib/sgdk/src/kdebug.s +109 -0
- package/src/platforms/genesis/lib/sgdk/src/map.c +1915 -0
- package/src/platforms/genesis/lib/sgdk/src/mapper.c +280 -0
- package/src/platforms/genesis/lib/sgdk/src/maths.c +878 -0
- package/src/platforms/genesis/lib/sgdk/src/maths3D.c +480 -0
- package/src/platforms/genesis/lib/sgdk/src/maths3D_a.s +205 -0
- package/src/platforms/genesis/lib/sgdk/src/memory.c +760 -0
- package/src/platforms/genesis/lib/sgdk/src/memory_a.s +306 -0
- package/src/platforms/genesis/lib/sgdk/src/object.c +111 -0
- package/src/platforms/genesis/lib/sgdk/src/pal.c +484 -0
- package/src/platforms/genesis/lib/sgdk/src/pool.c +234 -0
- package/src/platforms/genesis/lib/sgdk/src/psg.c +82 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/drv_null.s80 +27 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/drv_xgm.s80 +3037 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/pcm/drv_dpcm2.s80 +984 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/pcm/drv_pcm.s80 +592 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/pcm/drv_pcm4.s80 +699 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/pcm/snd_dpcm2.c +172 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/pcm/snd_pcm.c +152 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/pcm/snd_pcm4.c +213 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/pcm/tab_vol.c +277 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/smp_null.s +22 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/smp_null_dpcm.s +15 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/sound.c +33 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm.c +683 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2.s80 +993 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2_fct.i80 +611 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2_mac.i80 +133 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2_pcm_fct.i80 +114 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2_pcm_mac.i80 +1444 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2_psg_fct.i80 +491 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2_psg_mac.i80 +43 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2_ym_fct.i80 +1664 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2/drv_xgm2_ym_mac.i80 +295 -0
- package/src/platforms/genesis/lib/sgdk/src/snd/xgm2.c +1083 -0
- package/src/platforms/genesis/lib/sgdk/src/sprite_eng.c +2256 -0
- package/src/platforms/genesis/lib/sgdk/src/sprite_eng_legacy.c +2309 -0
- package/src/platforms/genesis/lib/sgdk/src/sram.c +30 -0
- package/src/platforms/genesis/lib/sgdk/src/sram_a.s +41 -0
- package/src/platforms/genesis/lib/sgdk/src/string.c +720 -0
- package/src/platforms/genesis/lib/sgdk/src/sys.c +1053 -0
- package/src/platforms/genesis/lib/sgdk/src/sys_a.s +74 -0
- package/src/platforms/genesis/lib/sgdk/src/tab_cnv.c +129 -0
- package/src/platforms/genesis/lib/sgdk/src/tab_log10.c +8201 -0
- package/src/platforms/genesis/lib/sgdk/src/tab_log2.c +8201 -0
- package/src/platforms/genesis/lib/sgdk/src/tab_sin.c +2058 -0
- package/src/platforms/genesis/lib/sgdk/src/tab_sqrt.c +8201 -0
- package/src/platforms/genesis/lib/sgdk/src/task.s +148 -0
- package/src/platforms/genesis/lib/sgdk/src/timer.c +201 -0
- package/src/platforms/genesis/lib/sgdk/src/tools.c +1299 -0
- package/src/platforms/genesis/lib/sgdk/src/tools_a.s +979 -0
- package/src/platforms/genesis/lib/sgdk/src/types.c +18 -0
- package/src/platforms/genesis/lib/sgdk/src/vdp.c +1060 -0
- package/src/platforms/genesis/lib/sgdk/src/vdp_bg.c +511 -0
- package/src/platforms/genesis/lib/sgdk/src/vdp_spr.c +322 -0
- package/src/platforms/genesis/lib/sgdk/src/vdp_tile.c +1011 -0
- package/src/platforms/genesis/lib/sgdk/src/vdp_tile_a.s +68 -0
- package/src/platforms/genesis/lib/sgdk/src/vram.c +273 -0
- package/src/platforms/genesis/lib/sgdk/src/ym2612.c +175 -0
- package/src/platforms/genesis/lib/sgdk/src/z80_ctrl.c +334 -0
- package/src/platforms/genesis/lib/sprite_table.s +129 -0
- package/src/platforms/genesis/lib/vblank_wait.s +73 -0
- package/src/platforms/genesis/lib/vdp_init.s +85 -0
- package/src/platforms/genesis/lib/wram.s +88 -0
- package/src/platforms/genesis/lib/z80_bootstrap.s +102 -0
- package/src/platforms/genesis/vdp.js +495 -0
- package/src/platforms/gg/MENTAL_MODEL.md +155 -0
- package/src/platforms/gg/TROUBLESHOOTING.md +91 -0
- package/src/platforms/gg/UPSTREAM_SOURCES.md +36 -0
- package/src/platforms/gg/lib/c/gg_crt0.s +112 -0
- package/src/platforms/gg/lib/c/gg_hw.h +62 -0
- package/src/platforms/gg/lib/c/gg_music.c +155 -0
- package/src/platforms/gg/lib/c/gg_music.h +89 -0
- package/src/platforms/gg/lib/c/gg_sfx.c +82 -0
- package/src/platforms/gg/lib/c/gg_sfx.h +40 -0
- package/src/platforms/gg/lib/c/joypad_read.c +22 -0
- package/src/platforms/gg/lib/c/load_palette.c +20 -0
- package/src/platforms/gg/lib/c/load_tiles.c +32 -0
- package/src/platforms/gg/lib/c/sprite_table.c +60 -0
- package/src/platforms/gg/lib/c/vblank_wait.c +10 -0
- package/src/platforms/gg/lib/c/vdp_init.c +58 -0
- package/src/platforms/index.js +7 -0
- package/src/platforms/lynx/MENTAL_MODEL.md +231 -0
- package/src/platforms/lynx/TROUBLESHOOTING.md +105 -0
- package/src/platforms/lynx/UPSTREAM_SOURCES.md +66 -0
- package/src/platforms/lynx/lib/c/lynx_music.c +63 -0
- package/src/platforms/lynx/lib/c/lynx_music.h +16 -0
- package/src/platforms/lynx/lib/c/lynx_sfx.c +147 -0
- package/src/platforms/lynx/lib/c/lynx_sfx.h +59 -0
- package/src/platforms/lynx/lib/cc65-src/bllhdr.s +18 -0
- package/src/platforms/lynx/lib/cc65-src/bootldr.s +195 -0
- package/src/platforms/lynx/lib/cc65-src/cgetc.s +69 -0
- package/src/platforms/lynx/lib/cc65-src/clock.s +87 -0
- package/src/platforms/lynx/lib/cc65-src/crt0.s +135 -0
- package/src/platforms/lynx/lib/cc65-src/defdir.s +29 -0
- package/src/platforms/lynx/lib/cc65-src/eeprom.s +255 -0
- package/src/platforms/lynx/lib/cc65-src/eeprom46.s +204 -0
- package/src/platforms/lynx/lib/cc65-src/eeprom66.s +227 -0
- package/src/platforms/lynx/lib/cc65-src/eeprom86.s +236 -0
- package/src/platforms/lynx/lib/cc65-src/exec.s +34 -0
- package/src/platforms/lynx/lib/cc65-src/exehdr.s +27 -0
- package/src/platforms/lynx/lib/cc65-src/extzp.inc +23 -0
- package/src/platforms/lynx/lib/cc65-src/extzp.s +30 -0
- package/src/platforms/lynx/lib/cc65-src/irq.s +45 -0
- package/src/platforms/lynx/lib/cc65-src/joy/lynx-stdjoy.s +93 -0
- package/src/platforms/lynx/lib/cc65-src/joy_stat_stddrv.s +14 -0
- package/src/platforms/lynx/lib/cc65-src/kbhit.s +56 -0
- package/src/platforms/lynx/lib/cc65-src/libref.s +9 -0
- package/src/platforms/lynx/lib/cc65-src/load.s +41 -0
- package/src/platforms/lynx/lib/cc65-src/lseek.s +58 -0
- package/src/platforms/lynx/lib/cc65-src/lynx-cart.s +98 -0
- package/src/platforms/lynx/lib/cc65-src/lynx-snd.s +1270 -0
- package/src/platforms/lynx/lib/cc65-src/mainargs.s +24 -0
- package/src/platforms/lynx/lib/cc65-src/open.s +136 -0
- package/src/platforms/lynx/lib/cc65-src/oserror.s +14 -0
- package/src/platforms/lynx/lib/cc65-src/read.s +44 -0
- package/src/platforms/lynx/lib/cc65-src/ser/lynx-comlynx.s +404 -0
- package/src/platforms/lynx/lib/cc65-src/ser_stat_stddrv.s +14 -0
- package/src/platforms/lynx/lib/cc65-src/sysuname.s +39 -0
- package/src/platforms/lynx/lib/cc65-src/tgi/lynx-160-102-16.s +1075 -0
- package/src/platforms/lynx/lib/cc65-src/tgi_colors.s +9 -0
- package/src/platforms/lynx/lib/cc65-src/tgi_irq.s +11 -0
- package/src/platforms/lynx/lib/cc65-src/tgi_stat_stddrv.s +14 -0
- package/src/platforms/lynx/lib/cc65-src/tgi_stddrv.s +13 -0
- package/src/platforms/lynx/lib/cc65-src/uploader.s +81 -0
- package/src/platforms/nes/MENTAL_MODEL.md +301 -0
- package/src/platforms/nes/TROUBLESHOOTING.md +321 -0
- package/src/platforms/nes/UPSTREAM_SOURCES.md +31 -0
- package/src/platforms/nes/image-to-chr.js +195 -0
- package/src/platforms/nes/image-to-tilemap.js +415 -0
- package/src/platforms/nes/lib/README.md +40 -0
- package/src/platforms/nes/lib/asm/LICENSE-FAMITONE +40 -0
- package/src/platforms/nes/lib/asm/chr_ram_header.s +32 -0
- package/src/platforms/nes/lib/asm/famitone2.s +1258 -0
- package/src/platforms/nes/lib/asm/famitone_bridge.s +50 -0
- package/src/platforms/nes/lib/asm/music_data.s +238 -0
- package/src/platforms/nes/lib/c/chr_ram_runtime_hello_sprite.c +81 -0
- package/src/platforms/nes/lib/c/chr_ram_runtime_hud_row.c +101 -0
- package/src/platforms/nes/lib/c/nes_runtime.c +347 -0
- package/src/platforms/nes/lib/c/nes_runtime.h +153 -0
- package/src/platforms/nes/lib/c/nmi_handler.c +51 -0
- package/src/platforms/nes/lib/c/nmi_trampoline.s +25 -0
- package/src/platforms/nes/lib/cc65-src/Makefile.inc +9 -0
- package/src/platforms/nes/lib/cc65-src/_scrsize.s +24 -0
- package/src/platforms/nes/lib/cc65-src/cclear.s +29 -0
- package/src/platforms/nes/lib/cc65-src/chline.s +31 -0
- package/src/platforms/nes/lib/cc65-src/clock.s +31 -0
- package/src/platforms/nes/lib/cc65-src/clrscr.s +72 -0
- package/src/platforms/nes/lib/cc65-src/color.s +68 -0
- package/src/platforms/nes/lib/cc65-src/cpeekc.s +37 -0
- package/src/platforms/nes/lib/cc65-src/cpeekcolor.s +8 -0
- package/src/platforms/nes/lib/cc65-src/cpeekrevers.s +37 -0
- package/src/platforms/nes/lib/cc65-src/cputc.s +95 -0
- package/src/platforms/nes/lib/cc65-src/crt0.s +180 -0
- package/src/platforms/nes/lib/cc65-src/cvline.s +31 -0
- package/src/platforms/nes/lib/cc65-src/get_tv.s +37 -0
- package/src/platforms/nes/lib/cc65-src/gotox.s +21 -0
- package/src/platforms/nes/lib/cc65-src/gotoxy.s +22 -0
- package/src/platforms/nes/lib/cc65-src/gotoy.s +22 -0
- package/src/platforms/nes/lib/cc65-src/irq.s +19 -0
- package/src/platforms/nes/lib/cc65-src/joy/nes-stdjoy.s +102 -0
- package/src/platforms/nes/lib/cc65-src/joy_stat_stddrv.s +14 -0
- package/src/platforms/nes/lib/cc65-src/libref.s +9 -0
- package/src/platforms/nes/lib/cc65-src/mainargs.s +24 -0
- package/src/platforms/nes/lib/cc65-src/neschar.s +4616 -0
- package/src/platforms/nes/lib/cc65-src/ppu.s +158 -0
- package/src/platforms/nes/lib/cc65-src/ppubuf.s +117 -0
- package/src/platforms/nes/lib/cc65-src/randomize.s +18 -0
- package/src/platforms/nes/lib/cc65-src/revers.s +27 -0
- package/src/platforms/nes/lib/cc65-src/setcursor.s +37 -0
- package/src/platforms/nes/lib/cc65-src/sysuname.s +39 -0
- package/src/platforms/nes/lib/cc65-src/tgi/nes-64-56-2.s +480 -0
- package/src/platforms/nes/lib/cc65-src/tgi_stat_stddrv.s +14 -0
- package/src/platforms/nes/lib/cc65-src/tgi_stddrv.s +13 -0
- package/src/platforms/nes/lib/cc65-src/waitvsync.s +18 -0
- package/src/platforms/nes/lib/cc65-src/wherex.s +19 -0
- package/src/platforms/nes/lib/cc65-src/wherey.s +19 -0
- package/src/platforms/nes/lib/clear_nametable.s +38 -0
- package/src/platforms/nes/lib/clear_oam.s +18 -0
- package/src/platforms/nes/lib/load_palette.s +31 -0
- package/src/platforms/nes/lib/nmi_safe.s +65 -0
- package/src/platforms/nes/lib/oam_dma.s +16 -0
- package/src/platforms/nes/lib/read_pad.s +46 -0
- package/src/platforms/nes/lib/reset.s +46 -0
- package/src/platforms/nes/lib/sprite_table_populate.s +75 -0
- package/src/platforms/nes/lib/wait_vblank.s +12 -0
- package/src/platforms/nes/palette.js +39 -0
- package/src/platforms/nes/ppu.js +372 -0
- package/src/platforms/sms/MENTAL_MODEL.md +267 -0
- package/src/platforms/sms/TROUBLESHOOTING.md +124 -0
- package/src/platforms/sms/UPSTREAM_SOURCES.md +29 -0
- package/src/platforms/sms/image-to-tilemap.js +260 -0
- package/src/platforms/sms/lib/README.md +117 -0
- package/src/platforms/sms/lib/c/joypad_read.c +33 -0
- package/src/platforms/sms/lib/c/load_palette.c +24 -0
- package/src/platforms/sms/lib/c/load_tiles.c +32 -0
- package/src/platforms/sms/lib/c/sms_crt0.s +101 -0
- package/src/platforms/sms/lib/c/sms_hw.h +53 -0
- package/src/platforms/sms/lib/c/sms_music.c +178 -0
- package/src/platforms/sms/lib/c/sms_music.h +50 -0
- package/src/platforms/sms/lib/c/sms_sfx.c +82 -0
- package/src/platforms/sms/lib/c/sms_sfx.h +40 -0
- package/src/platforms/sms/lib/c/sprite_table.c +60 -0
- package/src/platforms/sms/lib/c/vblank_wait.c +10 -0
- package/src/platforms/sms/lib/c/vdp_init.c +58 -0
- package/src/platforms/sms/lib/header.s +33 -0
- package/src/platforms/sms/lib/joypad_read.s +40 -0
- package/src/platforms/sms/lib/load_palette.s +30 -0
- package/src/platforms/sms/lib/load_tiles.s +50 -0
- package/src/platforms/sms/lib/sprite_table.s +44 -0
- package/src/platforms/sms/lib/vblank_wait.s +36 -0
- package/src/platforms/sms/lib/vdp_init.s +47 -0
- package/src/platforms/sms/vdp.js +530 -0
- package/src/platforms/snes/MENTAL_MODEL.md +275 -0
- package/src/platforms/snes/TROUBLESHOOTING.md +208 -0
- package/src/platforms/snes/UPSTREAM_SOURCES.md +50 -0
- package/src/platforms/snes/brr.js +208 -0
- package/src/platforms/snes/image-to-tilemap.js +227 -0
- package/src/platforms/snes/lib/audio/apu_blob.asm +228 -0
- package/src/platforms/snes/lib/audio/apu_blob.bin +0 -0
- package/src/platforms/snes/lib/audio/explosion.brr +0 -0
- package/src/platforms/snes/lib/audio/sample_bank.bin +0 -0
- package/src/platforms/snes/lib/audio/shoot.brr +0 -0
- package/src/platforms/snes/lib/audio/spc_driver.asm +241 -0
- package/src/platforms/snes/lib/audio_pipeline.asm +62 -0
- package/src/platforms/snes/lib/c/crt0.asm +125 -0
- package/src/platforms/snes/lib/c/hdr.asm +50 -0
- package/src/platforms/snes/lib/c/snes_sfx.c +116 -0
- package/src/platforms/snes/lib/c/snes_sfx.h +96 -0
- package/src/platforms/snes/lib/c/snes_sfx_data.asm +25 -0
- package/src/platforms/snes/lib/cgram_upload.asm +43 -0
- package/src/platforms/snes/lib/lorom_header.asm +47 -0
- package/src/platforms/snes/lib/lorom_multibank.asm +66 -0
- package/src/platforms/snes/lib/nmi_safe.asm +77 -0
- package/src/platforms/snes/lib/oam_upload.asm +45 -0
- package/src/platforms/snes/lib/pad_read.asm +64 -0
- package/src/platforms/snes/lib/pvsneslib/LICENSE +21 -0
- package/src/platforms/snes/lib/pvsneslib/include/ctype.h +6 -0
- package/src/platforms/snes/lib/pvsneslib/include/float.h +4 -0
- package/src/platforms/snes/lib/pvsneslib/include/hdr.asm +47 -0
- package/src/platforms/snes/lib/pvsneslib/include/limits.h +13 -0
- package/src/platforms/snes/lib/pvsneslib/include/math.h +10 -0
- package/src/platforms/snes/lib/pvsneslib/include/setjmp.h +4 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/background.h +396 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/console.h +188 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/dma.h +381 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/input.h +289 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/interrupt.h +264 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/libversion.h +10 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/lzss.h +43 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/map.h +113 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/object.h +234 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/pixel.h +53 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/scores.h +66 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/snestypes.h +65 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/sound.h +245 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/sprite.h +456 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes/video.h +465 -0
- package/src/platforms/snes/lib/pvsneslib/include/snes.h +190 -0
- package/src/platforms/snes/lib/pvsneslib/include/stdarg.h +28 -0
- package/src/platforms/snes/lib/pvsneslib/include/stdbool.h +53 -0
- package/src/platforms/snes/lib/pvsneslib/include/stddef.h +27 -0
- package/src/platforms/snes/lib/pvsneslib/include/stdint.h +7 -0
- package/src/platforms/snes/lib/pvsneslib/include/stdio.h +9 -0
- package/src/platforms/snes/lib/pvsneslib/include/stdlib.h +13 -0
- package/src/platforms/snes/lib/pvsneslib/include/string.h +19 -0
- package/src/platforms/snes/lib/pvsneslib/include/strings.h +5 -0
- package/src/platforms/snes/lib/pvsneslib/source/Makefile +87 -0
- package/src/platforms/snes/lib/pvsneslib/source/backgrounds.asm +834 -0
- package/src/platforms/snes/lib/pvsneslib/source/consoles.asm +1028 -0
- package/src/platforms/snes/lib/pvsneslib/source/crt0_snes.asm +329 -0
- package/src/platforms/snes/lib/pvsneslib/source/dmas.asm +1275 -0
- package/src/platforms/snes/lib/pvsneslib/source/hdr.asm +56 -0
- package/src/platforms/snes/lib/pvsneslib/source/input.asm +445 -0
- package/src/platforms/snes/lib/pvsneslib/source/libc.asm +485 -0
- package/src/platforms/snes/lib/pvsneslib/source/libc_c.c +1214 -0
- package/src/platforms/snes/lib/pvsneslib/source/libm.asm +510 -0
- package/src/platforms/snes/lib/pvsneslib/source/libtcc.asm +374 -0
- package/src/platforms/snes/lib/pvsneslib/source/lzsss.asm +256 -0
- package/src/platforms/snes/lib/pvsneslib/source/maps.asm +1078 -0
- package/src/platforms/snes/lib/pvsneslib/source/objects.asm +2881 -0
- package/src/platforms/snes/lib/pvsneslib/source/scores.asm +226 -0
- package/src/platforms/snes/lib/pvsneslib/source/sm_spc.asm +187 -0
- package/src/platforms/snes/lib/pvsneslib/source/snesmodwla.asm +1186 -0
- package/src/platforms/snes/lib/pvsneslib/source/sounds.asm +273 -0
- package/src/platforms/snes/lib/pvsneslib/source/sprites.asm +3946 -0
- package/src/platforms/snes/lib/pvsneslib/source/vblank.asm +917 -0
- package/src/platforms/snes/lib/pvsneslib/source/videos.asm +1137 -0
- package/src/platforms/snes/lib/reset_init.asm +31 -0
- package/src/platforms/snes/lib/sprite_table_populate.asm +122 -0
- package/src/platforms/snes/lib/vram_dma_upload.asm +42 -0
- package/src/platforms/snes/ppu.js +606 -0
- package/src/playtest/playtest.js +612 -0
- package/src/rom-id/identifier.js +421 -0
- package/src/rom-id/patch.js +217 -0
- package/src/toolchains/_worker/pool.js +253 -0
- package/src/toolchains/_worker/run.js +78 -0
- package/src/toolchains/_worker/wasm-worker.js +233 -0
- package/src/toolchains/arm-none-eabi-gcc/gcc.js +208 -0
- package/src/toolchains/asar/asar.js +542 -0
- package/src/toolchains/assemble-snippet.js +256 -0
- package/src/toolchains/cc65/cc65.js +395 -0
- package/src/toolchains/cc65/da65.js +119 -0
- package/src/toolchains/cc65/dbgparse.js +274 -0
- package/src/toolchains/cc65/preset-resolver.js +59 -0
- package/src/toolchains/cc65/presets/nes/chr-ram-runtime.cfg +79 -0
- package/src/toolchains/cc65/presets/nes/chr-ram-runtime.crt0.s +178 -0
- package/src/toolchains/cc65/presets/nes/chr-ram.cfg +76 -0
- package/src/toolchains/cc65/presets/nes/chr-ram.crt0.s +106 -0
- package/src/toolchains/common/ar.js +121 -0
- package/src/toolchains/common/sdk-cache.js +116 -0
- package/src/toolchains/common/symbols.js +139 -0
- package/src/toolchains/dasm/dasm.js +96 -0
- package/src/toolchains/gba-c/gba-c.js +832 -0
- package/src/toolchains/genesis-c/README.md +61 -0
- package/src/toolchains/genesis-c/genesis-c.js +598 -0
- package/src/toolchains/index.js +727 -0
- package/src/toolchains/m68k-elf-gcc/gcc.js +220 -0
- package/src/toolchains/m68kdasm.js +438 -0
- package/src/toolchains/parse-errors.js +258 -0
- package/src/toolchains/registry.js +67 -0
- package/src/toolchains/rgbds/rgbds.js +144 -0
- package/src/toolchains/sdcc/preflight-lint.js +295 -0
- package/src/toolchains/sdcc/sdcc.js +519 -0
- package/src/toolchains/sjasm/sjasm.js +85 -0
- package/src/toolchains/sm83dasm.js +194 -0
- package/src/toolchains/snes-c/snes-c.js +409 -0
- package/src/toolchains/tcc816/tcc816.js +79 -0
- package/src/toolchains/vasm68k/vasm68k.js +138 -0
- package/src/toolchains/wladx/wladx.js +120 -0
- package/src/toolchains/z80dasm.js +303 -0
|
@@ -0,0 +1,3946 @@
|
|
|
1
|
+
;---------------------------------------------------------------------------------
|
|
2
|
+
;
|
|
3
|
+
; Copyright (C) 2012-2025
|
|
4
|
+
; Alekmaul
|
|
5
|
+
;
|
|
6
|
+
; This software is provided 'as-is', without any express or implied
|
|
7
|
+
; warranty. In no event will the authors be held liable for any
|
|
8
|
+
; damages arising from the use of this software.
|
|
9
|
+
;
|
|
10
|
+
; Permission is granted to anyone to use this software for any
|
|
11
|
+
; purpose, including commercial applications, and to alter it and
|
|
12
|
+
; redistribute it freely, subject to the following restrictions:
|
|
13
|
+
;
|
|
14
|
+
; 1. The origin of this software must not be misrepresented; you
|
|
15
|
+
; must not claim that you wrote the original software. If you use
|
|
16
|
+
; this software in a product, an acknowledgment in the product
|
|
17
|
+
; documentation would be appreciated but is not required.
|
|
18
|
+
; 2. Altered source versions must be plainly marked as such, and
|
|
19
|
+
; must not be misrepresented as being the original software.
|
|
20
|
+
; 3. This notice may not be removed or altered from any source
|
|
21
|
+
; distribution.
|
|
22
|
+
;
|
|
23
|
+
;---------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
.EQU REG_OBSEL $2101
|
|
26
|
+
|
|
27
|
+
;.DEFINE GFXSPR0ADR $0000 ; sprite graphics entry #0 & #1 (not used, for information purpose)
|
|
28
|
+
;.DEFINE GFXSPR1ADR $1000 ;
|
|
29
|
+
|
|
30
|
+
.EQU OBJ_SPRITE32 1 ; sprite with 32x32 identifier
|
|
31
|
+
.EQU OBJ_SPRITE16 2 ; sprite with 16x16 identifier
|
|
32
|
+
.EQU OBJ_SPRITE8 4 ; sprite with 8x8 identifier
|
|
33
|
+
|
|
34
|
+
.EQU OBJ_SIZE16_L32 $60 ; (3<<5) default OAM size 16x16 (SM) and 32x32 (LG) pix for OBJSEL register (used for 16x16 sprite gfx entry)
|
|
35
|
+
|
|
36
|
+
.EQU OBJ_QUEUELIST_SIZE 128 ; 128 sprites of 8x8, 16x16 & 32x32 max in queue to update sprite graphics
|
|
37
|
+
.EQU MAXSPRTRF 7*6 ; 7 sprites max transferred each time to VRAM
|
|
38
|
+
|
|
39
|
+
.STRUCT t_oam
|
|
40
|
+
oamx DW ; 0 x position on the screen
|
|
41
|
+
oamy DW ; 2 y position on the screen
|
|
42
|
+
oamframeid DW ; 4 frame index in graphic file of the sprite
|
|
43
|
+
oamattribute DB ; 6 sprite attribute value (vhoopppc v : vertical flip h: horizontal flip o: priority bits p: palette num c : last byte of tile num)
|
|
44
|
+
oamrefresh DB ; 7 =1 if we need to load graphics from graphic file
|
|
45
|
+
oamgraphics DSB 4 ; 8..11 pointer to graphic file
|
|
46
|
+
dummy DSB 4 ; 12..15 to by align to 16 bytes
|
|
47
|
+
.ENDST
|
|
48
|
+
|
|
49
|
+
.BASE $00
|
|
50
|
+
.RAMSECTION ".reg_oams7e" BANK $7E SLOT RAMSLOT_0
|
|
51
|
+
|
|
52
|
+
sprit_val0 DB ; save value #0
|
|
53
|
+
sprit_val1 DB ; save value #1
|
|
54
|
+
sprit_val2 DW ; save value #2
|
|
55
|
+
sprit_mxsvg DW ; save value meta #1
|
|
56
|
+
sprit_mysvg DW ; save value meta #2
|
|
57
|
+
|
|
58
|
+
oamMemory DSB 128*4+8*4
|
|
59
|
+
|
|
60
|
+
oambuffer INSTANCEOF t_oam 128 ; oam struct in memory (128 sprites max for SNES)
|
|
61
|
+
|
|
62
|
+
oamQueueEntry DSB OBJ_QUEUELIST_SIZE*6 ; each entry : graphic pointer (0..2), vram address (3..4), sprite size (5)
|
|
63
|
+
|
|
64
|
+
oamqueuenumber DW
|
|
65
|
+
|
|
66
|
+
oamnumberperframe DW ; number of sprite added during current frame (current, old)
|
|
67
|
+
oamnumberperframeold DW
|
|
68
|
+
|
|
69
|
+
oamnumberspr0 DW ; number entry of sprite (and initial value) for 32x32,16x16 and 8x8 sprites
|
|
70
|
+
oamnumberspr0Init DW ; number is a multiple of 4
|
|
71
|
+
oamnumberspr1 DW
|
|
72
|
+
oamnumberspr1Init DW
|
|
73
|
+
|
|
74
|
+
spr16addrgfx DW ; graphic address for 16x16 sprites (default is $1000)
|
|
75
|
+
|
|
76
|
+
spr0addrgfx DW ; graphic address for large sprites (default is $0000)
|
|
77
|
+
spr1addrgfx DW ; graphic address for small sprites (default is $1000)
|
|
78
|
+
|
|
79
|
+
sprbyte4 DB
|
|
80
|
+
|
|
81
|
+
.ENDS
|
|
82
|
+
|
|
83
|
+
.BASE BASE_0
|
|
84
|
+
.SECTION ".sprites0_text" SUPERFREE
|
|
85
|
+
|
|
86
|
+
.ACCU 16
|
|
87
|
+
.INDEX 16
|
|
88
|
+
.16bit
|
|
89
|
+
|
|
90
|
+
;---------------------------------------------------------------------------
|
|
91
|
+
; void oamUpdate(void)
|
|
92
|
+
oamUpdate:
|
|
93
|
+
php
|
|
94
|
+
rep #$20 ; A 16 bits
|
|
95
|
+
|
|
96
|
+
lda.w #$0000
|
|
97
|
+
sta.l $2102 ; OAM address
|
|
98
|
+
|
|
99
|
+
lda.w #$0400
|
|
100
|
+
sta.l $4300 ; DMA type CPU -> PPU, auto inc, $2104 (OAM write)
|
|
101
|
+
|
|
102
|
+
lda.w #$0220
|
|
103
|
+
sta.l $4305 ; DMA size (220 = 128*4+32
|
|
104
|
+
|
|
105
|
+
lda.w #oamMemory
|
|
106
|
+
sta.l $4302 ; DMA address = oam memory
|
|
107
|
+
lda.w #:oamMemory
|
|
108
|
+
sep #$20
|
|
109
|
+
sta.l $4304 ; DMA address bank = oam memory
|
|
110
|
+
|
|
111
|
+
lda.b #$1 ; DMA channel 0 xxxx xxx1
|
|
112
|
+
sta.l $420b
|
|
113
|
+
|
|
114
|
+
plp
|
|
115
|
+
rtl
|
|
116
|
+
|
|
117
|
+
.ENDS
|
|
118
|
+
|
|
119
|
+
.SECTION ".sprites1_text" SUPERFREE
|
|
120
|
+
|
|
121
|
+
;---------------------------------------------------------------------------
|
|
122
|
+
; void oamFlip(u16 id, u8 xf, u8 yf);
|
|
123
|
+
oamFlip:
|
|
124
|
+
php
|
|
125
|
+
phb
|
|
126
|
+
phx
|
|
127
|
+
|
|
128
|
+
sep #$20
|
|
129
|
+
lda #$7e
|
|
130
|
+
pha
|
|
131
|
+
plb
|
|
132
|
+
|
|
133
|
+
rep #$30 ; A/X/Y 16 bits
|
|
134
|
+
lda 8,s ; get idoff (11)
|
|
135
|
+
tax
|
|
136
|
+
|
|
137
|
+
sep #$20 ; A 8 bits
|
|
138
|
+
lda #$3f ; xor mask for flip attribute
|
|
139
|
+
and.w oamMemory+3,x
|
|
140
|
+
sta.w oamMemory+3,x
|
|
141
|
+
|
|
142
|
+
lda 10,s ; get x flipping
|
|
143
|
+
beq + ; no x flipping
|
|
144
|
+
lda #$40 ; or mask for flip attribute
|
|
145
|
+
ora.w oamMemory+3,x
|
|
146
|
+
sta.w oamMemory+3,x
|
|
147
|
+
|
|
148
|
+
+
|
|
149
|
+
lda 11,s ; get y flipping
|
|
150
|
+
beq + ; no y flipping
|
|
151
|
+
lda #$80 ; or mask for flip attribute
|
|
152
|
+
ora.w oamMemory+3,x
|
|
153
|
+
sta.w oamMemory+3,x
|
|
154
|
+
|
|
155
|
+
+
|
|
156
|
+
plx
|
|
157
|
+
plb
|
|
158
|
+
plp
|
|
159
|
+
rtl
|
|
160
|
+
|
|
161
|
+
.ENDS
|
|
162
|
+
|
|
163
|
+
.SECTION "spritestable_text" KEEP
|
|
164
|
+
|
|
165
|
+
oammask:
|
|
166
|
+
.byte $01,$fe,$00,$00,$04,$fb,$00,$00,$10,$ef,$00,$00,$40,$bf,$00,$00
|
|
167
|
+
.byte $01,$fe,$01,$00,$04,$fb,$01,$00,$10,$ef,$01,$00,$40,$bf,$01,$00
|
|
168
|
+
.byte $01,$fe,$02,$00,$04,$fb,$02,$00,$10,$ef,$02,$00,$40,$bf,$02,$00
|
|
169
|
+
.byte $01,$fe,$03,$00,$04,$fb,$03,$00,$10,$ef,$03,$00,$40,$bf,$03,$00
|
|
170
|
+
.byte $01,$fe,$04,$00,$04,$fb,$04,$00,$10,$ef,$04,$00,$40,$bf,$04,$00
|
|
171
|
+
.byte $01,$fe,$05,$00,$04,$fb,$05,$00,$10,$ef,$05,$00,$40,$bf,$05,$00
|
|
172
|
+
.byte $01,$fe,$06,$00,$04,$fb,$06,$00,$10,$ef,$06,$00,$40,$bf,$06,$00
|
|
173
|
+
.byte $01,$fe,$07,$00,$04,$fb,$07,$00,$10,$ef,$07,$00,$40,$bf,$07,$00
|
|
174
|
+
.byte $01,$fe,$08,$00,$04,$fb,$08,$00,$10,$ef,$08,$00,$40,$bf,$08,$00
|
|
175
|
+
.byte $01,$fe,$09,$00,$04,$fb,$09,$00,$10,$ef,$09,$00,$40,$bf,$09,$00
|
|
176
|
+
.byte $01,$fe,$0a,$00,$04,$fb,$0a,$00,$10,$ef,$0a,$00,$40,$bf,$0a,$00
|
|
177
|
+
.byte $01,$fe,$0b,$00,$04,$fb,$0b,$00,$10,$ef,$0b,$00,$40,$bf,$0b,$00
|
|
178
|
+
.byte $01,$fe,$0c,$00,$04,$fb,$0c,$00,$10,$ef,$0c,$00,$40,$bf,$0c,$00
|
|
179
|
+
.byte $01,$fe,$0d,$00,$04,$fb,$0d,$00,$10,$ef,$0d,$00,$40,$bf,$0d,$00
|
|
180
|
+
.byte $01,$fe,$0e,$00,$04,$fb,$0e,$00,$10,$ef,$0e,$00,$40,$bf,$0e,$00
|
|
181
|
+
.byte $01,$fe,$0f,$00,$04,$fb,$0f,$00,$10,$ef,$0f,$00,$40,$bf,$0f,$00
|
|
182
|
+
.byte $01,$fe,$10,$00,$04,$fb,$10,$00,$10,$ef,$10,$00,$40,$bf,$10,$00
|
|
183
|
+
.byte $01,$fe,$11,$00,$04,$fb,$11,$00,$10,$ef,$11,$00,$40,$bf,$11,$00
|
|
184
|
+
.byte $01,$fe,$12,$00,$04,$fb,$12,$00,$10,$ef,$12,$00,$40,$bf,$12,$00
|
|
185
|
+
.byte $01,$fe,$13,$00,$04,$fb,$13,$00,$10,$ef,$13,$00,$40,$bf,$13,$00
|
|
186
|
+
.byte $01,$fe,$14,$00,$04,$fb,$14,$00,$10,$ef,$14,$00,$40,$bf,$14,$00
|
|
187
|
+
.byte $01,$fe,$15,$00,$04,$fb,$15,$00,$10,$ef,$15,$00,$40,$bf,$15,$00
|
|
188
|
+
.byte $01,$fe,$16,$00,$04,$fb,$16,$00,$10,$ef,$16,$00,$40,$bf,$16,$00
|
|
189
|
+
.byte $01,$fe,$17,$00,$04,$fb,$17,$00,$10,$ef,$17,$00,$40,$bf,$17,$00
|
|
190
|
+
.byte $01,$fe,$18,$00,$04,$fb,$18,$00,$10,$ef,$18,$00,$40,$bf,$18,$00
|
|
191
|
+
.byte $01,$fe,$19,$00,$04,$fb,$19,$00,$10,$ef,$19,$00,$40,$bf,$19,$00
|
|
192
|
+
.byte $01,$fe,$1a,$00,$04,$fb,$1a,$00,$10,$ef,$1a,$00,$40,$bf,$1a,$00
|
|
193
|
+
.byte $01,$fe,$1b,$00,$04,$fb,$1b,$00,$10,$ef,$1b,$00,$40,$bf,$1b,$00
|
|
194
|
+
.byte $01,$fe,$1c,$00,$04,$fb,$1c,$00,$10,$ef,$1c,$00,$40,$bf,$1c,$00
|
|
195
|
+
.byte $01,$fe,$1d,$00,$04,$fb,$1d,$00,$10,$ef,$1d,$00,$40,$bf,$1d,$00
|
|
196
|
+
.byte $01,$fe,$1e,$00,$04,$fb,$1e,$00,$10,$ef,$1e,$00,$40,$bf,$1e,$00
|
|
197
|
+
.byte $01,$fe,$1f,$00,$04,$fb,$1f,$00,$10,$ef,$1f,$00,$40,$bf,$1f,$00
|
|
198
|
+
.ENDS
|
|
199
|
+
|
|
200
|
+
.SECTION ".sprites2_text" SUPERFREE
|
|
201
|
+
|
|
202
|
+
;---------------------------------------------------------------------------
|
|
203
|
+
; void oamSetAttr(u16 id, u16 xspr, u16 yspr, u16 gfxoffset, u8 attr);
|
|
204
|
+
oamSetAttr:
|
|
205
|
+
php
|
|
206
|
+
phb
|
|
207
|
+
phx
|
|
208
|
+
phy
|
|
209
|
+
|
|
210
|
+
sep #$20
|
|
211
|
+
lda #$7e
|
|
212
|
+
pha
|
|
213
|
+
plb
|
|
214
|
+
|
|
215
|
+
rep #$30 ; A/X/Y 16 bits
|
|
216
|
+
|
|
217
|
+
lda 10,s ; get idoff (11)
|
|
218
|
+
tax
|
|
219
|
+
lda 12,s ; get x
|
|
220
|
+
xba
|
|
221
|
+
sep #$20 ; A 8 bits
|
|
222
|
+
ror a ; x msb into carry
|
|
223
|
+
|
|
224
|
+
lda 14,s ; get y
|
|
225
|
+
xba
|
|
226
|
+
rep #$20 ; A 16 bits
|
|
227
|
+
sta.w oamMemory+0,x
|
|
228
|
+
|
|
229
|
+
; sep #$20
|
|
230
|
+
lda 16,s ; get gfxOffset
|
|
231
|
+
sta.w oamMemory+2,x
|
|
232
|
+
|
|
233
|
+
lda.w #$0200 ; put $02 into MSB
|
|
234
|
+
sep #$20 ; A 8 bits
|
|
235
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
236
|
+
tay
|
|
237
|
+
|
|
238
|
+
bcs +
|
|
239
|
+
|
|
240
|
+
lda.l oammask+1,x
|
|
241
|
+
and.w oamMemory,y
|
|
242
|
+
sta.w oamMemory,y
|
|
243
|
+
lda 18,s ; get attr
|
|
244
|
+
ora.l oamMemory+3,x
|
|
245
|
+
sta.w oamMemory+3,x
|
|
246
|
+
|
|
247
|
+
ply
|
|
248
|
+
plx
|
|
249
|
+
plb
|
|
250
|
+
plp
|
|
251
|
+
rtl
|
|
252
|
+
+
|
|
253
|
+
lda.l oammask,x
|
|
254
|
+
ora.w oamMemory,y
|
|
255
|
+
sta.w oamMemory,y
|
|
256
|
+
lda 18,s ; get attr
|
|
257
|
+
ora.w oamMemory+3,x
|
|
258
|
+
sta.w oamMemory+3,x
|
|
259
|
+
|
|
260
|
+
ply
|
|
261
|
+
plx
|
|
262
|
+
plb
|
|
263
|
+
plp
|
|
264
|
+
rtl
|
|
265
|
+
|
|
266
|
+
;---------------------------------------------------------------------------
|
|
267
|
+
; void oamSetXY(u16 id, u16 xspr, u16 yspr);
|
|
268
|
+
oamSetXY:
|
|
269
|
+
php
|
|
270
|
+
phx
|
|
271
|
+
phy
|
|
272
|
+
|
|
273
|
+
rep #$30 ; A/X/Y 16 bits
|
|
274
|
+
|
|
275
|
+
lda 9,s ; get idoff
|
|
276
|
+
tax
|
|
277
|
+
lda 11,s ; get x
|
|
278
|
+
xba
|
|
279
|
+
sep #$20 ; A 8 bits
|
|
280
|
+
|
|
281
|
+
ror a ; x msb into carry
|
|
282
|
+
|
|
283
|
+
lda 13,s ; get y
|
|
284
|
+
xba
|
|
285
|
+
rep #$20 ; A 16 bits
|
|
286
|
+
sta.l oamMemory+0,x
|
|
287
|
+
|
|
288
|
+
lda.w #$0200 ; put $02 into MSB
|
|
289
|
+
sep #$20 ; A 8 bits
|
|
290
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
291
|
+
tay
|
|
292
|
+
|
|
293
|
+
bcs +
|
|
294
|
+
|
|
295
|
+
lda.l oammask+1,x
|
|
296
|
+
and.w oamMemory,y
|
|
297
|
+
sta.w oamMemory,y
|
|
298
|
+
|
|
299
|
+
ply
|
|
300
|
+
plx
|
|
301
|
+
plp
|
|
302
|
+
rtl
|
|
303
|
+
|
|
304
|
+
+ lda.l oammask,x
|
|
305
|
+
ora.w oamMemory,y
|
|
306
|
+
sta.w oamMemory,y
|
|
307
|
+
|
|
308
|
+
ply
|
|
309
|
+
plx
|
|
310
|
+
plp
|
|
311
|
+
rtl
|
|
312
|
+
|
|
313
|
+
;---------------------------------------------------------------------------
|
|
314
|
+
; void oamSet(u16 id, u16 xspr, u16 yspr, u8 priority, u8 hflip, u8 vflip, u16 gfxoffset, u8 paletteoffset);
|
|
315
|
+
; 9,11,13, 15,16,17, 18, 20,
|
|
316
|
+
oamSet:
|
|
317
|
+
php
|
|
318
|
+
phx
|
|
319
|
+
phy
|
|
320
|
+
|
|
321
|
+
rep #$30 ; A/X/Y 16 bits
|
|
322
|
+
|
|
323
|
+
lda 9,s ; get idoff
|
|
324
|
+
tax
|
|
325
|
+
lda 11,s ; get x
|
|
326
|
+
xba
|
|
327
|
+
sep #$20 ; A 8 bits
|
|
328
|
+
|
|
329
|
+
ror a ; x msb into carry
|
|
330
|
+
|
|
331
|
+
lda 13,s ; get y
|
|
332
|
+
xba
|
|
333
|
+
rep #$20 ; A 16 bits
|
|
334
|
+
sta.l oamMemory+0,x
|
|
335
|
+
|
|
336
|
+
lda.w #$0200 ; put $02 into MSB
|
|
337
|
+
sep #$20 ; A 8 bits
|
|
338
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
339
|
+
tay
|
|
340
|
+
|
|
341
|
+
bcs +
|
|
342
|
+
|
|
343
|
+
lda.l oammask+1,x
|
|
344
|
+
and.w oamMemory,y
|
|
345
|
+
sta.w oamMemory,y
|
|
346
|
+
bra osbyte4
|
|
347
|
+
|
|
348
|
+
+ lda.l oammask,x
|
|
349
|
+
ora.w oamMemory,y
|
|
350
|
+
sta.w oamMemory,y
|
|
351
|
+
|
|
352
|
+
osbyte4:
|
|
353
|
+
lda #$0 ; prepare Byte 4: vhoopppc v: vertical flip h: horizontal flip o: priority bits p: palette # c:sprite size (e.g. 8x8 or 16x16 pixel)
|
|
354
|
+
sta sprbyte4
|
|
355
|
+
|
|
356
|
+
lda 20,s ; get palette offset
|
|
357
|
+
asl a
|
|
358
|
+
sta sprbyte4
|
|
359
|
+
lda 15,s ; get priority
|
|
360
|
+
asl a
|
|
361
|
+
asl a
|
|
362
|
+
asl a
|
|
363
|
+
asl a
|
|
364
|
+
ora sprbyte4
|
|
365
|
+
sta sprbyte4
|
|
366
|
+
lda 16,s ; get hflip
|
|
367
|
+
asl a
|
|
368
|
+
asl a
|
|
369
|
+
asl a
|
|
370
|
+
asl a
|
|
371
|
+
asl a
|
|
372
|
+
asl a
|
|
373
|
+
ora sprbyte4
|
|
374
|
+
sta sprbyte4
|
|
375
|
+
lda 17,s ; get vflip
|
|
376
|
+
asl a
|
|
377
|
+
asl a
|
|
378
|
+
asl a
|
|
379
|
+
asl a
|
|
380
|
+
asl a
|
|
381
|
+
asl a
|
|
382
|
+
asl a
|
|
383
|
+
ora sprbyte4
|
|
384
|
+
ora 19,s ; get graphic offset (MSB)
|
|
385
|
+
sta oamMemory+3,x
|
|
386
|
+
|
|
387
|
+
lda 18,s ; get graphic offset (LSB)
|
|
388
|
+
sta oamMemory+2,x
|
|
389
|
+
|
|
390
|
+
ply
|
|
391
|
+
plx
|
|
392
|
+
plp
|
|
393
|
+
rtl
|
|
394
|
+
|
|
395
|
+
.ENDS
|
|
396
|
+
|
|
397
|
+
.SECTION ".sprites3_text" SUPERFREE
|
|
398
|
+
|
|
399
|
+
;---------------------------------------------------------------------------
|
|
400
|
+
; void oamSetVisible(u16 id, u8 hide)
|
|
401
|
+
oamSetVisible:
|
|
402
|
+
php
|
|
403
|
+
phb
|
|
404
|
+
|
|
405
|
+
phy
|
|
406
|
+
phx
|
|
407
|
+
|
|
408
|
+
sep #$20
|
|
409
|
+
lda #$7e
|
|
410
|
+
pha
|
|
411
|
+
plb
|
|
412
|
+
|
|
413
|
+
rep #$20 ; A 16 bits
|
|
414
|
+
lda 10,s ; id
|
|
415
|
+
lsr a
|
|
416
|
+
lsr a
|
|
417
|
+
lsr a
|
|
418
|
+
lsr a
|
|
419
|
+
clc
|
|
420
|
+
adc.w #512 ; id>>4 + 128*4
|
|
421
|
+
tay ; oam pointer is now on oam table #2
|
|
422
|
+
|
|
423
|
+
lda 10,s ; id
|
|
424
|
+
lsr a
|
|
425
|
+
lsr a
|
|
426
|
+
and.w #$3 ; id >> 2 & 3
|
|
427
|
+
tax
|
|
428
|
+
|
|
429
|
+
sep #$20
|
|
430
|
+
lda.b 12,s ; hide
|
|
431
|
+
bne oamHide1hi ; yes, go below
|
|
432
|
+
lda oamMemory,y ; get shifted value of show (<<0, <<2, <<4, <<6
|
|
433
|
+
and.l oamHideand,x
|
|
434
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
435
|
+
;bra oamHide1go
|
|
436
|
+
bra oamHide1end
|
|
437
|
+
|
|
438
|
+
oamHide1hi:
|
|
439
|
+
lda.l oamHideshift,x ; get shifted value of hide (<<0, <<2, <<4, <<6
|
|
440
|
+
ora oamMemory,y
|
|
441
|
+
|
|
442
|
+
oamHide1go:
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
446
|
+
|
|
447
|
+
rep #$20 ; A 16 bits
|
|
448
|
+
lda 10,s ; id
|
|
449
|
+
tay
|
|
450
|
+
sep #$20 ; A 8 bits
|
|
451
|
+
lda.b #$1 ; clear x entry (-255)
|
|
452
|
+
sta oamMemory,y
|
|
453
|
+
iny
|
|
454
|
+
lda.b #$F0 ; clear y entry
|
|
455
|
+
sta oamMemory,y
|
|
456
|
+
|
|
457
|
+
oamHide1end:
|
|
458
|
+
plx
|
|
459
|
+
ply
|
|
460
|
+
|
|
461
|
+
plb
|
|
462
|
+
plp
|
|
463
|
+
rtl
|
|
464
|
+
|
|
465
|
+
oamHideand:
|
|
466
|
+
.db $fe, $fb, $ef, $bf
|
|
467
|
+
oamHideshift:
|
|
468
|
+
.db $01, $04, $10, $40
|
|
469
|
+
|
|
470
|
+
.ENDS
|
|
471
|
+
|
|
472
|
+
.SECTION ".sprites4_text" SUPERFREE
|
|
473
|
+
|
|
474
|
+
;---------------------------------------------------------------------------
|
|
475
|
+
; void oamSetEx(u16 id, u8 size, u8 hide)
|
|
476
|
+
oamSetEx:
|
|
477
|
+
php
|
|
478
|
+
phb
|
|
479
|
+
|
|
480
|
+
phy
|
|
481
|
+
phx
|
|
482
|
+
|
|
483
|
+
sep #$20
|
|
484
|
+
lda #$7e
|
|
485
|
+
pha
|
|
486
|
+
plb
|
|
487
|
+
|
|
488
|
+
rep #$20 ; A 16 bits
|
|
489
|
+
lda 10,s ; id
|
|
490
|
+
lsr a
|
|
491
|
+
lsr a
|
|
492
|
+
lsr a
|
|
493
|
+
lsr a
|
|
494
|
+
clc
|
|
495
|
+
adc.w #512 ; id>>4 + 512
|
|
496
|
+
tay ; oam pointer is now on oam table #2
|
|
497
|
+
|
|
498
|
+
lda 10,s ; id
|
|
499
|
+
lsr a
|
|
500
|
+
lsr a
|
|
501
|
+
and.w #$3 ; id >> 2 & 3
|
|
502
|
+
tax
|
|
503
|
+
|
|
504
|
+
sep #$20
|
|
505
|
+
lda oamMemory,y ; get value of oam table #2
|
|
506
|
+
and.l oamSetExand,x
|
|
507
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
508
|
+
|
|
509
|
+
lda.b 12,s ; size
|
|
510
|
+
beq oamSetEx1nex ; small size, so go hide test
|
|
511
|
+
|
|
512
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
513
|
+
;clc
|
|
514
|
+
;adc __tccs_oamMemory,y
|
|
515
|
+
ora oamMemory,y
|
|
516
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
517
|
+
|
|
518
|
+
oamSetEx1nex:
|
|
519
|
+
lda.b 13,s ; hide ?
|
|
520
|
+
bne oamSetEx1hi ; yes, go below
|
|
521
|
+
lda oamMemory,y ; get shifted value of show (<<0, <<2, <<4, <<6
|
|
522
|
+
and.l oamHideand,x
|
|
523
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
524
|
+
bra oamSetEx1end
|
|
525
|
+
|
|
526
|
+
oamSetEx1hi:
|
|
527
|
+
lda.l oamHideshift,x ; get shifted value of hide (<<0, <<2, <<4, <<6
|
|
528
|
+
ora oamMemory,y
|
|
529
|
+
|
|
530
|
+
lda.l oamHideshift,x ; get shifted value of hide (<<0, <<2, <<4, <<6
|
|
531
|
+
;clc
|
|
532
|
+
;adc __tccs_oamMemory,y
|
|
533
|
+
ora oamMemory,y
|
|
534
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
535
|
+
|
|
536
|
+
rep #$20 ; A 16 bits
|
|
537
|
+
lda 10,s ; id
|
|
538
|
+
tay
|
|
539
|
+
sep #$20 ; A 8 bits
|
|
540
|
+
lda.b #$1 ; clear x entry (-255)
|
|
541
|
+
sta oamMemory,y
|
|
542
|
+
iny
|
|
543
|
+
lda.b #$F0 ; clear y entry
|
|
544
|
+
sta oamMemory,y
|
|
545
|
+
|
|
546
|
+
oamSetEx1end:
|
|
547
|
+
plx
|
|
548
|
+
ply
|
|
549
|
+
|
|
550
|
+
plb
|
|
551
|
+
plp
|
|
552
|
+
rtl
|
|
553
|
+
|
|
554
|
+
oamSetExand:
|
|
555
|
+
.db $fd, $f7, $df, $7f
|
|
556
|
+
; .db $fc, $f3, $cf, $3f
|
|
557
|
+
oamSizeshift:
|
|
558
|
+
.db $02, $08, $20, $80
|
|
559
|
+
|
|
560
|
+
.ENDS
|
|
561
|
+
|
|
562
|
+
.SECTION ".sprites4_0_text" SUPERFREE
|
|
563
|
+
;---------------------------------------------------------------------------
|
|
564
|
+
; void oamSetGfxOffset(u16 id, u16 gfxoffset)
|
|
565
|
+
; 9 11
|
|
566
|
+
oamSetGfxOffset:
|
|
567
|
+
php
|
|
568
|
+
phb
|
|
569
|
+
|
|
570
|
+
phx
|
|
571
|
+
|
|
572
|
+
rep #$20 ; A 16 bits
|
|
573
|
+
|
|
574
|
+
lda 8,s ; get idoff
|
|
575
|
+
tax
|
|
576
|
+
|
|
577
|
+
lda 10,s ; get offset
|
|
578
|
+
xba ; save msb
|
|
579
|
+
xba
|
|
580
|
+
sep #$20 ; A 8 bits
|
|
581
|
+
sta.l oamMemory+2,x ; store lsb oamMemory[id + 2] = (gfxoffset);
|
|
582
|
+
|
|
583
|
+
lda oamMemory+3,x
|
|
584
|
+
and #$FE
|
|
585
|
+
sta.l oamMemory+3,x
|
|
586
|
+
xba
|
|
587
|
+
and #$1
|
|
588
|
+
ora oamMemory+3,x
|
|
589
|
+
sta oamMemory+3,x ; store new value oamMemory[id + 3] = (oamMemory[id + 3] & 0xFE) | ((gfxoffset >> 8) & 1);
|
|
590
|
+
|
|
591
|
+
plx
|
|
592
|
+
|
|
593
|
+
plb
|
|
594
|
+
plp
|
|
595
|
+
rtl
|
|
596
|
+
|
|
597
|
+
.ENDS
|
|
598
|
+
|
|
599
|
+
.SECTION ".sprites5_text" SUPERFREE
|
|
600
|
+
|
|
601
|
+
;---------------------------------------------------------------------------
|
|
602
|
+
; void oamInitGfxAttr(u16 address, u8 oamsize)
|
|
603
|
+
oamInitGfxAttr:
|
|
604
|
+
php
|
|
605
|
+
phb
|
|
606
|
+
|
|
607
|
+
sep #$20
|
|
608
|
+
lda #$7e
|
|
609
|
+
pha
|
|
610
|
+
plb
|
|
611
|
+
|
|
612
|
+
rep #$20 ; A 16 bits
|
|
613
|
+
lda 6,s ; address
|
|
614
|
+
|
|
615
|
+
lsr a
|
|
616
|
+
lsr a
|
|
617
|
+
lsr a
|
|
618
|
+
lsr a
|
|
619
|
+
lsr a
|
|
620
|
+
lsr a
|
|
621
|
+
lsr a
|
|
622
|
+
lsr a
|
|
623
|
+
lsr a
|
|
624
|
+
lsr a
|
|
625
|
+
lsr a
|
|
626
|
+
lsr a
|
|
627
|
+
lsr a ; address >> 13
|
|
628
|
+
|
|
629
|
+
sep #$20
|
|
630
|
+
sta sprit_val1
|
|
631
|
+
|
|
632
|
+
lda.b 8,s ; oamsize
|
|
633
|
+
ora sprit_val1 ; oamsize | (address >> 13)
|
|
634
|
+
|
|
635
|
+
sta.l REG_OBSEL
|
|
636
|
+
|
|
637
|
+
plb
|
|
638
|
+
plp
|
|
639
|
+
rtl
|
|
640
|
+
|
|
641
|
+
.ENDS
|
|
642
|
+
|
|
643
|
+
.SECTION ".sprites6_text" SUPERFREE
|
|
644
|
+
|
|
645
|
+
//---------------------------------------------------------------------------------
|
|
646
|
+
; void oamInit(void)
|
|
647
|
+
oamInit:
|
|
648
|
+
php
|
|
649
|
+
phb
|
|
650
|
+
phx
|
|
651
|
+
|
|
652
|
+
sep #$20
|
|
653
|
+
lda #$7e
|
|
654
|
+
pha
|
|
655
|
+
plb
|
|
656
|
+
|
|
657
|
+
rep #$20
|
|
658
|
+
ldx #$0000
|
|
659
|
+
|
|
660
|
+
_oamInit1: ; all sprites are outside screen
|
|
661
|
+
lda #$F001 ; 1 & 240
|
|
662
|
+
sta.w oamMemory,x
|
|
663
|
+
inx
|
|
664
|
+
inx
|
|
665
|
+
lda #$0000 ; 0 & 0
|
|
666
|
+
sta.w oamMemory,x
|
|
667
|
+
inx
|
|
668
|
+
inx
|
|
669
|
+
txa
|
|
670
|
+
cmp #(128*4)
|
|
671
|
+
bne _oamInit1
|
|
672
|
+
|
|
673
|
+
_oamInit2: ; highatble now
|
|
674
|
+
lda #$5555 ; 1 & 240
|
|
675
|
+
sta.w oamMemory,x
|
|
676
|
+
inx
|
|
677
|
+
inx
|
|
678
|
+
lda #$5555 ; 1 & 240
|
|
679
|
+
sta.w oamMemory,x
|
|
680
|
+
inx
|
|
681
|
+
inx
|
|
682
|
+
txa
|
|
683
|
+
cmp #(136*4)
|
|
684
|
+
bne _oamInit2
|
|
685
|
+
|
|
686
|
+
plx
|
|
687
|
+
plb
|
|
688
|
+
plp
|
|
689
|
+
rtl
|
|
690
|
+
|
|
691
|
+
//---------------------------------------------------------------------------------
|
|
692
|
+
; void oamInitGfxSet(u8 *tileSource, u16 tileSize, u8 *tilePalette, u16 paletteSize, u8 tilePaletteNumber, u16 address, u8 oamsize)
|
|
693
|
+
oamInitGfxSet:
|
|
694
|
+
php
|
|
695
|
+
phb
|
|
696
|
+
|
|
697
|
+
wai ; force vblank interrupt
|
|
698
|
+
|
|
699
|
+
rep #$20 ; init tiles
|
|
700
|
+
lda 19,s ; dmaCopyVram(tileSource, (address), tileSize);
|
|
701
|
+
sta.l $2116 ; address for VRAM write(or read)
|
|
702
|
+
lda 10,s
|
|
703
|
+
sta.l $4305 ; number of bytes to be copied
|
|
704
|
+
lda 6,s ; loword address to copy
|
|
705
|
+
sta.l $4302 ; A1T0
|
|
706
|
+
|
|
707
|
+
sep #$20 ; 8bit A
|
|
708
|
+
lda #$80
|
|
709
|
+
sta.l $2115 ; VRAM address increment value designation
|
|
710
|
+
lda 8,s ; bank address of data in memory
|
|
711
|
+
sta.l $4304 ; // A1B0
|
|
712
|
+
lda #1
|
|
713
|
+
sta.l $4300 ; 1= word increment
|
|
714
|
+
lda #$18
|
|
715
|
+
sta.l $4301 ; 2118 is the VRAM gate
|
|
716
|
+
|
|
717
|
+
lda #$01 ; turn on bit 7 (channel 7) of DMA
|
|
718
|
+
sta.l $420b
|
|
719
|
+
|
|
720
|
+
lda 18,s ; init palette
|
|
721
|
+
asl a ; palEntry = (128+tilePaletteNumber*16);
|
|
722
|
+
asl a
|
|
723
|
+
asl a
|
|
724
|
+
asl a
|
|
725
|
+
clc
|
|
726
|
+
adc #128
|
|
727
|
+
sta.l $2121 ; address for VRAM write(or read)
|
|
728
|
+
rep #$20
|
|
729
|
+
lda 16,s
|
|
730
|
+
sta.l $4305 ; number of bytes to be copied
|
|
731
|
+
lda 12,s ; loword address to copy
|
|
732
|
+
sta.l $4302 ; A1T0
|
|
733
|
+
|
|
734
|
+
sep #$20 ; 8bit A
|
|
735
|
+
lda 14,s ; bank address of data in memory
|
|
736
|
+
sta.l $4304 ; // A1B0
|
|
737
|
+
lda #0 ; 0= 1 byte increment (not a word!)
|
|
738
|
+
sta.l $4300
|
|
739
|
+
lda #$22
|
|
740
|
+
sta.l $4301 ; destination 21xx this is 2122 (CGRAM Gate)
|
|
741
|
+
|
|
742
|
+
lda #$01 ; turn on bit 7 (channel 7) of DMA
|
|
743
|
+
sta.l $420b
|
|
744
|
+
|
|
745
|
+
rep #$20 ; update base address if needed (16k byte aligned)
|
|
746
|
+
lda 19,s ;
|
|
747
|
+
|
|
748
|
+
phy ; oamsize | (address >> 13);
|
|
749
|
+
ldy.w #13
|
|
750
|
+
-
|
|
751
|
+
lsr a
|
|
752
|
+
dey
|
|
753
|
+
bne -
|
|
754
|
+
ply
|
|
755
|
+
|
|
756
|
+
sep #$20
|
|
757
|
+
ora 21,s
|
|
758
|
+
sta.l REG_OBSEL
|
|
759
|
+
|
|
760
|
+
plb
|
|
761
|
+
plp
|
|
762
|
+
rtl
|
|
763
|
+
|
|
764
|
+
//---------------------------------------------------------------------------------
|
|
765
|
+
; void oamClear(u16 first, u8 numEntries) {
|
|
766
|
+
oamClear:
|
|
767
|
+
php
|
|
768
|
+
phb
|
|
769
|
+
|
|
770
|
+
phx
|
|
771
|
+
phy
|
|
772
|
+
|
|
773
|
+
sep #$20
|
|
774
|
+
lda 12,s ; get num entry
|
|
775
|
+
|
|
776
|
+
rep #$20
|
|
777
|
+
and #$00FF
|
|
778
|
+
asl a
|
|
779
|
+
asl a
|
|
780
|
+
cmp #$0000
|
|
781
|
+
bne +
|
|
782
|
+
lda #128*4 ; if no numentries, change it for all
|
|
783
|
+
+ tax ; All sprites are outside screen
|
|
784
|
+
|
|
785
|
+
lda 10,s ; 1sst sprite to update
|
|
786
|
+
tay
|
|
787
|
+
|
|
788
|
+
_oamClear1:
|
|
789
|
+
lda #1*256+0
|
|
790
|
+
pha
|
|
791
|
+
phy
|
|
792
|
+
jsl oamSetEx ; oamSetEx(i,OBJ_SMALL,OBJ_HIDE);
|
|
793
|
+
tsa
|
|
794
|
+
clc
|
|
795
|
+
adc #4
|
|
796
|
+
tas
|
|
797
|
+
dex
|
|
798
|
+
dex
|
|
799
|
+
dex
|
|
800
|
+
dex
|
|
801
|
+
iny
|
|
802
|
+
iny
|
|
803
|
+
iny
|
|
804
|
+
iny
|
|
805
|
+
txa
|
|
806
|
+
bne _oamClear1
|
|
807
|
+
|
|
808
|
+
ply
|
|
809
|
+
plx
|
|
810
|
+
plb
|
|
811
|
+
plp
|
|
812
|
+
rtl
|
|
813
|
+
|
|
814
|
+
.ENDS
|
|
815
|
+
|
|
816
|
+
.SECTION ".spritestable1_text" KEEP
|
|
817
|
+
|
|
818
|
+
lkup32oamS: ; lookup table for 32x32 sprites in VRAM (16 sprites max $0000->$1000 for gfx footprint)
|
|
819
|
+
.word $0000,$0080,$0100,$0180,$0800,$0880,$0900,$0980,$1000,$1080,$1100,$1180,$1800,$1880,$1900,$1980
|
|
820
|
+
.word $2000,$2080,$2100,$2180,$2800,$2880,$2900,$2980,$3000,$3080,$3100,$3180,$3800,$3880,$3900,$3980
|
|
821
|
+
.word $4000,$4080,$4100,$4180,$4800,$4880,$4900,$4980,$5000,$5080,$5100,$5180,$5800,$5880,$5900,$5980
|
|
822
|
+
.word $6000,$6080,$6100,$6180,$6800,$6880,$6900,$6980,$7000,$7080,$7100,$7180,$7800,$7880,$7900,$7980
|
|
823
|
+
lkup32idT: ; lookup table for 32x32 sprites ID identification
|
|
824
|
+
.word $0000,$0004,$0008,$000C,$0040,$0044,$0048,$004C,$0080,$0084,$0088,$008C,$00C0,$00C4,$00C8,$00CC
|
|
825
|
+
lkup32idB: ; lookup table for 32x32 sprites block identification
|
|
826
|
+
.word $0000,$0040,$0080,$00C0,$0400,$0440,$0480,$04C0,$0800,$0840,$0880,$08C0,$0C00,$0C40,$0C80,$0CC0
|
|
827
|
+
|
|
828
|
+
lkup16oamS: ; lookup table for 16x16 sprites in VRAM (64 sprites max $0000->$1000 for gfx footprint)
|
|
829
|
+
.word $0000,$0040,$0080,$00c0,$0100,$0140,$0180,$01c0,$0400,$0440,$0480,$04c0,$0500,$0540,$0580,$05c0
|
|
830
|
+
.word $0800,$0840,$0880,$08c0,$0900,$0940,$0980,$09c0,$0c00,$0c40,$0c80,$0cc0,$0d00,$0d40,$0d80,$0dc0
|
|
831
|
+
.word $1000,$1040,$1080,$10c0,$1100,$1140,$1180,$11c0,$1400,$1440,$1480,$14c0,$1500,$1540,$1580,$15c0
|
|
832
|
+
.word $1800,$1840,$1880,$18c0,$1900,$1940,$1980,$19c0,$1c00,$1c40,$1c80,$1cc0,$1d00,$1d40,$1d80,$1dc0
|
|
833
|
+
.word $2000,$2040,$2080,$20c0,$2100,$2140,$2180,$21c0,$2400,$2440,$2480,$24c0,$2500,$2540,$2580,$25c0
|
|
834
|
+
.word $2800,$2840,$2880,$28c0,$2900,$2940,$2980,$29c0,$2c00,$2c40,$2c80,$2cc0,$2d00,$2d40,$2d80,$2dc0
|
|
835
|
+
.word $3000,$3040,$3080,$30c0,$3100,$3140,$3180,$31c0,$3400,$3440,$3480,$34c0,$3500,$3540,$3580,$35c0
|
|
836
|
+
.word $3800,$1840,$3880,$38c0,$3900,$3940,$3980,$39c0,$3c00,$3c40,$3c80,$3cc0,$3d00,$3d40,$3d80,$3dc0
|
|
837
|
+
lkup16idT0: ; lookup table for 16x16 sprites ID identification when sprite 16 are big sprites
|
|
838
|
+
.word $0000,$0002,$0004,$0006,$0008,$000A,$000C,$000E,$0020,$0022,$0024,$0026,$0028,$002A,$002C,$002E
|
|
839
|
+
.word $0040,$0042,$0044,$0046,$0048,$004A,$004C,$004E,$0060,$0062,$0064,$0066,$0068,$006A,$006C,$006E
|
|
840
|
+
.word $0080,$0082,$0084,$0086,$0088,$008A,$008C,$008E,$00A0,$00A2,$00A4,$00A6,$00A8,$00AA,$00AC,$00AE
|
|
841
|
+
.word $00C0,$00C2,$00C4,$00C6,$00C8,$00CA,$00CC,$00CE,$00E0,$00E2,$00E4,$00E6,$00E8,$00EA,$00EC,$00EE
|
|
842
|
+
lkup16idT: ; lookup table for 16x16 sprites ID identification when sprite 16 are not big srites
|
|
843
|
+
.word $0100,$0102,$0104,$0106,$0108,$010A,$010C,$010E,$0120,$0122,$0124,$0126,$0128,$012A,$012C,$012E
|
|
844
|
+
.word $0140,$0142,$0144,$0146,$0148,$014A,$014C,$014E,$0160,$0162,$0164,$0166,$0168,$016A,$016C,$016E
|
|
845
|
+
.word $0180,$0182,$0184,$0186,$0188,$018A,$018C,$018E,$01A0,$01A2,$01A4,$01A6,$01A8,$01AA,$01AC,$01AE
|
|
846
|
+
.word $01C0,$01C2,$01C4,$01C6,$01C8,$01CA,$01CC,$01CE,$01E0,$01E2,$01E4,$01E6,$01E8,$01EA,$01EC,$01EE
|
|
847
|
+
lkup16idB: ; lookup table for 16x16 sprites block identification
|
|
848
|
+
.word $0000,$0020,$0040,$0060,$0080,$00A0,$00C0,$00E0,$0200,$0220,$0240,$0260,$0280,$02A0,$02C0,$02E0
|
|
849
|
+
.word $0400,$0420,$0440,$0460,$0480,$04A0,$04C0,$04E0,$0600,$0620,$0640,$0660,$0680,$06A0,$06C0,$06E0
|
|
850
|
+
.word $0800,$0820,$0840,$0860,$0880,$08A0,$08C0,$08E0,$0A00,$0A20,$0A40,$0A60,$0A80,$0AA0,$0AC0,$0AE0
|
|
851
|
+
.word $0C00,$0C20,$0C40,$0C60,$0C80,$0CA0,$0CC0,$0CE0,$0E00,$0E20,$0E40,$0E60,$0E80,$0EA0,$0EC0,$0EE0
|
|
852
|
+
|
|
853
|
+
lkup8oamS: ; lookup table for 8x8 sprites in VRAM (128 sprites max $0000->$1000 for gfx footprint)
|
|
854
|
+
.word $0000,$0020,$0040,$0060,$0080,$00A0,$00C0,$00E0,$0100,$0120,$0140,$0160,$0180,$01A0,$01C0,$01E0
|
|
855
|
+
.word $0200,$0220,$0240,$0260,$0280,$02A0,$02C0,$02E0,$0300,$0320,$0340,$0360,$0380,$03A0,$03C0,$03E0
|
|
856
|
+
.word $0400,$0420,$0440,$0460,$0480,$04A0,$04C0,$04E0,$0500,$0520,$0540,$0560,$0580,$05A0,$05C0,$05E0
|
|
857
|
+
.word $0600,$0620,$0640,$0660,$0680,$06A0,$06C0,$06E0,$0700,$0720,$0740,$0760,$0780,$07A0,$07C0,$07E0
|
|
858
|
+
.word $0800,$0820,$0840,$0860,$0880,$08A0,$08C0,$08E0,$0900,$0920,$0940,$0960,$0980,$09A0,$09C0,$09E0
|
|
859
|
+
.word $0A00,$0A20,$0A40,$0A60,$0A80,$0AA0,$0AC0,$0AE0,$0B00,$0B20,$0B40,$0B60,$0B80,$0BA0,$0BC0,$0BE0
|
|
860
|
+
.word $0C00,$0C20,$0C40,$0C60,$0C80,$0CA0,$0CC0,$0CE0,$0D00,$0D20,$0D40,$0D60,$0D80,$0DA0,$0DC0,$0DE0
|
|
861
|
+
.word $0E00,$0E20,$0E40,$0E60,$0E80,$0EA0,$0EC0,$0EE0,$0F00,$0F20,$0F40,$0F60,$0F80,$0FA0,$0FC0,$0FE0
|
|
862
|
+
lkup8idT: ; lookup table for 8x8 sprites ID identification
|
|
863
|
+
.word $0100,$0101,$0102,$0103,$0104,$0105,$0106,$0107,$0108,$0109,$010A,$010B,$010C,$010D,$010E,$010F
|
|
864
|
+
.word $0110,$0111,$0112,$0113,$0114,$0115,$0116,$0117,$0118,$0119,$011A,$011B,$011C,$011D,$011E,$011F
|
|
865
|
+
.word $0120,$0121,$0122,$0123,$0124,$0125,$0126,$0127,$0128,$0129,$012A,$012B,$012C,$012D,$012E,$012F
|
|
866
|
+
.word $0130,$0131,$0132,$0133,$0134,$0135,$0136,$0137,$0138,$0139,$013A,$013B,$013C,$013D,$013E,$013F
|
|
867
|
+
.word $0140,$0141,$0142,$0143,$0144,$0145,$0146,$0147,$0148,$0149,$014A,$014B,$014C,$014D,$014E,$014F
|
|
868
|
+
.word $0150,$0151,$0152,$0153,$0154,$0155,$0156,$0157,$0158,$0159,$015A,$015B,$015C,$015D,$015E,$015F
|
|
869
|
+
.word $0160,$0161,$0162,$0163,$0164,$0165,$0166,$0167,$0168,$0169,$016A,$016B,$016C,$016D,$016E,$016F
|
|
870
|
+
.word $0170,$0171,$0172,$0173,$0174,$0175,$0176,$0177,$0178,$0179,$017A,$017B,$017C,$017D,$017E,$017F
|
|
871
|
+
.word $0180,$0181,$0182,$0183,$0184,$0185,$0186,$0187,$0188,$0189,$018A,$018B,$018C,$018D,$018E,$018F
|
|
872
|
+
.word $0190,$0191,$0192,$0193,$0194,$0195,$0196,$0197,$0198,$0199,$019A,$019B,$019C,$019D,$019E,$019F
|
|
873
|
+
.word $01A0,$01A1,$01A2,$01A3,$01A4,$01A5,$01A6,$01A7,$01A8,$01A9,$01AA,$01AB,$01AC,$01AD,$01AE,$01AF
|
|
874
|
+
.word $01B0,$01B1,$01B2,$01B3,$01B4,$01B5,$01B6,$01B7,$01B8,$01B9,$01BA,$01BB,$01BC,$01BD,$01BE,$01BF
|
|
875
|
+
.word $01C0,$01C1,$01C2,$01C3,$01C4,$01C5,$01C6,$01C7,$01C8,$01C9,$01CA,$01CB,$01CC,$01CD,$01CE,$01CF
|
|
876
|
+
.word $01D0,$01D1,$01D2,$01D3,$01D4,$01D5,$01D6,$01D7,$01D8,$01D9,$01DA,$01DB,$01DC,$01DD,$01DE,$01DF
|
|
877
|
+
.word $01E0,$01E1,$01E2,$01E3,$01E4,$01E5,$01E6,$01E7,$01E8,$01E9,$01EA,$01EB,$01EC,$01ED,$01EE,$01EF
|
|
878
|
+
.word $01F0,$01F1,$01F2,$01F3,$01F4,$01F5,$01F6,$01F7,$01F8,$01F9,$01FA,$01FB,$01FC,$01FD,$01FE,$01FF
|
|
879
|
+
lkup8idB: ; lookup table for 8x8 sprites block identification
|
|
880
|
+
.word $0000,$0010,$0020,$0030,$0040,$0050,$0060,$0070,$0080,$0090,$00A0,$00B0,$00C0,$00D0,$00E0,$00F0
|
|
881
|
+
.word $0100,$0110,$0120,$0130,$0140,$0150,$0160,$0170,$0180,$0190,$01A0,$01B0,$01C0,$01D0,$01E0,$01F0
|
|
882
|
+
.word $0200,$0210,$0220,$0230,$0240,$0250,$0260,$0270,$0280,$0290,$02A0,$02B0,$02C0,$02D0,$02E0,$02F0
|
|
883
|
+
.word $0300,$0310,$0320,$0330,$0340,$0350,$0360,$0370,$0380,$0390,$03A0,$03B0,$03C0,$03D0,$03E0,$03F0
|
|
884
|
+
.word $0400,$0410,$0420,$0430,$0440,$0450,$0460,$0470,$0480,$0490,$04A0,$04B0,$04C0,$04D0,$04E0,$04F0
|
|
885
|
+
.word $0500,$0510,$0520,$0530,$0540,$0550,$0560,$0570,$0580,$0590,$05A0,$05B0,$05C0,$05D0,$05E0,$05F0
|
|
886
|
+
.word $0600,$0610,$0620,$0630,$0640,$0650,$0660,$0670,$0680,$0690,$06A0,$06B0,$06C0,$06D0,$06E0,$06F0
|
|
887
|
+
.word $0700,$0710,$0720,$0730,$0740,$0750,$0760,$0770,$0780,$0790,$07A0,$07B0,$07C0,$07D0,$07E0,$07F0
|
|
888
|
+
|
|
889
|
+
.ENDS
|
|
890
|
+
|
|
891
|
+
.SECTION ".sprites7_text" SUPERFREE
|
|
892
|
+
|
|
893
|
+
//---------------------------------------------------------------------------------
|
|
894
|
+
; oamInitDynamicSprite(u16 gfxsp0adr,u16 gfxsp1adr, u16 oamsp0init, u16 oamsp1init, u8 oamsize) {
|
|
895
|
+
; stack init is 10
|
|
896
|
+
oamInitDynamicSprite:
|
|
897
|
+
php
|
|
898
|
+
phb
|
|
899
|
+
phx
|
|
900
|
+
phy
|
|
901
|
+
|
|
902
|
+
sep #$20 ; change to correct bank
|
|
903
|
+
lda #$7e
|
|
904
|
+
pha
|
|
905
|
+
plb
|
|
906
|
+
|
|
907
|
+
ldx #$0000 ; init queue size for sprites 32x32,16x16 and 8x8
|
|
908
|
+
lda #$0
|
|
909
|
+
- sta oamQueueEntry,x
|
|
910
|
+
inx
|
|
911
|
+
cpx #OBJ_QUEUELIST_SIZE*6
|
|
912
|
+
bne -
|
|
913
|
+
|
|
914
|
+
rep #$20
|
|
915
|
+
stz.w oamqueuenumber ; init current entry in queue
|
|
916
|
+
|
|
917
|
+
stz.w oamnumberperframeold ; init current oam per frame number
|
|
918
|
+
stz.w oamnumberperframe
|
|
919
|
+
|
|
920
|
+
; init graphic address for each sprite size
|
|
921
|
+
lda 10,s ; get gfxsp0adr
|
|
922
|
+
sta spr0addrgfx
|
|
923
|
+
lda 12,s ; get gfxsp1adr
|
|
924
|
+
sta spr1addrgfx
|
|
925
|
+
|
|
926
|
+
; init current entry for each sprite size (multiple of 4)
|
|
927
|
+
lda 14,s ; get oamsp0init
|
|
928
|
+
sta oamnumberspr0
|
|
929
|
+
sta oamnumberspr0Init
|
|
930
|
+
lda 16,s ; get oamsp1init
|
|
931
|
+
sta oamnumberspr1
|
|
932
|
+
sta oamnumberspr1Init
|
|
933
|
+
|
|
934
|
+
lda spr1addrgfx ; change default graphic address for sprite 16x16 (it is the only one who need that)
|
|
935
|
+
sta spr16addrgfx
|
|
936
|
+
sep #$20
|
|
937
|
+
lda 18,s ; get oamsize to compute sprite 16 large or small size graphic address
|
|
938
|
+
cmp #OBJ_SIZE16_L32
|
|
939
|
+
beq +
|
|
940
|
+
rep #$20
|
|
941
|
+
lda spr0addrgfx ; change default graphic address for sprite 16x16 at $0000
|
|
942
|
+
sta spr16addrgfx
|
|
943
|
+
|
|
944
|
+
+: sep #$20 ; oamInitGfxAttr(GFXSPR0ADR,OBJ_SIZE8_L16);
|
|
945
|
+
lda 18,s ; get oamsize which is #OBJ_SIZE8_L16 or stufs like that
|
|
946
|
+
pha
|
|
947
|
+
rep #$20
|
|
948
|
+
lda spr0addrgfx ; initial address is from big sprites (always 0)
|
|
949
|
+
pha
|
|
950
|
+
jsl oamInitGfxAttr
|
|
951
|
+
pla
|
|
952
|
+
sep #$20
|
|
953
|
+
pla
|
|
954
|
+
rep #$20
|
|
955
|
+
jsl oamInit
|
|
956
|
+
|
|
957
|
+
ply
|
|
958
|
+
plx
|
|
959
|
+
plb
|
|
960
|
+
plp
|
|
961
|
+
rtl
|
|
962
|
+
|
|
963
|
+
;---------------------------------------------------------------------------------
|
|
964
|
+
; void oamInitDynamicSpriteScreen(void) {
|
|
965
|
+
oamInitDynamicSpriteScreen:
|
|
966
|
+
php
|
|
967
|
+
phb
|
|
968
|
+
|
|
969
|
+
sep #$20 ; change to correct bank
|
|
970
|
+
lda #$7e
|
|
971
|
+
pha
|
|
972
|
+
plb
|
|
973
|
+
|
|
974
|
+
rep #$20
|
|
975
|
+
|
|
976
|
+
lda #0
|
|
977
|
+
pha
|
|
978
|
+
pha
|
|
979
|
+
jsl oamClear ; Clear all sprites
|
|
980
|
+
pla
|
|
981
|
+
pla
|
|
982
|
+
|
|
983
|
+
lda oamnumberperframe ; init current oam per frame number on screen
|
|
984
|
+
sta oamnumberperframeold
|
|
985
|
+
stz.w oamnumberperframe
|
|
986
|
+
|
|
987
|
+
lda oamnumberspr0Init
|
|
988
|
+
sta oamnumberspr0
|
|
989
|
+
lda oamnumberspr1Init
|
|
990
|
+
sta oamnumberspr1
|
|
991
|
+
|
|
992
|
+
plb
|
|
993
|
+
plp
|
|
994
|
+
rtl
|
|
995
|
+
|
|
996
|
+
//---------------------------------------------------------------------------------
|
|
997
|
+
; void oamInitDynamicSpriteEndFrame(void) {
|
|
998
|
+
oamInitDynamicSpriteEndFrame:
|
|
999
|
+
php
|
|
1000
|
+
phb
|
|
1001
|
+
phx
|
|
1002
|
+
|
|
1003
|
+
sep #$20 ; change to correct bank
|
|
1004
|
+
lda #$7e
|
|
1005
|
+
pha
|
|
1006
|
+
plb
|
|
1007
|
+
|
|
1008
|
+
rep #$20 ; do we have to hide some sprites
|
|
1009
|
+
ldx oamnumberperframe
|
|
1010
|
+
txa
|
|
1011
|
+
cmp oamnumberperframeold
|
|
1012
|
+
bcs _oamIDSEndFrame2 ; no, leave the function
|
|
1013
|
+
|
|
1014
|
+
; change visibility of old frame sprites
|
|
1015
|
+
phy
|
|
1016
|
+
_oamIDSEndFrame1:
|
|
1017
|
+
lsr a
|
|
1018
|
+
lsr a
|
|
1019
|
+
lsr a
|
|
1020
|
+
lsr a
|
|
1021
|
+
clc
|
|
1022
|
+
adc.w #512 ; id>>4 + 512
|
|
1023
|
+
tay ; oam pointer is now on oam table #2
|
|
1024
|
+
|
|
1025
|
+
txa ; get id and save it
|
|
1026
|
+
phx
|
|
1027
|
+
lsr a
|
|
1028
|
+
lsr a
|
|
1029
|
+
and.w #$3 ; id >> 2 & 3
|
|
1030
|
+
tax
|
|
1031
|
+
|
|
1032
|
+
sep #$20
|
|
1033
|
+
lda.l oamHideshift,x ; get shifted value of hide (<<0, <<2, <<4, <<6
|
|
1034
|
+
ora oamMemory,y
|
|
1035
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1036
|
+
|
|
1037
|
+
rep #$20 ; A 16 bits
|
|
1038
|
+
plx ; retrieve id
|
|
1039
|
+
txa ; id
|
|
1040
|
+
tay
|
|
1041
|
+
sep #$20 ; A 8 bits
|
|
1042
|
+
lda.b #$1 ; clear x entry (-255)
|
|
1043
|
+
sta oamMemory,y
|
|
1044
|
+
iny
|
|
1045
|
+
lda.b #$F0 ; clear y entry
|
|
1046
|
+
sta oamMemory,y
|
|
1047
|
+
|
|
1048
|
+
rep #$20
|
|
1049
|
+
|
|
1050
|
+
inx
|
|
1051
|
+
inx
|
|
1052
|
+
inx
|
|
1053
|
+
inx
|
|
1054
|
+
txa
|
|
1055
|
+
|
|
1056
|
+
cmp oamnumberperframeold
|
|
1057
|
+
bne _oamIDSEndFrame1
|
|
1058
|
+
ply
|
|
1059
|
+
|
|
1060
|
+
; init values for next frame
|
|
1061
|
+
_oamIDSEndFrame2:
|
|
1062
|
+
lda oamnumberperframe
|
|
1063
|
+
sta oamnumberperframeold
|
|
1064
|
+
lda #$00
|
|
1065
|
+
sta oamnumberperframe
|
|
1066
|
+
|
|
1067
|
+
lda oamnumberspr0Init
|
|
1068
|
+
sta oamnumberspr0
|
|
1069
|
+
lda oamnumberspr1Init
|
|
1070
|
+
sta oamnumberspr1
|
|
1071
|
+
|
|
1072
|
+
plx
|
|
1073
|
+
plb
|
|
1074
|
+
plp
|
|
1075
|
+
rtl
|
|
1076
|
+
|
|
1077
|
+
;---------------------------------------------------------------------------
|
|
1078
|
+
; void oamVramQueueUpdate(void)
|
|
1079
|
+
oamVramQueueUpdate:
|
|
1080
|
+
php
|
|
1081
|
+
phb
|
|
1082
|
+
phx
|
|
1083
|
+
phy
|
|
1084
|
+
|
|
1085
|
+
sep #$20 ; 8bit A
|
|
1086
|
+
lda #$7e
|
|
1087
|
+
pha
|
|
1088
|
+
plb
|
|
1089
|
+
|
|
1090
|
+
ldx oamqueuenumber ; something to transfer to vram ?
|
|
1091
|
+
bne _ovqug1
|
|
1092
|
+
jmp _ovqug1z ; no, bye
|
|
1093
|
+
|
|
1094
|
+
_ovqug1:
|
|
1095
|
+
lda #$80
|
|
1096
|
+
sta.l $2115 ; VRAM address increment value designation
|
|
1097
|
+
|
|
1098
|
+
rep #$20
|
|
1099
|
+
stz.w oamqueuenumber ; currently, we consider we have enough time for all sprites during frame
|
|
1100
|
+
txa ; A got now number of data queued
|
|
1101
|
+
cmp #MAXSPRTRF
|
|
1102
|
+
bcc _ovqug1m ; not the max per frame
|
|
1103
|
+
ldx #MAXSPRTRF ; limit to the max
|
|
1104
|
+
sec
|
|
1105
|
+
sbc #MAXSPRTRF
|
|
1106
|
+
sta.l oamqueuenumber ; update to continue on next frame
|
|
1107
|
+
|
|
1108
|
+
_ovqug1m:
|
|
1109
|
+
lda #$1801
|
|
1110
|
+
sta.l $4310 ; 1= word increment
|
|
1111
|
+
sta.l $4320 ; 1= word increment
|
|
1112
|
+
sta.l $4330 ; 1= word increment
|
|
1113
|
+
sta.l $4340 ; 1= word increment
|
|
1114
|
+
|
|
1115
|
+
dex ; only first time, will be done at the end of loop after
|
|
1116
|
+
|
|
1117
|
+
_gfxld8:
|
|
1118
|
+
dex ; prepare next entry
|
|
1119
|
+
dex
|
|
1120
|
+
dex
|
|
1121
|
+
dex
|
|
1122
|
+
dex
|
|
1123
|
+
|
|
1124
|
+
sep #$20
|
|
1125
|
+
lda.l oamQueueEntry+5,x ; get sprite size
|
|
1126
|
+
cmp #OBJ_SPRITE8
|
|
1127
|
+
bne +
|
|
1128
|
+
jmp _ovqu8b ; sprite 8x8 transfer to VRAM
|
|
1129
|
+
+: cmp #OBJ_SPRITE16
|
|
1130
|
+
bne _ovqu32b
|
|
1131
|
+
jmp _ovqu16b ; sprite 16x16 transfer to VRAM
|
|
1132
|
+
|
|
1133
|
+
_ovqu32b: ;-------------------------------------------------
|
|
1134
|
+
rep #$20 ; 32x32 sprite transfer to VRAM
|
|
1135
|
+
lda.l oamQueueEntry+3,x ; get address
|
|
1136
|
+
sta.l $2116 ; address for VRAM write(or read)
|
|
1137
|
+
|
|
1138
|
+
lda.l oamQueueEntry,x ; get tileSource (lower 16 bits)
|
|
1139
|
+
sta.l $4312 ; data offset in memory
|
|
1140
|
+
clc
|
|
1141
|
+
adc #$200
|
|
1142
|
+
sta.l $4322 ; data offset in memory
|
|
1143
|
+
clc
|
|
1144
|
+
adc #$200
|
|
1145
|
+
sta.l $4332 ; data offset in memory
|
|
1146
|
+
clc
|
|
1147
|
+
adc #$200
|
|
1148
|
+
sta.l $4342 ; data offset in memory
|
|
1149
|
+
|
|
1150
|
+
lda #$0080
|
|
1151
|
+
sta.l $4315 ; number of bytes to be copied
|
|
1152
|
+
sta.l $4325 ; number of bytes to be copied
|
|
1153
|
+
sta.l $4335 ; number of bytes to be copied
|
|
1154
|
+
sta.l $4345 ; number of bytes to be copied
|
|
1155
|
+
|
|
1156
|
+
sep #$20 ; 8bit A
|
|
1157
|
+
lda.l oamQueueEntry+2,x ; get tileSource (bank)
|
|
1158
|
+
sta.l $4314
|
|
1159
|
+
sta.l $4324
|
|
1160
|
+
sta.l $4334
|
|
1161
|
+
sta.l $4344
|
|
1162
|
+
|
|
1163
|
+
lda #$02 ; turn on bit 1 (channel 1) of DMA
|
|
1164
|
+
sta.l $420b
|
|
1165
|
+
|
|
1166
|
+
rep #$20 ; second step
|
|
1167
|
+
lda #$100
|
|
1168
|
+
clc
|
|
1169
|
+
adc.l oamQueueEntry+3,x ; get address
|
|
1170
|
+
sta.l $2116 ; address for VRAM write(or read)
|
|
1171
|
+
sep #$20 ; 8bit A
|
|
1172
|
+
lda #$04 ; turn on bit 2 (channel 2) of DMA
|
|
1173
|
+
sta.l $420b
|
|
1174
|
+
|
|
1175
|
+
rep #$20 ; third step
|
|
1176
|
+
lda #$200
|
|
1177
|
+
clc
|
|
1178
|
+
adc.l oamQueueEntry+3,x ; get address
|
|
1179
|
+
sta.l $2116 ; address for VRAM write(or read)
|
|
1180
|
+
sep #$20 ; 8bit A
|
|
1181
|
+
lda #$08 ; turn on bit 3 (channel 3) of DMA
|
|
1182
|
+
sta.l $420b
|
|
1183
|
+
|
|
1184
|
+
rep #$20 ; fourth step
|
|
1185
|
+
lda #$300
|
|
1186
|
+
clc
|
|
1187
|
+
adc.l oamQueueEntry+3,x ; get address
|
|
1188
|
+
sta.l $2116 ; address for VRAM write(or read)
|
|
1189
|
+
sep #$20 ; 8bit A
|
|
1190
|
+
lda #$10 ; turn on bit 4 (channel 4) of DMA
|
|
1191
|
+
sta.l $420b
|
|
1192
|
+
|
|
1193
|
+
dex
|
|
1194
|
+
bpl +
|
|
1195
|
+
jmp _ovqug1z0
|
|
1196
|
+
+: beq +
|
|
1197
|
+
jmp _gfxld8
|
|
1198
|
+
+: jmp _ovqug1z0
|
|
1199
|
+
|
|
1200
|
+
_ovqu16b: ;-------------------------------------------------
|
|
1201
|
+
rep #$20 ; 16x16 sprite transfer to VRAM
|
|
1202
|
+
lda.l oamQueueEntry+3,x ; get address
|
|
1203
|
+
sta.l $2116 ; address for VRAM write(or read)
|
|
1204
|
+
|
|
1205
|
+
lda.l oamQueueEntry,x ; get tileSource (lower 16 bits)
|
|
1206
|
+
sta.l $4322 ; data offset in memory
|
|
1207
|
+
clc
|
|
1208
|
+
adc #$200
|
|
1209
|
+
sta.l $4332 ; data offset in memory
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
lda #$0040
|
|
1213
|
+
sta.l $4325 ; number of bytes to be copied
|
|
1214
|
+
sta.l $4335 ; number of bytes to be copied
|
|
1215
|
+
|
|
1216
|
+
sep #$20 ; 8bit A
|
|
1217
|
+
lda.l oamQueueEntry+2,x ; get tileSource (bank)
|
|
1218
|
+
sta.l $4324
|
|
1219
|
+
sta.l $4334
|
|
1220
|
+
|
|
1221
|
+
lda #$04 ; turn on bit 2 (channel 2) of DMA
|
|
1222
|
+
sta.l $420b
|
|
1223
|
+
|
|
1224
|
+
; second step
|
|
1225
|
+
rep #$20
|
|
1226
|
+
lda.l oamQueueEntry+3,x ; get address
|
|
1227
|
+
ora #$100
|
|
1228
|
+
sta.l $2116 ; address for VRAM write(or read)
|
|
1229
|
+
|
|
1230
|
+
sep #$20 ; 8bit A
|
|
1231
|
+
lda #$08 ; turn on bit 3 (channel 3) of DMA
|
|
1232
|
+
sta.l $420b
|
|
1233
|
+
|
|
1234
|
+
dex
|
|
1235
|
+
bmi _ovqug1z0
|
|
1236
|
+
beq +
|
|
1237
|
+
jmp _gfxld8
|
|
1238
|
+
+: jmp _ovqug1z0
|
|
1239
|
+
|
|
1240
|
+
_ovqu8b: ;-------------------------------------------------
|
|
1241
|
+
rep #$20 ; 8x8 sprite transfer to VRAM
|
|
1242
|
+
lda.l oamQueueEntry+3,x ; get address
|
|
1243
|
+
sta.l $2116 ; address for VRAM write(or read)
|
|
1244
|
+
|
|
1245
|
+
lda.l oamQueueEntry,x ; get tileSource (lower 8 bits)
|
|
1246
|
+
sta.l $4322 ; data offset in memory
|
|
1247
|
+
|
|
1248
|
+
lda #$0020
|
|
1249
|
+
sta.l $4325 ; number of bytes to be copied
|
|
1250
|
+
|
|
1251
|
+
sep #$20 ; 8bit A
|
|
1252
|
+
lda.l oamQueueEntry+2,x ; get tileSource (bank)
|
|
1253
|
+
sta.l $4324
|
|
1254
|
+
|
|
1255
|
+
lda #$04 ; turn on bit 2 (channel 2) of DMA
|
|
1256
|
+
sta.l $420b
|
|
1257
|
+
|
|
1258
|
+
dex
|
|
1259
|
+
bmi _ovqug1z0
|
|
1260
|
+
beq _ovqug1z0
|
|
1261
|
+
jmp _gfxld8
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
_ovqug1z0:
|
|
1265
|
+
rep #$20
|
|
1266
|
+
lda oamqueuenumber
|
|
1267
|
+
beq _ovqug1z ; if more than max sprite to transfer, put them on top of queue
|
|
1268
|
+
ldy #$0000
|
|
1269
|
+
ldx #MAXSPRTRF
|
|
1270
|
+
_ovqug1z1:
|
|
1271
|
+
pha
|
|
1272
|
+
lda.l oamQueueEntry,x
|
|
1273
|
+
sta.w oamQueueEntry,y
|
|
1274
|
+
iny
|
|
1275
|
+
inx
|
|
1276
|
+
pla
|
|
1277
|
+
dea
|
|
1278
|
+
bmi _ovqug1z
|
|
1279
|
+
jmp _ovqug1z1
|
|
1280
|
+
|
|
1281
|
+
_ovqug1z:
|
|
1282
|
+
|
|
1283
|
+
ply
|
|
1284
|
+
plx
|
|
1285
|
+
plb
|
|
1286
|
+
plp
|
|
1287
|
+
rtl
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
.ENDS
|
|
1291
|
+
|
|
1292
|
+
.SECTION ".sprites8_text" SUPERFREE
|
|
1293
|
+
|
|
1294
|
+
;---------------------------------------------------------------------------------
|
|
1295
|
+
; void oamDynamic32Draw(u16 id) {
|
|
1296
|
+
; For optim purpose with mesen : oamDynamic32Draw (PRG: $004604),2246
|
|
1297
|
+
oamDynamic32Draw:
|
|
1298
|
+
php
|
|
1299
|
+
phb
|
|
1300
|
+
phx
|
|
1301
|
+
phy
|
|
1302
|
+
|
|
1303
|
+
rep #$20
|
|
1304
|
+
lda 10,s ; get id
|
|
1305
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
1306
|
+
asl a
|
|
1307
|
+
asl a
|
|
1308
|
+
asl a
|
|
1309
|
+
tay
|
|
1310
|
+
|
|
1311
|
+
sep #$20
|
|
1312
|
+
lda #$7e
|
|
1313
|
+
pha
|
|
1314
|
+
plb
|
|
1315
|
+
|
|
1316
|
+
sep #$20
|
|
1317
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
1318
|
+
beq _o32DRep1
|
|
1319
|
+
lda #$00
|
|
1320
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
rep #$20
|
|
1324
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
1325
|
+
asl a
|
|
1326
|
+
tax
|
|
1327
|
+
lda.l lkup32oamS,x
|
|
1328
|
+
clc
|
|
1329
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
1330
|
+
sta.w sprit_val2
|
|
1331
|
+
|
|
1332
|
+
lda.l oamqueuenumber ; oamAddGfxQueue16(pgfx,GFXSPR0.1ADR+idBlock16);
|
|
1333
|
+
tax ; go to next graphic entry
|
|
1334
|
+
clc
|
|
1335
|
+
adc #$0006
|
|
1336
|
+
sta.l oamqueuenumber
|
|
1337
|
+
|
|
1338
|
+
phx
|
|
1339
|
+
lda oamnumberspr0 ; get address
|
|
1340
|
+
asl a
|
|
1341
|
+
tax
|
|
1342
|
+
lda.l lkup32idB,x
|
|
1343
|
+
plx
|
|
1344
|
+
clc
|
|
1345
|
+
adc spr0addrgfx
|
|
1346
|
+
sta.l oamQueueEntry+3,x
|
|
1347
|
+
lda sprit_val2 ; get tileSource (lower 16 bits)
|
|
1348
|
+
sta.l oamQueueEntry,x
|
|
1349
|
+
sep #$20 ; A 16 bits
|
|
1350
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
1351
|
+
sta.l oamQueueEntry+2,x
|
|
1352
|
+
|
|
1353
|
+
lda #OBJ_SPRITE32 ; store that it is a 32pix sprite
|
|
1354
|
+
sta.l oamQueueEntry+5,x
|
|
1355
|
+
|
|
1356
|
+
_o32DRep1:
|
|
1357
|
+
rep #$20
|
|
1358
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
1359
|
+
|
|
1360
|
+
phx
|
|
1361
|
+
lda oamnumberspr0 ; get graphics offset of 32x32 sprites
|
|
1362
|
+
asl a
|
|
1363
|
+
tax
|
|
1364
|
+
lda.l lkup32idT,x
|
|
1365
|
+
plx
|
|
1366
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
1367
|
+
|
|
1368
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
1369
|
+
xba ; save it
|
|
1370
|
+
sep #$20 ; A 8 bits
|
|
1371
|
+
ror a ; x msb into carry (saved if x>255)
|
|
1372
|
+
|
|
1373
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
1374
|
+
xba
|
|
1375
|
+
rep #$20 ; A 8 bits
|
|
1376
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
1377
|
+
|
|
1378
|
+
lda.w #$0200 ; put $02 into MSB
|
|
1379
|
+
sep #$20 ; A 8 bits
|
|
1380
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
1381
|
+
phy
|
|
1382
|
+
tay
|
|
1383
|
+
|
|
1384
|
+
bcs _o32DRep3 ; if no x<255, no need to update
|
|
1385
|
+
|
|
1386
|
+
lda.l oammask+1,x
|
|
1387
|
+
and.w oamMemory,y
|
|
1388
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1389
|
+
jmp _o32DRep3p
|
|
1390
|
+
|
|
1391
|
+
_o32DRep3:
|
|
1392
|
+
lda.l oammask,x
|
|
1393
|
+
ora.w oamMemory,y
|
|
1394
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1395
|
+
|
|
1396
|
+
_o32DRep3p:
|
|
1397
|
+
ply
|
|
1398
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
1399
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
1400
|
+
|
|
1401
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
1402
|
+
lda oamnumberperframe ; always small for 8px sprites
|
|
1403
|
+
lsr a
|
|
1404
|
+
lsr a
|
|
1405
|
+
lsr a
|
|
1406
|
+
lsr a
|
|
1407
|
+
clc
|
|
1408
|
+
adc.w #512 ; id>>4 + 512
|
|
1409
|
+
tay ; oam pointer is now on oam table #2
|
|
1410
|
+
|
|
1411
|
+
lda oamnumberperframe ; id
|
|
1412
|
+
lsr a
|
|
1413
|
+
lsr a
|
|
1414
|
+
and.w #$0003 ; id >> 2 & 3
|
|
1415
|
+
tax
|
|
1416
|
+
|
|
1417
|
+
sep #$20
|
|
1418
|
+
lda oamMemory,y ; get value of oam table #2
|
|
1419
|
+
and.l oamSetExand,x
|
|
1420
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1421
|
+
|
|
1422
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
1423
|
+
ora oamMemory,y
|
|
1424
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1425
|
+
|
|
1426
|
+
rep #$20
|
|
1427
|
+
inc.w oamnumberspr0 ; one more sprite 32x32
|
|
1428
|
+
|
|
1429
|
+
lda oamnumberperframe ; go to next sprite entry (x4 multiplier)
|
|
1430
|
+
clc
|
|
1431
|
+
adc #$0004
|
|
1432
|
+
sta.w oamnumberperframe
|
|
1433
|
+
|
|
1434
|
+
ply
|
|
1435
|
+
plx
|
|
1436
|
+
|
|
1437
|
+
plb
|
|
1438
|
+
plp
|
|
1439
|
+
rtl
|
|
1440
|
+
|
|
1441
|
+
.ENDS
|
|
1442
|
+
|
|
1443
|
+
.SECTION ".sprites8f_text" SUPERFREE
|
|
1444
|
+
|
|
1445
|
+
;---------------------------------------------------------------------------------
|
|
1446
|
+
; void oamFix32Draw(u16 id) {
|
|
1447
|
+
oamFix32Draw:
|
|
1448
|
+
php
|
|
1449
|
+
phb
|
|
1450
|
+
phx
|
|
1451
|
+
phy
|
|
1452
|
+
|
|
1453
|
+
sep #$20
|
|
1454
|
+
lda #$7e
|
|
1455
|
+
pha
|
|
1456
|
+
plb
|
|
1457
|
+
|
|
1458
|
+
rep #$20
|
|
1459
|
+
lda 10,s ; get id
|
|
1460
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
1461
|
+
asl a
|
|
1462
|
+
tax
|
|
1463
|
+
phx ; save oam sprite entry id*4
|
|
1464
|
+
asl a
|
|
1465
|
+
asl a
|
|
1466
|
+
|
|
1467
|
+
tay
|
|
1468
|
+
lda oambuffer.1.oamframeid,y ; get graphics offset of 32x32 sprites
|
|
1469
|
+
asl a
|
|
1470
|
+
tax
|
|
1471
|
+
lda.l lkup32idT,x
|
|
1472
|
+
plx
|
|
1473
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
1474
|
+
|
|
1475
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
1476
|
+
xba ; save it
|
|
1477
|
+
sep #$20 ; A 8 bits
|
|
1478
|
+
ror a ; x msb into carry (saved if x>255)
|
|
1479
|
+
|
|
1480
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
1481
|
+
xba
|
|
1482
|
+
rep #$20 ; A 8 bits
|
|
1483
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
1484
|
+
|
|
1485
|
+
lda.w #$0200 ; put $02 into MSB
|
|
1486
|
+
sep #$20 ; A 8 bits
|
|
1487
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
1488
|
+
phy
|
|
1489
|
+
tay
|
|
1490
|
+
|
|
1491
|
+
bcs _o32FRep3 ; if no x<255, no need to update
|
|
1492
|
+
|
|
1493
|
+
lda.l oammask+1,x
|
|
1494
|
+
and.w oamMemory,y
|
|
1495
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1496
|
+
brl +
|
|
1497
|
+
|
|
1498
|
+
_o32FRep3:
|
|
1499
|
+
lda.l oammask,x
|
|
1500
|
+
ora.w oamMemory,y
|
|
1501
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1502
|
+
|
|
1503
|
+
+:
|
|
1504
|
+
ply
|
|
1505
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
1506
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
1507
|
+
|
|
1508
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
1509
|
+
lda 10,s ; always large for 32px sprites
|
|
1510
|
+
lsr a
|
|
1511
|
+
lsr a
|
|
1512
|
+
clc
|
|
1513
|
+
adc.w #512 ; id>>4 + 512
|
|
1514
|
+
tay ; oam pointer is now on oam table #2
|
|
1515
|
+
|
|
1516
|
+
lda 10,s ; id
|
|
1517
|
+
and.w #$0003 ; id >> 2 & 3
|
|
1518
|
+
tax
|
|
1519
|
+
|
|
1520
|
+
sep #$20
|
|
1521
|
+
lda oamMemory,y ; get value of oam table #2
|
|
1522
|
+
and.l oamSetExand,x
|
|
1523
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1524
|
+
|
|
1525
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
1526
|
+
ora oamMemory,y
|
|
1527
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1528
|
+
|
|
1529
|
+
rep #$20 ; change number of sprite to transfert if ID is more than max
|
|
1530
|
+
lda 10,s
|
|
1531
|
+
asl a
|
|
1532
|
+
asl a
|
|
1533
|
+
cmp oamnumberperframe
|
|
1534
|
+
bcs _o32FRep2p0 ; no, leave the function
|
|
1535
|
+
sta.w oamnumberperframe
|
|
1536
|
+
|
|
1537
|
+
_o32FRep2p0:
|
|
1538
|
+
ply
|
|
1539
|
+
plx
|
|
1540
|
+
|
|
1541
|
+
plb
|
|
1542
|
+
plp
|
|
1543
|
+
rtl
|
|
1544
|
+
|
|
1545
|
+
.ENDS
|
|
1546
|
+
|
|
1547
|
+
.SECTION ".sprites9_text" SUPERFREE
|
|
1548
|
+
|
|
1549
|
+
;---------------------------------------------------------------------------------
|
|
1550
|
+
; void oamDynamic16Draw(u16 id) {
|
|
1551
|
+
; FOr optim purpose with Mesen : oamDynamic16Draw (PRG: $0043D9),2470
|
|
1552
|
+
oamDynamic16Draw:
|
|
1553
|
+
php
|
|
1554
|
+
phb
|
|
1555
|
+
phx
|
|
1556
|
+
phy
|
|
1557
|
+
|
|
1558
|
+
rep #$20
|
|
1559
|
+
lda 10,s ; get id
|
|
1560
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
1561
|
+
asl a
|
|
1562
|
+
asl a
|
|
1563
|
+
asl a
|
|
1564
|
+
tay
|
|
1565
|
+
|
|
1566
|
+
sep #$20
|
|
1567
|
+
lda #$7e
|
|
1568
|
+
pha
|
|
1569
|
+
plb
|
|
1570
|
+
|
|
1571
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
1572
|
+
beq _o16DRep1
|
|
1573
|
+
|
|
1574
|
+
lda #$00
|
|
1575
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
1576
|
+
|
|
1577
|
+
rep #$20
|
|
1578
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
1579
|
+
asl a
|
|
1580
|
+
tax
|
|
1581
|
+
lda.l lkup16oamS,x
|
|
1582
|
+
clc
|
|
1583
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
1584
|
+
sta.w sprit_val2
|
|
1585
|
+
|
|
1586
|
+
lda.l oamqueuenumber ; oamAddGfxQueue16(pgfx,GFXSPR0.1ADR+idBlock16);
|
|
1587
|
+
tax ; go to next graphic entry
|
|
1588
|
+
clc
|
|
1589
|
+
adc #$0006
|
|
1590
|
+
sta.l oamqueuenumber
|
|
1591
|
+
|
|
1592
|
+
phx
|
|
1593
|
+
lda spr16addrgfx ; if large sprite, adjust address
|
|
1594
|
+
cmp spr0addrgfx
|
|
1595
|
+
beq +
|
|
1596
|
+
lda oamnumberspr1 ; get address
|
|
1597
|
+
jmp _o16DRep0p
|
|
1598
|
+
+: lda oamnumberspr0 ; get address
|
|
1599
|
+
|
|
1600
|
+
_o16DRep0p:
|
|
1601
|
+
asl a
|
|
1602
|
+
tax
|
|
1603
|
+
lda.l lkup16idB,x
|
|
1604
|
+
plx
|
|
1605
|
+
clc
|
|
1606
|
+
adc spr16addrgfx
|
|
1607
|
+
sta.l oamQueueEntry+3,x
|
|
1608
|
+
lda sprit_val2 ; get tileSource (lower 16 bits)
|
|
1609
|
+
sta.l oamQueueEntry,x
|
|
1610
|
+
sep #$20 ; A 16 bits
|
|
1611
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
1612
|
+
sta.l oamQueueEntry+2,x
|
|
1613
|
+
|
|
1614
|
+
lda #OBJ_SPRITE16 ; store that it is a 16pix sprite
|
|
1615
|
+
sta.l oamQueueEntry+5,x
|
|
1616
|
+
|
|
1617
|
+
_o16DRep1:
|
|
1618
|
+
rep #$20
|
|
1619
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
1620
|
+
|
|
1621
|
+
phx
|
|
1622
|
+
lda spr16addrgfx ; if large sprite, adjust address
|
|
1623
|
+
cmp spr0addrgfx
|
|
1624
|
+
beq +
|
|
1625
|
+
lda oamnumberspr1 ; get address if not big sprite
|
|
1626
|
+
asl a
|
|
1627
|
+
tax
|
|
1628
|
+
lda.l lkup16idT,x
|
|
1629
|
+
jmp _o16DRep1p
|
|
1630
|
+
|
|
1631
|
+
+: lda oamnumberspr0 ; get address if big sprite
|
|
1632
|
+
asl a
|
|
1633
|
+
tax
|
|
1634
|
+
lda.l lkup16idT0,x
|
|
1635
|
+
_o16DRep1p:
|
|
1636
|
+
plx
|
|
1637
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
1638
|
+
|
|
1639
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
1640
|
+
xba ; save it
|
|
1641
|
+
sep #$20 ; A 8 bits
|
|
1642
|
+
ror a ; x msb into carry (saved if x>255)
|
|
1643
|
+
|
|
1644
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
1645
|
+
xba
|
|
1646
|
+
rep #$20 ; A 16 bits
|
|
1647
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
1648
|
+
|
|
1649
|
+
lda.w #$0200 ; put $02 into MSB
|
|
1650
|
+
sep #$20 ; A 8 bits
|
|
1651
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
1652
|
+
phy
|
|
1653
|
+
tay
|
|
1654
|
+
|
|
1655
|
+
bcs _o16DRep3 ; if no x<255, no need to update
|
|
1656
|
+
|
|
1657
|
+
lda.l oammask+1,x
|
|
1658
|
+
and.w oamMemory,y
|
|
1659
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1660
|
+
jmp _o16DRep3p
|
|
1661
|
+
|
|
1662
|
+
_o16DRep3:
|
|
1663
|
+
lda.l oammask,x
|
|
1664
|
+
ora.w oamMemory,y
|
|
1665
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1666
|
+
|
|
1667
|
+
_o16DRep3p:
|
|
1668
|
+
ply
|
|
1669
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
1670
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
1671
|
+
|
|
1672
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
1673
|
+
lda oamnumberperframe
|
|
1674
|
+
lsr a
|
|
1675
|
+
lsr a
|
|
1676
|
+
lsr a
|
|
1677
|
+
lsr a
|
|
1678
|
+
clc
|
|
1679
|
+
adc.w #512 ; id>>4 + 512
|
|
1680
|
+
tay ; oam pointer is now on oam table #2
|
|
1681
|
+
|
|
1682
|
+
lda oamnumberperframe ; id
|
|
1683
|
+
lsr a
|
|
1684
|
+
lsr a
|
|
1685
|
+
and.w #$0003 ; id >> 2 & 3
|
|
1686
|
+
tax
|
|
1687
|
+
|
|
1688
|
+
sep #$20
|
|
1689
|
+
lda oamMemory,y ; get value of oam table #2
|
|
1690
|
+
and.l oamSetExand,x
|
|
1691
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1692
|
+
|
|
1693
|
+
rep #$20
|
|
1694
|
+
lda spr16addrgfx ; if large sprite, adjust it
|
|
1695
|
+
cmp spr1addrgfx
|
|
1696
|
+
beq +
|
|
1697
|
+
sep #$20
|
|
1698
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
1699
|
+
ora oamMemory,y
|
|
1700
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1701
|
+
|
|
1702
|
+
+: rep #$20
|
|
1703
|
+
lda spr16addrgfx ; if large sprite, adjust address
|
|
1704
|
+
cmp spr0addrgfx
|
|
1705
|
+
beq +
|
|
1706
|
+
inc.w oamnumberspr1 ; one more sprite 16x16 small
|
|
1707
|
+
bra _o16DRep2p
|
|
1708
|
+
+: inc.w oamnumberspr0 ; one more sprite 16x16 large
|
|
1709
|
+
|
|
1710
|
+
_o16DRep2p:
|
|
1711
|
+
lda oamnumberperframe ; go to next sprite entry (x4 multiplier)
|
|
1712
|
+
clc
|
|
1713
|
+
adc #$0004
|
|
1714
|
+
sta.w oamnumberperframe
|
|
1715
|
+
|
|
1716
|
+
ply
|
|
1717
|
+
plx
|
|
1718
|
+
|
|
1719
|
+
plb
|
|
1720
|
+
plp
|
|
1721
|
+
rtl
|
|
1722
|
+
|
|
1723
|
+
.ENDS
|
|
1724
|
+
|
|
1725
|
+
.SECTION ".sprites9f_text" SUPERFREE
|
|
1726
|
+
|
|
1727
|
+
;---------------------------------------------------------------------------------
|
|
1728
|
+
; void oamFix16Draw(u16 id) {
|
|
1729
|
+
oamFix16Draw:
|
|
1730
|
+
php
|
|
1731
|
+
phb
|
|
1732
|
+
phx
|
|
1733
|
+
phy
|
|
1734
|
+
|
|
1735
|
+
sep #$20
|
|
1736
|
+
lda #$7e
|
|
1737
|
+
pha
|
|
1738
|
+
plb
|
|
1739
|
+
|
|
1740
|
+
rep #$20
|
|
1741
|
+
lda 10,s ; get id
|
|
1742
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
1743
|
+
asl a
|
|
1744
|
+
tax
|
|
1745
|
+
phx ; save oam sprite entry id*4
|
|
1746
|
+
asl a
|
|
1747
|
+
asl a
|
|
1748
|
+
|
|
1749
|
+
tay
|
|
1750
|
+
lda oambuffer.1.oamframeid,y ; get current graphic number
|
|
1751
|
+
|
|
1752
|
+
pha
|
|
1753
|
+
lda spr16addrgfx ; if large sprite, adjust address
|
|
1754
|
+
cmp spr0addrgfx
|
|
1755
|
+
beq +
|
|
1756
|
+
pla ; get address if not big sprite
|
|
1757
|
+
asl a
|
|
1758
|
+
tax
|
|
1759
|
+
lda.l lkup16idT,x
|
|
1760
|
+
brl _o16FRep1p
|
|
1761
|
+
|
|
1762
|
+
+: pla ; get address if big sprite
|
|
1763
|
+
asl a
|
|
1764
|
+
tax
|
|
1765
|
+
lda.l lkup16idT0,x
|
|
1766
|
+
_o16FRep1p:
|
|
1767
|
+
plx
|
|
1768
|
+
sta.w oamMemory+2,x ; store in oam memory id*4+2 TTTT TTTT - Low 8 bits of tile
|
|
1769
|
+
|
|
1770
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
1771
|
+
xba ; save it
|
|
1772
|
+
sep #$20 ; A 8 bits
|
|
1773
|
+
ror a ; x msb into carry (saved if x>255)
|
|
1774
|
+
|
|
1775
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
1776
|
+
xba
|
|
1777
|
+
rep #$20 ; A 16 bits
|
|
1778
|
+
sta.w oamMemory,x ; store x & y in oam memory id*4+0: XXXX XXXX - Low 8 bits of X position && id*4+1: YYYY YYYY - Y position
|
|
1779
|
+
|
|
1780
|
+
lda.w #$0200 ; put $02 into MSB
|
|
1781
|
+
sep #$20 ; A 8 bits
|
|
1782
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
1783
|
+
phy
|
|
1784
|
+
tay
|
|
1785
|
+
|
|
1786
|
+
bcs _o16FRep3 ; if no x<255, no need to update
|
|
1787
|
+
|
|
1788
|
+
lda.l oammask+1,x
|
|
1789
|
+
and.w oamMemory,y
|
|
1790
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1791
|
+
brl +
|
|
1792
|
+
|
|
1793
|
+
_o16FRep3:
|
|
1794
|
+
lda.l oammask,x
|
|
1795
|
+
ora.w oamMemory,y
|
|
1796
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1797
|
+
|
|
1798
|
+
+:
|
|
1799
|
+
ply
|
|
1800
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
1801
|
+
sta oamMemory+3,x ; store attributes in oam memory id*4+3: VHPP CCCt
|
|
1802
|
+
|
|
1803
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
1804
|
+
lda 10,s
|
|
1805
|
+
lsr a
|
|
1806
|
+
lsr a
|
|
1807
|
+
clc
|
|
1808
|
+
adc.w #512 ; id>>4 + 512
|
|
1809
|
+
tay ; oam pointer is now on oam table #2
|
|
1810
|
+
|
|
1811
|
+
lda 10,s ; id
|
|
1812
|
+
and.w #$0003 ; id >> 2 & 3
|
|
1813
|
+
tax
|
|
1814
|
+
|
|
1815
|
+
sep #$20
|
|
1816
|
+
lda oamMemory,y ; get value of oam table #2
|
|
1817
|
+
and.l oamSetExand,x
|
|
1818
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1819
|
+
|
|
1820
|
+
rep #$20
|
|
1821
|
+
lda spr16addrgfx ; if large sprite, adjust it
|
|
1822
|
+
cmp spr1addrgfx
|
|
1823
|
+
beq _o16FRep2p
|
|
1824
|
+
sep #$20
|
|
1825
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
1826
|
+
ora oamMemory,y
|
|
1827
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1828
|
+
|
|
1829
|
+
_o16FRep2p:
|
|
1830
|
+
rep #$20 ; change number of sprite to transfert if ID is more than max
|
|
1831
|
+
lda 10,s
|
|
1832
|
+
asl a
|
|
1833
|
+
asl a
|
|
1834
|
+
cmp oamnumberperframe
|
|
1835
|
+
bcs _o16FRep2p0 ; no, leave the function
|
|
1836
|
+
sta.w oamnumberperframe
|
|
1837
|
+
|
|
1838
|
+
_o16FRep2p0:
|
|
1839
|
+
ply
|
|
1840
|
+
plx
|
|
1841
|
+
|
|
1842
|
+
plb
|
|
1843
|
+
plp
|
|
1844
|
+
rtl
|
|
1845
|
+
|
|
1846
|
+
.ENDS
|
|
1847
|
+
|
|
1848
|
+
.SECTION ".spritesa_text" SUPERFREE
|
|
1849
|
+
|
|
1850
|
+
;---------------------------------------------------------------------------------
|
|
1851
|
+
; void oamDynamic8Draw(u8 id) {
|
|
1852
|
+
oamDynamic8Draw:
|
|
1853
|
+
php
|
|
1854
|
+
phb
|
|
1855
|
+
phx
|
|
1856
|
+
phy
|
|
1857
|
+
|
|
1858
|
+
rep #$20
|
|
1859
|
+
lda 10,s ; get id
|
|
1860
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
1861
|
+
asl a
|
|
1862
|
+
asl a
|
|
1863
|
+
asl a
|
|
1864
|
+
tay
|
|
1865
|
+
|
|
1866
|
+
sep #$20
|
|
1867
|
+
lda #$7e
|
|
1868
|
+
pha
|
|
1869
|
+
plb
|
|
1870
|
+
|
|
1871
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
1872
|
+
beq _o8DRep1
|
|
1873
|
+
lda #$00
|
|
1874
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
1875
|
+
|
|
1876
|
+
rep #$20
|
|
1877
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
1878
|
+
asl a
|
|
1879
|
+
tax
|
|
1880
|
+
lda.l lkup8oamS,x
|
|
1881
|
+
clc
|
|
1882
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
1883
|
+
sta.w sprit_val2
|
|
1884
|
+
|
|
1885
|
+
lda.l oamqueuenumber ; oamAddGfxQueue8(pgfx,GFXSPR0.1ADR+idBlock8);
|
|
1886
|
+
tax ; go to next graphic entry
|
|
1887
|
+
clc
|
|
1888
|
+
adc #$0006
|
|
1889
|
+
sta.l oamqueuenumber
|
|
1890
|
+
|
|
1891
|
+
phx
|
|
1892
|
+
lda oamnumberspr1 ; get address
|
|
1893
|
+
asl a
|
|
1894
|
+
tax
|
|
1895
|
+
lda.l lkup8idB,x
|
|
1896
|
+
plx
|
|
1897
|
+
clc
|
|
1898
|
+
adc spr1addrgfx ; not variable, always the second gfx entry
|
|
1899
|
+
sta.l oamQueueEntry+3,x
|
|
1900
|
+
lda sprit_val2 ; get tileSource (lower 8 bits)
|
|
1901
|
+
sta.l oamQueueEntry,x
|
|
1902
|
+
sep #$20 ; A 8 bits
|
|
1903
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
1904
|
+
sta.l oamQueueEntry+2,x
|
|
1905
|
+
|
|
1906
|
+
lda #OBJ_SPRITE8 ; store that it is a 8pix sprite
|
|
1907
|
+
sta.l oamQueueEntry+5,x
|
|
1908
|
+
|
|
1909
|
+
_o8DRep1:
|
|
1910
|
+
rep #$20
|
|
1911
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
1912
|
+
|
|
1913
|
+
phx
|
|
1914
|
+
lda oamnumberspr1 ; get graphics offset of 8x8 sprites
|
|
1915
|
+
asl a
|
|
1916
|
+
tax
|
|
1917
|
+
lda.l lkup8idT,x
|
|
1918
|
+
plx
|
|
1919
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
1920
|
+
|
|
1921
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
1922
|
+
xba ; save it
|
|
1923
|
+
sep #$20 ; A 8 bits
|
|
1924
|
+
ror a ; x msb into carry (saved if x>255)
|
|
1925
|
+
|
|
1926
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
1927
|
+
xba
|
|
1928
|
+
rep #$20 ; A 8 bits
|
|
1929
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
1930
|
+
|
|
1931
|
+
lda.w #$0200 ; put $02 into MSB
|
|
1932
|
+
sep #$20 ; A 8 bits
|
|
1933
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
1934
|
+
phy
|
|
1935
|
+
tay
|
|
1936
|
+
|
|
1937
|
+
bcs _o8DRep3 ; if no x<255, no need to update
|
|
1938
|
+
|
|
1939
|
+
lda.l oammask+1,x
|
|
1940
|
+
and.w oamMemory,y
|
|
1941
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1942
|
+
jmp _o8DRep3p
|
|
1943
|
+
|
|
1944
|
+
_o8DRep3:
|
|
1945
|
+
lda.l oammask,x
|
|
1946
|
+
ora.w oamMemory,y
|
|
1947
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
1948
|
+
|
|
1949
|
+
_o8DRep3p:
|
|
1950
|
+
ply
|
|
1951
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
1952
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
1953
|
+
|
|
1954
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
1955
|
+
lda oamnumberperframe ; always small for 8px sprites
|
|
1956
|
+
lsr a
|
|
1957
|
+
lsr a
|
|
1958
|
+
lsr a
|
|
1959
|
+
lsr a
|
|
1960
|
+
clc
|
|
1961
|
+
adc.w #512 ; id>>4 + 512
|
|
1962
|
+
tay ; oam pointer is now on oam table #2
|
|
1963
|
+
|
|
1964
|
+
lda oamnumberperframe ; id
|
|
1965
|
+
lsr a
|
|
1966
|
+
lsr a
|
|
1967
|
+
and.w #$0003 ; id >> 2 & 3
|
|
1968
|
+
tax
|
|
1969
|
+
|
|
1970
|
+
sep #$20
|
|
1971
|
+
lda oamMemory,y ; get value of oam table #2
|
|
1972
|
+
and.l oamSetExand,x
|
|
1973
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
1974
|
+
|
|
1975
|
+
rep #$20
|
|
1976
|
+
inc.w oamnumberspr1 ; one more sprite 8x8
|
|
1977
|
+
|
|
1978
|
+
lda oamnumberperframe ; go to next sprite entry (x4 multiplier)
|
|
1979
|
+
clc
|
|
1980
|
+
adc #$0004
|
|
1981
|
+
sta.w oamnumberperframe
|
|
1982
|
+
|
|
1983
|
+
ply
|
|
1984
|
+
plx
|
|
1985
|
+
|
|
1986
|
+
plb
|
|
1987
|
+
plp
|
|
1988
|
+
rtl
|
|
1989
|
+
|
|
1990
|
+
.ENDS
|
|
1991
|
+
|
|
1992
|
+
.SECTION ".spritesaf_text" SUPERFREE
|
|
1993
|
+
|
|
1994
|
+
;---------------------------------------------------------------------------------
|
|
1995
|
+
; void oamFix8Draw(u8 id) {
|
|
1996
|
+
oamFix8Draw:
|
|
1997
|
+
php
|
|
1998
|
+
phb
|
|
1999
|
+
phx
|
|
2000
|
+
phy
|
|
2001
|
+
|
|
2002
|
+
sep #$20
|
|
2003
|
+
lda #$7e
|
|
2004
|
+
pha
|
|
2005
|
+
plb
|
|
2006
|
+
|
|
2007
|
+
rep #$20
|
|
2008
|
+
lda 10,s ; get id
|
|
2009
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
2010
|
+
asl a
|
|
2011
|
+
tax
|
|
2012
|
+
phx ; save oam sprite entry id*4
|
|
2013
|
+
asl a
|
|
2014
|
+
asl a
|
|
2015
|
+
|
|
2016
|
+
tay
|
|
2017
|
+
lda oambuffer.1.oamframeid,y ; get current graphic number
|
|
2018
|
+
|
|
2019
|
+
asl a
|
|
2020
|
+
tax
|
|
2021
|
+
lda.l lkup8idT,x
|
|
2022
|
+
plx
|
|
2023
|
+
sta.w oamMemory+2,x ; store in oam memory id*4+2 TTTT TTTT - Low 8 bits of tile
|
|
2024
|
+
|
|
2025
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
2026
|
+
xba ; save it
|
|
2027
|
+
sep #$20 ; A 8 bits
|
|
2028
|
+
ror a ; x msb into carry (saved if x>255)
|
|
2029
|
+
|
|
2030
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
2031
|
+
xba
|
|
2032
|
+
rep #$20 ; A 8 bits
|
|
2033
|
+
sta.w oamMemory,x ; store x & y in oam memory id*4+0: XXXX XXXX - Low 8 bits of X position && id*4+1: YYYY YYYY - Y position
|
|
2034
|
+
|
|
2035
|
+
lda.w #$0200 ; put $02 into MSB
|
|
2036
|
+
sep #$20 ; A 8 bits
|
|
2037
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
2038
|
+
phy
|
|
2039
|
+
tay
|
|
2040
|
+
|
|
2041
|
+
bcs _o8FRep3 ; if no x<255, no need to update
|
|
2042
|
+
|
|
2043
|
+
lda.l oammask+1,x
|
|
2044
|
+
and.w oamMemory,y
|
|
2045
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2046
|
+
brl +
|
|
2047
|
+
|
|
2048
|
+
_o8FRep3:
|
|
2049
|
+
lda.l oammask,x
|
|
2050
|
+
ora.w oamMemory,y
|
|
2051
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2052
|
+
|
|
2053
|
+
+:
|
|
2054
|
+
ply
|
|
2055
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
2056
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
2057
|
+
|
|
2058
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
2059
|
+
lda 10,s
|
|
2060
|
+
lsr a
|
|
2061
|
+
lsr a
|
|
2062
|
+
clc
|
|
2063
|
+
adc.w #512 ; id>>4 + 512
|
|
2064
|
+
tay ; oam pointer is now on oam table #2
|
|
2065
|
+
|
|
2066
|
+
lda 10,s ; id
|
|
2067
|
+
and.w #$0003 ; id >> 2 & 3
|
|
2068
|
+
tax
|
|
2069
|
+
|
|
2070
|
+
sep #$20
|
|
2071
|
+
lda oamMemory,y ; get value of oam table #2
|
|
2072
|
+
and.l oamSetExand,x
|
|
2073
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
2074
|
+
|
|
2075
|
+
rep #$20
|
|
2076
|
+
lda 10,s
|
|
2077
|
+
asl a
|
|
2078
|
+
asl a
|
|
2079
|
+
cmp oamnumberperframe
|
|
2080
|
+
bcs _o8FRep2p0 ; no, leave the function
|
|
2081
|
+
sta.w oamnumberperframe
|
|
2082
|
+
|
|
2083
|
+
_o8FRep2p0:
|
|
2084
|
+
ply
|
|
2085
|
+
plx
|
|
2086
|
+
|
|
2087
|
+
plb
|
|
2088
|
+
plp
|
|
2089
|
+
rtl
|
|
2090
|
+
|
|
2091
|
+
.ENDS
|
|
2092
|
+
|
|
2093
|
+
.SECTION ".spritesb_text" SUPERFREE
|
|
2094
|
+
|
|
2095
|
+
;---------------------------------------------------------------------------------
|
|
2096
|
+
; void oamDynamicMetaDraw(u16 id, s16 x,s16 y, u8 *sprmeta)
|
|
2097
|
+
; 10-11 12-13 14-15 16-19
|
|
2098
|
+
; For optim purpose with Mesen oamDynamicMetaDraw (PRG: $0026BC),11676
|
|
2099
|
+
oamDynamicMetaDraw:
|
|
2100
|
+
php
|
|
2101
|
+
phb
|
|
2102
|
+
phx
|
|
2103
|
+
phy
|
|
2104
|
+
|
|
2105
|
+
sep #$20
|
|
2106
|
+
lda #$7e
|
|
2107
|
+
pha
|
|
2108
|
+
plb
|
|
2109
|
+
|
|
2110
|
+
rep #$20
|
|
2111
|
+
lda 10,s ; get id of sprite
|
|
2112
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
2113
|
+
asl a
|
|
2114
|
+
asl a
|
|
2115
|
+
asl a
|
|
2116
|
+
tax ; x is now the id of oam buffer
|
|
2117
|
+
lda #0
|
|
2118
|
+
tay ; y is now the id of meta sprite buffer
|
|
2119
|
+
|
|
2120
|
+
sep #$20 ; get 1st sprite refresh value, which will be the default
|
|
2121
|
+
lda oambuffer.1.oamrefresh,x
|
|
2122
|
+
sta sprit_val0
|
|
2123
|
+
|
|
2124
|
+
rep #$20
|
|
2125
|
+
lda 12,s ; save x coordinate
|
|
2126
|
+
sta sprit_mxsvg
|
|
2127
|
+
lda 14,s ; save y coordinate
|
|
2128
|
+
sta sprit_mysvg
|
|
2129
|
+
|
|
2130
|
+
lda 16,s
|
|
2131
|
+
sta tcc__r0 ; tcc_r0 = meta sprite source address
|
|
2132
|
+
sep #$20
|
|
2133
|
+
lda 18,s
|
|
2134
|
+
sta tcc__r0h
|
|
2135
|
+
rep #$20
|
|
2136
|
+
|
|
2137
|
+
_oMTDRep0p:
|
|
2138
|
+
lda [tcc__r0], y ; get x offset and calculate x coordinate of sprite
|
|
2139
|
+
cmp #$FFFF ; if we reached the end of table (0xFFFF), go out
|
|
2140
|
+
bne _oMTDRep0p_ok
|
|
2141
|
+
jmp _oMTDRepEnd0p
|
|
2142
|
+
|
|
2143
|
+
_oMTDRep0p_ok:
|
|
2144
|
+
iny
|
|
2145
|
+
iny
|
|
2146
|
+
clc
|
|
2147
|
+
adc sprit_mxsvg
|
|
2148
|
+
sta oambuffer.1.oamx,x
|
|
2149
|
+
|
|
2150
|
+
lda [tcc__r0], y ; get y offset and calculate y coordinate of sprite
|
|
2151
|
+
iny
|
|
2152
|
+
iny
|
|
2153
|
+
clc
|
|
2154
|
+
adc sprit_mysvg
|
|
2155
|
+
sta oambuffer.1.oamy,x
|
|
2156
|
+
|
|
2157
|
+
lda [tcc__r0], y ; get frameid
|
|
2158
|
+
iny
|
|
2159
|
+
iny
|
|
2160
|
+
sta oambuffer.1.oamframeid,x
|
|
2161
|
+
|
|
2162
|
+
sep #$20
|
|
2163
|
+
lda [tcc__r0], y ; get attribute
|
|
2164
|
+
iny
|
|
2165
|
+
sta oambuffer.1.oamattribute,x
|
|
2166
|
+
|
|
2167
|
+
lda [tcc__r0], y ; get type (8,16,32)
|
|
2168
|
+
iny
|
|
2169
|
+
sta sprit_val1
|
|
2170
|
+
|
|
2171
|
+
rep #$20
|
|
2172
|
+
lda [tcc__r0], y ; get graphic address
|
|
2173
|
+
iny
|
|
2174
|
+
iny
|
|
2175
|
+
sta oambuffer.1.oamgraphics,x
|
|
2176
|
+
lda [tcc__r0], y ; get graphic address (bank)
|
|
2177
|
+
iny
|
|
2178
|
+
iny
|
|
2179
|
+
sta oambuffer.1.oamgraphics+2,x
|
|
2180
|
+
phy ; because we will need it at the end for the table
|
|
2181
|
+
|
|
2182
|
+
txa ; push sprite id (must be in 0..127 range)
|
|
2183
|
+
phx ; because we will need it at the end for the table
|
|
2184
|
+
tay ; id normaly passed as argument of drawing function
|
|
2185
|
+
|
|
2186
|
+
sep #$20
|
|
2187
|
+
lda sprit_val0
|
|
2188
|
+
sta oambuffer.1.oamrefresh,x ; save initial sprite refresh value
|
|
2189
|
+
|
|
2190
|
+
lda sprit_val1 ; call sprite display function regarding sprite size
|
|
2191
|
+
cmp #OBJ_SPRITE16
|
|
2192
|
+
bne _oMTDRepChx8_16p
|
|
2193
|
+
jmp _oMTDRepChx_16p
|
|
2194
|
+
|
|
2195
|
+
_oMTDRepChx8_16p:
|
|
2196
|
+
cmp #OBJ_SPRITE8
|
|
2197
|
+
bne _oMTDRepChx32_8p
|
|
2198
|
+
jmp _oMTDRepChx_8p
|
|
2199
|
+
|
|
2200
|
+
_oMTDRepChx32_8p
|
|
2201
|
+
;--------------draw 32 pix sprite
|
|
2202
|
+
sep #$20
|
|
2203
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
2204
|
+
beq _oMTDRep1_32p
|
|
2205
|
+
lda #$00
|
|
2206
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
rep #$20
|
|
2210
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
2211
|
+
asl a
|
|
2212
|
+
tax
|
|
2213
|
+
lda.l lkup32oamS,x
|
|
2214
|
+
clc
|
|
2215
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
2216
|
+
sta.w sprit_val2
|
|
2217
|
+
|
|
2218
|
+
lda.l oamqueuenumber ; oamAddGfxQueue16(pgfx,GFXSPR0.1ADR+idBlock16);
|
|
2219
|
+
tax ; go to next graphic entry
|
|
2220
|
+
clc
|
|
2221
|
+
adc #$0006
|
|
2222
|
+
sta.l oamqueuenumber
|
|
2223
|
+
|
|
2224
|
+
phx
|
|
2225
|
+
lda oamnumberspr0 ; get address
|
|
2226
|
+
asl a
|
|
2227
|
+
tax
|
|
2228
|
+
lda.l lkup32idB,x
|
|
2229
|
+
plx
|
|
2230
|
+
clc
|
|
2231
|
+
adc spr0addrgfx
|
|
2232
|
+
sta.l oamQueueEntry+3,x
|
|
2233
|
+
lda sprit_val2 ; get tileSource (lower 16 bits)
|
|
2234
|
+
sta.l oamQueueEntry,x
|
|
2235
|
+
sep #$20 ; A 16 bits
|
|
2236
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
2237
|
+
sta.l oamQueueEntry+2,x
|
|
2238
|
+
|
|
2239
|
+
lda #OBJ_SPRITE32 ; store that it is a 32pix sprite
|
|
2240
|
+
sta.l oamQueueEntry+5,x
|
|
2241
|
+
|
|
2242
|
+
_oMTDRep1_32p:
|
|
2243
|
+
rep #$20
|
|
2244
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
2245
|
+
|
|
2246
|
+
phx
|
|
2247
|
+
lda oamnumberspr0 ; get graphics offset of 32x32 sprites
|
|
2248
|
+
asl a
|
|
2249
|
+
tax
|
|
2250
|
+
lda.l lkup32idT,x
|
|
2251
|
+
plx
|
|
2252
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
2253
|
+
|
|
2254
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
2255
|
+
xba ; save it
|
|
2256
|
+
sep #$20 ; A 8 bits
|
|
2257
|
+
ror a ; x msb into carry (saved if x>255)
|
|
2258
|
+
|
|
2259
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
2260
|
+
xba
|
|
2261
|
+
rep #$20 ; A 8 bits
|
|
2262
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
2263
|
+
|
|
2264
|
+
lda.w #$0200 ; put $02 into MSB
|
|
2265
|
+
sep #$20 ; A 8 bits
|
|
2266
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
2267
|
+
phy
|
|
2268
|
+
tay
|
|
2269
|
+
|
|
2270
|
+
bcs _oMTDRep3_32p ; if no x<255, no need to update
|
|
2271
|
+
|
|
2272
|
+
lda.l oammask+1,x
|
|
2273
|
+
and.w oamMemory,y
|
|
2274
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2275
|
+
bra _oMTDRep3p_32p
|
|
2276
|
+
|
|
2277
|
+
_oMTDRep3_32p:
|
|
2278
|
+
lda.l oammask,x
|
|
2279
|
+
ora.w oamMemory,y
|
|
2280
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2281
|
+
|
|
2282
|
+
_oMTDRep3p_32p:
|
|
2283
|
+
ply
|
|
2284
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
2285
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
2286
|
+
|
|
2287
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
2288
|
+
lda oamnumberperframe ; always small for 8px sprites
|
|
2289
|
+
lsr a
|
|
2290
|
+
lsr a
|
|
2291
|
+
lsr a
|
|
2292
|
+
lsr a
|
|
2293
|
+
clc
|
|
2294
|
+
adc.w #512 ; id>>4 + 512
|
|
2295
|
+
tay ; oam pointer is now on oam table #2
|
|
2296
|
+
|
|
2297
|
+
lda oamnumberperframe ; id
|
|
2298
|
+
lsr a
|
|
2299
|
+
lsr a
|
|
2300
|
+
and.w #$0003 ; id >> 2 & 3
|
|
2301
|
+
tax
|
|
2302
|
+
|
|
2303
|
+
sep #$20
|
|
2304
|
+
lda oamMemory,y ; get value of oam table #2
|
|
2305
|
+
and.l oamSetExand,x
|
|
2306
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
2307
|
+
|
|
2308
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
2309
|
+
ora oamMemory,y
|
|
2310
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
2311
|
+
|
|
2312
|
+
rep #$20
|
|
2313
|
+
inc.w oamnumberspr0 ; one more sprite 32x32
|
|
2314
|
+
|
|
2315
|
+
jmp _oMTDRep1p
|
|
2316
|
+
|
|
2317
|
+
_oMTDRepChx_16p:
|
|
2318
|
+
;--------------draw 16 pix sprite
|
|
2319
|
+
sep #$20
|
|
2320
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
2321
|
+
beq _oMTDRep1_16p
|
|
2322
|
+
lda #$00
|
|
2323
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
2324
|
+
|
|
2325
|
+
rep #$20
|
|
2326
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
2327
|
+
asl a
|
|
2328
|
+
tax
|
|
2329
|
+
lda.l lkup16oamS,x
|
|
2330
|
+
clc
|
|
2331
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
2332
|
+
sta.w sprit_val2
|
|
2333
|
+
|
|
2334
|
+
lda.l oamqueuenumber ; oamAddGfxQueue16(pgfx,GFXSPR0.1ADR+idBlock16);
|
|
2335
|
+
tax ; go to next graphic entry
|
|
2336
|
+
clc
|
|
2337
|
+
adc #$0006
|
|
2338
|
+
sta.l oamqueuenumber
|
|
2339
|
+
|
|
2340
|
+
phx
|
|
2341
|
+
lda spr16addrgfx ; if large sprite, adjust address
|
|
2342
|
+
cmp spr0addrgfx
|
|
2343
|
+
beq +
|
|
2344
|
+
lda oamnumberspr1 ; get address
|
|
2345
|
+
jmp _oMTDRep0p_16p
|
|
2346
|
+
|
|
2347
|
+
+: lda oamnumberspr0 ; get address
|
|
2348
|
+
_oMTDRep0p_16p:
|
|
2349
|
+
asl a
|
|
2350
|
+
tax
|
|
2351
|
+
lda.l lkup16idB,x
|
|
2352
|
+
plx
|
|
2353
|
+
clc
|
|
2354
|
+
adc spr16addrgfx
|
|
2355
|
+
sta.l oamQueueEntry+3,x
|
|
2356
|
+
lda sprit_val2 ; get tileSource (lower 16 bits)
|
|
2357
|
+
sta.l oamQueueEntry,x
|
|
2358
|
+
sep #$20 ; A 16 bits
|
|
2359
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
2360
|
+
sta.l oamQueueEntry+2,x
|
|
2361
|
+
|
|
2362
|
+
lda #OBJ_SPRITE16 ; store that it is a 16pix sprite
|
|
2363
|
+
sta.l oamQueueEntry+5,x
|
|
2364
|
+
|
|
2365
|
+
_oMTDRep1_16p:
|
|
2366
|
+
rep #$20
|
|
2367
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
2368
|
+
|
|
2369
|
+
phx
|
|
2370
|
+
lda spr16addrgfx ; if large sprite, adjust address
|
|
2371
|
+
cmp spr0addrgfx
|
|
2372
|
+
beq +
|
|
2373
|
+
lda oamnumberspr1 ; get address if not big sprite
|
|
2374
|
+
asl a
|
|
2375
|
+
tax
|
|
2376
|
+
lda.l lkup16idT,x
|
|
2377
|
+
jmp _oMTDRep1p_16p
|
|
2378
|
+
|
|
2379
|
+
+: lda oamnumberspr0 ; get address if big sprite
|
|
2380
|
+
asl a
|
|
2381
|
+
tax
|
|
2382
|
+
lda.l lkup16idT0,x
|
|
2383
|
+
_oMTDRep1p_16p:
|
|
2384
|
+
plx
|
|
2385
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
2386
|
+
|
|
2387
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
2388
|
+
xba ; save it
|
|
2389
|
+
sep #$20 ; A 8 bits
|
|
2390
|
+
ror a ; x msb into carry (saved if x>255)
|
|
2391
|
+
|
|
2392
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
2393
|
+
xba
|
|
2394
|
+
rep #$20 ; A 16 bits
|
|
2395
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
2396
|
+
|
|
2397
|
+
lda.w #$0200 ; put $02 into MSB
|
|
2398
|
+
sep #$20 ; A 8 bits
|
|
2399
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
2400
|
+
phy
|
|
2401
|
+
tay
|
|
2402
|
+
|
|
2403
|
+
bcs _oMTDRep3_16p ; if no x<255, no need to update
|
|
2404
|
+
|
|
2405
|
+
lda.l oammask+1,x
|
|
2406
|
+
and.w oamMemory,y
|
|
2407
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2408
|
+
jmp _oMTDRep3p_16p
|
|
2409
|
+
|
|
2410
|
+
_oMTDRep3_16p:
|
|
2411
|
+
lda.l oammask,x
|
|
2412
|
+
ora.w oamMemory,y
|
|
2413
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2414
|
+
|
|
2415
|
+
_oMTDRep3p_16p:
|
|
2416
|
+
ply
|
|
2417
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
2418
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
2419
|
+
|
|
2420
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
2421
|
+
lda oamnumberperframe
|
|
2422
|
+
lsr a
|
|
2423
|
+
lsr a
|
|
2424
|
+
lsr a
|
|
2425
|
+
lsr a
|
|
2426
|
+
clc
|
|
2427
|
+
adc.w #512 ; id>>4 + 512
|
|
2428
|
+
tay ; oam pointer is now on oam table #2
|
|
2429
|
+
|
|
2430
|
+
lda oamnumberperframe ; id
|
|
2431
|
+
lsr a
|
|
2432
|
+
lsr a
|
|
2433
|
+
and.w #$0003 ; id >> 2 & 3
|
|
2434
|
+
tax
|
|
2435
|
+
|
|
2436
|
+
sep #$20
|
|
2437
|
+
lda oamMemory,y ; get value of oam table #2
|
|
2438
|
+
and.l oamSetExand,x
|
|
2439
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
2440
|
+
|
|
2441
|
+
rep #$20
|
|
2442
|
+
lda spr16addrgfx ; if large sprite, adjust it
|
|
2443
|
+
cmp spr1addrgfx
|
|
2444
|
+
beq +
|
|
2445
|
+
sep #$20
|
|
2446
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
2447
|
+
ora oamMemory,y
|
|
2448
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
2449
|
+
|
|
2450
|
+
+: rep #$20
|
|
2451
|
+
lda spr16addrgfx ; if large sprite, adjust address
|
|
2452
|
+
cmp spr0addrgfx
|
|
2453
|
+
beq +
|
|
2454
|
+
inc.w oamnumberspr1 ; one more sprite 16x16 small
|
|
2455
|
+
jmp _oMTDRep1p
|
|
2456
|
+
+: inc.w oamnumberspr0 ; one more sprite 16x16 large
|
|
2457
|
+
jmp _oMTDRep1p
|
|
2458
|
+
|
|
2459
|
+
_oMTDRepChx_8p:
|
|
2460
|
+
;--------------draw 8 pix sprite
|
|
2461
|
+
sep #$20
|
|
2462
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
2463
|
+
beq _oMTDRep1_8p
|
|
2464
|
+
lda #$00
|
|
2465
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
2466
|
+
|
|
2467
|
+
rep #$20
|
|
2468
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
2469
|
+
asl a
|
|
2470
|
+
tax
|
|
2471
|
+
lda.l lkup8oamS,x
|
|
2472
|
+
clc
|
|
2473
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
2474
|
+
sta.w sprit_val2
|
|
2475
|
+
|
|
2476
|
+
lda.l oamqueuenumber ; oamAddGfxQueue8(pgfx,GFXSPR0.1ADR+idBlock8);
|
|
2477
|
+
tax ; go to next graphic entry
|
|
2478
|
+
clc
|
|
2479
|
+
adc #$0006
|
|
2480
|
+
sta.l oamqueuenumber
|
|
2481
|
+
|
|
2482
|
+
phx
|
|
2483
|
+
lda oamnumberspr1 ; get address
|
|
2484
|
+
asl a
|
|
2485
|
+
tax
|
|
2486
|
+
lda.l lkup8idB,x
|
|
2487
|
+
plx
|
|
2488
|
+
clc
|
|
2489
|
+
adc spr1addrgfx ; not variable, always the second gfx entry
|
|
2490
|
+
sta.l oamQueueEntry+3,x
|
|
2491
|
+
lda sprit_val2 ; get tileSource (lower 8 bits)
|
|
2492
|
+
sta.l oamQueueEntry,x
|
|
2493
|
+
sep #$20 ; A 8 bits
|
|
2494
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
2495
|
+
sta.l oamQueueEntry+2,x
|
|
2496
|
+
|
|
2497
|
+
lda #OBJ_SPRITE8 ; store that it is a 8pix sprite
|
|
2498
|
+
sta.l oamQueueEntry+5,x
|
|
2499
|
+
|
|
2500
|
+
_oMTDRep1_8p:
|
|
2501
|
+
rep #$20
|
|
2502
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
2503
|
+
|
|
2504
|
+
phx
|
|
2505
|
+
lda oamnumberspr1 ; get graphics offset of 8x8 sprites
|
|
2506
|
+
asl a
|
|
2507
|
+
tax
|
|
2508
|
+
lda.l lkup8idT,x
|
|
2509
|
+
plx
|
|
2510
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
2511
|
+
|
|
2512
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
2513
|
+
xba ; save it
|
|
2514
|
+
sep #$20 ; A 8 bits
|
|
2515
|
+
ror a ; x msb into carry (saved if x>255)
|
|
2516
|
+
|
|
2517
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
2518
|
+
xba
|
|
2519
|
+
rep #$20 ; A 8 bits
|
|
2520
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
2521
|
+
|
|
2522
|
+
lda.w #$0200 ; put $02 into MSB
|
|
2523
|
+
sep #$20 ; A 8 bits
|
|
2524
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
2525
|
+
phy
|
|
2526
|
+
tay
|
|
2527
|
+
|
|
2528
|
+
bcs _oMTDRep3_8p ; if no x<255, no need to update
|
|
2529
|
+
|
|
2530
|
+
lda.l oammask+1,x
|
|
2531
|
+
and.w oamMemory,y
|
|
2532
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2533
|
+
jmp _oMTDRep3p_8p
|
|
2534
|
+
|
|
2535
|
+
_oMTDRep3_8p:
|
|
2536
|
+
lda.l oammask,x
|
|
2537
|
+
ora.w oamMemory,y
|
|
2538
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2539
|
+
|
|
2540
|
+
_oMTDRep3p_8p:
|
|
2541
|
+
ply
|
|
2542
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
2543
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
2544
|
+
|
|
2545
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
2546
|
+
lda oamnumberperframe ; always small for 8px sprites
|
|
2547
|
+
lsr a
|
|
2548
|
+
lsr a
|
|
2549
|
+
lsr a
|
|
2550
|
+
lsr a
|
|
2551
|
+
clc
|
|
2552
|
+
adc.w #512 ; id>>4 + 512
|
|
2553
|
+
tay ; oam pointer is now on oam table #2
|
|
2554
|
+
|
|
2555
|
+
lda oamnumberperframe ; id
|
|
2556
|
+
lsr a
|
|
2557
|
+
lsr a
|
|
2558
|
+
and.w #$0003 ; id >> 2 & 3
|
|
2559
|
+
tax
|
|
2560
|
+
|
|
2561
|
+
sep #$20
|
|
2562
|
+
lda oamMemory,y ; get value of oam table #2
|
|
2563
|
+
and.l oamSetExand,x
|
|
2564
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
2565
|
+
|
|
2566
|
+
rep #$20
|
|
2567
|
+
inc.w oamnumberspr1 ; one more sprite 8x8
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
_oMTDRep1p:
|
|
2571
|
+
rep #$20
|
|
2572
|
+
lda oamnumberperframe ; go to next sprite entry (x4 multiplier)
|
|
2573
|
+
clc
|
|
2574
|
+
adc #$0004
|
|
2575
|
+
sta.w oamnumberperframe
|
|
2576
|
+
|
|
2577
|
+
.accu 16
|
|
2578
|
+
plx ; restore value pushed before displaying sprites
|
|
2579
|
+
txa ; go to next oambuffer
|
|
2580
|
+
clc
|
|
2581
|
+
adc #16
|
|
2582
|
+
tax
|
|
2583
|
+
ply ; saved before displaying sprites 32,16 & 8
|
|
2584
|
+
|
|
2585
|
+
;lda [tcc__r0], y ; get end or no
|
|
2586
|
+
;iny ; 4 inc to go to next id
|
|
2587
|
+
;iny
|
|
2588
|
+
;iny
|
|
2589
|
+
;iny
|
|
2590
|
+
;cmp #$FFFF
|
|
2591
|
+
;beq _oMTDRepEnd0p
|
|
2592
|
+
jmp _oMTDRep0p
|
|
2593
|
+
|
|
2594
|
+
_oMTDRepEnd0p:
|
|
2595
|
+
ply
|
|
2596
|
+
plx
|
|
2597
|
+
plb
|
|
2598
|
+
plp
|
|
2599
|
+
|
|
2600
|
+
rtl
|
|
2601
|
+
|
|
2602
|
+
.ENDS
|
|
2603
|
+
|
|
2604
|
+
.SECTION ".spritesc_text" SUPERFREE
|
|
2605
|
+
|
|
2606
|
+
;---------------------------------------------------------------------------------
|
|
2607
|
+
; void oamSort(u8 id)
|
|
2608
|
+
; 10
|
|
2609
|
+
oamSort:
|
|
2610
|
+
php
|
|
2611
|
+
phb
|
|
2612
|
+
phx
|
|
2613
|
+
|
|
2614
|
+
sep #$20
|
|
2615
|
+
lda #$7e
|
|
2616
|
+
pha
|
|
2617
|
+
plb
|
|
2618
|
+
|
|
2619
|
+
; lda #TABLE_SIZE - 1 ; Initialize high index
|
|
2620
|
+
; ldx #0 ; Initialize low index
|
|
2621
|
+
|
|
2622
|
+
jsr quicksort ; Perform quicksort
|
|
2623
|
+
|
|
2624
|
+
plx
|
|
2625
|
+
plb
|
|
2626
|
+
plp
|
|
2627
|
+
|
|
2628
|
+
rtl
|
|
2629
|
+
|
|
2630
|
+
quicksort: ; Quicksort algorithm
|
|
2631
|
+
pha ; Save registers
|
|
2632
|
+
phx
|
|
2633
|
+
phy
|
|
2634
|
+
|
|
2635
|
+
; LDX #VAR1_OFFSET ; Sort based on VAR1
|
|
2636
|
+
|
|
2637
|
+
; LDA HIGH_IDX ; Load high index
|
|
2638
|
+
; STA TEMP_HIGH
|
|
2639
|
+
|
|
2640
|
+
; LDA LOW_IDX ; Load low index
|
|
2641
|
+
; STA TEMP_LOW
|
|
2642
|
+
|
|
2643
|
+
; LDX TEMP_LOW ; Load low index into X
|
|
2644
|
+
|
|
2645
|
+
; INX ; Increment low index
|
|
2646
|
+
|
|
2647
|
+
; LDA TABLE, X ; Load pivot element
|
|
2648
|
+
; STA PIVOT
|
|
2649
|
+
|
|
2650
|
+
; Partition the table
|
|
2651
|
+
partition_loop:
|
|
2652
|
+
; LDA TABLE, X ; Load element for comparison
|
|
2653
|
+
; CMP PIVOT
|
|
2654
|
+
|
|
2655
|
+
BCC increment_low_index ; If element is less than pivot, increment low index
|
|
2656
|
+
|
|
2657
|
+
; Swap elements
|
|
2658
|
+
; LDA TABLE, X
|
|
2659
|
+
; STA TABLE, TEMP_HIGH
|
|
2660
|
+
; LDA TABLE, TEMP_LOW
|
|
2661
|
+
; STA TABLE, X
|
|
2662
|
+
|
|
2663
|
+
; DEC TEMP_HIGH ; Decrement high index
|
|
2664
|
+
; DEY ; Decrement Y
|
|
2665
|
+
|
|
2666
|
+
; Check if all elements have been partitioned
|
|
2667
|
+
; CPX TEMP_HIGH
|
|
2668
|
+
; BCC partition_loop ; If not, continue partitioning
|
|
2669
|
+
|
|
2670
|
+
; Swap pivot element into its correct position
|
|
2671
|
+
; LDA TABLE, X
|
|
2672
|
+
; STA TABLE, TEMP_HIGH
|
|
2673
|
+
; LDA PIVOT
|
|
2674
|
+
; STA TABLE, X
|
|
2675
|
+
|
|
2676
|
+
; Recursive calls to quicksort
|
|
2677
|
+
; LDA TEMP_LOW
|
|
2678
|
+
; CMP LOW_IDX
|
|
2679
|
+
; BCC skip_left
|
|
2680
|
+
; STA HIGH_IDX
|
|
2681
|
+
; JSR quicksort
|
|
2682
|
+
|
|
2683
|
+
skip_left:
|
|
2684
|
+
; LDA TEMP_HIGH
|
|
2685
|
+
; CMP HIGH_IDX
|
|
2686
|
+
; BCC skip_right
|
|
2687
|
+
; STA LOW_IDX
|
|
2688
|
+
; JSR quicksort
|
|
2689
|
+
|
|
2690
|
+
skip_right:
|
|
2691
|
+
ply
|
|
2692
|
+
plx
|
|
2693
|
+
pla
|
|
2694
|
+
|
|
2695
|
+
rts ; Return from subroutine
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
.ENDS
|
|
2699
|
+
|
|
2700
|
+
.SECTION ".spritesmt1_text" SUPERFREE
|
|
2701
|
+
|
|
2702
|
+
;---------------------------------------------------------------------------------
|
|
2703
|
+
; void oamMetaDrawDyn32(u16 id, s16 x,s16 y, u8 *sprmeta,u8 *gfxptr)
|
|
2704
|
+
; 10-11 12-13 14-15 16-19 20-23
|
|
2705
|
+
oamMetaDrawDyn32:
|
|
2706
|
+
php
|
|
2707
|
+
phb
|
|
2708
|
+
phx
|
|
2709
|
+
phy
|
|
2710
|
+
|
|
2711
|
+
sep #$20
|
|
2712
|
+
lda #$7e
|
|
2713
|
+
pha
|
|
2714
|
+
plb
|
|
2715
|
+
|
|
2716
|
+
rep #$20
|
|
2717
|
+
lda 10,s ; get id of sprite
|
|
2718
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
2719
|
+
asl a
|
|
2720
|
+
asl a
|
|
2721
|
+
asl a
|
|
2722
|
+
tax ; x is now the id of oam buffer
|
|
2723
|
+
lda #0
|
|
2724
|
+
tay ; y is now the id of meta sprite buffer
|
|
2725
|
+
|
|
2726
|
+
lda 12,s ; save x coordinate
|
|
2727
|
+
sta sprit_mxsvg
|
|
2728
|
+
lda 14,s ; save y coordinate
|
|
2729
|
+
sta sprit_mysvg
|
|
2730
|
+
|
|
2731
|
+
lda 16,s
|
|
2732
|
+
sta tcc__r0 ; tcc_r0 = meta sprite source address
|
|
2733
|
+
|
|
2734
|
+
sep #$20
|
|
2735
|
+
lda 18,s ; bank of meta sprite source address
|
|
2736
|
+
sta tcc__r0h
|
|
2737
|
+
|
|
2738
|
+
lda oambuffer.1.oamrefresh,x ; get 1st sprite refresh value, which will be the default
|
|
2739
|
+
sta sprit_val0
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
_oMTDD32Rep0p:
|
|
2743
|
+
rep #$20 ; mandatory because of the loop
|
|
2744
|
+
lda [tcc__r0], y ; get x offset and calculate x coordinate of sprite
|
|
2745
|
+
cmp #$FF80 ; if we reached the end of table (-128 in 16 bits), go out
|
|
2746
|
+
bne _oMTDD32Rep0p_ok
|
|
2747
|
+
jmp _oMTDD32RepEnd0p
|
|
2748
|
+
|
|
2749
|
+
_oMTDD32Rep0p_ok:
|
|
2750
|
+
iny
|
|
2751
|
+
iny
|
|
2752
|
+
clc
|
|
2753
|
+
adc sprit_mxsvg ; todo test if > 256
|
|
2754
|
+
sta oambuffer.1.oamx,x
|
|
2755
|
+
|
|
2756
|
+
lda [tcc__r0], y ; get y offset and calculate y coordinate of sprite
|
|
2757
|
+
iny
|
|
2758
|
+
iny
|
|
2759
|
+
clc
|
|
2760
|
+
adc sprit_mysvg ; todo test if > 256
|
|
2761
|
+
sta oambuffer.1.oamy,x
|
|
2762
|
+
|
|
2763
|
+
lda [tcc__r0], y ; get frameid
|
|
2764
|
+
iny
|
|
2765
|
+
iny
|
|
2766
|
+
sta oambuffer.1.oamframeid,x
|
|
2767
|
+
|
|
2768
|
+
sep #$20
|
|
2769
|
+
lda [tcc__r0], y ; get attribute
|
|
2770
|
+
iny
|
|
2771
|
+
iny
|
|
2772
|
+
sta oambuffer.1.oamattribute,x ; no change of size, it is necessarily big
|
|
2773
|
+
|
|
2774
|
+
rep #$20
|
|
2775
|
+
lda 20,s ; get graphic address
|
|
2776
|
+
sta oambuffer.1.oamgraphics,x
|
|
2777
|
+
lda 22, s ; get graphic address (bank)
|
|
2778
|
+
sta oambuffer.1.oamgraphics+2,x
|
|
2779
|
+
phy ; because we will need it at the end for the table
|
|
2780
|
+
|
|
2781
|
+
txa ; push sprite id (must be in 0..127 range)
|
|
2782
|
+
phx ; because we will need it at the end for the table
|
|
2783
|
+
tay ; id normaly passed as argument of drawing function
|
|
2784
|
+
|
|
2785
|
+
sep #$20
|
|
2786
|
+
lda sprit_val0
|
|
2787
|
+
sta oambuffer.1.oamrefresh,y ; save initial sprite refresh value
|
|
2788
|
+
|
|
2789
|
+
;--------------push 16 pix sprite graphic on queue if needed
|
|
2790
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
2791
|
+
beq _oMTDD32Rep1_16p
|
|
2792
|
+
lda #$00
|
|
2793
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
2794
|
+
|
|
2795
|
+
rep #$20
|
|
2796
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
2797
|
+
asl a
|
|
2798
|
+
tax
|
|
2799
|
+
lda.l lkup32oamS,x
|
|
2800
|
+
clc
|
|
2801
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
2802
|
+
sta.w sprit_val2
|
|
2803
|
+
|
|
2804
|
+
lda.l oamqueuenumber ; oamAddGfxQueue16(pgfx,GFXSPR0.1ADR+idBlock16);
|
|
2805
|
+
tax ; go to next graphic entry
|
|
2806
|
+
clc
|
|
2807
|
+
adc #$0006
|
|
2808
|
+
sta.l oamqueuenumber
|
|
2809
|
+
|
|
2810
|
+
phx ; for large sprite, adjust address
|
|
2811
|
+
lda oamnumberspr0 ; get address for large
|
|
2812
|
+
|
|
2813
|
+
asl a
|
|
2814
|
+
tax
|
|
2815
|
+
lda.l lkup32idB,x
|
|
2816
|
+
plx
|
|
2817
|
+
clc
|
|
2818
|
+
adc spr0addrgfx
|
|
2819
|
+
sta.l oamQueueEntry+3,x
|
|
2820
|
+
lda sprit_val2 ; get tileSource (lower 16 bits)
|
|
2821
|
+
sta.l oamQueueEntry,x
|
|
2822
|
+
sep #$20 ; A 16 bits
|
|
2823
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
2824
|
+
sta.l oamQueueEntry+2,x
|
|
2825
|
+
|
|
2826
|
+
lda #OBJ_SPRITE32 ; store that it is a 16pix sprite
|
|
2827
|
+
sta.l oamQueueEntry+5,x
|
|
2828
|
+
|
|
2829
|
+
_oMTDD32Rep1_16p:
|
|
2830
|
+
rep #$20
|
|
2831
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
2832
|
+
|
|
2833
|
+
phx ; no adjust for big sprite
|
|
2834
|
+
lda oamnumberspr0 ; get address if large sprite
|
|
2835
|
+
asl a
|
|
2836
|
+
tax
|
|
2837
|
+
lda.l lkup32idT,x
|
|
2838
|
+
_oMTDD32Rep1p_16p:
|
|
2839
|
+
plx
|
|
2840
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
2841
|
+
|
|
2842
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
2843
|
+
xba ; save it
|
|
2844
|
+
sep #$20 ; A 8 bits
|
|
2845
|
+
ror a ; x msb into carry (saved if x>255)
|
|
2846
|
+
|
|
2847
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
2848
|
+
xba
|
|
2849
|
+
rep #$20 ; A 16 bits
|
|
2850
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
2851
|
+
|
|
2852
|
+
lda.w #$0200 ; put $02 into MSB
|
|
2853
|
+
sep #$20 ; A 8 bits
|
|
2854
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
2855
|
+
phy
|
|
2856
|
+
tay
|
|
2857
|
+
|
|
2858
|
+
bcs _oMTDD32Rep3_16p ; if no x<255, no need to update
|
|
2859
|
+
|
|
2860
|
+
lda.l oammask+1,x
|
|
2861
|
+
and.w oamMemory,y
|
|
2862
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2863
|
+
bra _oMTDD32Rep3p_16p
|
|
2864
|
+
|
|
2865
|
+
_oMTDD32Rep3_16p:
|
|
2866
|
+
lda.l oammask,x
|
|
2867
|
+
ora.w oamMemory,y
|
|
2868
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
2869
|
+
|
|
2870
|
+
_oMTDD32Rep3p_16p:
|
|
2871
|
+
ply
|
|
2872
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
2873
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
2874
|
+
|
|
2875
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_LARGE, OBJ_SHOW);
|
|
2876
|
+
lda oamnumberperframe
|
|
2877
|
+
lsr a
|
|
2878
|
+
lsr a
|
|
2879
|
+
lsr a
|
|
2880
|
+
lsr a
|
|
2881
|
+
clc
|
|
2882
|
+
adc.w #512 ; id>>4 + 512
|
|
2883
|
+
tay ; oam pointer is now on oam table #2
|
|
2884
|
+
|
|
2885
|
+
lda oamnumberperframe ; id
|
|
2886
|
+
lsr a
|
|
2887
|
+
lsr a
|
|
2888
|
+
and.w #$0003 ; id >> 2 & 3
|
|
2889
|
+
tax
|
|
2890
|
+
|
|
2891
|
+
sep #$20
|
|
2892
|
+
lda oamMemory,y ; get value of oam table #2
|
|
2893
|
+
and.l oamSetExand,x
|
|
2894
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
2895
|
+
|
|
2896
|
+
lda.l oamSizeshift,x ; for large sprite, get shifted value of hide (<<1, <<3, <<5, <<7 for large one
|
|
2897
|
+
ora oamMemory,y
|
|
2898
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
2899
|
+
|
|
2900
|
+
rep #$20
|
|
2901
|
+
inc.w oamnumberspr0 ; one more sprite 16x16 large
|
|
2902
|
+
|
|
2903
|
+
lda oamnumberperframe ; go to next sprite entry (x4 multiplier)
|
|
2904
|
+
clc
|
|
2905
|
+
adc #$0004
|
|
2906
|
+
sta.w oamnumberperframe
|
|
2907
|
+
|
|
2908
|
+
.accu 16
|
|
2909
|
+
plx ; restore value pushed before displaying sprites
|
|
2910
|
+
txa ; go to next oambuffer
|
|
2911
|
+
clc
|
|
2912
|
+
adc #16
|
|
2913
|
+
tax
|
|
2914
|
+
ply ; saved before displaying sprites 32,16 & 8
|
|
2915
|
+
|
|
2916
|
+
jmp _oMTDD32Rep0p
|
|
2917
|
+
|
|
2918
|
+
_oMTDD32RepEnd0p:
|
|
2919
|
+
ply
|
|
2920
|
+
plx
|
|
2921
|
+
plb
|
|
2922
|
+
plp
|
|
2923
|
+
|
|
2924
|
+
rtl
|
|
2925
|
+
|
|
2926
|
+
.ENDS
|
|
2927
|
+
|
|
2928
|
+
.SECTION ".spritesmt2_text" SUPERFREE
|
|
2929
|
+
|
|
2930
|
+
;---------------------------------------------------------------------------------
|
|
2931
|
+
; void oamMetaDraw32(u16 id, s16 x,s16 y, u8 *sprmeta, u16 ofsgfx)
|
|
2932
|
+
; 10-11 12-13 14-15 16-19 20-21
|
|
2933
|
+
oamMetaDraw32:
|
|
2934
|
+
php
|
|
2935
|
+
phb
|
|
2936
|
+
phx
|
|
2937
|
+
phy
|
|
2938
|
+
|
|
2939
|
+
sep #$20
|
|
2940
|
+
lda #$7e
|
|
2941
|
+
pha
|
|
2942
|
+
plb
|
|
2943
|
+
|
|
2944
|
+
rep #$20
|
|
2945
|
+
lda 10,s ; get id of sprite
|
|
2946
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
2947
|
+
asl a
|
|
2948
|
+
sta.w sprit_val0 ; save id of sprite
|
|
2949
|
+
asl a
|
|
2950
|
+
asl a
|
|
2951
|
+
tax ; x is now the id of oam buffer
|
|
2952
|
+
lda #0
|
|
2953
|
+
tay ; y is now the id of meta sprite buffer
|
|
2954
|
+
|
|
2955
|
+
lda 12,s ; save x coordinate
|
|
2956
|
+
sta sprit_mxsvg
|
|
2957
|
+
lda 14,s ; save y coordinate
|
|
2958
|
+
sta sprit_mysvg
|
|
2959
|
+
|
|
2960
|
+
lda 16,s
|
|
2961
|
+
sta tcc__r0 ; tcc_r0 = meta sprite source address
|
|
2962
|
+
|
|
2963
|
+
sep #$20
|
|
2964
|
+
lda 18,s ; bank of meta sprite source address
|
|
2965
|
+
sta tcc__r0h
|
|
2966
|
+
|
|
2967
|
+
_oMTD32Rep0p:
|
|
2968
|
+
rep #$20 ; mandatory because of the loop
|
|
2969
|
+
lda [tcc__r0], y ; get x offset and calculate x coordinate of sprite
|
|
2970
|
+
cmp #$FF80 ; if we reached the end of table (-128 in 16 bits), go out
|
|
2971
|
+
bne _oMTD32Rep0p_ok
|
|
2972
|
+
jmp _oMTD32RepEnd0p
|
|
2973
|
+
|
|
2974
|
+
_oMTD32Rep0p_ok:
|
|
2975
|
+
iny
|
|
2976
|
+
iny
|
|
2977
|
+
clc
|
|
2978
|
+
adc sprit_mxsvg ; todo test if > 256
|
|
2979
|
+
sta oambuffer.1.oamx,x
|
|
2980
|
+
|
|
2981
|
+
lda [tcc__r0], y ; get y offset and calculate y coordinate of sprite
|
|
2982
|
+
iny
|
|
2983
|
+
iny
|
|
2984
|
+
clc
|
|
2985
|
+
adc sprit_mysvg ; todo test if > 256
|
|
2986
|
+
sta oambuffer.1.oamy,x
|
|
2987
|
+
|
|
2988
|
+
lda [tcc__r0], y ; get frameid
|
|
2989
|
+
iny
|
|
2990
|
+
iny
|
|
2991
|
+
sta oambuffer.1.oamframeid,x
|
|
2992
|
+
|
|
2993
|
+
sep #$20
|
|
2994
|
+
lda [tcc__r0], y ; get attribute
|
|
2995
|
+
iny
|
|
2996
|
+
iny
|
|
2997
|
+
sta oambuffer.1.oamattribute,x ; necessarilly LARGE
|
|
2998
|
+
rep #$20
|
|
2999
|
+
|
|
3000
|
+
phy ; because we will need it at the end for the table
|
|
3001
|
+
|
|
3002
|
+
txa ; push sprite id (must be in 0..127 range)
|
|
3003
|
+
phx ; because we will need it at the end for the table
|
|
3004
|
+
tay ; id normaly passed as argument of drawing function
|
|
3005
|
+
|
|
3006
|
+
lda sprit_val0 ; get current graphic number
|
|
3007
|
+
pha ; will be restore in x
|
|
3008
|
+
lsr a ; for lookup spriteid entry (nb>>4 *2)
|
|
3009
|
+
tax
|
|
3010
|
+
lda.l lkup32idT,x
|
|
3011
|
+
|
|
3012
|
+
plx
|
|
3013
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
3014
|
+
|
|
3015
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
3016
|
+
xba ; save it
|
|
3017
|
+
sep #$20 ; A 8 bits
|
|
3018
|
+
ror a ; x msb into carry (saved if x>255)
|
|
3019
|
+
|
|
3020
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
3021
|
+
xba
|
|
3022
|
+
rep #$20 ; A 16 bits
|
|
3023
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
3024
|
+
|
|
3025
|
+
lda.w #$0200 ; put $02 into MSB
|
|
3026
|
+
sep #$20 ; A 8 bits
|
|
3027
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
3028
|
+
phy
|
|
3029
|
+
tay
|
|
3030
|
+
|
|
3031
|
+
bcs _oMTD32Rep3_16p ; if no x<255, no need to update
|
|
3032
|
+
|
|
3033
|
+
lda.l oammask+1,x
|
|
3034
|
+
and.w oamMemory,y
|
|
3035
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3036
|
+
bra _oMTD32Rep3p_16p
|
|
3037
|
+
|
|
3038
|
+
_oMTD32Rep3_16p:
|
|
3039
|
+
lda.l oammask,x
|
|
3040
|
+
ora.w oamMemory,y
|
|
3041
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3042
|
+
|
|
3043
|
+
_oMTD32Rep3p_16p:
|
|
3044
|
+
ply
|
|
3045
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
3046
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
3047
|
+
|
|
3048
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_LARGE, OBJ_SHOW);
|
|
3049
|
+
lda sprit_val0
|
|
3050
|
+
lsr a
|
|
3051
|
+
lsr a
|
|
3052
|
+
lsr a
|
|
3053
|
+
lsr a
|
|
3054
|
+
clc
|
|
3055
|
+
adc.w #512 ; id>>4 + 512
|
|
3056
|
+
tay ; oam pointer is now on oam table #2
|
|
3057
|
+
|
|
3058
|
+
lda sprit_val0 ; id
|
|
3059
|
+
lsr a
|
|
3060
|
+
lsr a
|
|
3061
|
+
and.w #$0003 ; id >> 2 & 3
|
|
3062
|
+
tax
|
|
3063
|
+
|
|
3064
|
+
sep #$20
|
|
3065
|
+
lda oamMemory,y ; get value of oam table #2
|
|
3066
|
+
and.l oamSetExand,x
|
|
3067
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3068
|
+
|
|
3069
|
+
lda.l oamSizeshift,x ; for large sprite, adjust it, get shifted value of hide (<<1, <<3, <<5, <<7
|
|
3070
|
+
ora oamMemory,y
|
|
3071
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3072
|
+
|
|
3073
|
+
rep #$20 ; for large sprite, adjust address (20+2+2)
|
|
3074
|
+
lda sprit_val0 ; go to next sprite entry (x4 multiplier)
|
|
3075
|
+
clc
|
|
3076
|
+
adc #$0004
|
|
3077
|
+
sta.w sprit_val0
|
|
3078
|
+
|
|
3079
|
+
.accu 16
|
|
3080
|
+
plx ; restore value pushed before displaying sprites
|
|
3081
|
+
txa ; go to next oambuffer
|
|
3082
|
+
clc
|
|
3083
|
+
adc #16
|
|
3084
|
+
tax
|
|
3085
|
+
ply ; saved before displaying sprites 32,16 & 8
|
|
3086
|
+
|
|
3087
|
+
jmp _oMTD32Rep0p
|
|
3088
|
+
|
|
3089
|
+
_oMTD32RepEnd0p:
|
|
3090
|
+
ply
|
|
3091
|
+
plx
|
|
3092
|
+
plb
|
|
3093
|
+
plp
|
|
3094
|
+
|
|
3095
|
+
rtl
|
|
3096
|
+
|
|
3097
|
+
.ENDS
|
|
3098
|
+
|
|
3099
|
+
.SECTION ".spritesmt3_text" SUPERFREE
|
|
3100
|
+
|
|
3101
|
+
;---------------------------------------------------------------------------------
|
|
3102
|
+
; void oamMetaDrawDyn16(u16 id, s16 x,s16 y, u8 *sprmeta,u8 *gfxptr, u16 sprsize)
|
|
3103
|
+
; 10-11 12-13 14-15 16-19 20-23 24
|
|
3104
|
+
oamMetaDrawDyn16:
|
|
3105
|
+
php
|
|
3106
|
+
phb
|
|
3107
|
+
phx
|
|
3108
|
+
phy
|
|
3109
|
+
|
|
3110
|
+
sep #$20
|
|
3111
|
+
lda #$7e
|
|
3112
|
+
pha
|
|
3113
|
+
plb
|
|
3114
|
+
|
|
3115
|
+
rep #$20
|
|
3116
|
+
lda 10,s ; get id of sprite
|
|
3117
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
3118
|
+
asl a
|
|
3119
|
+
asl a
|
|
3120
|
+
asl a
|
|
3121
|
+
tax ; x is now the id of oam buffer
|
|
3122
|
+
lda #0
|
|
3123
|
+
tay ; y is now the id of meta sprite buffer
|
|
3124
|
+
|
|
3125
|
+
lda 12,s ; save x coordinate
|
|
3126
|
+
sta sprit_mxsvg
|
|
3127
|
+
lda 14,s ; save y coordinate
|
|
3128
|
+
sta sprit_mysvg
|
|
3129
|
+
|
|
3130
|
+
lda 16,s
|
|
3131
|
+
sta tcc__r0 ; tcc_r0 = meta sprite source address
|
|
3132
|
+
|
|
3133
|
+
sep #$20
|
|
3134
|
+
lda 18,s ; bank of meta sprite source address
|
|
3135
|
+
sta tcc__r0h
|
|
3136
|
+
|
|
3137
|
+
lda oambuffer.1.oamrefresh,x ; get 1st sprite refresh value, which will be the default
|
|
3138
|
+
sta sprit_val0
|
|
3139
|
+
|
|
3140
|
+
|
|
3141
|
+
_oMTDDRep0p:
|
|
3142
|
+
rep #$20 ; mandatory because of the loop
|
|
3143
|
+
lda [tcc__r0], y ; get x offset and calculate x coordinate of sprite
|
|
3144
|
+
cmp #$FF80 ; if we reached the end of table (-128 in 16 bits), go out
|
|
3145
|
+
bne _oMTDDRep0p_ok
|
|
3146
|
+
jmp _oMTDDRepEnd0p
|
|
3147
|
+
|
|
3148
|
+
_oMTDDRep0p_ok:
|
|
3149
|
+
iny
|
|
3150
|
+
iny
|
|
3151
|
+
clc
|
|
3152
|
+
adc sprit_mxsvg ; todo test if > 256
|
|
3153
|
+
sta oambuffer.1.oamx,x
|
|
3154
|
+
|
|
3155
|
+
lda [tcc__r0], y ; get y offset and calculate y coordinate of sprite
|
|
3156
|
+
iny
|
|
3157
|
+
iny
|
|
3158
|
+
clc
|
|
3159
|
+
adc sprit_mysvg ; todo test if > 256
|
|
3160
|
+
sta oambuffer.1.oamy,x
|
|
3161
|
+
|
|
3162
|
+
lda [tcc__r0], y ; get frameid
|
|
3163
|
+
iny
|
|
3164
|
+
iny
|
|
3165
|
+
sta oambuffer.1.oamframeid,x
|
|
3166
|
+
|
|
3167
|
+
sep #$20
|
|
3168
|
+
lda [tcc__r0], y ; get attribute
|
|
3169
|
+
iny
|
|
3170
|
+
iny
|
|
3171
|
+
sta oambuffer.1.oamattribute,x
|
|
3172
|
+
|
|
3173
|
+
rep #$20
|
|
3174
|
+
lda 24,s ; get size
|
|
3175
|
+
bne +
|
|
3176
|
+
sep #$20 ; if small size, add upper 1bit to attribute
|
|
3177
|
+
lda oambuffer.1.oamattribute,x
|
|
3178
|
+
ora #$1
|
|
3179
|
+
sta oambuffer.1.oamattribute,x
|
|
3180
|
+
rep #$20
|
|
3181
|
+
|
|
3182
|
+
+: lda 20,s ; get graphic address
|
|
3183
|
+
sta oambuffer.1.oamgraphics,x
|
|
3184
|
+
lda 22, s ; get graphic address (bank)
|
|
3185
|
+
sta oambuffer.1.oamgraphics+2,x
|
|
3186
|
+
phy ; because we will need it at the end for the table
|
|
3187
|
+
|
|
3188
|
+
txa ; push sprite id (must be in 0..127 range)
|
|
3189
|
+
phx ; because we will need it at the end for the table
|
|
3190
|
+
tay ; id normaly passed as argument of drawing function
|
|
3191
|
+
|
|
3192
|
+
sep #$20
|
|
3193
|
+
lda sprit_val0
|
|
3194
|
+
sta oambuffer.1.oamrefresh,y ; save initial sprite refresh value
|
|
3195
|
+
|
|
3196
|
+
;--------------push 16 pix sprite graphic on queue if needed
|
|
3197
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
3198
|
+
beq _oMTDDRep1_16p
|
|
3199
|
+
lda #$00
|
|
3200
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
3201
|
+
|
|
3202
|
+
rep #$20
|
|
3203
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
3204
|
+
asl a
|
|
3205
|
+
tax
|
|
3206
|
+
lda.l lkup16oamS,x
|
|
3207
|
+
clc
|
|
3208
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
3209
|
+
sta.w sprit_val2
|
|
3210
|
+
|
|
3211
|
+
lda.l oamqueuenumber ; oamAddGfxQueue16(pgfx,GFXSPR0.1ADR+idBlock16);
|
|
3212
|
+
tax ; go to next graphic entry
|
|
3213
|
+
clc
|
|
3214
|
+
adc #$0006
|
|
3215
|
+
sta.l oamqueuenumber
|
|
3216
|
+
|
|
3217
|
+
phx
|
|
3218
|
+
lda 30,s ; if large sprite, adjust address (24+2+2+2)
|
|
3219
|
+
bne +
|
|
3220
|
+
lda oamnumberspr1 ; get address for small
|
|
3221
|
+
bra _oMTDDRep0p_16p
|
|
3222
|
+
|
|
3223
|
+
+: lda oamnumberspr0 ; get address for large
|
|
3224
|
+
_oMTDDRep0p_16p:
|
|
3225
|
+
asl a
|
|
3226
|
+
tax
|
|
3227
|
+
lda.l lkup16idB,x
|
|
3228
|
+
plx
|
|
3229
|
+
clc
|
|
3230
|
+
adc spr16addrgfx
|
|
3231
|
+
sta.l oamQueueEntry+3,x
|
|
3232
|
+
lda sprit_val2 ; get tileSource (lower 16 bits)
|
|
3233
|
+
sta.l oamQueueEntry,x
|
|
3234
|
+
sep #$20 ; A 16 bits
|
|
3235
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
3236
|
+
sta.l oamQueueEntry+2,x
|
|
3237
|
+
|
|
3238
|
+
lda #OBJ_SPRITE16 ; store that it is a 16pix sprite
|
|
3239
|
+
sta.l oamQueueEntry+5,x
|
|
3240
|
+
|
|
3241
|
+
_oMTDDRep1_16p:
|
|
3242
|
+
rep #$20
|
|
3243
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
3244
|
+
|
|
3245
|
+
phx
|
|
3246
|
+
lda 30,s ; if large sprite, adjust address (22+2+2+2)
|
|
3247
|
+
bne +
|
|
3248
|
+
lda oamnumberspr1 ; get address if small sprite
|
|
3249
|
+
asl a
|
|
3250
|
+
tax
|
|
3251
|
+
lda.l lkup16idT,x
|
|
3252
|
+
bra _oMTDDRep1p_16p
|
|
3253
|
+
|
|
3254
|
+
+: lda oamnumberspr0 ; get address if large sprite
|
|
3255
|
+
asl a
|
|
3256
|
+
tax
|
|
3257
|
+
lda.l lkup16idT0,x
|
|
3258
|
+
_oMTDDRep1p_16p:
|
|
3259
|
+
plx
|
|
3260
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
3261
|
+
|
|
3262
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
3263
|
+
xba ; save it
|
|
3264
|
+
sep #$20 ; A 8 bits
|
|
3265
|
+
ror a ; x msb into carry (saved if x>255)
|
|
3266
|
+
|
|
3267
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
3268
|
+
xba
|
|
3269
|
+
rep #$20 ; A 16 bits
|
|
3270
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
3271
|
+
|
|
3272
|
+
lda.w #$0200 ; put $02 into MSB
|
|
3273
|
+
sep #$20 ; A 8 bits
|
|
3274
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
3275
|
+
phy
|
|
3276
|
+
tay
|
|
3277
|
+
|
|
3278
|
+
bcs _oMTDDRep3_16p ; if no x<255, no need to update
|
|
3279
|
+
|
|
3280
|
+
lda.l oammask+1,x
|
|
3281
|
+
and.w oamMemory,y
|
|
3282
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3283
|
+
bra _oMTDDRep3p_16p
|
|
3284
|
+
|
|
3285
|
+
_oMTDDRep3_16p:
|
|
3286
|
+
lda.l oammask,x
|
|
3287
|
+
ora.w oamMemory,y
|
|
3288
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3289
|
+
|
|
3290
|
+
_oMTDDRep3p_16p:
|
|
3291
|
+
ply
|
|
3292
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
3293
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
3294
|
+
|
|
3295
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
3296
|
+
lda oamnumberperframe
|
|
3297
|
+
lsr a
|
|
3298
|
+
lsr a
|
|
3299
|
+
lsr a
|
|
3300
|
+
lsr a
|
|
3301
|
+
clc
|
|
3302
|
+
adc.w #512 ; id>>4 + 512
|
|
3303
|
+
tay ; oam pointer is now on oam table #2
|
|
3304
|
+
|
|
3305
|
+
lda oamnumberperframe ; id
|
|
3306
|
+
lsr a
|
|
3307
|
+
lsr a
|
|
3308
|
+
and.w #$0003 ; id >> 2 & 3
|
|
3309
|
+
tax
|
|
3310
|
+
|
|
3311
|
+
sep #$20
|
|
3312
|
+
lda oamMemory,y ; get value of oam table #2
|
|
3313
|
+
and.l oamSetExand,x
|
|
3314
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3315
|
+
|
|
3316
|
+
rep #$20
|
|
3317
|
+
lda 28,s ; if large sprite, adjust it (24+2+2)
|
|
3318
|
+
beq +
|
|
3319
|
+
sep #$20
|
|
3320
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
3321
|
+
ora oamMemory,y
|
|
3322
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3323
|
+
|
|
3324
|
+
+: rep #$20
|
|
3325
|
+
lda 28,s ; if large sprite, adjust address (24+2+2)
|
|
3326
|
+
bne +
|
|
3327
|
+
inc.w oamnumberspr1 ; one more sprite 16x16 small
|
|
3328
|
+
bra _oMTDDRep1p
|
|
3329
|
+
+: inc.w oamnumberspr0 ; one more sprite 16x16 large
|
|
3330
|
+
_oMTDDRep1p:
|
|
3331
|
+
lda oamnumberperframe ; go to next sprite entry (x4 multiplier)
|
|
3332
|
+
clc
|
|
3333
|
+
adc #$0004
|
|
3334
|
+
sta.w oamnumberperframe
|
|
3335
|
+
|
|
3336
|
+
.accu 16
|
|
3337
|
+
plx ; restore value pushed before displaying sprites
|
|
3338
|
+
txa ; go to next oambuffer
|
|
3339
|
+
clc
|
|
3340
|
+
adc #16
|
|
3341
|
+
tax
|
|
3342
|
+
ply ; saved before displaying sprites 32,16 & 8
|
|
3343
|
+
|
|
3344
|
+
jmp _oMTDDRep0p
|
|
3345
|
+
|
|
3346
|
+
_oMTDDRepEnd0p:
|
|
3347
|
+
ply
|
|
3348
|
+
plx
|
|
3349
|
+
plb
|
|
3350
|
+
plp
|
|
3351
|
+
|
|
3352
|
+
rtl
|
|
3353
|
+
|
|
3354
|
+
.ENDS
|
|
3355
|
+
|
|
3356
|
+
.SECTION ".spritesmt4_text" SUPERFREE
|
|
3357
|
+
|
|
3358
|
+
;---------------------------------------------------------------------------------
|
|
3359
|
+
; void oamMetaDraw16(u16 id, s16 x,s16 y, u8 *sprmeta, u16 sprsize, u16 ofsgfx)
|
|
3360
|
+
; 10-11 12-13 14-15 16-19 20-21 22-23
|
|
3361
|
+
oamMetaDraw16:
|
|
3362
|
+
php
|
|
3363
|
+
phb
|
|
3364
|
+
phx
|
|
3365
|
+
phy
|
|
3366
|
+
|
|
3367
|
+
sep #$20
|
|
3368
|
+
lda #$7e
|
|
3369
|
+
pha
|
|
3370
|
+
plb
|
|
3371
|
+
|
|
3372
|
+
rep #$20
|
|
3373
|
+
lda 10,s ; get id of sprite
|
|
3374
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
3375
|
+
asl a
|
|
3376
|
+
sta.w sprit_val0 ; save id of sprite
|
|
3377
|
+
asl a
|
|
3378
|
+
asl a
|
|
3379
|
+
tax ; x is now the id of oam buffer
|
|
3380
|
+
lda #0
|
|
3381
|
+
tay ; y is now the id of meta sprite buffer
|
|
3382
|
+
|
|
3383
|
+
lda 12,s ; save x coordinate
|
|
3384
|
+
sta sprit_mxsvg
|
|
3385
|
+
lda 14,s ; save y coordinate
|
|
3386
|
+
sta sprit_mysvg
|
|
3387
|
+
|
|
3388
|
+
lda 16,s
|
|
3389
|
+
sta tcc__r0 ; tcc_r0 = meta sprite source address
|
|
3390
|
+
|
|
3391
|
+
sep #$20
|
|
3392
|
+
lda 18,s ; bank of meta sprite source address
|
|
3393
|
+
sta tcc__r0h
|
|
3394
|
+
|
|
3395
|
+
_oMTD16Rep0p:
|
|
3396
|
+
rep #$20 ; mandatory because of the loop
|
|
3397
|
+
lda [tcc__r0], y ; get x offset and calculate x coordinate of sprite
|
|
3398
|
+
cmp #$FF80 ; if we reached the end of table (-128 in 16 bits), go out
|
|
3399
|
+
bne _oMTD16Rep0p_ok
|
|
3400
|
+
jmp _oMTD16RepEnd0p
|
|
3401
|
+
|
|
3402
|
+
_oMTD16Rep0p_ok:
|
|
3403
|
+
iny
|
|
3404
|
+
iny
|
|
3405
|
+
clc
|
|
3406
|
+
adc sprit_mxsvg ; todo test if > 256
|
|
3407
|
+
sta oambuffer.1.oamx,x
|
|
3408
|
+
|
|
3409
|
+
lda [tcc__r0], y ; get y offset and calculate y coordinate of sprite
|
|
3410
|
+
iny
|
|
3411
|
+
iny
|
|
3412
|
+
clc
|
|
3413
|
+
adc sprit_mysvg ; todo test if > 256
|
|
3414
|
+
sta oambuffer.1.oamy,x
|
|
3415
|
+
|
|
3416
|
+
lda [tcc__r0], y ; get frameid
|
|
3417
|
+
iny
|
|
3418
|
+
iny
|
|
3419
|
+
sta oambuffer.1.oamframeid,x
|
|
3420
|
+
|
|
3421
|
+
sep #$20
|
|
3422
|
+
lda [tcc__r0], y ; get attribute
|
|
3423
|
+
iny
|
|
3424
|
+
iny
|
|
3425
|
+
sta oambuffer.1.oamattribute,x
|
|
3426
|
+
|
|
3427
|
+
rep #$20
|
|
3428
|
+
lda 20,s ; get size
|
|
3429
|
+
bne +
|
|
3430
|
+
sep #$20 ; if small size, add upper 1bit to attribute
|
|
3431
|
+
lda oambuffer.1.oamattribute,x
|
|
3432
|
+
ora #$1
|
|
3433
|
+
sta oambuffer.1.oamattribute,x
|
|
3434
|
+
rep #$20
|
|
3435
|
+
|
|
3436
|
+
+: phy ; because we will need it at the end for the table
|
|
3437
|
+
|
|
3438
|
+
txa ; push sprite id (must be in 0..127 range)
|
|
3439
|
+
phx ; because we will need it at the end for the table
|
|
3440
|
+
tay ; id normaly passed as argument of drawing function
|
|
3441
|
+
|
|
3442
|
+
lda sprit_val0 ; get current graphic number
|
|
3443
|
+
pha ; will be restore in x
|
|
3444
|
+
lsr a ; for lookup spriteid entry (nb>>4 *2)
|
|
3445
|
+
tax
|
|
3446
|
+
|
|
3447
|
+
lda 24,s ; if large sprite, adjust address (20+2+2)
|
|
3448
|
+
bne +
|
|
3449
|
+
lda.l lkup16idT,x
|
|
3450
|
+
bra _oMTD16Rep1p_16p
|
|
3451
|
+
|
|
3452
|
+
+: lda.l lkup16idT0,x
|
|
3453
|
+
_oMTD16Rep1p_16p:
|
|
3454
|
+
plx
|
|
3455
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
3456
|
+
|
|
3457
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
3458
|
+
xba ; save it
|
|
3459
|
+
sep #$20 ; A 8 bits
|
|
3460
|
+
ror a ; x msb into carry (saved if x>255)
|
|
3461
|
+
|
|
3462
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
3463
|
+
xba
|
|
3464
|
+
rep #$20 ; A 16 bits
|
|
3465
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
3466
|
+
|
|
3467
|
+
lda.w #$0200 ; put $02 into MSB
|
|
3468
|
+
sep #$20 ; A 8 bits
|
|
3469
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
3470
|
+
phy
|
|
3471
|
+
tay
|
|
3472
|
+
|
|
3473
|
+
bcs _oMTD16Rep3_16p ; if no x<255, no need to update
|
|
3474
|
+
|
|
3475
|
+
lda.l oammask+1,x
|
|
3476
|
+
and.w oamMemory,y
|
|
3477
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3478
|
+
bra _oMTD16Rep3p_16p
|
|
3479
|
+
|
|
3480
|
+
_oMTD16Rep3_16p:
|
|
3481
|
+
lda.l oammask,x
|
|
3482
|
+
ora.w oamMemory,y
|
|
3483
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3484
|
+
|
|
3485
|
+
_oMTD16Rep3p_16p:
|
|
3486
|
+
ply
|
|
3487
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
3488
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
3489
|
+
|
|
3490
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
3491
|
+
lda sprit_val0
|
|
3492
|
+
lsr a
|
|
3493
|
+
lsr a
|
|
3494
|
+
lsr a
|
|
3495
|
+
lsr a
|
|
3496
|
+
clc
|
|
3497
|
+
adc.w #512 ; id>>4 + 512
|
|
3498
|
+
tay ; oam pointer is now on oam table #2
|
|
3499
|
+
|
|
3500
|
+
lda sprit_val0 ; id
|
|
3501
|
+
lsr a
|
|
3502
|
+
lsr a
|
|
3503
|
+
and.w #$0003 ; id >> 2 & 3
|
|
3504
|
+
tax
|
|
3505
|
+
|
|
3506
|
+
sep #$20
|
|
3507
|
+
lda oamMemory,y ; get value of oam table #2
|
|
3508
|
+
and.l oamSetExand,x
|
|
3509
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3510
|
+
|
|
3511
|
+
rep #$20
|
|
3512
|
+
lda 24,s ; if large sprite, adjust it (20+2+2)
|
|
3513
|
+
beq +
|
|
3514
|
+
sep #$20
|
|
3515
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
3516
|
+
ora oamMemory,y
|
|
3517
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3518
|
+
|
|
3519
|
+
+: rep #$20
|
|
3520
|
+
lda sprit_val0 ; go to next sprite entry (x4 multiplier)
|
|
3521
|
+
clc
|
|
3522
|
+
adc #$0004
|
|
3523
|
+
sta.w sprit_val0
|
|
3524
|
+
|
|
3525
|
+
.accu 16
|
|
3526
|
+
plx ; restore value pushed before displaying sprites
|
|
3527
|
+
txa ; go to next oambuffer
|
|
3528
|
+
clc
|
|
3529
|
+
adc #16
|
|
3530
|
+
tax
|
|
3531
|
+
ply ; saved before displaying sprites 32,16 & 8
|
|
3532
|
+
|
|
3533
|
+
jmp _oMTD16Rep0p
|
|
3534
|
+
|
|
3535
|
+
_oMTD16RepEnd0p:
|
|
3536
|
+
ply
|
|
3537
|
+
plx
|
|
3538
|
+
plb
|
|
3539
|
+
plp
|
|
3540
|
+
|
|
3541
|
+
rtl
|
|
3542
|
+
|
|
3543
|
+
.ENDS
|
|
3544
|
+
|
|
3545
|
+
.SECTION ".spritesmt5_text" SUPERFREE
|
|
3546
|
+
|
|
3547
|
+
;---------------------------------------------------------------------------------
|
|
3548
|
+
; void oamMetaDrawDyn8(u16 id, s16 x,s16 y, u8 *sprmeta,u8 *gfxptr)
|
|
3549
|
+
; 10-11 12-13 14-15 16-19 20-23
|
|
3550
|
+
oamMetaDrawDyn8:
|
|
3551
|
+
php
|
|
3552
|
+
phb
|
|
3553
|
+
phx
|
|
3554
|
+
phy
|
|
3555
|
+
|
|
3556
|
+
sep #$20
|
|
3557
|
+
lda #$7e
|
|
3558
|
+
pha
|
|
3559
|
+
plb
|
|
3560
|
+
|
|
3561
|
+
rep #$20
|
|
3562
|
+
lda 10,s ; get id of sprite
|
|
3563
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
3564
|
+
asl a
|
|
3565
|
+
asl a
|
|
3566
|
+
asl a
|
|
3567
|
+
tax ; x is now the id of oam buffer
|
|
3568
|
+
lda #0
|
|
3569
|
+
tay ; y is now the id of meta sprite buffer
|
|
3570
|
+
|
|
3571
|
+
lda 12,s ; save x coordinate
|
|
3572
|
+
sta sprit_mxsvg
|
|
3573
|
+
lda 14,s ; save y coordinate
|
|
3574
|
+
sta sprit_mysvg
|
|
3575
|
+
|
|
3576
|
+
lda 16,s
|
|
3577
|
+
sta tcc__r0 ; tcc_r0 = meta sprite source address
|
|
3578
|
+
|
|
3579
|
+
sep #$20
|
|
3580
|
+
lda 18,s ; bank of meta sprite source address
|
|
3581
|
+
sta tcc__r0h
|
|
3582
|
+
|
|
3583
|
+
lda oambuffer.1.oamrefresh,x ; get 1st sprite refresh value, which will be the default
|
|
3584
|
+
sta sprit_val0
|
|
3585
|
+
|
|
3586
|
+
|
|
3587
|
+
_oMTDD8Rep0p:
|
|
3588
|
+
rep #$20 ; mandatory because of the loop
|
|
3589
|
+
lda [tcc__r0], y ; get x offset and calculate x coordinate of sprite
|
|
3590
|
+
cmp #$FF80 ; if we reached the end of table (-128 in 16 bits), go out
|
|
3591
|
+
bne _oMTDD8Rep0p_ok
|
|
3592
|
+
jmp _oMTDD8RepEnd0p
|
|
3593
|
+
|
|
3594
|
+
_oMTDD8Rep0p_ok:
|
|
3595
|
+
iny
|
|
3596
|
+
iny
|
|
3597
|
+
clc
|
|
3598
|
+
adc sprit_mxsvg ; todo test if > 256
|
|
3599
|
+
sta oambuffer.1.oamx,x
|
|
3600
|
+
|
|
3601
|
+
lda [tcc__r0], y ; get y offset and calculate y coordinate of sprite
|
|
3602
|
+
iny
|
|
3603
|
+
iny
|
|
3604
|
+
clc
|
|
3605
|
+
adc sprit_mysvg ; todo test if > 256
|
|
3606
|
+
sta oambuffer.1.oamy,x
|
|
3607
|
+
|
|
3608
|
+
lda [tcc__r0], y ; get frameid
|
|
3609
|
+
iny
|
|
3610
|
+
iny
|
|
3611
|
+
sta oambuffer.1.oamframeid,x
|
|
3612
|
+
|
|
3613
|
+
sep #$20
|
|
3614
|
+
lda [tcc__r0], y ; get attribute
|
|
3615
|
+
iny
|
|
3616
|
+
iny
|
|
3617
|
+
ora #$1
|
|
3618
|
+
sta oambuffer.1.oamattribute,x
|
|
3619
|
+
rep #$20
|
|
3620
|
+
|
|
3621
|
+
lda 20,s ; get graphic address
|
|
3622
|
+
sta oambuffer.1.oamgraphics,x
|
|
3623
|
+
lda 22, s ; get graphic address (bank)
|
|
3624
|
+
sta oambuffer.1.oamgraphics+2,x
|
|
3625
|
+
phy ; because we will need it at the end for the table
|
|
3626
|
+
|
|
3627
|
+
txa ; push sprite id (must be in 0..127 range)
|
|
3628
|
+
phx ; because we will need it at the end for the table
|
|
3629
|
+
tay ; id normaly passed as argument of drawing function
|
|
3630
|
+
|
|
3631
|
+
sep #$20
|
|
3632
|
+
lda sprit_val0
|
|
3633
|
+
sta oambuffer.1.oamrefresh,y ; save initial sprite refresh value
|
|
3634
|
+
|
|
3635
|
+
;--------------push 16 pix sprite graphic on queue if needed
|
|
3636
|
+
lda oambuffer.1.oamrefresh,y ; check if we need to update graphics
|
|
3637
|
+
beq _oMTDD8Rep1_16p
|
|
3638
|
+
lda #$00
|
|
3639
|
+
sta oambuffer.1.oamrefresh,y ; reinit it
|
|
3640
|
+
|
|
3641
|
+
rep #$20
|
|
3642
|
+
lda oambuffer.1.oamframeid,y ; get sprite entry number for graphics
|
|
3643
|
+
asl a
|
|
3644
|
+
tax
|
|
3645
|
+
lda.l lkup8oamS,x
|
|
3646
|
+
clc
|
|
3647
|
+
adc.w oambuffer.1.oamgraphics,y
|
|
3648
|
+
sta.w sprit_val2
|
|
3649
|
+
|
|
3650
|
+
lda.l oamqueuenumber ; oamAddGfxQueue16(pgfx,GFXSPR0.1ADR+idBlock16);
|
|
3651
|
+
tax ; go to next graphic entry
|
|
3652
|
+
clc
|
|
3653
|
+
adc #$0006
|
|
3654
|
+
sta.l oamqueuenumber
|
|
3655
|
+
|
|
3656
|
+
phx
|
|
3657
|
+
|
|
3658
|
+
lda oamnumberspr1 ; get address for small
|
|
3659
|
+
asl a
|
|
3660
|
+
tax
|
|
3661
|
+
lda.l lkup8idB,x
|
|
3662
|
+
plx
|
|
3663
|
+
clc
|
|
3664
|
+
adc spr1addrgfx ; not variable, always the second gfx entry
|
|
3665
|
+
sta.l oamQueueEntry+3,x
|
|
3666
|
+
lda sprit_val2 ; get tileSource (lower 16 bits)
|
|
3667
|
+
sta.l oamQueueEntry,x
|
|
3668
|
+
sep #$20 ; A 16 bits
|
|
3669
|
+
lda oambuffer.1.oamgraphics+2,y ; get tileSource (bank)
|
|
3670
|
+
sta.l oamQueueEntry+2,x
|
|
3671
|
+
|
|
3672
|
+
lda #OBJ_SPRITE8 ; store that it is a 16pix sprite
|
|
3673
|
+
sta.l oamQueueEntry+5,x
|
|
3674
|
+
|
|
3675
|
+
_oMTDD8Rep1_16p:
|
|
3676
|
+
rep #$20
|
|
3677
|
+
ldx oamnumberperframe ; get current sprite number (x4 entry)
|
|
3678
|
+
|
|
3679
|
+
phx
|
|
3680
|
+
lda oamnumberspr1 ; get address if small sprite
|
|
3681
|
+
asl a
|
|
3682
|
+
tax
|
|
3683
|
+
lda.l lkup8idT,x
|
|
3684
|
+
_oMTDD8Rep1p_16p:
|
|
3685
|
+
plx
|
|
3686
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
3687
|
+
|
|
3688
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
3689
|
+
xba ; save it
|
|
3690
|
+
sep #$20 ; A 8 bits
|
|
3691
|
+
ror a ; x msb into carry (saved if x>255)
|
|
3692
|
+
|
|
3693
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
3694
|
+
xba
|
|
3695
|
+
rep #$20 ; A 16 bits
|
|
3696
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
3697
|
+
|
|
3698
|
+
lda.w #$0200 ; put $02 into MSB
|
|
3699
|
+
sep #$20 ; A 8 bits
|
|
3700
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
3701
|
+
phy
|
|
3702
|
+
tay
|
|
3703
|
+
|
|
3704
|
+
bcs _oMTDD8Rep3_16p ; if no x<255, no need to update
|
|
3705
|
+
|
|
3706
|
+
lda.l oammask+1,x
|
|
3707
|
+
and.w oamMemory,y
|
|
3708
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3709
|
+
bra _oMTDD8Rep3p_16p
|
|
3710
|
+
|
|
3711
|
+
_oMTDD8Rep3_16p:
|
|
3712
|
+
lda.l oammask,x
|
|
3713
|
+
ora.w oamMemory,y
|
|
3714
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3715
|
+
|
|
3716
|
+
_oMTDD8Rep3p_16p:
|
|
3717
|
+
ply
|
|
3718
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
3719
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
3720
|
+
|
|
3721
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
3722
|
+
lda oamnumberperframe
|
|
3723
|
+
lsr a
|
|
3724
|
+
lsr a
|
|
3725
|
+
lsr a
|
|
3726
|
+
lsr a
|
|
3727
|
+
clc
|
|
3728
|
+
adc.w #512 ; id>>4 + 512
|
|
3729
|
+
tay ; oam pointer is now on oam table #2
|
|
3730
|
+
|
|
3731
|
+
lda oamnumberperframe ; id
|
|
3732
|
+
lsr a
|
|
3733
|
+
lsr a
|
|
3734
|
+
and.w #$0003 ; id >> 2 & 3
|
|
3735
|
+
tax
|
|
3736
|
+
|
|
3737
|
+
sep #$20
|
|
3738
|
+
lda oamMemory,y ; get value of oam table #2
|
|
3739
|
+
and.l oamSetExand,x
|
|
3740
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3741
|
+
|
|
3742
|
+
rep #$20
|
|
3743
|
+
inc.w oamnumberspr1 ; one more sprite 8x8 small
|
|
3744
|
+
_oMTDD8Rep1p:
|
|
3745
|
+
lda oamnumberperframe ; go to next sprite entry (x4 multiplier)
|
|
3746
|
+
clc
|
|
3747
|
+
adc #$0004
|
|
3748
|
+
sta.w oamnumberperframe
|
|
3749
|
+
|
|
3750
|
+
.accu 16
|
|
3751
|
+
plx ; restore value pushed before displaying sprites
|
|
3752
|
+
txa ; go to next oambuffer
|
|
3753
|
+
clc
|
|
3754
|
+
adc #16
|
|
3755
|
+
tax
|
|
3756
|
+
ply ; saved before displaying sprites 32,16 & 8
|
|
3757
|
+
|
|
3758
|
+
jmp _oMTDD8Rep0p
|
|
3759
|
+
|
|
3760
|
+
_oMTDD8RepEnd0p:
|
|
3761
|
+
ply
|
|
3762
|
+
plx
|
|
3763
|
+
plb
|
|
3764
|
+
plp
|
|
3765
|
+
|
|
3766
|
+
rtl
|
|
3767
|
+
|
|
3768
|
+
.ENDS
|
|
3769
|
+
|
|
3770
|
+
.SECTION ".spritesmt6_text" SUPERFREE
|
|
3771
|
+
|
|
3772
|
+
;---------------------------------------------------------------------------------
|
|
3773
|
+
; void oamMetaDraw8(u16 id, s16 x,s16 y, u8 *sprmeta, u16 ofsgfx)
|
|
3774
|
+
; 10-11 12-13 14-15 16-19 20-21
|
|
3775
|
+
oamMetaDraw8:
|
|
3776
|
+
php
|
|
3777
|
+
phb
|
|
3778
|
+
phx
|
|
3779
|
+
phy
|
|
3780
|
+
|
|
3781
|
+
sep #$20
|
|
3782
|
+
lda #$7e
|
|
3783
|
+
pha
|
|
3784
|
+
plb
|
|
3785
|
+
|
|
3786
|
+
rep #$20
|
|
3787
|
+
lda 10,s ; get id of sprite
|
|
3788
|
+
asl a ; to be on correct index (16 bytes per oam)
|
|
3789
|
+
asl a
|
|
3790
|
+
sta.w sprit_val0 ; save id of sprite
|
|
3791
|
+
asl a
|
|
3792
|
+
asl a
|
|
3793
|
+
tax ; x is now the id of oam buffer
|
|
3794
|
+
lda #0
|
|
3795
|
+
tay ; y is now the id of meta sprite buffer
|
|
3796
|
+
|
|
3797
|
+
lda 12,s ; save x coordinate
|
|
3798
|
+
sta sprit_mxsvg
|
|
3799
|
+
lda 14,s ; save y coordinate
|
|
3800
|
+
sta sprit_mysvg
|
|
3801
|
+
|
|
3802
|
+
lda 16,s
|
|
3803
|
+
sta tcc__r0 ; tcc_r0 = meta sprite source address
|
|
3804
|
+
|
|
3805
|
+
sep #$20
|
|
3806
|
+
lda 18,s ; bank of meta sprite source address
|
|
3807
|
+
sta tcc__r0h
|
|
3808
|
+
|
|
3809
|
+
_oMTD8Rep0p:
|
|
3810
|
+
rep #$20 ; mandatory because of the loop
|
|
3811
|
+
lda [tcc__r0], y ; get x offset and calculate x coordinate of sprite
|
|
3812
|
+
cmp #$FF80 ; if we reached the end of table (-128 in 16 bits), go out
|
|
3813
|
+
bne _oMTD8Rep0p_ok
|
|
3814
|
+
jmp _oMTD8RepEnd0p
|
|
3815
|
+
|
|
3816
|
+
_oMTD8Rep0p_ok:
|
|
3817
|
+
iny
|
|
3818
|
+
iny
|
|
3819
|
+
clc
|
|
3820
|
+
adc sprit_mxsvg ; todo test if > 256
|
|
3821
|
+
sta oambuffer.1.oamx,x
|
|
3822
|
+
|
|
3823
|
+
lda [tcc__r0], y ; get y offset and calculate y coordinate of sprite
|
|
3824
|
+
iny
|
|
3825
|
+
iny
|
|
3826
|
+
clc
|
|
3827
|
+
adc sprit_mysvg ; todo test if > 256
|
|
3828
|
+
sta oambuffer.1.oamy,x
|
|
3829
|
+
|
|
3830
|
+
lda [tcc__r0], y ; get frameid
|
|
3831
|
+
iny
|
|
3832
|
+
iny
|
|
3833
|
+
sta oambuffer.1.oamframeid,x
|
|
3834
|
+
|
|
3835
|
+
sep #$20
|
|
3836
|
+
lda [tcc__r0], y ; get attribute
|
|
3837
|
+
iny
|
|
3838
|
+
iny
|
|
3839
|
+
ora #$1
|
|
3840
|
+
sta oambuffer.1.oamattribute,x
|
|
3841
|
+
|
|
3842
|
+
rep #$20
|
|
3843
|
+
phy ; because we will need it at the end for the table
|
|
3844
|
+
|
|
3845
|
+
txa ; push sprite id (must be in 0..127 range)
|
|
3846
|
+
phx ; because we will need it at the end for the table
|
|
3847
|
+
tay ; id normaly passed as argument of drawing function
|
|
3848
|
+
|
|
3849
|
+
lda sprit_val0 ; get current graphic number
|
|
3850
|
+
pha ; will be restore in x
|
|
3851
|
+
lsr a ; for lookup spriteid entry (nb>>4 *2)
|
|
3852
|
+
tax
|
|
3853
|
+
|
|
3854
|
+
lda 26,s ; if large sprite, adjust address (20+2+2+2)
|
|
3855
|
+
bne +
|
|
3856
|
+
lda.l lkup8idT,x
|
|
3857
|
+
bra _oMTD8Rep1p_16p
|
|
3858
|
+
|
|
3859
|
+
+: lda.l lkup16idT0,x
|
|
3860
|
+
_oMTD8Rep1p_16p:
|
|
3861
|
+
plx
|
|
3862
|
+
sta.w oamMemory+2,x ; store in oam memory
|
|
3863
|
+
|
|
3864
|
+
lda oambuffer.1.oamx,y ; get x coordinate
|
|
3865
|
+
xba ; save it
|
|
3866
|
+
sep #$20 ; A 8 bits
|
|
3867
|
+
ror a ; x msb into carry (saved if x>255)
|
|
3868
|
+
|
|
3869
|
+
lda oambuffer.1.oamy,y ; get y coordinate
|
|
3870
|
+
xba
|
|
3871
|
+
rep #$20 ; A 16 bits
|
|
3872
|
+
sta.w oamMemory,x ; store x & y in oam memory
|
|
3873
|
+
|
|
3874
|
+
lda.w #$0200 ; put $02 into MSB
|
|
3875
|
+
sep #$20 ; A 8 bits
|
|
3876
|
+
lda.l oammask+2,x ; get offset in the extra OAM data
|
|
3877
|
+
phy
|
|
3878
|
+
tay
|
|
3879
|
+
|
|
3880
|
+
bcs _oMTD8Rep3_16p ; if no x<255, no need to update
|
|
3881
|
+
|
|
3882
|
+
lda.l oammask+1,x
|
|
3883
|
+
and.w oamMemory,y
|
|
3884
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3885
|
+
bra _oMTD8Rep3p_16p
|
|
3886
|
+
|
|
3887
|
+
_oMTD8Rep3_16p:
|
|
3888
|
+
lda.l oammask,x
|
|
3889
|
+
ora.w oamMemory,y
|
|
3890
|
+
sta.w oamMemory,y ; store x in oam memory
|
|
3891
|
+
|
|
3892
|
+
_oMTD8Rep3p_16p:
|
|
3893
|
+
ply
|
|
3894
|
+
lda oambuffer.1.oamattribute,y ; get attr
|
|
3895
|
+
sta oamMemory+3,x ; store attributes in oam memory
|
|
3896
|
+
|
|
3897
|
+
rep #$20 ; oamSetEx(nb_sprites_oam, OBJ_SMALL, OBJ_SHOW);
|
|
3898
|
+
lda sprit_val0
|
|
3899
|
+
lsr a
|
|
3900
|
+
lsr a
|
|
3901
|
+
lsr a
|
|
3902
|
+
lsr a
|
|
3903
|
+
clc
|
|
3904
|
+
adc.w #512 ; id>>4 + 512
|
|
3905
|
+
tay ; oam pointer is now on oam table #2
|
|
3906
|
+
|
|
3907
|
+
lda sprit_val0 ; id
|
|
3908
|
+
lsr a
|
|
3909
|
+
lsr a
|
|
3910
|
+
and.w #$0003 ; id >> 2 & 3
|
|
3911
|
+
tax
|
|
3912
|
+
|
|
3913
|
+
sep #$20
|
|
3914
|
+
lda oamMemory,y ; get value of oam table #2
|
|
3915
|
+
and.l oamSetExand,x
|
|
3916
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3917
|
+
|
|
3918
|
+
lda.l oamSizeshift,x ; get shifted value of hide (<<1, <<3, <<5, <<7
|
|
3919
|
+
ora oamMemory,y
|
|
3920
|
+
sta oamMemory,y ; store new value in oam table #2
|
|
3921
|
+
|
|
3922
|
+
rep #$20
|
|
3923
|
+
lda sprit_val0 ; go to next sprite entry (x4 multiplier)
|
|
3924
|
+
clc
|
|
3925
|
+
adc #$0004
|
|
3926
|
+
sta.w sprit_val0
|
|
3927
|
+
|
|
3928
|
+
.accu 16
|
|
3929
|
+
plx ; restore value pushed before displaying sprites
|
|
3930
|
+
txa ; go to next oambuffer
|
|
3931
|
+
clc
|
|
3932
|
+
adc #16
|
|
3933
|
+
tax
|
|
3934
|
+
ply ; saved before displaying sprites 32,16 & 8
|
|
3935
|
+
|
|
3936
|
+
jmp _oMTD8Rep0p
|
|
3937
|
+
|
|
3938
|
+
_oMTD8RepEnd0p:
|
|
3939
|
+
ply
|
|
3940
|
+
plx
|
|
3941
|
+
plb
|
|
3942
|
+
plp
|
|
3943
|
+
|
|
3944
|
+
rtl
|
|
3945
|
+
|
|
3946
|
+
.ENDS
|