From 9f71c29aa67855bcbd249a6bef3e4380e65b9f0f Mon Sep 17 00:00:00 2001 From: 4am Date: Mon, 9 Sep 2024 18:37:13 -0400 Subject: [PATCH] sync code and build improvements with 4cade build 4012 --- Makefile | 478 ++++++---- bin/addfile.sh | 19 - bin/addfiles.py | 40 + bin/buildfileinfo.js | 12 - bin/buildfileinfo.sh | 11 - bin/buildindexedfile.py | 94 ++ bin/buildindexedfile.sh | 96 -- bin/buildokvs.py | 28 + bin/buildokvs.sh | 27 - bin/buildsearch.py | 105 +++ bin/buildsearch.sh | 77 -- bin/buildslideshow.py | 63 ++ bin/buildslideshow.sh | 58 -- bin/dumpcr.js | 17 - bin/flatten.js | 13 + bin/rsync.js | 19 - res/ATTRACT.CONF | 2 - res/CREDITS | 1 - res/DFX.CONF | 1 - res/FX.CONF | 1 - res/HELPTEXT | 1 - res/SFX.CONF | 2 - res/proboothd | Bin 512 -> 0 bytes src/4cade.a | 81 +- src/4cade.init.a | 215 ++--- src/4cade.init.machine.a | 1 + src/4cade.init.screen.a | 2 +- src/4cade.version.a | 6 +- src/constants.a | 234 ++++- src/fx.lib.a | 822 ++++++++++++++++++ src/fx/code.dhgr.48boxes.a | 677 +++++++++++++++ src/fx/code.dhgr.dither.precomputed.1bit.a | 160 ++++ src/fx/code.dhgr.dither.precomputed.2bit.a | 138 +++ ...ial.common.a => code.dhgr.dither.radial.a} | 87 +- src/fx/code.dhgr.precomputed.1bit.a | 95 ++ src/fx/code.dhgr.precomputed.2bit.a | 78 ++ ...hgr.radial.common.a => code.dhgr.radial.a} | 85 +- src/fx/code.hgr.48boxes.a | 496 +++++++++++ src/fx/code.hgr.dither.precomputed.1bit.a | 140 +++ src/fx/code.hgr.dither.precomputed.2bit.a | 126 +++ src/fx/code.hgr.dither.precomputed.3bit.a | 148 ++++ ...dial.common.a => code.hgr.dither.radial.a} | 44 +- src/fx/code.hgr.precomputed.1bit.a | 75 ++ src/fx/code.hgr.precomputed.2bit.a | 56 ++ src/fx/code.hgr.precomputed.3bit.a | 65 ++ src/fx/code.hgr.radial.a | 82 ++ src/fx/fx.cover.fade.a | 7 +- src/fx/fx.dgr.fizzle.a | 6 +- src/fx/fx.dhgr.2bit.fizzle.a | 20 +- src/fx/fx.dhgr.2pass.lr.a | 19 +- src/fx/fx.dhgr.48boxes.2snakes.a | 34 +- src/fx/fx.dhgr.48boxes.a | 64 +- src/fx/fx.dhgr.48boxes.arrow.a | 34 +- src/fx/fx.dhgr.48boxes.common.a | 762 +--------------- src/fx/fx.dhgr.48boxes.down.a | 34 +- src/fx/fx.dhgr.48boxes.longdiagonal.a | 34 +- src/fx/fx.dhgr.48boxes.pageturn.clear.a | 64 +- src/fx/fx.dhgr.48boxes.sidetoside.a | 34 +- src/fx/fx.dhgr.48boxes.snake.a | 34 +- src/fx/fx.dhgr.48boxes.snake.clear.a | 64 +- src/fx/fx.dhgr.48boxes.spiral.a | 34 +- src/fx/fx.dhgr.48boxes.spiral.clear.a | 64 +- src/fx/fx.dhgr.48boxes.sync.a | 34 +- src/fx/fx.dhgr.48boxes.sync.clear.a | 64 +- src/fx/fx.dhgr.bar.dissolve.a | 18 +- src/fx/fx.dhgr.bubbles.a | 9 +- src/fx/fx.dhgr.bubbles.in.a | 11 +- src/fx/fx.dhgr.butterfly.a | 9 +- src/fx/fx.dhgr.butterfly.in.a | 11 +- src/fx/fx.dhgr.butterfly.ripple.a | 11 +- src/fx/fx.dhgr.corner4.a | 9 +- src/fx/fx.dhgr.corner4.in.a | 11 +- src/fx/fx.dhgr.corner4.ripple.a | 14 +- src/fx/fx.dhgr.diagonal.a | 30 +- src/fx/fx.dhgr.dither.bubbles.a | 9 +- src/fx/fx.dhgr.dither.butterfly.a | 9 +- src/fx/fx.dhgr.dither.corner4.a | 9 +- src/fx/fx.dhgr.dither.heart.a | 9 +- src/fx/fx.dhgr.dither.iris.a | 9 +- src/fx/fx.dhgr.dither.maple.a | 9 +- src/fx/fx.dhgr.dither.radial.a | 85 +- src/fx/fx.dhgr.dither.radial2.a | 13 +- src/fx/fx.dhgr.dither.radial4.a | 13 +- src/fx/fx.dhgr.dither.slow.star.a | 9 +- src/fx/fx.dhgr.dither.snowflake.a | 9 +- src/fx/fx.dhgr.dither.soft.iris.a | 9 +- src/fx/fx.dhgr.dither.star.a | 9 +- src/fx/fx.dhgr.dither.star7.a | 9 +- src/fx/fx.dhgr.dither.wavy.iris.a | 9 +- src/fx/fx.dhgr.dither.wavy.iris.bloom.a | 9 +- src/fx/fx.dhgr.fizzle.a | 8 +- src/fx/fx.dhgr.flick.a | 20 +- src/fx/fx.dhgr.heart.a | 9 +- src/fx/fx.dhgr.heart.in.a | 11 +- src/fx/fx.dhgr.heart.ripple.a | 11 +- src/fx/fx.dhgr.iris.a | 9 +- src/fx/fx.dhgr.iris.in.a | 11 +- src/fx/fx.dhgr.maple.a | 9 +- src/fx/fx.dhgr.maple.in.a | 11 +- src/fx/fx.dhgr.maple.ripple.a | 11 +- src/fx/fx.dhgr.precomputed.1bit.a | 292 ------- src/fx/fx.dhgr.precomputed.2bit.a | 256 ------ src/fx/fx.dhgr.r.by.pixel.a | 21 +- src/fx/fx.dhgr.radial.a | 83 +- src/fx/fx.dhgr.radial2.a | 13 +- src/fx/fx.dhgr.radial3.a | 75 +- src/fx/fx.dhgr.radial4.a | 13 +- src/fx/fx.dhgr.radial5.a | 13 +- src/fx/fx.dhgr.redlines.a | 27 +- src/fx/fx.dhgr.ripple.a | 14 +- src/fx/fx.dhgr.slow.star.a | 9 +- src/fx/fx.dhgr.slow.star.in.a | 11 +- src/fx/fx.dhgr.slow.star.ripple.a | 14 +- src/fx/fx.dhgr.snowflake.a | 9 +- src/fx/fx.dhgr.snowflake.in.a | 11 +- src/fx/fx.dhgr.snowflake.ripple.a | 14 +- src/fx/fx.dhgr.soft.diagonal.a | 8 +- src/fx/fx.dhgr.soft.iris.a | 9 +- src/fx/fx.dhgr.soft.iris.in.a | 11 +- src/fx/fx.dhgr.star.a | 9 +- src/fx/fx.dhgr.star.in.a | 11 +- src/fx/fx.dhgr.star.ripple.a | 11 +- src/fx/fx.dhgr.star7.a | 9 +- src/fx/fx.dhgr.star7.in.a | 11 +- src/fx/fx.dhgr.star7.ripple.a | 11 +- src/fx/fx.dhgr.swirl.a | 14 +- src/fx/fx.dhgr.wavy.iris.a | 9 +- src/fx/fx.dhgr.wavy.iris.bloom.a | 9 +- src/fx/fx.dhgr.wavy.iris.bloom.in.a | 11 +- src/fx/fx.dhgr.wavy.iris.in.a | 11 +- src/fx/fx.dhgr.wavy.ripple.a | 11 +- src/fx/fx.dhgr.wavy.ripple.bloom.a | 11 +- src/fx/fx.gr.fizzle.a | 2 +- src/fx/fx.hgr.1bit.fizzle.a | 2 +- src/fx/fx.hgr.2bit.fizzle.a | 2 +- src/fx/fx.hgr.2pass.lr.a | 5 +- src/fx/fx.hgr.48boxes.2snakes.a | 2 - src/fx/fx.hgr.48boxes.a | 1 + src/fx/fx.hgr.48boxes.arrow.a | 2 - src/fx/fx.hgr.48boxes.common.a | 571 +----------- src/fx/fx.hgr.48boxes.down.a | 2 - src/fx/fx.hgr.48boxes.longdiagonal.a | 2 - src/fx/fx.hgr.48boxes.sidetoside.a | 2 - src/fx/fx.hgr.48boxes.snake.a | 2 - src/fx/fx.hgr.48boxes.spiral.a | 2 - src/fx/fx.hgr.48boxes.sync.a | 2 - src/fx/fx.hgr.apple.a | 9 +- src/fx/fx.hgr.apple.data.a | 2 +- src/fx/fx.hgr.apple.in.a | 11 +- src/fx/fx.hgr.apple.ripple.a | 11 +- src/fx/fx.hgr.arrow.a | 1 - src/fx/fx.hgr.arrow.white.a | 7 +- src/fx/fx.hgr.bar.dissolve.a | 3 +- src/fx/fx.hgr.block.fizzle.a | 3 +- src/fx/fx.hgr.block.fizzle.white.a | 5 +- src/fx/fx.hgr.bolt.a | 9 +- src/fx/fx.hgr.bolt.data.a | 2 +- src/fx/fx.hgr.bolt.in.a | 11 +- src/fx/fx.hgr.bolt.ripple.a | 11 +- src/fx/fx.hgr.bubbles.a | 9 +- src/fx/fx.hgr.bubbles.data.a | 2 +- src/fx/fx.hgr.bubbles.in.a | 11 +- src/fx/fx.hgr.butterfly.a | 9 +- src/fx/fx.hgr.butterfly.data.a | 2 +- src/fx/fx.hgr.butterfly.in.a | 11 +- src/fx/fx.hgr.butterfly.ripple.a | 11 +- src/fx/fx.hgr.center.by.pixel.a | 2 - src/fx/fx.hgr.checkerboard.fizzle.a | 6 +- src/fx/fx.hgr.circle.stripes.a | 8 +- src/fx/fx.hgr.color.fizzle.a | 3 +- src/fx/fx.hgr.corner4.a | 9 +- src/fx/fx.hgr.corner4.data.a | 7 +- src/fx/fx.hgr.corner4.in.a | 11 +- src/fx/fx.hgr.corner4.ripple.a | 14 +- src/fx/fx.hgr.crystal.a | 3 +- src/fx/fx.hgr.diagonal.a | 3 +- src/fx/fx.hgr.diagonal.stripes.a | 8 +- src/fx/fx.hgr.diagonal2.a | 3 +- src/fx/fx.hgr.diagonal3.a | 3 +- src/fx/fx.hgr.diagonal4.a | 3 +- src/fx/fx.hgr.diamond.a | 1 - src/fx/fx.hgr.diamond.stripes.a | 8 +- src/fx/fx.hgr.dither.apple.a | 9 +- src/fx/fx.hgr.dither.bolt.a | 9 +- src/fx/fx.hgr.dither.butterfly.a | 9 +- src/fx/fx.hgr.dither.corner4.a | 9 +- src/fx/fx.hgr.dither.dissolve.a | 3 +- src/fx/fx.hgr.dither.flower.a | 9 +- src/fx/fx.hgr.dither.flower.radial.a | 9 +- src/fx/fx.hgr.dither.heart.a | 9 +- src/fx/fx.hgr.dither.iris.a | 9 +- src/fx/fx.hgr.dither.mandelbrot.a | 9 +- src/fx/fx.hgr.dither.maple.a | 9 +- src/fx/fx.hgr.dither.radial.a | 45 +- src/fx/fx.hgr.dither.radial2.a | 13 +- src/fx/fx.hgr.dither.radial4.a | 13 +- src/fx/fx.hgr.dither.radial5.a | 13 +- src/fx/fx.hgr.dither.slow.star.a | 9 +- src/fx/fx.hgr.dither.snowflake.a | 9 +- src/fx/fx.hgr.dither.soft.iris.a | 9 +- src/fx/fx.hgr.dither.star.a | 9 +- src/fx/fx.hgr.dither.star7.a | 9 +- src/fx/fx.hgr.dither.wavy.iris.a | 9 +- src/fx/fx.hgr.fizzle.a | 2 +- src/fx/fx.hgr.flick.a | 14 +- src/fx/fx.hgr.flower.a | 9 +- src/fx/fx.hgr.flower.data.a | 2 +- src/fx/fx.hgr.flower.in.a | 11 +- src/fx/fx.hgr.flower.radial.a | 9 +- src/fx/fx.hgr.flower.radial.data.a | 2 +- src/fx/fx.hgr.flower.radial.in.a | 11 +- src/fx/fx.hgr.flower.radial.ripple.a | 11 +- src/fx/fx.hgr.flower.ripple.a | 11 +- src/fx/fx.hgr.fourspiral.a | 3 +- src/fx/fx.hgr.foursquare.white.a | 5 +- src/fx/fx.hgr.full.of.stars.a | 16 +- src/fx/fx.hgr.full.of.stars.data.a | 3 + src/fx/fx.hgr.halfblock.fizzle.a | 3 +- src/fx/fx.hgr.halfblock.fizzle.white.a | 5 +- src/fx/fx.hgr.heart.a | 9 +- src/fx/fx.hgr.heart.data.a | 2 +- src/fx/fx.hgr.heart.in.a | 11 +- src/fx/fx.hgr.heart.ripple.a | 11 +- src/fx/fx.hgr.interlock.lr.a | 3 +- src/fx/fx.hgr.interlock.ud.a | 3 +- src/fx/fx.hgr.iris.a | 9 +- src/fx/fx.hgr.iris.data.a | 7 +- src/fx/fx.hgr.iris.in.a | 11 +- src/fx/fx.hgr.lattice.a | 2 - src/fx/fx.hgr.lr.by.pixel.a | 5 +- src/fx/fx.hgr.mandelbrot.a | 9 +- src/fx/fx.hgr.mandelbrot.data.a | 2 +- src/fx/fx.hgr.mandelbrot.in.a | 11 +- src/fx/fx.hgr.mandelbrot.ripple.a | 11 +- src/fx/fx.hgr.maple.a | 9 +- src/fx/fx.hgr.maple.data.a | 2 +- src/fx/fx.hgr.maple.in.a | 11 +- src/fx/fx.hgr.maple.ripple.a | 11 +- src/fx/fx.hgr.meet.in.the.middle.a | 3 +- src/fx/fx.hgr.onesquare.white.a | 5 +- src/fx/fx.hgr.palette.fizzle.a | 2 +- src/fx/fx.hgr.pinwheels.a | 16 +- src/fx/fx.hgr.pinwheels.data.a | 3 + src/fx/fx.hgr.precomputed.1bit.a | 428 +-------- src/fx/fx.hgr.precomputed.2bit.a | 439 +--------- src/fx/fx.hgr.precomputed.3bit.a | 463 +--------- src/fx/fx.hgr.r.by.2.a | 2 - src/fx/fx.hgr.r.by.palette.a | 2 - src/fx/fx.hgr.r.by.pixel.a | 3 +- src/fx/fx.hgr.radbubbles.a | 16 +- src/fx/fx.hgr.radbubbles.data.a | 3 + src/fx/fx.hgr.radial.a | 43 +- src/fx/fx.hgr.radial.common.a | 79 -- src/fx/fx.hgr.radial.data.a | 7 +- src/fx/fx.hgr.radial2.a | 13 +- src/fx/fx.hgr.radial3.a | 35 +- src/fx/fx.hgr.radial4.a | 13 +- src/fx/fx.hgr.radial5.a | 13 +- src/fx/fx.hgr.redlines.a | 5 +- src/fx/fx.hgr.ripple.a | 14 +- src/fx/fx.hgr.slow.star.a | 9 +- src/fx/fx.hgr.slow.star.data.a | 7 +- src/fx/fx.hgr.slow.star.in.a | 11 +- src/fx/fx.hgr.slow.star.ripple.a | 14 +- src/fx/fx.hgr.snowflake.a | 9 +- src/fx/fx.hgr.snowflake.data.a | 7 +- src/fx/fx.hgr.snowflake.in.a | 11 +- src/fx/fx.hgr.snowflake.ripple.a | 14 +- src/fx/fx.hgr.soft.diagonal.a | 6 +- src/fx/fx.hgr.soft.iris.a | 9 +- src/fx/fx.hgr.soft.iris.data.a | 2 +- src/fx/fx.hgr.soft.iris.in.a | 11 +- src/fx/fx.hgr.soft.l.a | 2 - src/fx/fx.hgr.soft.r.a | 2 - src/fx/fx.hgr.soft.ud.a | 3 +- src/fx/fx.hgr.soft.ud.in.a | 3 +- src/fx/fx.hgr.soft.ud.out.a | 3 +- src/fx/fx.hgr.spiral.a | 3 +- src/fx/fx.hgr.split.ud.intro.a | 5 +- src/fx/fx.hgr.stagger.lr.a | 3 +- src/fx/fx.hgr.stagger.lr.white.a | 5 +- src/fx/fx.hgr.stagger.ud.a | 3 +- src/fx/fx.hgr.stagger.ud.white.a | 5 +- src/fx/fx.hgr.star.a | 9 +- src/fx/fx.hgr.star.bloom.a | 16 +- src/fx/fx.hgr.star.bloom.data.a | 3 + src/fx/fx.hgr.star.data.a | 2 +- src/fx/fx.hgr.star.in.a | 11 +- src/fx/fx.hgr.star.ripple.a | 11 +- src/fx/fx.hgr.star7.a | 9 +- src/fx/fx.hgr.star7.data.a | 2 +- src/fx/fx.hgr.star7.in.a | 11 +- src/fx/fx.hgr.star7.ripple.a | 11 +- src/fx/fx.hgr.swirl.a | 14 +- src/fx/fx.hgr.thin.bar.dissolve.a | 3 +- src/fx/fx.hgr.tri.fizzle.a | 3 +- src/fx/fx.hgr.wavy.iris.a | 9 +- src/fx/fx.hgr.wavy.iris.bloom.a | 9 +- src/fx/fx.hgr.wavy.iris.bloom.data.a | 2 +- src/fx/fx.hgr.wavy.iris.bloom.in.a | 11 +- src/fx/fx.hgr.wavy.iris.data.a | 2 +- src/fx/fx.hgr.wavy.iris.in.a | 11 +- src/fx/fx.hgr.wavy.ripple.a | 11 +- src/fx/fx.hgr.wavy.ripple.bloom.a | 11 +- src/fx/fx.shr.2pass.lr.a | 2 +- src/fx/fx.shr.80boxes.common.a | 2 +- src/fx/fx.shr.diagonal.a | 2 +- src/fx/fx.shr.fadein.a | 18 +- src/fx/fx.shr.fizzle.a | 2 +- src/fx/fx.shr.iris.a | 17 +- src/fx/fx.shr.iris.data.a | 2 +- src/fx/fx.shr.iris.in.a | 17 +- src/fx/fx.shr.lr.a | 2 +- src/fx/fx.shr.lr2.a | 2 +- src/fx/fx.shr.radial.a | 27 +- src/fx/fx.shr.radial.data.a | 2 +- src/fx/fx.shr.radial2.a | 21 +- src/fx/fx.shr.ripple.a | 17 +- src/fx/fx.shr.ripple.data.a | 2 +- src/fx/fx.shr.soft.iris.a | 17 +- src/fx/fx.shr.soft.iris.data.a | 2 +- src/fx/fx.shr.soft.iris.in.a | 17 +- src/fx/fx.shr.ud.a | 2 +- src/fx/macros.a | 1 - src/fx/macros.dhgr.a | 20 +- src/fx/macros.dither.a | 73 -- src/fx/macros.hgr.a | 153 ++-- src/fx/macros.misc.a | 16 +- src/fx/macros.shr.a | 19 +- src/glue.launch.lc2.a | 43 +- src/hw.accel.a | 2 +- src/hw.joystick.a | 18 +- src/hw.mockingboard.a | 2 + src/hw.vbl.init.a | 3 +- src/index/artwork.idx.a | 2 +- src/index/attract.idx.a | 2 +- src/index/cache00.idx.a | 2 +- src/index/cache01.idx.a | 2 +- src/index/cache10.idx.a | 2 +- src/index/cache11.idx.a | 2 +- src/index/coverfade.idx.a | 4 +- src/index/credits.idx.a | 2 +- src/index/decrunch.idx.a | 2 +- src/index/demo.idx.a | 2 +- src/index/dfx.idx.a | 2 +- src/index/dgr.fizzle.idx.a | 2 +- src/index/dgr.idx.a | 4 +- src/index/dhgr.idx.a | 2 +- src/index/dtitle.idx.a | 2 +- src/index/fx.idx.a | 2 +- src/index/fxcode.idx.a | 8 + src/index/fxdata.idx.a | 8 + src/index/gamehelp.idx.a | 2 +- src/index/gr.fizzle.idx.a | 2 +- src/index/gr.idx.a | 2 +- src/index/helptext.idx.a | 2 +- src/index/hgr0.idx.a | 2 +- src/index/hgr1.idx.a | 2 +- src/index/hgr2.idx.a | 2 +- src/index/hgr3.idx.a | 2 +- src/index/hgr4.idx.a | 2 +- src/index/hgr5.idx.a | 2 +- src/index/hgr6.idx.a | 2 +- src/index/joystick.idx.a | 2 +- src/index/miniattract0.idx.a | 2 +- src/index/miniattract1.idx.a | 2 +- src/index/prelaunch.idx.a | 2 +- src/index/res.cover.idx.a | 2 +- src/index/res.help.idx.a | 2 +- src/index/res.title.idx.a | 2 +- src/index/search00.idx.a | 2 +- src/index/search01.idx.a | 2 +- src/index/search10.idx.a | 2 +- src/index/search11.idx.a | 2 +- src/index/sfx.idx.a | 2 +- src/index/slideshow.idx.a | 2 +- src/index/title.idx.a | 2 +- src/index/xsingle.idx.a | 2 +- src/macros.a | 21 +- src/parse.prefs.a | 15 +- src/prelaunch/acey.deucy.a | 2 +- src/prelaunch/advance.a | 2 +- src/prelaunch/anchorman.a | 2 +- src/prelaunch/battle.chess.a | 2 +- src/prelaunch/black.belt.a | 2 +- src/prelaunch/bop.n.wrestle.a | 2 +- src/prelaunch/champ.baseball.a | 2 +- src/prelaunch/champ.boxing.a | 2 +- src/prelaunch/champ.bsketball.a | 4 +- src/prelaunch/champ.wrestle.a | 2 +- src/prelaunch/checkers.a | 2 +- src/prelaunch/chuck.yeager.a | 2 +- src/prelaunch/common.a | 36 - src/prelaunch/computer.foosball.a | 2 +- src/prelaunch/dive.bomber.a | 2 +- src/prelaunch/draw.poker.a | 2 +- src/prelaunch/family.feud.a | 2 +- src/prelaunch/fight.night.a | 2 +- src/prelaunch/formula.1.racer.a | 2 +- src/prelaunch/fox.and.geese.a | 2 +- src/prelaunch/fs2.a | 2 +- src/prelaunch/gfl.football.a | 2 +- src/prelaunch/go.a | 2 +- src/prelaunch/go.four.it.a | 2 +- src/prelaunch/hardball.a | 2 +- src/prelaunch/hires.football.a | 2 +- src/prelaunch/hires.soccer.a | 2 +- src/prelaunch/intl.gran.prix.a | 2 +- src/prelaunch/jump.pit.a | 2 +- src/prelaunch/kono.a | 2 +- src/prelaunch/magnet.madness.a | 2 +- src/prelaunch/microchess.a | 2 +- src/prelaunch/microgolf.a | 2 +- src/prelaunch/mix.matcher.a | 2 +- src/prelaunch/mpl.a | 2 +- src/prelaunch/mpt.a | 2 +- src/prelaunch/mu.torere.a | 2 +- src/prelaunch/nimwit.a | 2 +- src/prelaunch/nine.mens.a | 2 +- src/prelaunch/odin.a | 2 +- src/prelaunch/one.on.one.a | 2 +- src/prelaunch/pay.day.a | 2 +- src/prelaunch/pensate.a | 2 +- src/prelaunch/pitstop.ii.a | 2 +- src/prelaunch/place.ball.a | 2 +- src/prelaunch/pool.a | 2 +- src/prelaunch/reversi.a | 2 +- src/prelaunch/rock.n.scroll.a | 2 +- src/prelaunch/seega.a | 2 +- src/prelaunch/shuffleboard.a | 2 +- src/prelaunch/ski.crazed.a | 2 +- src/prelaunch/slicks.a | 2 +- src/prelaunch/spdway.classic.a | 2 +- src/prelaunch/ss.baseball.a | 2 +- src/prelaunch/ss.basketball.a | 2 +- src/prelaunch/standard.a | 10 +- src/prelaunch/stunt.car.racer.a | 2 +- src/prelaunch/sudoku.a | 2 +- src/prelaunch/summer.games.a | 2 +- src/prelaunch/summer.games.ii.a | 2 +- src/prelaunch/super.huey.a | 2 +- src/prelaunch/super.icehockey.a | 2 +- src/prelaunch/tag.team.a | 2 +- src/prelaunch/test.drive.a | 2 +- src/prelaunch/the.dam.busters.a | 2 +- src/prelaunch/tomahawk.a | 2 +- src/prelaunch/tsn.baseball.a | 2 +- src/prelaunch/ultracheckers.a | 2 +- src/prelaunch/wari.a | 2 +- src/prelaunch/winter.games.a | 2 +- src/prelaunch/wipeout.a | 2 +- src/prelaunch/world.games.a | 2 +- src/prelaunch/world.karate.a | 2 +- src/prelaunch/zzfs.a | 2 +- src/proboothd/proboothd.a | 11 +- src/prodos.path.a | 39 +- src/ui.animation.a | 14 +- src/ui.attract.hgr.a | 67 +- src/ui.browse.mode.a | 76 +- src/ui.common.a | 14 +- src/ui.search.mode.a | 7 +- src/wait.a | 21 - winmake.bat | 729 ++++++++-------- 463 files changed, 6825 insertions(+), 6247 deletions(-) delete mode 100755 bin/addfile.sh create mode 100755 bin/addfiles.py delete mode 100644 bin/buildfileinfo.js delete mode 100755 bin/buildfileinfo.sh create mode 100755 bin/buildindexedfile.py delete mode 100755 bin/buildindexedfile.sh create mode 100755 bin/buildokvs.py delete mode 100755 bin/buildokvs.sh create mode 100755 bin/buildsearch.py delete mode 100755 bin/buildsearch.sh create mode 100755 bin/buildslideshow.py delete mode 100755 bin/buildslideshow.sh delete mode 100644 bin/dumpcr.js create mode 100644 bin/flatten.js delete mode 100644 bin/rsync.js delete mode 100644 res/proboothd mode change 100644 => 100755 src/4cade.init.a create mode 100644 src/fx.lib.a create mode 100644 src/fx/code.dhgr.48boxes.a create mode 100644 src/fx/code.dhgr.dither.precomputed.1bit.a create mode 100644 src/fx/code.dhgr.dither.precomputed.2bit.a rename src/fx/{fx.dhgr.dither.radial.common.a => code.dhgr.dither.radial.a} (56%) create mode 100644 src/fx/code.dhgr.precomputed.1bit.a create mode 100644 src/fx/code.dhgr.precomputed.2bit.a rename src/fx/{fx.dhgr.radial.common.a => code.dhgr.radial.a} (51%) create mode 100644 src/fx/code.hgr.48boxes.a create mode 100644 src/fx/code.hgr.dither.precomputed.1bit.a create mode 100644 src/fx/code.hgr.dither.precomputed.2bit.a create mode 100644 src/fx/code.hgr.dither.precomputed.3bit.a rename src/fx/{fx.hgr.dither.radial.common.a => code.hgr.dither.radial.a} (63%) create mode 100644 src/fx/code.hgr.precomputed.1bit.a create mode 100644 src/fx/code.hgr.precomputed.2bit.a create mode 100644 src/fx/code.hgr.precomputed.3bit.a create mode 100644 src/fx/code.hgr.radial.a delete mode 100644 src/fx/fx.hgr.radial.common.a delete mode 100644 src/fx/macros.dither.a create mode 100644 src/index/fxcode.idx.a create mode 100644 src/index/fxdata.idx.a delete mode 100644 src/prelaunch/common.a delete mode 100644 src/wait.a diff --git a/Makefile b/Makefile index 11fd82b..debd070 100644 --- a/Makefile +++ b/Makefile @@ -33,218 +33,358 @@ PYTHON=python3 # version 3.1.0 or later EXOMIZER=exomizer mem -q -P23 -lnone -dsk: index asmproboot asmlauncher extract - cp res/blank.hdv build/"$(DISK)" - cp res/_FileInformation.txt build/ - $(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" build/LAUNCHER.SYSTEM -C >>build/log - cp res/PREFS.CONF build/PREFS.CONF - bin/padto.sh build/PREFS.CONF -# -# create _FileInformation.txt files for subdirectories -# - bin/buildfileinfo.sh res/ICONS "CA" "0000" - bin/buildfileinfo.sh build/FX "06" "6000" - cp src/prelaunch/_FileInformation.txt build/PRELAUNCH/ -# -# add everything to the disk -# - for f in \ - build/TOTAL.DATA \ - build/PREFS.CONF \ - res/Finder.Data \ - res/Finder.Root; do \ - $(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "$$f" -C >>build/log; \ +BUILDDIR=build +MD=$(BUILDDIR)/make.touch +CADIUS.LOG=$(BUILDDIR)/log +DEMO.SOURCES=$(wildcard src/demo/*.a) +FX.SOURCES=$(wildcard src/fx/*.a) +PRELAUNCH.SOURCES=$(wildcard src/prelaunch/*.a) +PROBOOT.SOURCES=$(wildcard src/proboot/*.a) +LAUNCHER.SOURCES=$(wildcard src/*.a src/index/*.a) +HDV=$(BUILDDIR)/$(DISK) +PROBOOTHD=$(BUILDDIR)/proboothd +DEMO=$(BUILDDIR)/DEMO +DEMO.LIST=$(BUILDDIR)/demo.list +FX=$(BUILDDIR)/FX +FXCODE.LIST=$(BUILDDIR)/fxcode.list +FXDATA.LIST=$(BUILDDIR)/fxdata.list +PRELAUNCH=$(BUILDDIR)/PRELAUNCH +LAUNCHER.SYSTEM=$(BUILDDIR)/LAUNCHER.SYSTEM +ATTRACT=$(BUILDDIR)/ATTRACT +MINI.ATTRACT0.LIST=$(BUILDDIR)/mini.attract0.list +MINI.ATTRACT1.LIST=$(BUILDDIR)/mini.attract1.list +ATTRACT.IDX=$(BUILDDIR)/ATTRACT.IDX +HELPTEXT=$(BUILDDIR)/HELPTEXT +CREDITS=$(BUILDDIR)/CREDITS +GAMEHELP=$(BUILDDIR)/GAMEHELP +GAMES.CONF=$(BUILDDIR)/GAMES.CONF +GAMES.SORTED=$(BUILDDIR)/GAMES.SORTED +PREFS.CONF=$(BUILDDIR)/PREFS.CONF +SS=$(BUILDDIR)/SS +SS.LIST=$(BUILDDIR)/ss.list +ACTION.DHGR.LIST=$(BUILDDIR)/action.dhgr.list +ACTION.GR.LIST=$(BUILDDIR)/action.gr.list +ACTION.HGR0.LIST=$(BUILDDIR)/action.hgr0.list +ACTION.HGR1.LIST=$(BUILDDIR)/action.hgr1.list +ACTION.HGR2.LIST=$(BUILDDIR)/action.hgr2.list +ACTION.HGR3.LIST=$(BUILDDIR)/action.hgr3.list +ACTION.HGR4.LIST=$(BUILDDIR)/action.hgr4.list +ACTION.HGR5.LIST=$(BUILDDIR)/action.hgr5.list +ACTION.HGR6.LIST=$(BUILDDIR)/action.hgr6.list +ARTWORK.SHR.LIST=$(BUILDDIR)/artwork.shr.list +TITLE.HGR.LIST=$(BUILDDIR)/title.hgr.list +TITLE.DHGR.LIST=$(BUILDDIR)/title.dhgr.list +TOTAL.DATA=$(BUILDDIR)/TOTAL.DATA +X=$(BUILDDIR)/X +XSINGLE.LIST=$(BUILDDIR)/xsingle.list +ACTION.DHGR.SOURCES=$(wildcard res/ACTION.DHGR/*) +ACTION.GR.SOURCES=$(wildcard res/ACTION.GR/*) +ACTION.HGR.SOURCES=$(wildcard res/ACTION.HGR/*) +ARTWORK.SHR.SOURCES=$(wildcard res/ARTWORK.SHR/*) +ATTRACT.SOURCES=$(wildcard res/ATTRACT/*) +GAMEHELP.SOURCES=$(wildcard res/GAMEHELP/*) +SS.SOURCES=$(wildcard res/SS/*) +TITLE.ANIMATED.SOURCES=$(wildcard res/TITLE.ANIMATED/*) +TITLE.DHGR.SOURCES=$(wildcard res/TITLE.DHGR/*) +TITLE.HGR.SOURCES=$(wildcard res/TITLE.HGR/*) +CACHE.SOURCES=$(wildcard res/CACHE*.IDX) +ICONS=$(wildcard res/ICONS/*) +ATTRACT.CONF=res/ATTRACT.CONF +DFX.CONF=res/DFX.CONF +FX.CONF=res/FX.CONF +SFX.CONF=res/SFX.CONF +PREFS.CONF.SOURCE=res/PREFS.CONF +COVER=res/COVER +DECRUNCH=res/DECRUNCH +FINDER.DATA=res/Finder.Data +FINDER.ROOT=res/Finder.Root +HELP=res/HELP +JOYSTICK=res/JOYSTICK +TITLE=res/TITLE + +.PHONY: compress attract cache clean mount all al + +# build final disk image +$(HDV): $(PROBOOTHD) $(LAUNCHER.SYSTEM) $(PRELAUNCH) $(X) $(TOTAL.DATA) $(TITLE.ANIMATED.SOURCES) $(ICONS) $(FINDER.DATA) $(FINDER.ROOT) $(PREFS.CONF) + cp res/blank.hdv "$@" + cp res/_FileInformation.txt "$(BUILDDIR)"/ + $(CADIUS) ADDFILE "$@" "/$(VOLUME)/" "$(LAUNCHER.SYSTEM)" -C >> "$(CADIUS.LOG)" + for f in "$(TOTAL.DATA)" "$(PREFS.CONF)" "$(FINDER.DATA)" "$(FINDER.ROOT)"; do \ + $(CADIUS) ADDFILE "$@" "/$(VOLUME)/" "$$f" -C >> "$(CADIUS.LOG)"; \ done - for f in \ - res/TITLE.ANIMATED \ - res/ICONS \ - build/FX \ - build/PRELAUNCH; do \ + cp src/prelaunch/_FileInformation.txt "$(PRELAUNCH)"/ + for f in res/TITLE.ANIMATED res/ICONS "$(PRELAUNCH)" "$(X)"; do \ rm -f "$$f"/.DS_Store; \ - $(CADIUS) ADDFOLDER build/"$(DISK)" "/$(VOLUME)/$$(basename $$f)" "$$f" -C >>build/log; \ + $(CADIUS) ADDFOLDER "$@" "/$(VOLUME)/$$(basename $$f)" "$$f" -C >> "$(CADIUS.LOG)"; \ done - $(CADIUS) ADDFOLDER build/"$(DISK)" "/$(VOLUME)/X" "build/X" -C >>build/log; \ - bin/changebootloader.sh build/"$(DISK)" build/proboothd + bin/changebootloader.sh "$@" $(PROBOOTHD) + @touch "$@" + +# build padded prefs file (padding is required for writing by ProRWTS) +$(PREFS.CONF): $(PREFS.CONF.SOURCE) | $(MD) + cp "$(PREFS.CONF.SOURCE)" "$@" + bin/padto.sh "$@" -gamesconf: preconditions md -# # create a version of GAMES.CONF without comments or blank lines or anything after display titles -# - [ -f build/index ] || (awk '!/^$$|^#/' < res/GAMES.CONF | awk -F'/' '{ print $$1 }' > build/GAMES.CONF) -# +$(GAMES.CONF): $(MD) + awk '!/^$$|^#/' < res/GAMES.CONF | awk -F'/' '{ print $$1 }' > "$@" + # create a list of all game filenames, without metadata or display names, sorted by game filename -# - [ -f build/index ] || (awk -F, '/,/ { print $$2 }' < build/GAMES.CONF | awk -F= '{ print $$1 }' | sort > build/GAMES.SORTED) +$(GAMES.SORTED): | $(MD) $(GAMES.CONF) + awk -F, '/,/ { print $$2 }' < "$(GAMES.CONF)" | awk -F= '{ print $$1 }' | sort > "$@" -extract: preconditions md gamesconf - $(PARALLEL) '$(CADIUS) EXTRACTVOLUME {} build/X/ >>build/log' ::: res/dsk/*.po - rm -f build/X/**/.DS_Store build/X/**/PRODOS* build/X/**/LOADER.SYSTEM* build/X/**/_FileInformation.txt - for f in $$(grep '^....1' build/GAMES.CONF | awk '!/^$$|^#/' | awk -F, '/,/ { print $$2 }' | awk -F= '{ print $$1 }'); do mv build/X/"$$(basename $$f)"/"$$(basename $$f)"* build/X.INDEXED/; rm -rf build/X/"$$(basename $$f)"; done - for d in build/X/*; do \ - for f in "$$d"/*; do \ - mv -i "$$f" build/X/"$$(basename $$f)"; \ - done; \ - rmdir "$$d"; \ - done - (for f in build/X.INDEXED/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a -p build/TOTAL.DATA build/X.INDEXED > build/XSINGLE.IDX +# extract files from original disk images and move them to their final directories +$(X): | $(MD) $(GAMES.CONF) + mkdir -p "$@" "$(BUILDDIR)"/X.INDEXED + $(PARALLEL) '$(CADIUS) EXTRACTVOLUME {} "$@"/ >> "$(CADIUS.LOG)"' ::: res/dsk/*.po + rm -f "$@"/**/.DS_Store "$@"/**/PRODOS* "$@"/**/LOADER.SYSTEM* "$@"/**/_FileInformation.txt + for f in $$(grep '^....1' "$(GAMES.CONF)" | awk '!/^$$|^#/' | awk -F, '/,/ { print $$2 }' | awk -F= '{ print $$1 }'); do mv "$@"/"$$f"/"$$f"* "$(BUILDDIR)"/X.INDEXED/; rm -rf "$@"/"$$f"; done + (cd "$(BUILDDIR)"/X.INDEXED/ && for f in *; do echo "$$f"; done) > "$(XSINGLE.LIST)" + for d in "$@"/*; do mv "$$d"/* "$@"/; rmdir "$$d"; done + @touch "$@" -index: preconditions md asmfx asmprelaunch asmdemo compress extract -# # precompute binary data structure for mega-attract mode configuration file -# - [ -f build/index ] || (bin/buildokvs.sh < res/ATTRACT.CONF > build/ATTRACT.IDX) -# -# precompute binary data structure and substitute special characters -# in game help and other all-text pages -# - [ -f build/index ] || (bin/converthelp.sh res/HELPTEXT build/HELPTEXT) - [ -f build/index ] || (bin/converthelp.sh res/CREDITS build/CREDITS) - [ -f build/index ] || $(PARALLEL) 'bin/converthelp.sh "{}" "build/GAMEHELP/{/}"' ::: res/GAMEHELP/* +$(ATTRACT.IDX): $(MD) + bin/buildokvs.py < res/ATTRACT.CONF > "$@" + +# precompute binary data structure and substitute special characters in global help +$(HELPTEXT): $(MD) + bin/converthelp.sh res/HELPTEXT "$@" + +# precompute binary data structure and substitute special characters in credits +$(CREDITS): $(MD) + bin/converthelp.sh res/CREDITS "$@" + +# precompute binary data structures and substitute special characters for each game's help +$(GAMEHELP): $(GAMEHELP.SOURCES) | $(MD) + mkdir -p "$@" + $(PARALLEL) 'bin/converthelp.sh "{}" "$@/{/}"' ::: res/GAMEHELP/* + @touch "$@" + +# precompute binary data structures for slideshow configuration files +$(SS): $(SS.SOURCES) | $(MD) $(GAMES.CONF) + mkdir -p "$@" + $(PARALLEL) 'bin/buildslideshow.py "{}" "$(GAMES.CONF)" < "{}" > "$@/{/}"' ::: res/SS/* + (cd "$(SS)"/ && for f in *; do echo "$$f"; done) > "$(SS.LIST)" + @touch "$@" + +# precompute binary data structures for each game's mini-attract configuration file +$(ATTRACT): $(ATTRACT.SOURCES) | $(MD) + mkdir -p "$@" + $(PARALLEL) 'bin/buildokvs.py < "{}" > "$@/{/}"' ::: res/ATTRACT/* + (cd "$(ATTRACT)"/ && for f in [ABCDEFGHIJKLMNOP]*; do echo "$$f"; done) > "$(MINI.ATTRACT0.LIST)" + (cd "$(ATTRACT)"/ && for f in [QRSTUVWXYZ]*; do echo "$$f"; done) > "$(MINI.ATTRACT1.LIST)" + @touch "$@" + +# create lists of specific files used to build data structures later +$(ACTION.HGR0.LIST): $(ACTION.HGR.SOURCES) | $(MD) + (cd res/ACTION.HGR/ && for f in [ABCD]*; do echo "$$f"; done) > "$@" + +$(ACTION.HGR1.LIST): $(ACTION.HGR.SOURCES) | $(MD) + (cd res/ACTION.HGR/ && for f in [EFGH]*; do echo "$$f"; done) > "$@" + +$(ACTION.HGR2.LIST): $(ACTION.HGR.SOURCES) | $(MD) + (cd res/ACTION.HGR/ && for f in [IJKL]*; do echo "$$f"; done) > "$@" + +$(ACTION.HGR3.LIST): $(ACTION.HGR.SOURCES) | $(MD) + (cd res/ACTION.HGR/ && for f in [MNOP]*; do echo "$$f"; done) > "$@" + +$(ACTION.HGR4.LIST): $(ACTION.HGR.SOURCES) | $(MD) + (cd res/ACTION.HGR/ && for f in [QRST]*; do echo "$$f"; done) > "$@" + +$(ACTION.HGR5.LIST): $(ACTION.HGR.SOURCES) | $(MD) + (cd res/ACTION.HGR/ && for f in [UVWX]*; do echo "$$f"; done) > "$@" + +$(ACTION.HGR6.LIST): $(ACTION.HGR.SOURCES) | $(MD) + (cd res/ACTION.HGR/ && for f in [YZ]*; do echo "$$f"; done) > "$@" + +$(ACTION.DHGR.LIST): $(ACTION.DHGR.SOURCES) | $(MD) + (cd res/ACTION.DHGR/ && for f in *; do echo "$$f"; done) > "$@" + +$(ACTION.GR.LIST): $(ACTION.GR.SOURCES) | $(MD) + (cd res/ACTION.GR/ && for f in *; do echo "$$f"; done) > "$@" + +$(ARTWORK.SHR.LIST): $(ARTWORK.SHR.SOURCES) | $(MD) + (cd res/ARTWORK.SHR/ && for f in *; do echo "$$f"; done) > "$@" + +$(TITLE.HGR.LIST): $(TITLE.HGR.SOURCES) | $(MD) + (cd res/TITLE.HGR/ && for f in *; do echo "$$f"; done) > "$@" + +$(TITLE.DHGR.LIST): $(TITLE.DHGR.SOURCES) | $(MD) + (cd res/TITLE.DHGR/ && for f in *; do echo "$$f"; done) > "$@" + +$(TOTAL.DATA): $(FX) $(PRELAUNCH) $(DEMO) $(SS) $(X) $(ATTRACT) $(ATTRACT.IDX) $(HELPTEXT) $(CREDITS) $(GAMEHELP) $(GAMES.CONF) $(GAMES.SORTED) $(ACTION.HGR0.LIST) $(ACTION.HGR1.LIST) $(ACTION.HGR2.LIST) $(ACTION.HGR3.LIST) $(ACTION.HGR4.LIST) $(ACTION.HGR5.LIST) $(ACTION.HGR6.LIST) $(ACTION.DHGR.LIST) $(ACTION.GR.LIST) $(ARTWORK.SHR.LIST) $(TITLE.DHGR.LIST) $(TITLE.HGR.LIST) $(CACHE.SOURCES) $(ATTRACT.CONF) $(DFX.CONF) $(FX.CONF) $(SFX.CONF) $(COVER) $(DECRUNCH) $(HELP) $(JOYSTICK) $(TITLE) # # precompute indexed files for prelaunch # note: prelaunch must be first in TOTAL.DATA due to a hack in LoadStandardPrelaunch # note 2: these can not be padded because they are loaded at $0106 and padding would clobber the stack # - [ -f build/index ] || (bin/buildindexedfile.sh build/TOTAL.DATA build/PRELAUNCH.INDEXED < build/GAMES.SORTED > build/PRELAUNCH.IDX) + rm -f "$@" + touch "$@" + bin/buildindexedfile.py "$@" "$(BUILDDIR)"/PRELAUNCH.INDEXED < "$(GAMES.SORTED)" > "$(BUILDDIR)"/PRELAUNCH.IDX # # precompute indexed files for HGR & DHGR titles # note: these are not padded because they are all an exact block-multiple anyway # - [ -f build/index ] || bin/padto.sh build/TOTAL.DATA - [ -f build/index ] || ((for f in res/TITLE.HGR/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/TITLE.HGR build/HGR.TITLES.LOG > build/TITLE.IDX) - [ -f build/index ] || ((for f in res/TITLE.DHGR/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/TITLE.DHGR build/DHGR.TITLES.LOG > build/DTITLE.IDX) - [ -f build/index ] || bin/addfile.sh res/COVER build/TOTAL.DATA > src/index/res.cover.idx.a - [ -f build/index ] || bin/addfile.sh res/TITLE build/TOTAL.DATA > src/index/res.title.idx.a - [ -f build/index ] || bin/addfile.sh res/HELP build/TOTAL.DATA > src/index/res.help.idx.a + bin/padto.sh "$@" + bin/buildindexedfile.py "$@" res/TITLE.HGR "$(BUILDDIR)"/HGR.TITLES.LOG < "$(TITLE.HGR.LIST)" > "$(BUILDDIR)"/TITLE.IDX + bin/buildindexedfile.py "$@" res/TITLE.DHGR "$(BUILDDIR)"/DHGR.TITLES.LOG < "$(TITLE.DHGR.LIST)" > "$(BUILDDIR)"/DTITLE.IDX + bin/addfiles.py "$@" \ + "$(COVER)" src/index/res.cover.idx.a \ + "$(TITLE)" src/index/res.title.idx.a \ + "$(HELP)" src/index/res.help.idx.a # # precompute indexed files for game help # note: these can be padded because they're loaded into $800 at a time when $800..$1FFF is clobber-able # - [ -f build/index ] || (bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/GAMEHELP < build/GAMES.SORTED > build/GAMEHELP.IDX) + bin/buildindexedfile.py -p "$@" "$(GAMEHELP)" < "$(GAMES.SORTED)" > "$(BUILDDIR)"/GAMEHELP.IDX # # precompute indexed files for slideshows # note: these can be padded because they're loaded into $800 at a time when $800..$1FFF is clobber-able # - [ -f build/index ] || $(PARALLEL) '[ $$(echo "{/}" | cut -c-3) = "ACT" ] && bin/buildslideshow.sh -d build/GAMES.CONF < "{}" > "build/SS/{/}" || bin/buildslideshow.sh build/GAMES.CONF < "{}" > "build/SS/{/}"' ::: res/SS/* - [ -f build/index ] || ((for f in build/SS/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/SS > build/SLIDESHOW.IDX) - [ -f build/index ] || $(PARALLEL) 'bin/buildokvs.sh < "{}" > "build/ATTRACT/{/}"' ::: res/ATTRACT/* - [ -f build/index ] || ((for f in build/ATTRACT/[ABCDEFGHIJKLMNOP]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/ATTRACT > build/MINIATTRACT0.IDX) - [ -f build/index ] || ((for f in build/ATTRACT/[QRSTUVWXYZ]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/ATTRACT > build/MINIATTRACT1.IDX) + bin/buildindexedfile.py -p "$@" "$(SS)" < "$(SS.LIST)" > "$(BUILDDIR)"/SLIDESHOW.IDX + bin/buildindexedfile.py -p "$@" "$(ATTRACT)" < "$(MINI.ATTRACT0.LIST)" > "$(BUILDDIR)"/MINIATTRACT0.IDX + bin/buildindexedfile.py -p "$@" "$(ATTRACT)" < "$(MINI.ATTRACT1.LIST)" > "$(BUILDDIR)"/MINIATTRACT1.IDX # # precompute indexed files for graphic effects # note: these can be padded because they're loaded into $6000 at a time when $6000..$BEFF is clobber-able # - [ -f build/index ] || (bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/FX.INDEXED < res/FX.CONF > build/FX.IDX) - [ -f build/index ] || (bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/FX.INDEXED < res/DFX.CONF > build/DFX.IDX) - [ -f build/index ] || (bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/FX.INDEXED < res/SFX.CONF > build/SFX.IDX) + bin/buildindexedfile.py -p "$@" "$(BUILDDIR)"/FX.INDEXED < "$(FX.CONF)" > "$(BUILDDIR)"/FX.IDX + bin/buildindexedfile.py -p "$@" "$(BUILDDIR)"/FX.INDEXED < "$(DFX.CONF)" > "$(BUILDDIR)"/DFX.IDX + bin/buildindexedfile.py -p "$@" "$(BUILDDIR)"/FX.INDEXED < "$(SFX.CONF)" > "$(BUILDDIR)"/SFX.IDX + bin/buildindexedfile.py -p "$@" "$(BUILDDIR)"/FXCODE < "$(FXCODE.LIST)" > "$(BUILDDIR)"/FXCODE.IDX +# +# precompute indexed files for coordinates files loaded by graphic effects +# note: these can not be padded because some of them are loaded into tight spaces near the unclobberable top of main memory +# + bin/buildindexedfile.py "$@" "$(BUILDDIR)"/FXDATA < "$(FXDATA.LIST)" > "$(BUILDDIR)"/FXDATA.IDX # # precompute indexed files for HGR & DHGR action screenshots # note: these can not be padded because they are compressed and the decompressor needs the exact size # - [ -f build/index ] || ((for f in res/ACTION.HGR/[ABCD]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR0.IDX) - [ -f build/index ] || ((for f in res/ACTION.HGR/[EFGH]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR1.IDX) - [ -f build/index ] || ((for f in res/ACTION.HGR/[IJKL]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR2.IDX) - [ -f build/index ] || ((for f in res/ACTION.HGR/[MNOP]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR3.IDX) - [ -f build/index ] || ((for f in res/ACTION.HGR/[QRST]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR4.IDX) - [ -f build/index ] || ((for f in res/ACTION.HGR/[UVWX]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR5.IDX) - [ -f build/index ] || ((for f in res/ACTION.HGR/[YZ]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR6.IDX) - [ -f build/index ] || ((for f in res/ACTION.DHGR/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.DHGR > build/DHGR.IDX) + bin/buildindexedfile.py "$@" res/ACTION.HGR < "$(ACTION.HGR0.LIST)" > "$(BUILDDIR)"/HGR0.IDX + bin/buildindexedfile.py "$@" res/ACTION.HGR < "$(ACTION.HGR1.LIST)" > "$(BUILDDIR)"/HGR1.IDX + bin/buildindexedfile.py "$@" res/ACTION.HGR < "$(ACTION.HGR2.LIST)" > "$(BUILDDIR)"/HGR2.IDX + bin/buildindexedfile.py "$@" res/ACTION.HGR < "$(ACTION.HGR3.LIST)" > "$(BUILDDIR)"/HGR3.IDX + bin/buildindexedfile.py "$@" res/ACTION.HGR < "$(ACTION.HGR4.LIST)" > "$(BUILDDIR)"/HGR4.IDX + bin/buildindexedfile.py "$@" res/ACTION.HGR < "$(ACTION.HGR5.LIST)" > "$(BUILDDIR)"/HGR5.IDX + bin/buildindexedfile.py "$@" res/ACTION.HGR < "$(ACTION.HGR6.LIST)" > "$(BUILDDIR)"/HGR6.IDX + bin/buildindexedfile.py "$@" res/ACTION.DHGR < "$(ACTION.DHGR.LIST)" > "$(BUILDDIR)"/DHGR.IDX # -# precompute indexed files for GR and DGR action screenshots +# precompute indexed files for GR action screenshots # note: these can be padded because they are not compressed # - [ -f build/index ] || ((for f in res/ACTION.GR/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a -p build/TOTAL.DATA res/ACTION.GR > build/GR.IDX) - [ -f build/index ] || ((for f in res/ACTION.DGR/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a -p build/TOTAL.DATA res/ACTION.DGR > build/DGR.IDX) + bin/buildindexedfile.py -p "$@" res/ACTION.GR < "$(ACTION.GR.LIST)" > "$(BUILDDIR)"/GR.IDX # # precompute indexed files for SHR artwork # note: these can not be padded because they are compressed and the decompressor needs the exact size # - [ -f build/index ] || ((for f in res/ARTWORK.SHR/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ARTWORK.SHR > build/ARTWORK.IDX) + bin/buildindexedfile.py "$@" res/ARTWORK.SHR < "$(ARTWORK.SHR.LIST)" > "$(BUILDDIR)"/ARTWORK.IDX # # precompute indexed files for demo launchers # note: these can not be padded because some of them are loaded too close to $C000 # - [ -f build/index ] || ((for f in build/DEMO/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA build/DEMO > build/DEMO.IDX) - [ -f build/index ] || bin/addfile.sh build/DEMO.IDX build/TOTAL.DATA > src/index/demo.idx.a + bin/buildindexedfile.py "$@" "$(DEMO)" < "$(DEMO.LIST)" > "$(BUILDDIR)"/DEMO.IDX # # precompute indexed files for single-load game binaries # note: these can be padded because they are loaded at a time when all of main memory is clobber-able # - [ -f build/index ] || ((for f in build/X.INDEXED/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a -p build/TOTAL.DATA build/X.INDEXED > build/XSINGLE.IDX) - [ -f build/index ] || bin/addfile.sh build/XSINGLE.IDX build/TOTAL.DATA > src/index/xsingle.idx.a + bin/buildindexedfile.py -p "$@" "$(BUILDDIR)"/X.INDEXED < "$(XSINGLE.LIST)" > "$(BUILDDIR)"/XSINGLE.IDX # # create search indexes for each variation of (game-requires-joystick) X (game-requires-128K) # in the form of OKVS data structures, plus game counts in the form of source files # - [ -f build/index ] || $(PARALLEL) ::: \ - '(grep "^00" < build/GAMES.CONF | bin/buildsearch.sh src/index/count00.a build/HGR.TITLES.LOG /dev/null > build/SEARCH00.IDX)' \ - '(grep "^0" < build/GAMES.CONF | bin/buildsearch.sh src/index/count01.a build/HGR.TITLES.LOG build/DHGR.TITLES.LOG > build/SEARCH01.IDX)' \ - '(grep "^.0" < build/GAMES.CONF | bin/buildsearch.sh src/index/count10.a build/HGR.TITLES.LOG /dev/null > build/SEARCH10.IDX)' \ - '(bin/buildsearch.sh src/index/count11.a build/HGR.TITLES.LOG build/DHGR.TITLES.LOG < build/GAMES.CONF > build/SEARCH11.IDX)' + $(PARALLEL) ::: \ + '(grep "^00" < "$(GAMES.CONF)" | bin/buildsearch.py src/index/count00.a "$(BUILDDIR)"/HGR.TITLES.LOG "" > "$(BUILDDIR)"/SEARCH00.IDX)' \ + '(grep "^0" < "$(GAMES.CONF)" | bin/buildsearch.py src/index/count01.a "$(BUILDDIR)"/HGR.TITLES.LOG "$(BUILDDIR)"/DHGR.TITLES.LOG > "$(BUILDDIR)"/SEARCH01.IDX)' \ + '(grep "^.0" < "$(GAMES.CONF)" | bin/buildsearch.py src/index/count10.a "$(BUILDDIR)"/HGR.TITLES.LOG "" > "$(BUILDDIR)"/SEARCH10.IDX)' \ + '(bin/buildsearch.py src/index/count11.a "$(BUILDDIR)"/HGR.TITLES.LOG "$(BUILDDIR)"/DHGR.TITLES.LOG < "$(GAMES.CONF)" > "$(BUILDDIR)"/SEARCH11.IDX)' # # add IDX files to the combined index file and generate -# the index records that callers use to reference them +# the index records that callers use to reference them, +# plus additional miscellaneous files # - [ -f build/index ] || bin/addfile.sh build/SEARCH00.IDX build/TOTAL.DATA > src/index/search00.idx.a - [ -f build/index ] || bin/addfile.sh res/CACHE00.IDX build/TOTAL.DATA > src/index/cache00.idx.a - [ -f build/index ] || bin/addfile.sh build/SEARCH01.IDX build/TOTAL.DATA > src/index/search01.idx.a - [ -f build/index ] || bin/addfile.sh res/CACHE01.IDX build/TOTAL.DATA > src/index/cache01.idx.a - [ -f build/index ] || bin/addfile.sh build/SEARCH10.IDX build/TOTAL.DATA > src/index/search10.idx.a - [ -f build/index ] || bin/addfile.sh res/CACHE10.IDX build/TOTAL.DATA > src/index/cache10.idx.a - [ -f build/index ] || bin/addfile.sh build/SEARCH11.IDX build/TOTAL.DATA > src/index/search11.idx.a - [ -f build/index ] || bin/addfile.sh res/CACHE11.IDX build/TOTAL.DATA > src/index/cache11.idx.a - [ -f build/index ] || bin/addfile.sh build/PRELAUNCH.IDX build/TOTAL.DATA > src/index/prelaunch.idx.a - [ -f build/index ] || bin/addfile.sh build/ATTRACT.IDX build/TOTAL.DATA > src/index/attract.idx.a - [ -f build/index ] || bin/addfile.sh build/FX.IDX build/TOTAL.DATA > src/index/fx.idx.a - [ -f build/index ] || bin/addfile.sh build/DFX.IDX build/TOTAL.DATA > src/index/dfx.idx.a - [ -f build/index ] || bin/addfile.sh build/SFX.IDX build/TOTAL.DATA > src/index/sfx.idx.a - [ -f build/index ] || bin/addfile.sh build/GAMEHELP.IDX build/TOTAL.DATA > src/index/gamehelp.idx.a - [ -f build/index ] || bin/addfile.sh build/SLIDESHOW.IDX build/TOTAL.DATA > src/index/slideshow.idx.a - [ -f build/index ] || bin/addfile.sh build/MINIATTRACT0.IDX build/TOTAL.DATA > src/index/miniattract0.idx.a - [ -f build/index ] || bin/addfile.sh build/MINIATTRACT1.IDX build/TOTAL.DATA > src/index/miniattract1.idx.a - [ -f build/index ] || bin/addfile.sh build/TITLE.IDX build/TOTAL.DATA > src/index/title.idx.a - [ -f build/index ] || bin/addfile.sh build/DTITLE.IDX build/TOTAL.DATA > src/index/dtitle.idx.a - [ -f build/index ] || bin/addfile.sh build/HGR0.IDX build/TOTAL.DATA > src/index/hgr0.idx.a - [ -f build/index ] || bin/addfile.sh build/HGR1.IDX build/TOTAL.DATA > src/index/hgr1.idx.a - [ -f build/index ] || bin/addfile.sh build/HGR2.IDX build/TOTAL.DATA > src/index/hgr2.idx.a - [ -f build/index ] || bin/addfile.sh build/HGR3.IDX build/TOTAL.DATA > src/index/hgr3.idx.a - [ -f build/index ] || bin/addfile.sh build/HGR4.IDX build/TOTAL.DATA > src/index/hgr4.idx.a - [ -f build/index ] || bin/addfile.sh build/HGR5.IDX build/TOTAL.DATA > src/index/hgr5.idx.a - [ -f build/index ] || bin/addfile.sh build/HGR6.IDX build/TOTAL.DATA > src/index/hgr6.idx.a - [ -f build/index ] || bin/addfile.sh build/DHGR.IDX build/TOTAL.DATA > src/index/dhgr.idx.a - [ -f build/index ] || bin/addfile.sh build/GR.IDX build/TOTAL.DATA > src/index/gr.idx.a - [ -f build/index ] || bin/addfile.sh build/DGR.IDX build/TOTAL.DATA > src/index/dgr.idx.a - [ -f build/index ] || bin/addfile.sh build/ARTWORK.IDX build/TOTAL.DATA > src/index/artwork.idx.a -# -# add additional miscellaneous files -# - [ -f build/index ] || bin/addfile.sh build/COVERFADE build/TOTAL.DATA > src/index/coverfade.idx.a - [ -f build/index ] || bin/addfile.sh build/GR.FIZZLE build/TOTAL.DATA > src/index/gr.fizzle.idx.a - [ -f build/index ] || bin/addfile.sh build/DGR.FIZZLE build/TOTAL.DATA > src/index/dgr.fizzle.idx.a - [ -f build/index ] || bin/addfile.sh build/HELPTEXT build/TOTAL.DATA > src/index/helptext.idx.a - [ -f build/index ] || bin/addfile.sh build/CREDITS build/TOTAL.DATA > src/index/credits.idx.a - [ -f build/index ] || bin/addfile.sh res/DECRUNCH build/TOTAL.DATA > src/index/decrunch.idx.a - [ -f build/index ] || bin/addfile.sh res/JOYSTICK build/TOTAL.DATA > src/index/joystick.idx.a - touch build/index + bin/addfiles.py "$@" \ + "$(BUILDDIR)"/SEARCH00.IDX src/index/search00.idx.a \ + res/CACHE00.IDX src/index/cache00.idx.a \ + "$(BUILDDIR)"/SEARCH01.IDX src/index/search01.idx.a \ + res/CACHE01.IDX src/index/cache01.idx.a \ + "$(BUILDDIR)"/SEARCH10.IDX src/index/search10.idx.a \ + res/CACHE10.IDX src/index/cache10.idx.a \ + "$(BUILDDIR)"/SEARCH11.IDX src/index/search11.idx.a \ + res/CACHE11.IDX src/index/cache11.idx.a \ + "$(BUILDDIR)"/PRELAUNCH.IDX src/index/prelaunch.idx.a \ + "$(ATTRACT.IDX)" src/index/attract.idx.a \ + "$(BUILDDIR)"/DEMO.IDX src/index/demo.idx.a \ + "$(BUILDDIR)"/XSINGLE.IDX src/index/xsingle.idx.a \ + "$(BUILDDIR)"/FX.IDX src/index/fx.idx.a \ + "$(BUILDDIR)"/DFX.IDX src/index/dfx.idx.a \ + "$(BUILDDIR)"/SFX.IDX src/index/sfx.idx.a \ + "$(BUILDDIR)"/FXCODE.IDX src/index/fxcode.idx.a \ + "$(BUILDDIR)"/FXDATA.IDX src/index/fxdata.idx.a \ + "$(BUILDDIR)"/GAMEHELP.IDX src/index/gamehelp.idx.a \ + "$(BUILDDIR)"/SLIDESHOW.IDX src/index/slideshow.idx.a \ + "$(BUILDDIR)"/MINIATTRACT0.IDX src/index/miniattract0.idx.a \ + "$(BUILDDIR)"/MINIATTRACT1.IDX src/index/miniattract1.idx.a \ + "$(BUILDDIR)"/TITLE.IDX src/index/title.idx.a \ + "$(BUILDDIR)"/DTITLE.IDX src/index/dtitle.idx.a \ + "$(BUILDDIR)"/HGR0.IDX src/index/hgr0.idx.a \ + "$(BUILDDIR)"/HGR1.IDX src/index/hgr1.idx.a \ + "$(BUILDDIR)"/HGR2.IDX src/index/hgr2.idx.a \ + "$(BUILDDIR)"/HGR3.IDX src/index/hgr3.idx.a \ + "$(BUILDDIR)"/HGR4.IDX src/index/hgr4.idx.a \ + "$(BUILDDIR)"/HGR5.IDX src/index/hgr5.idx.a \ + "$(BUILDDIR)"/HGR6.IDX src/index/hgr6.idx.a \ + "$(BUILDDIR)"/DHGR.IDX src/index/dhgr.idx.a \ + "$(BUILDDIR)"/GR.IDX src/index/gr.idx.a \ + "$(BUILDDIR)"/ARTWORK.IDX src/index/artwork.idx.a \ + "$(BUILDDIR)"/COVERFADE src/index/coverfade.idx.a \ + "$(BUILDDIR)"/GR.FIZZLE src/index/gr.fizzle.idx.a \ + "$(HELPTEXT)" src/index/helptext.idx.a \ + "$(CREDITS)" src/index/credits.idx.a \ + "$(DECRUNCH)" src/index/decrunch.idx.a \ + "$(JOYSTICK)" src/index/joystick.idx.a + @touch "$@" -asmlauncher: preconditions md - $(ACME) -DBUILDNUMBER=`git rev-list --count HEAD` src/4cade.a 2>build/relbase.log - $(ACME) -r build/4cade.lst -DBUILDNUMBER=`git rev-list --count HEAD` -DRELBASE=`cat build/relbase.log | grep "RELBASE =" | cut -d"=" -f2 | cut -d"(" -f2 | cut -d")" -f1` src/4cade.a +# assemble main program +$(LAUNCHER.SYSTEM): $(LAUNCHER.SOURCES) | $(MD) $(TOTAL.DATA) + $(ACME) -DBUILDNUMBER=`git rev-list --count HEAD` src/4cade.a 2>"$(BUILDDIR)"/relbase.log + $(ACME) -r "$(BUILDDIR)"/4cade.lst -DBUILDNUMBER=`git rev-list --count HEAD` -DRELBASE=`cat "$(BUILDDIR)"/relbase.log | grep "RELBASE =" | cut -d"=" -f2 | cut -d"(" -f2 | cut -d")" -f1` src/4cade.a + @touch "$@" -asmdemo: preconditions md +# assemble launchers for self-running demos +$(DEMO): $(DEMO.SOURCES) | $(MD) + mkdir -p "$@" $(PARALLEL) 'if grep -q "^!to" "{}"; then $(ACME) "{}"; fi' ::: src/demo/*.a + (cd "$(DEMO)"/ && for f in *; do echo "$$f"; done) > "$(DEMO.LIST)" + @touch "$@" -asmfx: preconditions md +# assemble graphic effects +$(FX): $(FX.SOURCES) | $(MD) + mkdir -p "$@" "$(BUILDDIR)"/FX.INDEXED "$(BUILDDIR)"/FXDATA "$(BUILDDIR)"/FXCODE $(PARALLEL) 'if grep -q "^!to" "{}"; then $(ACME) "{}"; fi' ::: src/fx/*.a + (cd "$(BUILDDIR)"/FXCODE/ && for f in *; do echo "$$f"; done) > "$(FXCODE.LIST)" + (cd "$(BUILDDIR)"/FXDATA/ && for f in *; do echo "$$f"; done) > "$(FXDATA.LIST)" + @touch "$@" -asmprelaunch: preconditions md +# assemble launchers for games +$(PRELAUNCH): $(PRELAUNCH.SOURCES) | $(MD) + mkdir -p "$@" "$(BUILDDIR)"/PRELAUNCH.INDEXED $(PARALLEL) 'if grep -q "^!to" "{}"; then $(ACME) "{}"; fi' ::: src/prelaunch/*.a + @touch "$@" -asmproboot: md - $(ACME) -r build/proboothd.lst src/proboothd/proboothd.a +# assemble bootloader +$(PROBOOTHD): $(PROBOOT.SOURCES) | $(MD) + $(ACME) -r "$(BUILDDIR)"/proboothd.lst src/proboothd/proboothd.a + @touch "$@" -compress: preconditions md +# +# |compress| must be called separately because it is slow and +# only needs to be run when a new graphic file is added. +# It create files in the repository which can then be checked in. +# +compress: $(MD) $(PARALLEL) '[ -f "res/ACTION.HGR/{/}" ] || ${EXOMIZER} "{}"@0x4000 -o "res/ACTION.HGR/{/}"' ::: res/ACTION.HGR.UNCOMPRESSED/* $(PARALLEL) '[ -f "res/ACTION.DHGR/{/}" ] || ${EXOMIZER} "{}"@0x4000 -o "res/ACTION.DHGR/{/}"' ::: res/ACTION.DHGR.UNCOMPRESSED/* $(PARALLEL) '[ -f "res/ARTWORK.SHR/{/}" ] || ${EXOMIZER} "{}"@0x2000 -o "res/ARTWORK.SHR/{/}"' ::: res/ARTWORK.SHR.UNCOMPRESSED/* @@ -259,34 +399,40 @@ attract: compress bin/check-attract-mode.sh bin/generate-mini-attract-mode.sh -cache: preconditions md gamesconf +# +# |cache| must be called separately because it is slow and +# only needs to be run when a new game is added. +# It create files in the repository which can then be checked in. +# +cache: $(GAMES.CONF) $(PARALLEL) ::: \ - 'awk -F= '"'"'/^00/ { print $$2 }'"'"' < build/GAMES.CONF | bin/buildcache.py > build/cache00.a' \ - 'awk -F= '"'"'/^0/ { print $$2 }'"'"' < build/GAMES.CONF | bin/buildcache.py > build/cache01.a' \ - 'awk -F= '"'"'/^.0/ { print $$2 }'"'"' < build/GAMES.CONF | bin/buildcache.py > build/cache10.a' \ - 'awk -F= '"'"'!/^$$|^#|^\[/ { print $$2 }'"'"' < build/GAMES.CONF | bin/buildcache.py > build/cache11.a' + 'awk -F= '"'"'/^00/ { print $$2 }'"'"' < "$(GAMES.CONF)" | bin/buildcache.py > "$(BUILDDIR)"/cache00.a' \ + 'awk -F= '"'"'/^0/ { print $$2 }'"'"' < "$(GAMES.CONF)" | bin/buildcache.py > "$(BUILDDIR)"/cache01.a' \ + 'awk -F= '"'"'/^.0/ { print $$2 }'"'"' < "$(GAMES.CONF)" | bin/buildcache.py > "$(BUILDDIR)"/cache10.a' \ + 'awk -F= '"'"'!/^$$|^#/ { print $$2 }'"'"' < "$(GAMES.CONF)" | bin/buildcache.py > "$(BUILDDIR)"/cache11.a' $(PARALLEL) ::: \ - '$(ACME) -o res/CACHE00.IDX build/cache00.a' \ - '$(ACME) -o res/CACHE01.IDX build/cache01.a' \ - '$(ACME) -o res/CACHE10.IDX build/cache10.a' \ - '$(ACME) -o res/CACHE11.IDX build/cache11.a' + '$(ACME) -o res/CACHE00.IDX "$(BUILDDIR)"/cache00.a' \ + '$(ACME) -o res/CACHE01.IDX "$(BUILDDIR)"/cache01.a' \ + '$(ACME) -o res/CACHE10.IDX "$(BUILDDIR)"/cache10.a' \ + '$(ACME) -o res/CACHE11.IDX "$(BUILDDIR)"/cache11.a' -mount: dsk - osascript bin/V2Make.scpt "`pwd`" bin/4cade.vii build/"$(DISK)" +mount: $(HDV) + osascript bin/V2Make.scpt "`pwd`" bin/4cade.vii "$(HDV)" -md: - mkdir -p build/X build/X.INDEXED build/FX build/FX.INDEXED build/PRELAUNCH build/PRELAUNCH.INDEXED build/ATTRACT build/SS build/GAMEHELP build/DEMO - touch build/log - -clean: - rm -rf build/ || rm -rf build - -preconditions: +$(MD): @$(ACME) --version | grep -q "ACME, release" || (echo "ACME is not installed" && exit 1) @$(CADIUS) | grep -q "cadius v" || (echo "Cadius is not installed" && exit 1) @$(PARALLEL) --version | grep -q "GNU" || (echo "GNU Parallel is not installed" && exit 1) @$(PYTHON) --version | grep -q "Python 3" || (echo "Python 3 is not installed" && exit 1) + mkdir -p "$(BUILDDIR)" + touch "$(CADIUS.LOG)" + @touch "$@" -all: clean dsk mount +clean: + rm -rf "$(BUILDDIR)"/ || rm -rf "$(BUILDDIR)" + +all: clean $(HDV) mount al: all + +.NOTPARALLEL: diff --git a/bin/addfile.sh b/bin/addfile.sh deleted file mode 100755 index 3b70c79..0000000 --- a/bin/addfile.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# parameters -# 1 - input file -# 2 - output filename for data file -# stdout - source code of index record - -touch "$2" -size=$(wc -c < "$1") -offset=$(wc -c < "$2") -cat "$1" >> "$2" -echo ";" -echo "; Index record for $1" -echo ";" -echo "; This file is automatically generated" -echo ";" -echo " !byte 0" -echo " !be24 $offset" -echo " !le16 $size" diff --git a/bin/addfiles.py b/bin/addfiles.py new file mode 100755 index 0000000..459905b --- /dev/null +++ b/bin/addfiles.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + +# parameters +# 1 - output filename for combined data file +# 2,3 - input filename, output index record filename +# 4,5 - "" +# 6,7... in pairs + +import os.path +import sys + +if __name__ == "__main__": + output_file = sys.argv[1] + offset = os.path.getsize(output_file) + data = [] + index_records = [] + # read and aggregate all input files, and generate index records + for input_file in sys.argv[2::2]: + with open(input_file, 'rb') as input_handle: + data.append(input_handle.read()) + size = len(data[-1]) + index_records.append(f"""; +; Index record for {input_file} +; +; This file is automatically generated +; + !byte 0 + !be24 {offset:>9} + !le16 {size:>8} +""") + offset += size + + # write out index records to specified files + for index_file, record in zip(sys.argv[3::2], index_records): + with open(index_file, 'w') as index_handle: + index_handle.write(record) + + # write out combined data + with open(output_file, 'ab') as output_handle: + output_handle.write(b''.join(data)) diff --git a/bin/buildfileinfo.js b/bin/buildfileinfo.js deleted file mode 100644 index 27ad8de..0000000 --- a/bin/buildfileinfo.js +++ /dev/null @@ -1,12 +0,0 @@ -a = new ActiveXObject("scripting.filesystemobject") -fileinfo = "# This file is automatically generated\r\n" - -for (b = new Enumerator(a.GetFolder(WScript.Arguments(0)).files); !b.atEnd(); b.moveNext()) -{ - if (b.item().Name.toUpperCase() != "_FILEINFORMATION.TXT") - { - fileinfo += "\r\n" + b.item().Name.toUpperCase() + "=Type(" + WScript.Arguments(1) + "),AuxType(" + WScript.Arguments(2) + "),Access(C3)" - } -} -fileinfo += "\r\n" + "_FileInformation.txt=Type(" + WScript.Arguments(1) + "),AuxType(" + WScript.Arguments(2) + "),Access(C3)\r\n" -a.createtextfile(WScript.Arguments(0)+"\\_FileInformation.txt", 1).write(fileinfo) diff --git a/bin/buildfileinfo.sh b/bin/buildfileinfo.sh deleted file mode 100755 index cb6b798..0000000 --- a/bin/buildfileinfo.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -indir=$1 -intype=$2 -inaddress=$3 -cd "$indir" -rm -f _FileInformation.txt -(echo "# This file is automatically generated\n" - for f in *; do - echo "$f=Type($intype),AuxType($inaddress),Access(C3)" - done) > _FileInformation.txt diff --git a/bin/buildindexedfile.py b/bin/buildindexedfile.py new file mode 100755 index 0000000..17a17cb --- /dev/null +++ b/bin/buildindexedfile.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 + +# flags +# -p pad sizes within data file to next block size (default off) + +# parameters +# stdin - input containing list of files (e.g. FX.CONF) +# stdout - binary OKVS data structure +# 1 - output filename for data file +# 2 - input directory of files to merge into data file +# 3 - (optional) output filename for log of key,offset,size + +import argparse +import os +import os.path +from struct import pack +import sys + +kStandardFilename = 'STANDARD' + +def build(records, args): + output_file_size = os.path.getsize(args.output_file) + standard_offset = standard_size = 0 + standard_filename = os.path.join(args.input_directory, kStandardFilename) + with open(args.output_file, 'ab') as output_file_handle: + if os.path.exists(standard_filename): + standard_offset = output_file_size + standard_size = os.path.getsize(standard_filename) + with open(standard_filename, 'rb') as standard_handle: + output_file_handle.write(standard_handle.read()) + output_file_size += standard_size + + # yield OKVS header (2 x 2 bytes, unsigned int, little-endian) + yield pack('<2H', len(records), 0) + + for rec in records: + filename, dummy, dummy = rec.partition('=') + key, dummy, addr = filename.partition('#') + key_length = len(key) + filename = os.path.join(args.input_directory, filename) + rec_offset = standard_offset + rec_size = standard_size + + # yield record length (1 byte, unsigned byte) + if addr: + # if filename is in the form 'NAME#06ADDR' then create extended index record + yield pack('B', key_length+9) + # trim '06' so we get just the starting address + addr = addr[2:] + else: + yield pack('B', key_length+7) + + # yield key (Pascal-style string) + yield pack(f'{key_length+1}p', key.encode('ascii')) + + if os.path.exists(filename): + rec_offset = output_file_size + rec_size = os.path.getsize(filename) + output_file_size += rec_size + if args.pad: + # If offset+size does not cross a block boundary, use file's true size. + # Otherwise, round up size to the next block boundary. + # This padding does not get added to the file; it is just an + # optimization to avoid a partial copy on the last block read. + if (rec_offset // 512) != ((rec_offset + rec_size) // 512): + rec_size = ((rec_offset + rec_size + 511) & -512) - rec_offset + with open(filename, 'rb') as input_file_handle: + output_file_handle.write(input_file_handle.read()) + + # yield record offset (3 bytes, big-endian, unsigned long) + yield pack('>L', rec_offset)[1:] + + # yield record size (2 bytes, little-endian, unsigned short) + yield pack('> "$1" -fi - -# make temp file with list of lines that contain keys -records=$(mktemp) -tr -d "\r" | awk '!/^$|^#|^\[/' > "$records" - -# make temp assembly source file that represents the binary OKVS data structure -source=$(mktemp) -(echo "*=0" # dummy program counter for assembler - echo "!le16 $(wc -l <"$records"), 0" # OKVS header - while IFS="=" read -r filename dummy; do - key=$(echo "$filename" | awk -F'#' '{ print $1 }') - addr=$(echo "$filename" | awk -F'#' '{ print $2 }') - if [ "${#addr}" -ne "0" ]; then # if filename is in the form 'NAME#06ADDR' then create extended index record - addr=$(echo "$addr" | cut -c3-) # trim '06' so we get just the starting address - echo "!byte ${#key}+9" # OKVS record length - else - echo "!byte ${#key}+7" # OKVS record length - fi - echo "!byte ${#key}" # OKVS key length - echo "!text \"$key\"" # OKVS key - if [ ! -e "$2/$filename" ]; then # if file does not exist, use standard offset and size - offset="$standardoffset" - size="$standardsize" - else # otherwise calculate offset and size from file and options - offset=$(wc -c < "$1") - size=$(wc -c < "$2/$filename") - if [ "$pad" = true ]; then - # If offset+size does not cross a block boundary, use file's true size. - # Otherwise, round up size to the next block boundary. - # This padding does not get added to the file; it is just an - # optimization to avoid a partial copy on the last block read. - if [ $(($offset / 512)) -ne $((($offset + $size) / 512)) ]; then - size=$(((($offset + $size + 511) & -512) - $offset)) - fi - fi - cat "$2/$filename" >> "$1" # append this file to the end of the merged data file - fi - echo "!be24 $offset" - echo "!le16 $size" - [ "${#addr}" -ne "0" ] && echo '!le16 $'"$addr" - [ "${#3}" -ne "0" ] && echo "$key,$offset,$size" >> "$3" - done < "$records") > "$source" - -# assemble temp source file into binary OKVS data structure, then output that -out=$(mktemp) -acme -o "$out" "$source" -cat "$out" - -# clean up -rm "$out" -rm "$source" -rm "$records" diff --git a/bin/buildokvs.py b/bin/buildokvs.py new file mode 100755 index 0000000..3957249 --- /dev/null +++ b/bin/buildokvs.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +# parameters +# stdin - input containing key=value pairs (e.g. res/ATTRACT.CONF or some file in res/ATTRACT/) +# stdout - binary OKVS data structure + +import struct +import sys + +def build(records): + # yield OKVS header (2 x 2 bytes, unsigned int, little-endian) + yield struct.pack('<2H', len(records), 0) + + for key, dummy, value in records: + # yield record length (1 byte) + yield struct.pack('B', len(key) + len(value) + 3) + + # yield key (Pascal-style string) + yield struct.pack(f'{len(key)+1}p', key.encode('ascii')) + + # yield value (Pascal-style string) + yield struct.pack(f'{len(value)+1}p', value.encode('ascii')) + +if __name__ == "__main__": + records = [x.strip() for x in sys.stdin.readlines()] + records = [x.partition('=') for x in records if x and x[0] not in ('#', '[')] + for b in build(records): + sys.stdout.buffer.write(b) diff --git a/bin/buildokvs.sh b/bin/buildokvs.sh deleted file mode 100755 index 08d768e..0000000 --- a/bin/buildokvs.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# make temp file with just the key/value pairs (strip blank lines, comments, eof marker) -records=$(mktemp) -tr -d "\r" | awk '!/^$|^#|^\[/' > "$records" - -# make temp assembly source file that represents the binary OKVS data structure -source=$(mktemp) -(echo "*=0" # dummy program counter for assembler - echo "!le16 $(wc -l <"$records"), 0" # OKVS header - while IFS="=" read -r key value; do - echo "!byte ${#key}+${#value}+3" # OKVS record length - echo "!byte ${#key}" # OKVS key length - echo "!text \"$key\"" # OKVS key - echo "!byte ${#value}" # OKVS value length - echo "!text \"$value\"" # OKVS value - done < "$records") > "$source" - -# assemble temp source file into binary OKVS data structure, then output that -out=$(mktemp) -acme -o "$out" "$source" -cat "$out" - -# clean up -rm "$out" -rm "$source" -rm "$records" diff --git a/bin/buildsearch.py b/bin/buildsearch.py new file mode 100755 index 0000000..c532947 --- /dev/null +++ b/bin/buildsearch.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 + +# parameters +# stdin - input containing list of game metadata, filename, display name (e.g. GAMES.CONF or some subset of it) +# stdout - binary OKVS data structure +# 1 - output filename for game count in assembler code format +# 2 - input filename of HGR titles, offsets, and sizes +# 3 - input filename of DHGR titles, offsets, and sizes + +import argparse +import pprint +from struct import pack +import sys + +gSearchIndex = 0x6000 # must match gSearchIndex in src/constants.a + +# indexes into |flags| as string +iDHGRTitle = 2 +iCheatCategory = 3 +iSingleLoad = 4 + +# maps of flag raw string value -> value in final flags byte +kHasDHGRTitle = {'0': 0, '1': 128} +kSingleLoad = {'0': 0, '1': 64} + +def parse_log_file(filename): + if not filename: + return {} + with open(filename, 'r') as f: + lines = [x.strip().split(',') for x in f.readlines()] + lines = [(title, (int(offset), int(size))) for title, offset, size in lines] + return dict(lines) + +def build(records, args): + # records is [(flags, key, value), (flags, key, value) ...] + hgr_cache = parse_log_file(args.input_hgr_log_file) + dhgr_cache = parse_log_file(args.input_dhgr_log_file) + cache_ptr = {'0': hgr_cache, '1': dhgr_cache} + record_count = len(records) + + # generate source file with game count + with open(args.output_game_count_file, 'w') as file_handle: + file_handle.write(f"""; +; Game count +; +; This file is automatically generated +; +!word {record_count:>8} +""") + + # lookup table is stored after all record data, so first calculate total record size + # record_count * (length-prefixed key + length-prefixed value + 8 other bytes) + # then lookup table address is that + gSearchIndex + 4 bytes for the OKVS header + total_record_size = len("".join([x for xs in records for x in xs[1:]])) + 10*record_count + + # yield OKVS header (2 x 2 bytes, unsigned int, little-endian) + yield pack('<2H', record_count, total_record_size + gSearchIndex + 4) + + rec_key_address = gSearchIndex + 5 + key_addresses = [] + for flags, key, value in records: + key_addresses.append(rec_key_address) + rec_length = len(key) + len(value) + 10 + rec_key_address += rec_length + + # yield record length (1 byte) + yield pack('B', rec_length) + + # yield key (Pascal-style string) + yield pack(f'{len(key)+1}p', key.encode('ascii')) + + # yield value (Pascal-style string) + yield pack(f'{len(value)+1}p', value.encode('ascii')) + + yield pack('B', 1) + + # yield flags + has_dhgr_title = dhgr_cache and flags[iDHGRTitle] or '0' + yield pack('B', kHasDHGRTitle[has_dhgr_title] + \ + kSingleLoad[flags[iSingleLoad]] + \ + int(flags[iCheatCategory])) + + rec_offset, rec_size = cache_ptr[has_dhgr_title][key] + + # yield record offset (3 bytes, big-endian, unsigned long) + yield pack('>L', rec_offset)[1:] + + # yield record size (2 bytes, little-endian, unsigned short) + yield pack(' "$records" - -# read logs of offsets & sizes for HGR and DHGR titles -# that were generated by an earlier script -hgrlog=$(< "$2") -dhgrlog=$(< "$3") - -# generate source file with game count -(echo ";" - echo "; Game count" - echo ";" - echo "; This file is automatically generated" - echo ";" - echo "!word $(wc -l < "$records")") > "$1" - -# make temp assembly source file that represents the binary OKVS data structure -source=$(mktemp) -(echo '*=$6000' - echo "!le16 $(wc -l <"$records")" # OKVS header - echo "!word KeyLookup" - count=0 - while IFS="=" read -r key value; do - count=$((count+1)) - if [ -z "$dhgrlog" ]; then - dhgr="0" - else - dhgr=$(echo "$key" | cut -c3) # 'has DHGR title screen' flag (0 or 1) - fi - cheat=$(echo "$key" | cut -c4) # 'cheat category' (0..7) - single=$(echo "$key" | cut -c5) # 'single-load' flag (0 or 1) - key=$(echo "$key" | cut -d"," -f2) - if [ "$dhgr" -eq "0" ]; then - offset=$hgrlog - size=$hgrlog - else - offset=$dhgrlog - size=$dhgrlog - fi - offset=$(echo "$offset" | awk -F, '/^'"$key"',/ { print $2 }') - size=$(echo "$size" | awk -F, '/^'"$key"',/ { print $3 }') - echo "!byte ${#key}+${#value}+10" # OKVS record length - echo "Key${count}" - echo "!byte ${#key}" # OKVS key length - echo "!text \"$key\"" # OKVS key (filename) - echo "!byte ${#value}" # OKVS value length - echo "!text \"$value\"" # OKVS value (display name) - echo "!byte 1" - echo "!byte $((dhgr*128))+$((single*64))+$cheat" - echo "!be24 $offset" - echo "!le16 $size" - done < "$records" - echo "KeyLookup" - for i in $(seq $count); do - echo "!word Key$i" - done -) > "$source" - -# assemble temp source file into binary OKVS data structure, then output that -out=$(mktemp) -acme -o "$out" "$source" -cat "$out" - -# clean up -rm "$out" -rm "$source" -rm "$records" diff --git a/bin/buildslideshow.py b/bin/buildslideshow.py new file mode 100755 index 0000000..079c91a --- /dev/null +++ b/bin/buildslideshow.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 + +# parameters +# stdin - input containing slideshow (e.g. some file in res/SS/) +# stdout - binary OKVS data structure +# 1 - name of slideshow file (used to decide whether if this is an action slideshow) +# 2 - name of file containing list of games with metadata (e.g. build/GAMES.CONF) + +import argparse +import os.path +from struct import pack +import sys + +# indexes into |flags| as string +iNeedsJoystick = 0 +iNeeds128K = 1 + +# maps of flag raw string value -> value in final flags byte +kNeedsJoystick = {'0': 0, '1': 128} +kNeeds128K = {'0': 0, '1': 64} + +def build(records, args): + with open(args.games_file, 'r') as games_file_handle: + games_list = [x.strip() for x in games_file_handle.readlines()] + games_list = [x.replace('=',',').split(',') + for x in games_list + if x and x[0] not in ('#', '[')] + if os.path.basename(args.slideshow_file).startswith('ACT'): + games_cache = dict([(key, (flags, displayname)) for flags, key, displayname in games_list]) + else: + games_cache = dict([(key, (flags, '')) for flags, key, displayname in games_list]) + + # yield OKVS header (2 x 2 bytes, unsigned int, little-endian) + yield pack('<2H', len(records), 0) + + for key, dummy, value in records: + flags, displayname = games_cache[value or key] + + # yield record length (1 byte) + yield pack('B', len(key) + len(value) + len(displayname) + 5) + + # yield key (Pascal-style string) + yield pack(f'{len(key)+1}p', key.encode('ascii')) + + # yield value (Pascal-style string) + yield pack(f'{len(value)+1}p', value.encode('ascii')) + + # yield display name (Pascal-style string) + yield pack(f'{len(displayname)+1}p', displayname.encode('ascii')) + + # yield flags + yield pack('B', kNeedsJoystick[flags[iNeedsJoystick]] + \ + kNeeds128K[flags[iNeeds128K]]) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Build indexed OKVS structure from slideshow configuration file") + parser.add_argument("slideshow_file") + parser.add_argument("games_file") + args = parser.parse_args() + records = [x.strip() for x in sys.stdin.readlines()] + records = [x.partition('=') for x in records if x and x[0] not in ('#', '[')] + for b in build(records, args): + sys.stdout.buffer.write(b) diff --git a/bin/buildslideshow.sh b/bin/buildslideshow.sh deleted file mode 100755 index b67c194..0000000 --- a/bin/buildslideshow.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -# flags -# -d include game display name (default off = display name will be 0-length string) - -# parameters -# stdin - input containing slideshow (e.g. some file in res/SS/) -# stdout - binary OKVS data structure -# 1 - list of games with metadata (e.g. build/GAMES.CONF) - -include_displayname=false -while getopts ":d" opt; do - case $opt in - d) include_displayname=true - ;; - esac -done -shift $((OPTIND-1)) - -games=$(cat "$1") - -# make temp file with just the key/value pairs (strip blank lines, comments, eof marker) -records=$(mktemp) -tr -d "\r" | awk '!/^$|^#|^\[/' > "$records" - -# make temp assembly source file that represents the binary OKVS data structure -source=$(mktemp) -(echo "*=0" # dummy program counter for assembler - echo "!le16 $(wc -l <"$records"), 0" # OKVS header - while IFS="=" read -r key value; do - [ -n "$value" ] && filename="$value" || filename="$key" - line=$(echo "$games" | awk '/,'"$filename"'=/') - needsjoystick=$(echo "$line" | cut -c1) # 'requires joystick' flag (0 or 1) - needs128k=$(echo "$line" | cut -c2) # 'requires 128K' flag (0 or 1) - if [ "$include_displayname" = false ]; then - displayname="" - else - displayname=$(echo "$line" | tr -d "\r" | awk -F= '{ print $2 }') - fi - echo "!byte ${#key}+${#value}+${#displayname}+5" # OKVS record length - echo "!byte ${#key}" # OKVS key length - echo "!text \"$key\"" # OKVS key - echo "!byte ${#value}" # OKVS value length - echo "!text \"$value\"" # OKVS value - echo "!byte ${#displayname}" - echo "!text \"$displayname\"" - echo "!byte $((needsjoystick*128))+$((needs128k*64))" - done < "$records") > "$source" - -# assemble temp source file into binary OKVS data structure, then output that -out=$(mktemp) -acme -o "$out" "$source" -cat "$out" - -# clean up -rm "$out" -rm "$source" -rm "$records" diff --git a/bin/dumpcr.js b/bin/dumpcr.js deleted file mode 100644 index abb598e..0000000 --- a/bin/dumpcr.js +++ /dev/null @@ -1,17 +0,0 @@ -a = new ActiveXObject("scripting.filesystemobject") -b = WScript.Arguments(0).lastIndexOf('\\') + 1 -c = WScript.Arguments(0).substr(0, b) -d = WScript.Arguments(0).substr(b) -if (d.substr(0, 2) == '*.') -{ - d = d.substr(2) -} -for (b = new Enumerator(a.GetFolder(c).files); !b.atEnd(); b.moveNext()) -{ - if ((d == '*') || (d == b.item().name) || (d == a.getextensionname(b.item().name))) - { - e = a.opentextfile(c + b.item().name).readall() - e = e.replace(/\r\n/g, "\n") - a.createtextfile(c + b.item().name).write(e) - } -} diff --git a/bin/flatten.js b/bin/flatten.js new file mode 100644 index 0000000..b2a22ea --- /dev/null +++ b/bin/flatten.js @@ -0,0 +1,13 @@ +a = new ActiveXObject("scripting.filesystemobject") +x = new ActiveXObject("wscript.shell") + +for (b = new Enumerator(a.GetFolder("build\\X").subfolders); !b.atEnd(); b.moveNext()) +{ + for (c = new Enumerator(b.item().subfolders); !c.atEnd(); c.moveNext()) + { + x.run('cmd /c move build\\X\\' + b.item().name + '\\' + c.item().name + ' build\\X', 0, 1) + } + + x.run('cmd /c move build\\X\\' + b.item().name + '\\* build\\X', 0, 1) + x.run('cmd /c rd build\\X\\' + b.item().name, 0, 1) +} diff --git a/bin/rsync.js b/bin/rsync.js deleted file mode 100644 index aec73f0..0000000 --- a/bin/rsync.js +++ /dev/null @@ -1,19 +0,0 @@ -a = new ActiveXObject("scripting.filesystemobject") -b = WScript.Arguments(0).lastIndexOf('\\') + 1 -c = WScript.Arguments(0).substr(0, b) -d = WScript.Arguments(0).substr(b) -if (d.substr(0, 2) == '*.') -{ - d = d.substr(2) -} -for (b = new Enumerator(a.GetFolder(c).files); !b.atEnd(); b.moveNext()) -{ - if ((d == '*') || (d == b.item().name) || (d == a.getextensionname(b.item().name))) - { - e = WScript.Arguments(1) + "\\" + b.item().Name - if (!a.fileexists(e) || (a.getfile(e).datelastmodified < b.item().datelastmodified)) - { - new ActiveXObject("wscript.shell").run('cmd /c copy "' + c + b.item().name + '" ' + WScript.Arguments(1)+"\\"+b.item().name.toUpperCase(), 0, 1) - } - } -} diff --git a/res/ATTRACT.CONF b/res/ATTRACT.CONF index 5ffe991..c83095d 100644 --- a/res/ATTRACT.CONF +++ b/res/ATTRACT.CONF @@ -155,5 +155,3 @@ ACTGHIJ2.CONF=2 TITLENOPQR.CONF=1 ACTNOPQR2.CONF=2 #5 - -[eof] diff --git a/res/CREDITS b/res/CREDITS index f97931d..f381728 100644 --- a/res/CREDITS +++ b/res/CREDITS @@ -22,4 +22,3 @@ testing & patches* * * * * * * * * * * * archive.org/details/TotalReplay2 -[eof] diff --git a/res/DFX.CONF b/res/DFX.CONF index b1e6e22..e6df157 100644 --- a/res/DFX.CONF +++ b/res/DFX.CONF @@ -106,4 +106,3 @@ DHGR.BLOOM.RIP DHGR.DITHRAD4 DHGR.48.SYNC DHGR.FLICK -[eof] diff --git a/res/FX.CONF b/res/FX.CONF index 959f16d..84277c9 100644 --- a/res/FX.CONF +++ b/res/FX.CONF @@ -170,4 +170,3 @@ SLOW.STAR.RIP BOXES48.ARROW REDLINES FLICK -[eof] diff --git a/res/HELPTEXT b/res/HELPTEXT index 1680919..9b69809 100644 --- a/res/HELPTEXT +++ b/res/HELPTEXT @@ -17,4 +17,3 @@ [Ctrl-P] joystick [Ctrl-A] credits -[eof] diff --git a/res/SFX.CONF b/res/SFX.CONF index b8a3cf8..bdbdbc9 100644 --- a/res/SFX.CONF +++ b/res/SFX.CONF @@ -61,5 +61,3 @@ SHR.LR2 SHR.80.ARROW SHR.IRIS SHR.UD - -[eof] diff --git a/res/proboothd b/res/proboothd deleted file mode 100644 index ad00609679466e2bc59e684d2b75d42f2dc87fa4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 512 zcmZQv(WOxRLzA8Jz)XXEy`mhwQ#scDKi@lrW9J(7nL_(cTzJsp(r2*0hkaBJYn4a06{D0xeIwrX_%yJvfpV(-3 z>cYLY{|f{++N}a|Rsi)rbA9HzHn$e{m5i-UOI2<03&@|UjP6A diff --git a/src/4cade.a b/src/4cade.a index 4b53ec9..1c5f505 100644 --- a/src/4cade.a +++ b/src/4cade.a @@ -20,6 +20,8 @@ RELBASE=$2000 FirstMover !pseudopc RELBASE { + !source "src/fx.lib.a" + ;------------------------------------------------------------------------------ ; Reenter ; This is the primary entry point for returning to the launcher from anywhere. @@ -37,10 +39,15 @@ FirstMover ; ; If there is no stack to restore, this exits via SearchMode. ; -; in: none +; in: LC RAM bank 1 or 2 must be banked in for reading because that's where +; this code lives ; out: see above ;------------------------------------------------------------------------------ Reenter + ; ensure that this code is high enough that it can function with + ; either LC RAM bank 1 or 2 banked in, because we might switch banks + ; during the routine + !if (RELBASE != $2000) and (* < $E000) { !serious "Reenter is too low" } cld sta $C000 ; Turn 80STORE switch off ldx #$ff @@ -54,6 +61,8 @@ Reenter sta $bf00,x dex bpl - + lda #= DisableAccelerator { !error "code is too large: ends at ", LCRAM2_END } - FONTDST = $E000 + FONTDST = $D100 } EvenLasterMover FONTSRC = * @@ -223,5 +253,8 @@ EvenLasterMover !warn "OKVS CACHE at ", OKVS_CACHE !warn "LCRAM2 ends at ", LCRAM2_END !warn "RELBASE = ", $10000 - (LastMover - FirstMover) + !if ($10000 - (LastMover - FirstMover) < $D500) { ; end of font data + !serious "code is too large, RELBASE overlaps with font data" + } } } diff --git a/src/4cade.init.a b/src/4cade.init.a old mode 100644 new mode 100755 index 7fa150d..e1d00e7 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -7,7 +7,7 @@ ; .SYSTEM file is loaded ; - !src "src/4cade.init.machine.a" + !src "src/4cade.init.machine.a" ; exits with ROM read, no write !src "src/4cade.init.screen.a" ; print text title in same place as graphical title will appear @@ -21,7 +21,8 @@ } jsr Has64K ; check for 64K (required) - bcc + + ; exits with ROM read, no write + bcc @enough_mem ldy #@no64Klen - lda @s_no64K,y @@ -32,26 +33,30 @@ @s_no64K !scrxor $80,"REQUIRES 64K" @no64Klen=(*-@s_no64K)-1 -+ +@enough_mem lda #0 sta zpMachineStatus sta SETC3ROM jsr HasVidHDCard ; check for VidHD card (allows super hi-res artwork even on non-IIgs machines) + ; does not rely on ROM sta CLRC3ROM ror zpMachineStatus - lda ROM_MACHINEID + lda ROM_MACHINEID ; requires ROM read cmp #$06 bne @NotGS sec jsr $FE1F ; check for IIgs (allows super hi-res artwork) + ; requires ROM read bcs @NotGS sec +HIDE_NEXT_BYTE @NotGS clc ror zpMachineStatus jsr Has128K ; check for 128K (allows DHGR slideshows and 128K games) + ; exits with ROM read, no write ror zpMachineStatus jsr HasJoystick ; check for joystick (absence is OK but we filter out some games that require a joystick) + ; requires ROM read ror zpMachineStatus ; now bit 4 = 1 if VidHD ; bit 5 = 1 if IIgs @@ -83,7 +88,7 @@ + ; accommodate uppercase-only machines (64K ][ and ][+ are supported) - lda ROM_MACHINEID + lda ROM_MACHINEID ; requires ROM read cmp #$A0 beq + ; Spectrum ED cmp #$06 @@ -98,14 +103,14 @@ ; print version or build number in lower right corner ldx #28 ldy #23 - jsr SetCursorPosition + jsr SetCursorPosition ; requires ROM read +LDADDR LoadingVersion - jsr LoadingPrint + jsr LoadingPrint ; requires ROM read !ifndef RELEASE { lda LoadingBuild ldx LoadingBuild+1 ldy #0 - jsr PrintAsDecimal + jsr PrintAsDecimal ; requires ROM read } ; set up text window so it only covers lower left corner @@ -117,7 +122,7 @@ ; print machine configuration in lower left corner ldx #0 ldy #23 - jsr SetCursorPosition + jsr SetCursorPosition ; requires ROM read ; if zpMachineStatus AND IS_IIGS then print 'IIgs' ; else if zpMachineStatus AND HAS_128K then print '128K' @@ -135,21 +140,21 @@ + +LDADDR Loading64K @printMem - jsr LoadingPrint + jsr LoadingPrint ; requires ROM read ; if zpMachineStatus AND HAS_JOYSTICK then CR & print 'joystick' lda zpMachineStatus and #HAS_JOYSTICK beq + +LDADDR LoadingJoystick - jsr LoadingPrint + jsr LoadingPrint ; requires ROM read + ; if zpMachineStatus AND HAS_VIDHD then CR & print 'VidHD' lda zpMachineStatus and #HAS_VIDHD beq + +LDADDR LoadingVidHD - jsr LoadingPrint + jsr LoadingPrint ; requires ROM read + @Relocate @@ -159,24 +164,24 @@ and #IS_IIGS beq + jsr HackThaCFFA - + + ; initialize and relocate ProRWTS2 to $D400 in LC RAM bank 2 +READ_ROM_WRITE_RAM2 - jsr init ; initialize and relocate ProRWTS2 to $D400 in RAM bank 2 - ; ProRWTS2 disk-data live at $D000-D3FF - ldx #$00 ; relocate program code to top of language card - ; since we end at $0000 now, adjust low offset to avoid destroying zpage -@FM lda FirstMover - (RELBASE & $FF),x - sta RELBASE & $FF00,x - inx - bne @FM - inc @FM+2 - inc @FM+5 - bne @FM + jsr init ; requires RAM2 write + ; overwrite ProDOS IRQ handler + sei + lda #NOIRQ + sta $3FF + cli + + ; relocate pseudo-ProDOS to LC RAM bank 2 + ldx #$00 ldy #>(255 + EvenLasterMover - LastMover) -@LM lda COPYSRC,x ; relocate pseudo-ProDOS to RAM bank 2 - sta COPYDST,x +@LM lda COPYSRC, x + sta COPYDST, x ; requires RAM2 write inx bne @LM inc @LM+2 @@ -184,10 +189,35 @@ dey bne @LM + jsr BuildAcceleratorFunction ; requires ROM read + +ST16 @accelSrc + dex +- +@accelSrc=*+1 + lda $FDFD,x ; copy (de)acceleration functions to LC RAM bank 2 + sta DisableAccelerator,x ; requires RAM2 write + dex + bpl - + ; X=FF + + ; relocate program code to LC RAM bank 1 + ; since we end at $0000 now, we adjust low offset to avoid destroying zpage + +READ_ROM_WRITE_RAM1 + inx + ;X=0 +@FM lda FirstMover - (RELBASE & $FF), x + sta RELBASE & $FF00, x ; requires RAM1 write + inx + bne @FM + inc @FM+2 + inc @FM+5 + bne @FM + ;X=0 + + ; relocate font data to LC RAM bank 1 ldy #4 -@ELM lda FONTSRC,x - ; relocate font data to $E000 - sta FONTDST,x +@ELM lda FONTSRC, x + sta FONTDST, x ; requires RAM1 write inx bne @ELM inc @ELM+2 @@ -195,30 +225,18 @@ dey bne @ELM - +READ_ROM_NO_WRITE - jsr BuildAcceleratorFunction - +READ_RAM2_WRITE_RAM2 - +ST16 @accelSrc - dex -- -@accelSrc=*+1 - lda $FDFD,x ; copy (de)acceleration functions to RAM bank 2 - sta DisableAccelerator,x - dex - bpl - - - +READ_ROM_WRITE_RAM2 - jsr BuildVBLFunction +DISABLE_ACCEL ; cycle counting in Mockingboard detection requires 1MHz - + ; /!\ macro exits with ROM read, no write +LDADDR FoundMockingboardCallback - jsr GetMockingboardStuff - +READ_RAM2_WRITE_RAM2 - stx MockingboardStuff ; save mockingboard slot and type in LC RAM - +READ_ROM_NO_WRITE - - txa - beq + + jsr GetMockingboardStuff ; requires ROM read + ; /!\ exits with ROM read, no write + +READ_ROM_WRITE_RAM1 + stx MockingboardStuff ; save mockingboard slot and type + txa ; requires RAM1 write + php + jsr BuildVBLFunction ; requires ROM read, RAM1 write + plp + beq @done_with_mb and #HAS_STEREO beq @mb_mono +LDADDR LoadingMockingboardStereo @@ -226,18 +244,18 @@ @mb_mono +LDADDR LoadingMockingboardStereo @mb_print - jsr LoadingPrint + jsr LoadingPrint ; requires ROM read ; if Mockingboard AND HAS_SPEECH then print CR & '...and it talks!' txa and #HAS_SPEECH - beq + + beq @done_with_mb +LDADDR LoadingMockingboardSpeech - jsr LoadingPrint + jsr LoadingPrint ; requires ROM read -+ - +READ_RAM2_WRITE_RAM2 - jsr EnableAccelerator +@done_with_mb + +READ_RAM2_NO_WRITE + jsr EnableAccelerator ; requires RAM2 read jmp OneTimeSetup ; ProRWTS2 has its own function to relocate itself @@ -281,36 +299,29 @@ FoundMockingboardCallback ora #$B0 jmp ROM_COUT +NOIRQ rti + !src "src/4cade.branding.a" !src "src/4cade.version.a" Loading64K - !byte 3 - !text "64K" + +PSTRING "64K" Loading128K - !byte 4 - !text "128K" + +PSTRING "128K" LoadingIIgs - !byte 4 - !text "IIgs" + +PSTRING "IIgs" LoadingJoystick - !byte 9 - !text $8D,"joystick" + +PSTRING "\rjoystick" LoadingVidHD - !byte 6 - !text $8D,"VidHD" + +PSTRING "\rVidHD" LoadingMockingboard - !byte 22 - !text $8D,"Mockingboard in slot " + +PSTRING "\rMockingboard in slot " LoadingMockingboardStereo - !byte 7 - !text $8D,"Stereo" + +PSTRING "\rStereo" LoadingMockingboardMono - !byte 5 - !text $8D,"Mono" + +PSTRING "\rMono" LoadingMockingboardSpeech - !byte 16 - !text "...and it talks!" + +PSTRING "...and it talks!" !ifndef RELEASE { PrintAsDecimal @@ -348,8 +359,10 @@ PrintAsDecimal !source "src/parse.common.a" OneTimeSetup + +READ_ROM_WRITE_RAM1 lda zpMachineStatus - sta MachineStatus ; save machine status in LC RAM + sta MachineStatus ; save machine status + ; requires RAM1 write and #IS_IIGS beq @NotGSOS !cpu 65816 @@ -359,33 +372,39 @@ OneTimeSetup jsr PrepareGSOS @NotGSOS + ; initialize ProDOS shim + +READ_RAM2_WRITE_RAM2 ldy #$0b -CopyDevs - lda $BF13,y - sta promote + $13,y +- lda $BF13, y + sta promote + $13, y ; requires RAM2 write dey - bpl CopyDevs - + bpl - + ; save unit in LC bank 2 while overriding !pseudopc lda $BF30 - sta promote + ProDOS_unit - $bf00 - ; save unit in LC bank 2 while overriding !pseudopc + sta promote + ProDOS_unit - $bf00 ; requires RAM2 write - lda hddopendir+1 ; save current directory as 'root' - ldy hddopendir+3 - sta gRootDirectory+1 - sty gRootDirectory+3 - jsr SwitchToBank1 + ; save current directory as 'root' + lda hddopendir+1 ; requires RAM2 read + ldy hddopendir+3 ; requires RAM2 read + sta gRootDirectory+1 ; requires RAM2 write + sty gRootDirectory+3 ; requires RAM2 write - jsr LoadFile ; load preferences file into $8000 + ; load raw preferences file into $8000 + +READ_RAM1_WRITE_RAM1 + jsr LoadFile ; requires RAM1 read + ; exits with RAM1 read/write !word kRootDirectory !word kGlobalPrefsFilename - !word $8000 - jsr ParseKeyValueList ; parse contents into OKVS data structure into LC RAM bank + + ; parse raw preferences file into OKVS data structure + jsr ParseKeyValueList ; requires RAM1 write because that's where gGlobalPrefsStore is !word gGlobalPrefsStore !word - !byte 16 - jsr pref_get ; see if cheats are enabled by default + ; see if cheats are enabled by default + jsr pref_get ; requires RAM1 read ; sets PTR -> cheat pref value as length-prefixed string '1' or '0' !word kCheat !word 0 @@ -395,8 +414,9 @@ CopyDevs asl asl asl ; A = #$08 or #$00 - ora MachineStatus + ora MachineStatus ; requires RAM1 read sta MachineStatus ; set bit 3 of MachineStatus + ; requires RAM1 write rol rol @@ -406,9 +426,10 @@ CopyDevs tax ; X in (0,2,4,6) ldy kGameCounts, x sty GameCount ; store total game count based on based on (has-joystick) X (has-128K) + ; requires RAM1 write sty SAVE ldy kGameCounts+1, x - sty GameCount+1 + sty GameCount+1 ; requires RAM1 write sty SAVE+1 lsr tax ; X in (0,1,2,3) @@ -423,10 +444,10 @@ CopyDevs ldy #5 @searchIndexSrc lda $FDFD, y ; SMC - sta kSearchIndexRecord, y + sta kSearchIndexRecord, y ; requires RAM1 write @searchCacheSrc lda $FDFD, y - sta kSearchCacheRecord, y + sta kSearchCacheRecord, y ; requires RAM1 write dey bpl @searchIndexSrc @@ -454,13 +475,13 @@ CopyDevs sta SAVE pla ora #$30 - sta VisibleGameCount,y + sta VisibleGameCount,y ; requires RAM1 write iny cpy #$03 bcc @outer bit CLEARKBD - jmp Reenter + jmp Reenter ; requires RAM1 or RAM2 read @kPowersOfTen !byte 100 diff --git a/src/4cade.init.machine.a b/src/4cade.init.machine.a index d45ab0f..b95f9c9 100644 --- a/src/4cade.init.machine.a +++ b/src/4cade.init.machine.a @@ -13,3 +13,4 @@ sta STOREOFF sta READMAINMEM sta WRITEMAINMEM + sta SETSTDZP diff --git a/src/4cade.init.screen.a b/src/4cade.init.screen.a index 9309cf6..1f9b0c6 100644 --- a/src/4cade.init.screen.a +++ b/src/4cade.init.screen.a @@ -2,7 +2,7 @@ ;(c) 2023 by 4am ; ; initialize and clear screen -; assumes zero page is completely trashed other than |zpCharMask| +; assumes zero page is completely trashed ; assumes ROM is banked in on entry ; ; note: this file is included by both the launcher and proboothd diff --git a/src/4cade.version.a b/src/4cade.version.a index d1bd26f..c3409c0 100644 --- a/src/4cade.version.a +++ b/src/4cade.version.a @@ -4,12 +4,10 @@ !ifndef RELEASE { LoadingVersion - !byte 9 - !text " build 0" + +PSTRING " build 0" LoadingBuild !word BUILDNUMBER } else { LoadingVersion - !byte 12 - !text "v1.0-alpha.3" + +PSTRING "v1.0-alpha.3" } diff --git a/src/constants.a b/src/constants.a index 46a6e81..b473376 100644 --- a/src/constants.a +++ b/src/constants.a @@ -9,7 +9,7 @@ ; D000 - reserved ; D001..D06E - gGlobalPrefsStore ; ...unused... -; E000..E3FF - HGR font data +; D100..D4FF - HGR font data ; ...unused... ; E6C9..FFEB - main program code ; FFEC..FFF9 - API functions and global constants available for main program @@ -20,9 +20,9 @@ ; LC RAM BANK 2 ; D000..D5FF - ProRWTS data ; D600..D8BD - ProRWTS code -; D8BE..DC76 - ProRWTS glue code -; DC77..DC7C - backup of stack (during gameplay and self-running demos) -; DC7D..DC82 - okvs cache (attract state saved across self-running demo) +; D8BE..DCB7 - ProRWTS glue code +; DCB8..DCBD - backup of stack (during gameplay and self-running demos) +; DCBE..DCC2 - okvs cache (attract state saved across self-running demo) ; ...unused... ; DFB4..DFFF - (de)acceleration function ; @@ -56,7 +56,7 @@ ; MAIN MEMORY DURING GAME LAUNCH ; 0100..0105 - re-entry code ; 0106..01BF - prelaunch code -; 0400..7FFF - text screen cleared +; 0400..07FF - text screen cleared ; 2000..5FFF - hi-res screens cleared ; A000.. - prelaunch index file ; @@ -77,16 +77,19 @@ ; soft switches KBD = $C000 ; last key pressed (if any) CLEARKBD = $C010 ; clear last key pressed -STOREOFF = $C000 ; STA then use the following 4 flags: -READMAINMEM = $C002 ; STA to read from main mem -READAUXMEM = $C003 ; STA to read from aux mem -WRITEMAINMEM = $C004 ; STA to write to main mem -WRITEAUXMEM = $C005 ; STA to write to aux mem + +STOREOFF = $C000 ; STA then use the following flags: +READMAINMEM = $C002 ; STA to read from main mem ($0200..$BFFF) +READAUXMEM = $C003 ; STA to read from aux mem ($0200..$BFFF) +WRITEMAINMEM = $C004 ; STA to write to main mem ($0200..$BFFF) +WRITEAUXMEM = $C005 ; STA to write to aux mem ($0200..$BFFF) + +SETSTDZP = $C008 ; STA to r/w from main mem stack and zero page ($0000..$01FF) CLRC3ROM = $C00A ; STA to use internal Slot 3 ROM (required to use 128K and DHGR) SETC3ROM = $C00B ; STA to use external Slot 3 ROM (required to detect VidHD in slot 3) -CLR80VID = $C00C ; 40 columns (also used to get out of DHGR mode) -SET80VID = $C00D ; 80 columns (also used to get into DHGR mode) -PRIMARYCHARSET= $C00E ; no mousetext for you +CLR80VID = $C00C ; STA to use 40 columns (also used to get out of DHGR mode) +SET80VID = $C00D ; STA to use 80 columns (also used to get into DHGR mode) +PRIMARYCHARSET= $C00E ; STA to use no-mousetext character set SLOT3STATUS = $C017 ; bit 7 only MONOCOLOR = $C021 ; IIgs bit 7 switches composite mono/color modes TBCOLOR = $C022 ; IIgs text foreground and background colors (also VidHD but write-only) @@ -116,7 +119,7 @@ ROM_NORMAL = $FE84 ; NORMAL text (instead of INVERSE or FLASH) ROM_IN0 = $FE89 ; SETKBD ROM_PR0 = $FE93 ; SETVID -; zero page during init ONLY +; zero page addresses during init ONLY zpMachineStatus= $F0 ; bit 7 = 1 if machine has joystick ; bit 6 = 1 if machine has 128K ; bit 5 = 1 if machine has a VidHD card @@ -124,7 +127,7 @@ zpMachineStatus= $F0 ; bit 7 = 1 if machine has joystick ; only used during init, then copied to MachineStatus in LC RAM zpCharMask = $F1 ; only used during init, then clobbered -; zero page +; zero page addresses PARAM = $00 ; word (used by PARAMS_ON_STACK macro, so basically everywhere) PTR = $02 ; word SRC = $04 ; word @@ -135,6 +138,7 @@ WCOUNT = $0C ; word HTAB = $24 ; byte VTAB = $25 ; byte RNDSEED = $4E ; word +PrelaunchInit= $EA ; textrank BestMatchIndex = $E5 ; word tmpx = $E7 ; byte @@ -153,28 +157,182 @@ firstletter= $FA ; byte MatchCount = $FB ; byte BestMatchScore = $FC ; byte -; main memory -gStackSize = 6 ; seems like only six are needed -gPathname = $BFD0 ; used by SetPath/AddToPath -gKeyLen = $1F00 -gKey = $1F01 -UILine1 = $1FB0 -UILine2 = $1FD8 -UI_ToPlay = $1FF7 -ProBootEntry = $2025 - -gValLen = $1F80 -gVal = $1F81 - +; main memory addresses +gKeyLen = $1F00 ; used by ParseKeyValueList +gKey = $1F01 ; "" +gValLen = $1F80 ; "" +gVal = $1F81 ; "" +UILine1 = $1FB0 ; used by DrawUI +UILine2 = $1FD8 ; "" +UI_ToPlay = $1FF7 ; "" +ProBootEntry = $2028 ; used by ProBoot gSearchIndex = $6000 gSearchCache = $A000 +gPathname = $BFD0 ; used by SetPath/AddToPath -; LC RAM 1 & 2 -iLoadXSingle = $FFE9 -iAddToPath = $FFEC -iLoadFileDirect = $FFEF ; note: you really want LC RAM 2 banked in before calling this -WaitForVBL = $FFF2 -UnwaitForVBL = $FFF5 +; main memory addresses used by graphic effects +hgrlo = $0201 ; $C0 bytes +mirror_cols = $02C1 ; $28 bytes +hgrhi = $0301 ; $C0 bytes +hgr1hi = hgrhi + +FXCode = $6200 +Coordinates1Bit= $8600 ; $3481 bytes ($3480 on disk + 1 byte EOF marker added at runtime) +EndCoordinates1Bit = Coordinates1Bit + $3480 + +Coordinates2Bit= $8100 ; $3C01 bytes ($3C00 on disk + 1 byte EOF marker added at runtime) +EndCoordinates2Bit = Coordinates2Bit + $3C00 + +Coordinates3Bit= $6D00 ; $5001 bytes ($5000 on disk + 1 byte EOF marker added at runtime) +EndCoordinates3Bit = Coordinates3Bit + $5000 + +hgrlomirror = $BB01 ; $C0 bytes +hgr1himirror = $BC01 ; $C0 bytes +dithermasks = $BDA8 ; $58 bytes, must not cross page boundary +evenrow_masks = dithermasks +oddrow_masks = dithermasks+2 +no_masks = dithermasks+44 +copymasks1bit = $BE00 ; $100 bytes but sparse, index is 0..6 but in high 3 bits, so $00,$20,$40,$60,$80,$A0,$C0 +copymasks2bit = copymasks1bit ; $100 bytes but sparse, index is 0..4 but in high 3 bits, so $00,$20,$40,$60,$80 +copymasks3bit = copymasks1bit ; $100 bytes but sparse, index is 0..7 but in high 3 bits, so $00,$20,$40,$60,$80,$A0,$C0,$E0 +mirror_copymasks1bit = copymasks1bit+1 +mirror_copymasks2bit = copymasks2bit+1 +hgrlo3a = $6A00 ; $80 bytes +hgrlo3b = $6A80 ; $80 bytes +hgrlo3c = $6B00 ; $80 bytes +hgrhi3a = $6B80 ; $80 bytes +dither1_lo = $6880 ; $80 bytes +dither2_lo = $6900 ; $80 bytes +dither3_lo = $6980 ; $80 bytes +hgrhi3b = $6C00 ; $80 bytes +hgrhi3c = $BD01 ; $80 bytes +extra_cols = $BEF8 ; $08 bytes + +; hgr.48boxes constants +HGR48StageDrawingRoutines = $7F00 ; $100 bytes +; High bytes of drawing routines for each stage (actual routines will be page-aligned). +; To minimize code size, we build drawing routines in this order: +; - copy01 (STAGE1 template) +; - copy00 (STAGE0 template) +; - copy0F..copy09 (OUTER_STAGE template) +; - copy08..copy02 (MIDDLE_STAGE template) +; - change some opcodes to turn the 'copy' routines into 'clear' routines +; - clear0F..clear08 (OUTER_STAGE) +; - clear07..clear02 (MIDDLE_STAGE) +; - clear01 (STAGE1) +; - clear00 (STAGE0) +clear00 = $80 +clear01 = $81 +clear02 = $82 +clear03 = $83 +clear04 = $84 +clear05 = $85 +clear06 = $86 +clear07 = $87 +clear08 = $88 +clear09 = $89 +clear0A = $8A +clear0B = $8B +clear0C = $8C +clear0D = $8D +clear0E = $8E +clear0F = $8F +copy02 = $90 +copy03 = $91 +copy04 = $92 +copy05 = $93 +copy06 = $94 +copy07 = $95 +copy08 = $96 +copy09 = $97 +copy0A = $98 +copy0B = $99 +copy0C = $9A +copy0D = $9B +copy0E = $9C +copy0F = $9D +copy00 = $9E +copy01 = $9F + +; dhgr.48boxes constants +DHGR48BoxStages = $10 ; $30 bytes, current stage for each box +DHGR48StageDrawingRoutines = $6F00 ; $100 bytes +; High bytes of drawing routines for each stage (actual routines will be page-aligned). +; To minimize code size, we build drawing routines in this order: +; - copy01 (STAGE1 template) +; - copy00 (STAGE0 template) +; - copy0F..copy09 (OUTER_STAGE template) +; - copy08..copy02 (MIDDLE_STAGE template) +; - change some opcodes to turn the 'copy' routines into 'clear' routines +; - clear0F..clear08 (OUTER_STAGE) +; - clear07..clear02 (MIDDLE_STAGE) +; - clear01 (STAGE1) +; - clear00 (STAGE0) +dhgr_clear00 = $70 +dhgr_clear01 = $71 +dhgr_clear02 = $72 +dhgr_clear03 = $73 +dhgr_clear04 = $74 +dhgr_clear05 = $75 +dhgr_clear06 = $76 +dhgr_clear07 = $77 +dhgr_clear08 = $78 +dhgr_clear09 = $79 +dhgr_clear0A = $7A +dhgr_clear0B = $7B +dhgr_clear0C = $7C +dhgr_clear0D = $7D +dhgr_clear0E = $7E +dhgr_clear0F = $7F +dhgr_copy02 = $80 +dhgr_copy03 = $81 +dhgr_copy04 = $82 +dhgr_copy05 = $83 +dhgr_copy06 = $84 +dhgr_copy07 = $85 +dhgr_copy08 = $86 +dhgr_copy09 = $87 +dhgr_copy0A = $88 +dhgr_copy0B = $89 +dhgr_copy0C = $8A +dhgr_copy0D = $8B +dhgr_copy0E = $8C +dhgr_copy0F = $8D +dhgr_copy00 = $8E +dhgr_copy01 = $8F + +; LC RAM 1 & 2 addresses +; these are defined here because they are also called by other targets +; that are assembled separately, e.g. prelaunchers, demo launchers, and graphic effects +UnwaitForVBL = $FFEE +WaitForVBL = UnwaitForVBL-3 +iLoadFileDirect = WaitForVBL-3 ; note: you really want LC RAM 2 banked in before calling this +iAddToPath = iLoadFileDirect-3 +iLoadXSingle = iAddToPath-3 +iLoadFXCODE = iLoadXSingle-3 +iLoadFXDATA = iLoadFXCODE-3 +iBuildHGRTables = iLoadFXDATA-3 +iBuildHGRMirrorTables = iBuildHGRTables-3 +iBuildHGRMirrorCols = iBuildHGRMirrorTables-3 +iBuildDHGRMirrorCols = iBuildHGRMirrorCols-3 +iBuildHGRDitherMasks = iBuildDHGRMirrorCols-3 +iBuildDHGRDitherMasks = iBuildHGRDitherMasks-3 +iWaitForKeyWithTimeout = iBuildDHGRDitherMasks-3 +iReverseCoordinates1Bit = iWaitForKeyWithTimeout-3 +iRippleCoordinates1Bit = iReverseCoordinates1Bit-3 +iRippleCoordinates1Bit2 = iRippleCoordinates1Bit-3 +iRippleCoordinates1Bit3 = iRippleCoordinates1Bit2-3 +iRippleCoordinates1Bit4 = iRippleCoordinates1Bit3-3 +iBuildHGRSparseBitmasks1Bit = iRippleCoordinates1Bit4-3 +iBuildDHGRSparseBitmasks1Bit = iBuildHGRSparseBitmasks1Bit-3 +iBuildHGRSparseBitmasks2Bit = iBuildDHGRSparseBitmasks1Bit-3 +iBuildDHGRSparseBitmasks2Bit = iBuildHGRSparseBitmasks2Bit-3 +iReverseCoordinates2Bit = iBuildDHGRSparseBitmasks2Bit-3 +iRippleCoordinates2Bit = iReverseCoordinates2Bit-3 +iReverseCoordinates3Bit = iRippleCoordinates2Bit-3 +iRippleCoordinates3Bit = iReverseCoordinates3Bit-3 +iSetupPrecomputed3Bit = iRippleCoordinates3Bit-3 +iPrelaunchInit = iSetupPrecomputed3Bit-3 MockingboardStuff = $FFF8 ; bit 7 = 1 if SC-01 speech chip present (Speech I) ; bit 6 = 1 if SSI-263 speech chip present (Mockingboard "B"-"D") @@ -184,10 +342,14 @@ MockingboardStuff = $FFF8 ; bit 7 = 1 if SC-01 speech chip present (Speech I) ; bits 0-3: slot number MachineStatus = $FFF9 -; LC RAM 2 +; LC RAM 2 addresses DisableAccelerator = $DFB4 EnableAccelerator = DisableAccelerator+3 +; application constants +gStackSize = 6 ; seems like only six are needed +PRELAUNCH_STANDARD_SIZE = 61 ; LoadStandardPrelaunch, eventually to be determined at build-time + ; AND masks for MockingboardStuff MOCKINGBOARD_SLOT = %00001111 HAS_STEREO = %00100000 @@ -218,8 +380,6 @@ ATTRACT_SHR = %00100000 ATTRACT_GR = %01000000 ATTRACT_DGR = %10000000 -PRELAUNCH_STANDARD_SIZE = 61 ; LoadStandardPrelaunch, eventually to be determined at build-time - ; shared symbols for prelaunch and effects to call ProRWTS2 functions iCurBlockLo = $D601 ; constant iCurBlockHi = $D603 ; constant diff --git a/src/fx.lib.a b/src/fx.lib.a new file mode 100644 index 0000000..5e3ec56 --- /dev/null +++ b/src/fx.lib.a @@ -0,0 +1,822 @@ +;license:MIT +;(c) 2024 by 4am +; +; common routines used by graphic effects +; +; Note: launcher code can call these routines directly. However, +; graphic effects are assembled as separate targets and must call +; these routines indirectly via the vectors defined in constants.a, +; e.g. iBuildHGRTables instead of BuildHGRTables. +; +; Public functions: +; - WaitForKeyWithTimeout +; - BuildHGRTables +; - BuildHGRMirrorTables +; - BuildHGRMirrorCols +; - BuildDHGRMirrorCols +; - BuildHGRDitherMasks +; - BuildDHGRDitherMasks + +; - BuildHGRSparseBitmasks1Bit +; - BuildDHGRSparseBitmasks1Bit +; - ReverseCoordinates1Bit +; - RippleCoordinates1Bit +; - RippleCoordinates1Bit2 +; - RippleCoordinates1Bit3 +; - RippleCoordinates1Bit4 + +; - BuildHGRSparseBitmasks2Bit +; - BuildDHGRSparseBitmasks2Bit +; - ReverseCoordinates2Bit +; - RippleCoordinates2Bit + +; - SetupPrecomputed3Bit +; - ReverseCoordinates3Bit +; - RippleCoordinates3Bit + + !source "src/fx/macros.a" + +WaitForKeyWithTimeout +; in: A = timeout length (like standard $FCA8 wait routine) +; out: A clobbered (not always 0 if key is pressed, but also not the key pressed) +; X/Y preserved + sec +@wait1 pha +@wait2 sbc #1 + bne @wait2 + pla + bit KBD + bmi @exit + sbc #1 + bne @wait1 +@exit rts + +; based on routine by John Brooks +; posted on comp.sys.apple2 on 2018-07-11 +; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ +BuildHGRTables +; out: populates tables at $0201 (hgrlo) and $0301 (hgrhi) +; A clobbered +; X=$C0 (important! some callers rely on this) +; Z=1 +; Y preserved + ldx #0 +- txa + and #$F8 + bpl + + ora #5 ++ asl + bpl + + ora #5 ++ asl + asl + sta hgrlo, x + txa + and #7 + rol + asl hgrlo, x + rol + ora #$20 + sta hgrhi, x + inx + cpx #$C0 + bne - + rts + +BuildHGRMirrorTables + ldx #$C0 + ldy #0 +- tya + and #$F8 + bpl + + ora #5 ++ asl + bpl + + ora #5 ++ asl + asl + sta hgrlomirror-1, x + tya + and #7 + rol + asl hgrlomirror-1, x + rol + ora #$20 + sta hgr1himirror-1, x + iny + dex + bne - + rts + +BuildHGRMirrorCols +; in: none +; out: mirror_cols populated with lookup table to get $27-y for y in $00..$27 +; all registers and flags clobbered + ldx #$27 + ldy #$00 +- tya + sta mirror_cols, x + iny + dex + bpl - + rts + +BuildDHGRMirrorCols +; out: mirror_cols populated with lookup table to get $27-y for y in $00..$27 +; duplicated in both mainmem and auxmem +; X=0 +; Z=1 + ldx #$28 + ldy #$00 +- tya + sta mirror_cols-1, x + sta $C005 + sta mirror_cols-1, x + sta $C004 + iny + dex + bne - + rts + +BuildHGRDitherMasks + ldy #40 +- lda #%10110011 + sta dithermasks, y + lda #%11100110 + sta dithermasks+1, y + lda #%11001100 + sta dithermasks+2, y + lda #%10011001 + sta dithermasks+3, y + dey + dey + dey + dey + bpl - + ldy #43 + lda #$FF +- sta no_masks, y + dey + bpl - + rts + +BuildDHGRDitherMasks + ldy #40 +- lda #%10011110 + sta dithermasks, y + lda #%11111000 + sta dithermasks+1, y + lda #%11100001 + sta dithermasks+2, y + lda #%10000111 + sta dithermasks+3, y + dey + dey + dey + dey + bpl - + ldy #43 +- lda #$FF + sta no_masks, y + dey + bpl - + sta $C005 + ldy #40 +- lda #%10001111 + sta dithermasks, y + lda #%10111100 + sta dithermasks+1, y + lda #%11110000 + sta dithermasks+2, y + lda #%11000011 + sta dithermasks+3, y + dey + dey + dey + dey + bpl - + ldy #43 +- lda #$FF + sta no_masks, y + dey + bpl - + sta $C004 + rts + +BuildHGRSparseBitmasks1Bit + lda #%10000001 + sta copymasks1bit + sta mirror_copymasks1bit+$C0 + + lda #%10000010 + sta copymasks1bit+$20 + sta mirror_copymasks1bit+$A0 + + lda #%10000100 + sta copymasks1bit+$40 + sta mirror_copymasks1bit+$80 + + lda #%10001000 + sta copymasks1bit+$60 + sta mirror_copymasks1bit+$60 + + lda #%10010000 + sta copymasks1bit+$80 + sta mirror_copymasks1bit+$40 + + lda #%10100000 + sta copymasks1bit+$A0 + sta mirror_copymasks1bit+$20 + + lda #%11000000 + sta copymasks1bit+$C0 + sta mirror_copymasks1bit + rts + +BuildDHGRSparseBitmasks1Bit +; out: X=0 + ldx #$00 + txa +- sta copymasks1bit, x + sta $C005 + sta copymasks1bit, x + sta $C004 + inx + bne - + ; X=0 + + lda #%00000111 + sta copymasks1bit+$80 + sta mirror_copymasks1bit+$40 + + lda #%00011000 + sta copymasks1bit+$A0 + sta mirror_copymasks1bit+$20 + + lda #%01100000 + sta copymasks1bit+$C0 + sta mirror_copymasks1bit + + sta $C005 + + lda #%10000011 + sta copymasks1bit + sta mirror_copymasks1bit+$C0 + + lda #%10001100 + sta copymasks1bit+$20 + sta mirror_copymasks1bit+$A0 + + lda #%10110000 + sta copymasks1bit+$40 + sta mirror_copymasks1bit+$80 + + lda #%11000000 + sta copymasks1bit+$60 + sta mirror_copymasks1bit+$60 + + sta $C004 + rts + +ReverseCoordinates1Bit + ldy #0 ; Coordinates1Bit + sta $f1 + lda #<(EndCoordinates1Bit - 2) + sta $f2 + lda #>(EndCoordinates1Bit - 2) + sta $f3 + clc + !byte $24 +- sec +-- lda ($f0), y + pha + lda ($f2), y + sta ($f0), y + pla + sta ($f2), y + iny + bcc - + ldy #0 + !byte $24 +- clc + inc $f0 + bne + + inc $f1 ++ lda $f1 + eor #>(Coordinates1Bit + $1A40) + bne + + lda $f0 + eor #<(Coordinates1Bit + $1A40) + beq ++ ++ lda $f2 + bne + + dec $f3 ++ dec $f2 + bcs - + bcc -- ; always +++ rts + +BuildHGRSparseBitmasks2Bit + lda #%10000011 + sta copymasks2bit + sta mirror_copymasks2bit+$E0 + + lda #%10001100 + sta copymasks2bit+$20 + sta mirror_copymasks2bit+$C0 + + lda #%10110000 + sta copymasks2bit+$40 + sta mirror_copymasks2bit+$A0 + + lda #%11000000 + sta copymasks2bit+$60 + sta mirror_copymasks2bit+$80 + + lda #%10000001 + sta copymasks2bit+$80 + sta mirror_copymasks2bit+$60 + + lda #%10000110 + sta copymasks2bit+$A0 + sta mirror_copymasks2bit+$40 + + lda #%10011000 + sta copymasks2bit+$C0 + sta mirror_copymasks2bit+$20 + + lda #%11100000 + sta copymasks2bit+$E0 + sta mirror_copymasks2bit + rts + +BuildDHGRSparseBitmasks2Bit + ldx #$00 + txa +- sta copymasks2bit, x + sta $C005 + sta copymasks2bit, x + sta $C004 + inx + bne - + + lda #%10011111 + sta copymasks2bit+$40 + sta mirror_copymasks2bit+$A0 + + lda #%11100000 + sta copymasks2bit+$60 + sta mirror_copymasks2bit+$80 + + lda #%10000111 + sta copymasks2bit+$C0 + sta mirror_copymasks2bit+$20 + + lda #%11111000 + sta copymasks2bit+$E0 + sta mirror_copymasks2bit + + sta $C005 + + lda #%10001111 + sta copymasks2bit + sta mirror_copymasks2bit+$E0 + + lda #%11110000 + sta copymasks2bit+$20 + sta mirror_copymasks2bit+$C0 + + lda #%10000011 + sta copymasks2bit+$80 + sta mirror_copymasks2bit+$60 + + lda #%11111100 + sta copymasks2bit+$A0 + sta mirror_copymasks2bit+$40 + + sta $C004 + rts + +ReverseCoordinates2Bit + ldy #0 ; Coordinates2Bit + sta $f1 + lda #<(EndCoordinates2Bit - 2) + sta $f2 + lda #>(EndCoordinates2Bit - 2) + sta $f3 + + ldx #$1E ; #$3C/2 + clc + !byte $24 +- sec +-- lda ($f0), y + pha + lda ($f2), y + sta ($f0), y + pla + sta ($f2), y + iny + bcc - + ldy #0 + !byte $24 +- clc + inc $f0 + bne + + inc $f1 + dex + beq ++ ++ lda $f2 + bne + + dec $f3 ++ dec $f2 + bcs - + bcc -- ; always branches +++ rts + +RippleCoordinates2Bit + ldy #0 + + ldx #$33 +- lda @ptrtbl, x + sta $c0, x + dex + bpl - + + lda #$9b + sta $fe + iny + sty $ff + + ldx #6 +- lda Coordinates2Bit + 1, x + sta $7f, x + lda Coordinates2Bit + 9, x + sta $85, x + lda Coordinates2Bit + 17, x + sta $8b, x + lda Coordinates2Bit + 65, x + sta $9b, x + dex + bne - + lda Coordinates2Bit + 28 + sta $92 + lda Coordinates2Bit + 29 + sta $93 + ldx #4 +- lda Coordinates2Bit + 33, x + sta $93, x + lda Coordinates2Bit + 41, x + sta $97, x + lda Coordinates2Bit + 83, x + sta $a1, x + dex + bne - + ldx #2 +- lda Coordinates2Bit + 125, x + sta $a5, x + lda Coordinates2Bit + 131, x + sta $a7, x + lda Coordinates2Bit + 139, x + sta $a9, x + lda Coordinates2Bit + 169, x + sta $ab, x + lda Coordinates2Bit + 237, x + sta $ad, x + lda Coordinates2Bit + 2193, x + sta $af, x + lda Coordinates2Bit + 6581, x + sta $b1, x + dex + bne - + +--- ldx #$34 +-- lda $be, x + tay + ora $bf, x + beq + + lda $bf, x + jsr @aslmod + sty $be, x + sta $bf, x + sty $fc + clc + adc #>Coordinates2Bit + sta $fd + ldy #0 + !byte $24 +- sec + lda ($fc), y + pha + lda $7e, x + sta ($fc), y + pla + sta $7e, x + inx + iny + bcc - + dex + dex ++ dex + dex + bne -- + ldy #1 + lda $fe + eor #<(411 - 2) + beq + + ldy #9 + eor #<(411 - 2) xor <(411 - 136) + bne ++ ++ +- ldx @zerotbl, y + sta $0, x + sta $1, x + dey + bpl - +++ dec $fe + bne --- + dec $ff + bpl --- + bmi @exit ; always branches +@aslmod jsr + ++ cmp #$1E + bcc + + iny ++ pha + tya + asl + tay + pla + rol + cmp #$3C + bcc @exit + sbc #$3C +@exit rts +@ptrtbl !word 2, 4, 6, 10, 12, 14, 18, 20 + !word 22, 28, 34, 36, 42, 44, 66, 68 + !word 70, 84, 86, 126, 132, 140, 170, 238 + !word 2194, 6582 +@zerotbl !byte $f0, $f2, $ca, $d2, $d8, $e0, $e2, $e6, $ea, $ee + +SetupPrecomputed3Bit + ; build regular HGR lookup tables, then split them + jsr BuildHGRTables + ldx #$BF + ldy #$3F +- lda hgrlo, x + sta hgrlo3c, y + sta hgrlo3c+$40, y + lda hgrhi, x + sta hgrhi3c, y + sta hgrhi3c+$40, y + dex + lda hgrlo, x + sta hgrlo3b, y + sta hgrlo3b+$40, y + lda hgrhi, x + sta hgrhi3b, y + sta hgrhi3b+$40, y + dex + lda hgrlo, x + sta hgrlo3a, y + sta hgrlo3a+$40, y + lda hgrhi, x + sta hgrhi3a, y + sta hgrhi3a+$40, y + dex + dey + bpl - + + ; build lookup table to get $20+y for y in $00..$07 + ldx #$07 + ldy #$27 +- tya + sta extra_cols-$20, y + dey + dex + bpl - + + ; build sparse lookup tables for bitmasks + lda #%10000011 + sta copymasks3bit + + lda #%10001100 + sta copymasks3bit+$20 + + lda #%10110000 + sta copymasks3bit+$40 + + lda #%11000000 + sta copymasks3bit+$60 + + lda #%10000001 + sta copymasks3bit+$80 + + lda #%10000110 + sta copymasks3bit+$A0 + + lda #%10011000 + sta copymasks3bit+$C0 + + lda #%11100000 + sta copymasks3bit+$E0 + rts + +ReverseCoordinates3Bit + ldy #0 ; Coordinates3Bit + sta $f1 + lda #<(EndCoordinates3Bit - 2) + sta $f2 + lda #>(EndCoordinates3Bit - 2) + sta $f3 + + ldx #$28 ; #$50/2 + clc + !byte $24 +- sec +-- lda ($f0), y + pha + lda ($f2), y + sta ($f0), y + pla + sta ($f2), y + iny + bcc - + ldy #0 + !byte $24 +- clc + inc $f0 + bne + + inc $f1 + dex + beq ++ ++ lda $f2 + bne + + dec $f3 ++ dec $f2 + bcs - + bcc -- ; always branches +++ rts + +RippleCoordinates3Bit + ldx #$1B +- lda @ripplezp, x + sta $e0, x + dex + bpl - + +--- ldx #$0c +-- ldy $ee, x + lda $ef, x + jsr @aslmod + sty $ee, x + sta $ef, x + sty $ec + clc + adc #>Coordinates3Bit + sta $ed + ldy #0 + !byte $24 +- sec + lda ($ec), y + pha + lda $de, x + sta ($ec), y + pla + sta $de, x + inx + iny + bcc - + dex + dex + dex + dex + bne -- + dec $ee + bne --- + dec $ef + bpl --- + bmi @exit ; always branches +@aslmod jsr + ++ cmp #$28 + bcc + + iny ++ pha + tya + asl + tay + pla + rol + cmp #$50 + bcc @exit + sbc #$50 +@exit rts +@ripplezp + !byte $1F,$F3,$20,$F3,$20,$14,$20,$D3 + !byte $1E,$F3,$1F,$54,$00,$00,$AA,$06 + !byte $02,$00,$04,$00,$06,$00,$0C,$00 + !byte $16,$00,$1A,$00 + +!zone { +RippleCoordinates1Bit4 + lda #Coordinates1Bit + sta $ed + ldy #0 + !byte $24 +- sec + lda ($ec), y + pha + lda $de, x + sta ($ec), y + pla + sta $de, x + inx + iny + bcc - + dex + dex + dex + dex + bne -- + dec $ee + bne --- + dec $ef + bpl --- + bmi exit ; always branches +aslmod4 jsr aslmod +aslmod3 jsr aslmod +aslmod2 jsr aslmod +aslmod cmp #$1A +!if (>aslmod != >aslmod4) { + !serious "aslmod entry points are not on the same page" +} + bcc + + bne ++ + cpy #$40 + bcc + +++ iny ++ pha + tya + asl + tay + pla + rol + cmp #$34 + bcc exit + bne ++ + cpy #$80 + bcc exit +++ pha + tya + sbc #$80 + tay + pla + sbc #$34 +exit rts +} diff --git a/src/fx/code.dhgr.48boxes.a b/src/fx/code.dhgr.48boxes.a new file mode 100644 index 0000000..7ad910a --- /dev/null +++ b/src/fx/code.dhgr.48boxes.a @@ -0,0 +1,677 @@ +;license:MIT +;(c) 2020 by 4am & qkumba +; +!cpu 6502 +!to "build/FXCODE/DHGR48",plain +*=$6200 + +; The screen is separated into 48 boxes. +; Boxes are laid out in a grid, left-to-right, top-down: +; +; 0 1 2 3 4 5 6 7 +; 8 9 10 11 12 13 14 15 +; 16 17 18 19 20 21 22 23 +; 24 25 26 27 28 29 30 31 +; 32 33 34 35 36 37 38 39 +; 40 41 42 43 44 45 46 47 +; +; Each box is 70x32 pixels, so each row of each box is 5 consecutive +; bytes in main memory and another 5 in auxiliary memory, all of which +; are easy to find once you calculate the base address for that row. +; +; |BoxInitialStages| defines the initial grid of stages for each box. +; Each stage is used as an index into the |StagesHi| array +; to find the drawing routine for that stage (if any). +; Each box's stage is incremented after each iteration through the main loop. +; When the main loop iterates through all 48 boxes without drawing anything, +; the program exits. +; +; There are 16 clear routines that set certain bits to 0 (black), +; labeled clear00..clear0F. clear00 clears the inner-most box, and +; clear0F clears the outermost box (see diagram). +; There are 16 copy routines that copy certain bits from the source +; image on page 2 to the destination image on page 1, labeled copy00..copy0F. +; +; row| pixels +; ---+--------------------------------------- +; 00 |FFFFFFF|FFFFFFF|FFFFFFF|FFFFFFF|FFFFFFF +; 01 |FEEEEEE|EEEEEEE|EEEEEEE|EEEEEEE|EEEEEEF +; 02 |FEDDDDD|DDDDDDD|DDDDDDD|DDDDDDD|DDDDDEF +; 03 |FEDCCCC|CCCCCCC|CCCCCCC|CCCCCCC|CCCCDEF +; 04 |FEDCBBB|BBBBBBB|BBBBBBB|BBBBBBB|BBBCDEF +; 05 |FEDCBAA|AAAAAAA|AAAAAAA|AAAAAAA|AABCDEF +; 06 |FEDCBA9|9999999|9999999|9999999|9ABCDEF +; 07 |FEDCBA9|8888888|8888888|8888888|9ABCDEF +; ---+-------+-------+-------+-------+------- +; 08 |FEDCBA9|8777777|7777777|7777778|9ABCDEF +; 09 |FEDCBA9|8766666|6666666|6666678|9ABCDEF +; 0A |FEDCBA9|8765555|5555555|5555678|9ABCDEF +; 0B |FEDCBA9|8765444|4444444|4445678|9ABCDEF +; 0C |FEDCBA9|8765433|3333333|3345678|9ABCDEF +; 0D |FEDCBA9|8765432|2222222|2345678|9ABCDEF +; 0E |FEDCBA9|8765432|1111111|2345678|9ABCDEF +; 0F |FEDCBA9|8765432|1000001|2345678|9ABCDEF +; ---+-------+-------+-------+-------+------- +; 10 |FEDCBA9|8765432|1000001|2345678|9ABCDEF +; 11 |FEDCBA9|8765432|1111111|2345678|9ABCDEF +; 12 |FEDCBA9|8765432|2222222|2345678|9ABCDEF +; 13 |FEDCBA9|8765433|3333333|3345678|9ABCDEF +; 14 |FEDCBA9|8765444|4444444|4445678|9ABCDEF +; 15 |FEDCBA9|8765555|5555555|5555678|9ABCDEF +; 16 |FEDCBA9|8766666|6666666|6666678|9ABCDEF +; 17 |FEDCBA9|8777777|7777777|7777778|9ABCDEF +; ---+-------+-------+-------+-------+------- +; 18 |FEDCBA9|8888888|8888888|8888888|9ABCDEF +; 19 |FEDCBA9|9999999|9999999|9999999|9ABCDEF +; 1A |FEDCBAA|AAAAAAA|AAAAAAA|AAAAAAA|AABCDEF +; 1B |FEDCBBB|BBBBBBB|BBBBBBB|BBBBBBB|BBBCDEF +; 1C |FEDCCCC|CCCCCCC|CCCCCCC|CCCCCCC|CCCCDEF +; 1D |FEDDDDD|DDDDDDD|DDDDDDD|DDDDDDD|DDDDDEF +; 1E |FEEEEEE|EEEEEEE|EEEEEEE|EEEEEEE|EEEEEEF +; 1F |FFFFFFF|FFFFFFF|FFFFFFF|FFFFFFF|FFFFFFF +; + +src = $00 ; [word][must be at $00] used by drawing routines +dst = $02 ; [word] used by drawing routines +rowcount = $04 ; [byte] used by drawing routines +tmpy = $05 ; [byte] used by drawing routines +box = $0E ; [byte] counter in main loop +auxsrc_hgrhi = $BD01 ; [$C0 bytes] HGR base addresses (hi) starting at $9000 +BoxesX = $BE90 ; [$30 bytes] starting row for each box +BoxesY = $BEC0 ; [$30 bytes] starting byte offset for each box + +; tokens for code generation +; used as indexes into |codegen_pieces| and |codegen_piece_lengths|, +; so keep all three in sync +k_rts = 0 ; must be 0 +k_edge_left_mask_main = 1 ; must be 1 +k_edge_right_mask_main = 2 ; must be 2 +k_left_mask_main = 3 ; must be 3 +k_right_mask_main = 4 ; must be 4 +k_edge_left_mask_aux = 5 ; must be 5 +k_edge_right_mask_aux = 6 ; must be 6 +k_left_mask_aux = 7 ; must be 7 +k_right_mask_aux = 8 ; must be 8 +k_current_page = 9 +k_switch_to_main = 10 +k_switch_to_aux = 11 +k_switch_to_aux_and_byte_copy = 12 +k_inx_and_recalc = 13 +k_recalc = 14 +k_set_row_count = 15 +k_set_first_row = 16 +k_iny2 = 17 +k_iny = 18 +k_dey = 19 +k_save_y = 20 +k_restore_y = 21 +k_middle_jsr = 22 +k_outer_jsr = 23 +k_middle_branch = 24 +k_outer_branch = 25 +k_mask_copy_pre = 26 +k_mask_copy_post = 27 +k_byte_copy = 28 +k_byte_copy_and_iny = 29 +k_bitcopy = 30 ; must be last token + + !source "src/fx/macros.a" + +;*=FXCode + jmp BuildingPhase +;*=FXCode+3 + jmp DrawingPhase + +; All template p-code must be on the same page +;!align 255,0 +; Template for 'stage 0' routine (copy00), which copies the innermost +; part of the box (labeled '0' in diagram above). +STAGE0 + !byte k_set_first_row + !byte k_iny2 + !byte k_recalc + !byte k_bitcopy, k_left_mask_main + !byte k_switch_to_aux + !byte k_bitcopy, k_left_mask_main + !byte k_switch_to_main + !byte k_inx_and_recalc + !byte k_bitcopy, k_left_mask_aux + !byte k_switch_to_aux + !byte k_bitcopy, k_left_mask_aux + !byte k_rts ; also serves as an end-of-template marker + +; Template for 'stage 1' routine (copy01), which copies the pixels +; around the innermost box (labeled '1' in diagram above). +STAGE1 + !byte k_set_first_row + !byte k_iny2 + !byte k_recalc + !byte k_byte_copy + !byte k_switch_to_aux_and_byte_copy + !byte k_switch_to_main + !byte k_inx_and_recalc + !byte k_byte_copy + !byte k_switch_to_aux_and_byte_copy + !byte k_switch_to_main + !byte k_inx_and_recalc + !byte k_byte_copy + !byte k_switch_to_aux_and_byte_copy + !byte k_switch_to_main + !byte k_inx_and_recalc + !byte k_byte_copy + !byte k_switch_to_aux_and_byte_copy + !byte k_rts ; also serves as an end-of-template marker + +; Template for stages 2-8 (copy02..copy08) +MIDDLE_STAGE + !byte k_set_row_count + !byte k_set_first_row + !byte k_iny + !byte k_save_y + !byte k_middle_jsr, k_current_page + ;- + !byte k_inx_and_recalc + !byte k_bitcopy, k_left_mask_main + !byte k_iny2 + !byte k_bitcopy, k_right_mask_main + !byte k_switch_to_aux + !byte k_bitcopy, k_right_mask_aux + !byte k_restore_y + !byte k_bitcopy, k_left_mask_aux + !byte k_switch_to_main + !byte k_middle_branch + ;+ + !byte k_inx_and_recalc + !byte k_bitcopy, k_edge_left_mask_main + !byte k_iny + !byte k_byte_copy_and_iny + !byte k_bitcopy, k_edge_right_mask_main + !byte k_switch_to_aux + !byte k_bitcopy, k_edge_right_mask_aux + !byte k_dey + !byte k_byte_copy + !byte k_dey + !byte k_bitcopy, k_edge_left_mask_aux + !byte k_rts ; also serves as an end-of-template marker + +; Template for stages 9-15 (copy09..copy0F) +OUTER_STAGE + !byte k_set_row_count + !byte k_set_first_row + !byte k_save_y + !byte k_outer_jsr, k_current_page + ;- + !byte k_inx_and_recalc + !byte k_bitcopy, k_left_mask_main + !byte k_iny2 + !byte k_iny2 + !byte k_bitcopy, k_right_mask_main + !byte k_switch_to_aux + !byte k_bitcopy, k_right_mask_aux + !byte k_restore_y + !byte k_bitcopy, k_left_mask_aux + !byte k_switch_to_main + !byte k_outer_branch + ;+ + !byte k_inx_and_recalc + !byte k_bitcopy, k_edge_left_mask_main + !byte k_iny + !byte k_byte_copy_and_iny + !byte k_byte_copy_and_iny + !byte k_byte_copy_and_iny + !byte k_bitcopy, k_edge_right_mask_main + !byte k_switch_to_aux + !byte k_bitcopy, k_edge_right_mask_aux + !byte k_dey + !byte k_byte_copy + !byte k_dey + !byte k_byte_copy + !byte k_dey + !byte k_byte_copy + !byte k_dey + !byte k_bitcopy, k_edge_left_mask_aux + !byte k_rts ; also serves as an end-of-template marker +!if >* != >STAGE0 { + !error "Templates are not all on same page" +} + +BuildingPhase +; generate |BoxesX| and |BoxesY| arrays + ldx #48 + ldy #$A0 + lda #$23 + pha +- tya + sta BoxesX-1, x + pla + sta BoxesY-1, x + sec + sbc #5 + bcs + + lda #$23 ++ pha + dex + txa + and #7 + bne - + tya + sec + sbc #$20 + tay + txa + bne - + pla + + ; construct drawing routines for each stage + jsr BuildDrawingRoutines + ; A=0 here + + jsr iBuildHGRTables + ; X=$C0 here + +- lda hgrhi-1, x + clc + adc #$70 + sta auxsrc_hgrhi-1, x + dex + bne - + rts + +DrawingPhase + sta $C001 ; 80STORE mode so we can bank $2000/aux in & out with STA $C055 & $C054 +MainLoop ldx #48 +BoxLoop ldy DHGR48BoxStages-1, x ; for each box, get its current stage + inc DHGR48BoxStages-1, x ; increment every box's stage every time through the loop + lda DHGR48StageDrawingRoutines, y + beq NextBox ; if stage's drawing routine is 0, nothing to do + stx box + sta j+2 + lda BoxesX-1, x ; A = starting HGR row for this box + ldy BoxesY-1, x ; Y = starting byte offset for this box + clc +j jsr $0000 ; [SMC] call drawing routine for this stage + ldx box +NextBox dex + bne BoxLoop + lda j+2 + beq + ; if we didn't draw anything in any box, we're done + stx j+2 ; X=0 here + bit KBD ; check for key + bpl MainLoop ++ sta $C000 ; 80STORE off + ; execution falls through here + +; These are all the pieces of code we need to construct the drawing routines. +; There are 32 drawing routines, which we construct from +; four templates (below). Templates use tokens to refer to these code pieces. +; Note that several pieces overlap in order to minimize code size. +; Everything from CODEGEN_COPY_START and onward is copied to zero page for +; the code generation phase on program startup. +EDGE_LEFT_MASK_MAIN = $01 ; address $01 to match token +EDGE_RIGHT_MASK_MAIN = $02 ; address $02 to match token +LEFT_MASK_MAIN = $03 ; address $03 to match token +RIGHT_MASK_MAIN = $04 ; address $04 to match token +EDGE_LEFT_MASK_AUX = $05 ; address $05 to match token +EDGE_RIGHT_MASK_AUX = $06 ; address $06 to match token +LEFT_MASK_AUX = $07 ; address $07 to match token +RIGHT_MASK_AUX = $08 ; address $08 to match token +CODEGEN_COPY_START +!pseudopc 9 { +RTS0 +SWITCH_TO_MAIN + sta $C054 +SWITCH_TO_MAIN_E + rts ; also terminates MainLoop +RTS0_E +; +SWITCH_TO_AUX_AND_BYTE_COPY +SWITCH_TO_AUX + sta $C055 + lda auxsrc_hgrhi, x + sta src+1 +SWITCH_TO_AUX_E +BYTECOPY_AND_INY +BYTECOPY + lda (src), y + sta (dst), y +BYTECOPY_E +SWITCH_TO_AUX_AND_BYTE_COPY_E +INY2 +INY1 + iny +INY1_E +BYTECOPY_AND_INY_E + iny +INY2_E +; +DEY1 + dey +DEY1_E +; +SAVE_Y + sty tmpy +SAVE_Y_E +; +RESTORE_Y + ldy tmpy +RESTORE_Y_E +; +INX_AND_RECALC + inx +RECALC + lda hgrlo, x + sta src + sta dst + lda hgrhi, x + sta dst+1 + eor #$60 + sta src+1 +RECALC_E +INX_AND_RECALC_E +; +SET_ROW_COUNT +ROW_COUNT=*+1 + ldx #$1D ; SMC + stx rowcount +SET_ROW_COUNT_E +; +SET_FIRST_ROW +FIRST_ROW=*+1 + adc #$0E ; SMC + tax +SET_FIRST_ROW_E +; +MASKCOPY_PRE + lda (dst), y +BIT_FOR_CLEAR + eor (src), y + !byte $29 ; (AND #$44 opcode) +MASKCOPY_PRE_E +; + +codegen_pieces ; address of each of the pieces (on zero page, so 1 byte) + !byte nothing to generate + bmi + ; copymask>=$80 -> assume full byte + lda #k_mask_copy_pre + jsr ProcessToken + lda #1 + sta =$80 + sta 127 then we're done + +ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 + +ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2 + + iny + lda (<.input), y + +HIGH_3_LOW_5 .input + sty <.y + clc +.bankloop + lda copymasks1bit, x + beq + + sta <.copymask + + ; main 1x2 block in top-left quadrant +.src1=*+1 + lda $FDFD, y + eor (<.dest1), y +.copymask=*+1 + and #$FD ; SMC + and (<.evenrow_ptr), y + eor (<.dest1), y +.dest1=*+1 + sta $FDFD, y +.src2=*+1 + lda $FDFD, y + eor (<.dest2), y + and <.copymask + and (<.oddrow_ptr), y + eor (<.dest2), y +.dest2=*+1 + sta $FDFD, y + + ; corresponding 1x2 block in bottom-left quadrant (opposite row, original column) + +COPY_BIT_ZP_DITHER .mirror_src1, .mirror_dest1, .copymask, .oddrow_ptr + +COPY_BIT_ZP_DITHER .mirror_src2, .mirror_dest2, .copymask, .evenrow_ptr + ++ + lda mirror_copymasks1bit, x + beq + + sta <.mirror_copymask + ; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column) + lda mirror_cols, y + tay +.mirror_src1=*+1 + lda $FDFD, y + eor (<.mirror_dest1), y +.mirror_copymask=*+1 + and #$FD ; SMC + and (<.oddrow_ptr), y + eor (<.mirror_dest1), y +.mirror_dest1=*+1 + sta $FDFD, y +.mirror_src2=*+1 + lda $FDFD, y + eor (<.mirror_dest2), y + and <.mirror_copymask + and (<.evenrow_ptr), y + eor (<.mirror_dest2), y +.mirror_dest2=*+1 + sta $FDFD, y + + ; corresponding 1x2 block in top-right quadrant (same row, opposite column) + +COPY_BIT_ZP_DITHER .src1, .dest1, .mirror_copymask, .evenrow_ptr + +COPY_BIT_ZP_DITHER .src2, .dest2, .mirror_copymask, .oddrow_ptr ++ + bcs + + sta READAUXMEM + sta WRITEAUXMEM +.y=*+1 + ldy #$FD + sec + jmp .bankloop ++ sta READMAINMEM + sta WRITEMAINMEM + +.next + inc <.input + inc <.input + bne + + bit KBD + bmi ++ + inc <.input+1 ++ jmp .InputLoop +++ rts +} +.end + +.next2_start +!pseudopc .next { + lda <.input + php + dec <.input + dec <.input + plp + bne + + dec <.input+1 + bit KBD + bmi ++ ++ jmp .InputLoop +++ rts +} +.next2_end diff --git a/src/fx/code.dhgr.dither.precomputed.2bit.a b/src/fx/code.dhgr.dither.precomputed.2bit.a new file mode 100644 index 0000000..c0b423f --- /dev/null +++ b/src/fx/code.dhgr.dither.precomputed.2bit.a @@ -0,0 +1,138 @@ +!cpu 6502 +!to "build/FXCODE/DHGRDITHER2",plain +*=$6200 + + !source "src/fx/macros.a" + +;DHGRDitherPrecomputed2Bit + jsr iBuildDHGRDitherMasks + jsr iBuildDHGRSparseBitmasks2Bit + jsr iBuildHGRTables + jsr iBuildDHGRMirrorCols + + ; phase 1 - in reverse, with additional masking (dithering) + jsr .copytozp + + ; set up starting coordinate for reading coordinates in reverse order + +LDADDR EndCoordinates2Bit-2 + sta <.input + sty <.input+1 + + ; set up EOF marker to stop reading coordinates in reverse order + lda #$00 + sta Coordinates2Bit-2 + + ; set up logic to advance to next coordinates in reverse order + ldx #(.next2_end-.next2_start-1) +- lda .next2_start, x + sta <.next, x + dex + bpl - + + jsr .InputLoop + + bit KBD + bmi .start + + ; phase 2 - in order, without additional masking + jsr .copytozp + + ; redirect additional masking pointers to an array that contains #$FFs (so no dithering) + lda # 127 then we're done + +ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 + +ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2 + + inc .input + lda (<.input), y + +HIGH_3_LOW_5 .input + sty <.y + clc +.bankloop + lda copymasks1bit, x + beq + + sta <.copymask + + ; main 1x2 block in top-left quadrant +.src1=*+1 + lda $FDFD, y + eor (<.dest1), y +.copymask=*+1 + and #$FD ; SMC + eor (<.dest1), y +.dest1=*+1 + sta $FDFD, y +.src2=*+1 + lda $FDFD, y + eor (<.dest2), y + and <.copymask + eor (<.dest2), y +.dest2=*+1 + sta $FDFD, y + + ; corresponding 1x2 block in bottom-left quadrant (opposite row, original column) + +COPY_BIT_ZP .mirror_src1, .mirror_dest1, .copymask + +COPY_BIT_ZP .mirror_src2, .mirror_dest2, .copymask + ++ + lda mirror_copymasks1bit, x ; exists at the same address in mainmem and auxmem but each is different + beq + + sta <.mirror_copymask + ; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column) + lda mirror_cols, y ; duplicated in mainmem and auxmem + tay +.mirror_src1=*+1 + lda $FDFD, y + eor (<.mirror_dest1), y +.mirror_copymask=*+1 + and #$FD ; SMC + eor (<.mirror_dest1), y +.mirror_dest1=*+1 + sta $FDFD, y +.mirror_src2=*+1 + lda $FDFD, y + eor (<.mirror_dest2), y + and <.mirror_copymask + eor (<.mirror_dest2), y +.mirror_dest2=*+1 + sta $FDFD, y + + ; corresponding 1x2 block in top-right quadrant (same row, opposite column) + +COPY_BIT_ZP .src1, .dest1, .mirror_copymask + +COPY_BIT_ZP .src2, .dest2, .mirror_copymask ++ + bcs + + sta $C003 + sta $C005 +.y=*+1 + ldy #$FD + sec + bcs .bankloop ++ sta $C002 + sta $C004 + + +INC_INPUT_AND_LOOP .input, .InputLoop +} +.end diff --git a/src/fx/code.dhgr.precomputed.2bit.a b/src/fx/code.dhgr.precomputed.2bit.a new file mode 100644 index 0000000..99bac7d --- /dev/null +++ b/src/fx/code.dhgr.precomputed.2bit.a @@ -0,0 +1,78 @@ +!cpu 6502 +!to "build/FXCODE/DHGR2",plain +*=$6200 + + !source "src/fx/macros.a" + +;DHGRPrecomputed2Bit + jsr iBuildDHGRSparseBitmasks2Bit + jsr iBuildHGRTables + jsr iBuildDHGRMirrorCols + +COPY_TO_0 .start, .end + jmp .InputLoop + +.start +!pseudopc 0 { +.Exit2Bit rts +.InputLoop + ldy #0 +.input=*+1 + ldx Coordinates2Bit ; first value: HGR row + 1 + beq .Exit2Bit ; if 0 then we're done + +ROW_X_TO_2BIT_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 + + inc <.input + lda (<.input), y + +HIGH_3_LOW_5 .input + + ; main 2x2 block in left half + clc +- lda copymasks2bit, x + beq + +.src1=*+1 + lda $FDFD, y + eor (<.dest1), y + and copymasks2bit, x + eor (<.dest1), y +.dest1=*+1 + sta $FDFD, y +.src2=*+1 + lda $FDFD, y + eor (<.dest2), y + and copymasks2bit, x + eor (<.dest2), y +.dest2=*+1 + sta $FDFD, y ++ bcs + + sta $C003 + sta $C005 + sec + bcs - ++ sta $C002 + sta $C004 + + ; corresponding 2x2 block in right half (same row, opposite column) + lda mirror_cols, y + tay + clc +- lda mirror_copymasks2bit, x + beq + + +COPY_BIT .src1, .dest1, mirror_copymasks2bit + +COPY_BIT .src2, .dest2, mirror_copymasks2bit ++ bcs + + sta $C003 + sta $C005 + sec + bcs - ++ sta $C002 + sta $C004 + + inc <.input + +LBNE .InputLoop + bit $c000 + bmi + + inc <.input+1 + jmp .InputLoop ++ rts +} +.end diff --git a/src/fx/fx.dhgr.radial.common.a b/src/fx/code.dhgr.radial.a similarity index 51% rename from src/fx/fx.dhgr.radial.common.a rename to src/fx/code.dhgr.radial.a index f731438..4577710 100644 --- a/src/fx/fx.dhgr.radial.common.a +++ b/src/fx/code.dhgr.radial.a @@ -2,6 +2,12 @@ ;(c) 2019-2022 by 4am ; +!cpu 6502 +!to "build/FXCODE/DHGRRADIAL",plain +*=$6200 + + !source "src/fx/macros.a" + mirror_src1 = $E8 ; word mirror_dest1 = $EA ; word mirror_src2 = $EC ; word @@ -13,15 +19,16 @@ dest2 = $F6 ; word reverse_input = $FC ; word input = $FE ; word - +BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks - +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi - +BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror - +BUILD_MIRROR_COLS_DHGR mirror_cols - +COPY_TO_AUXMEM $60, 4 +;DHGRRadialPrecomputed1Bit + jsr iBuildDHGRSparseBitmasks1Bit + jsr iBuildHGRTables + jsr iBuildHGRMirrorTables + jsr iBuildDHGRMirrorCols + +COPY_TO_AUXMEM $62, 4 - +LDADDR Coordinates + +LDADDR Coordinates1Bit +ST16 input - +LDADDR EndCoordinates-2 + +LDADDR EndCoordinates1Bit-2 +ST16 reverse_input jmp Loop Exit rts @@ -29,80 +36,80 @@ Loop ldy #0 lda (input),y bmi Exit tax - +ROW_X_TO_BASE_ADDRESSES - +ROW_X_TO_MIRROR_ADDRESSES + +ROW_X_TO_BASE_ADDRESSES src1, src2, dest1, dest2 + +ROW_X_TO_MIRROR_ADDRESSES mirror_src1, mirror_src2, mirror_dest1, mirror_dest2 inc input lda (input),y +HIGH_3_LOW_5 input ; top-left quadrant (original row, original column, original input order) clc -- lda copymasks, x +- lda copymasks1bit, x beq + - +COPY_BIT src1, dest1, copymasks - +COPY_BIT src2, dest2, copymasks + +COPY_BIT src1, dest1, copymasks1bit + +COPY_BIT src2, dest2, copymasks1bit + bcs + - sta $C003 - sta $C005 + sta READAUXMEM + sta WRITEAUXMEM sec bcs - -+ sta $C002 - sta $C004 ++ sta READMAINMEM + sta WRITEMAINMEM ; bottom-right quadrant (opposite row, opposite column, original input order) lda mirror_cols,y tay clc -- lda mirror_copymasks, x +- lda mirror_copymasks1bit, x beq + - +COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks - +COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks + +COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks1bit + +COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks1bit + bcs + - sta $C003 - sta $C005 + sta READAUXMEM + sta WRITEAUXMEM sec bcs - -+ sta $C002 - sta $C004 ++ sta READMAINMEM + sta WRITEMAINMEM ldy #0 lda (reverse_input),y tax - +ROW_X_TO_BASE_ADDRESSES - +ROW_X_TO_MIRROR_ADDRESSES + +ROW_X_TO_BASE_ADDRESSES src1, src2, dest1, dest2 + +ROW_X_TO_MIRROR_ADDRESSES mirror_src1, mirror_src2, mirror_dest1, mirror_dest2 iny lda (reverse_input),y +HIGH_3_LOW_5 reverse_input ; bottom-left quadrant (opposite row, original column, reverse input order) clc -- lda copymasks, x +- lda copymasks1bit, x beq + - +COPY_BIT mirror_src1, mirror_dest1, copymasks - +COPY_BIT mirror_src2, mirror_dest2, copymasks + +COPY_BIT mirror_src1, mirror_dest1, copymasks1bit + +COPY_BIT mirror_src2, mirror_dest2, copymasks1bit + bcs + - sta $C003 - sta $C005 + sta READAUXMEM + sta WRITEAUXMEM sec bcs - -+ sta $C002 - sta $C004 ++ sta READMAINMEM + sta WRITEMAINMEM ; top-right quadrant (same row, opposite column, reverse input order) lda mirror_cols,y tay clc -- lda mirror_copymasks, x +- lda mirror_copymasks1bit, x beq + - +COPY_BIT src1, dest1, mirror_copymasks - +COPY_BIT src2, dest2, mirror_copymasks + +COPY_BIT src1, dest1, mirror_copymasks1bit + +COPY_BIT src2, dest2, mirror_copymasks1bit + bcs + - sta $C003 - sta $C005 + sta READAUXMEM + sta WRITEAUXMEM sec bcs - -+ sta $C002 - sta $C004 ++ sta READMAINMEM + sta WRITEMAINMEM inc input bne + diff --git a/src/fx/code.hgr.48boxes.a b/src/fx/code.hgr.48boxes.a new file mode 100644 index 0000000..e94d160 --- /dev/null +++ b/src/fx/code.hgr.48boxes.a @@ -0,0 +1,496 @@ +;license:MIT +;(c) 2020 by 4am & qkumba +; +!cpu 6502 +!to "build/FXCODE/HGR48",plain +*=$6200 + +; The screen is separated into 48 boxes. +; Boxes are laid out in a grid, left-to-right, top-down: +; +; 0 1 2 3 4 5 6 7 +; 8 9 10 11 12 13 14 15 +; 16 17 18 19 20 21 22 23 +; 24 25 26 27 28 29 30 31 +; 32 33 34 35 36 37 38 39 +; 40 41 42 43 44 45 46 47 +; +; Each box is 35x32 pixels, so each row of each box is 5 consecutive +; bytes in memory once you calculate the HGR base address for that row. +; +; |BoxInitialStages| defines the initial grid of stages for each box. +; Each stage is used as an index into the |StagesHi| array +; to find the drawing routine for that stage (if any). +; Each box's stage is incremented after each iteration through the main loop. +; When the main loop iterates through all 48 boxes without drawing anything, +; the program exits. +; +; There are 16 clear routines that set certain bits to 0 (black), +; labeled clear00..clear0F. clear00 clears the inner-most box, and +; clear0F clears the outermost box (see diagram). +; There are 16 copy routines that copy certain bits from the source +; image on page 2 to the destination image on page 1, labeled copy00..copy0F. +; +; row| bits +; ---+--------------------------------------- +; 00 |FFFFFFF|FFFFFFF|FFFFFFF|FFFFFFF|FFFFFFF +; 01 |FEEEEEE|EEEEEEE|EEEEEEE|EEEEEEE|EEEEEEF +; 02 |FEDDDDD|DDDDDDD|DDDDDDD|DDDDDDD|DDDDDEF +; 03 |FEDCCCC|CCCCCCC|CCCCCCC|CCCCCCC|CCCCDEF +; 04 |FEDCBBB|BBBBBBB|BBBBBBB|BBBBBBB|BBBCDEF +; 05 |FEDCBAA|AAAAAAA|AAAAAAA|AAAAAAA|AABCDEF +; 06 |FEDCBA9|9999999|9999999|9999999|9ABCDEF +; 07 |FEDCBA9|8888888|8888888|8888888|9ABCDEF +; ---+-------+-------+-------+-------+------- +; 08 |FEDCBA9|8777777|7777777|7777778|9ABCDEF +; 09 |FEDCBA9|8766666|6666666|6666678|9ABCDEF +; 0A |FEDCBA9|8765555|5555555|5555678|9ABCDEF +; 0B |FEDCBA9|8765444|4444444|4445678|9ABCDEF +; 0C |FEDCBA9|8765433|3333333|3345678|9ABCDEF +; 0D |FEDCBA9|8765432|2222222|2345678|9ABCDEF +; 0E |FEDCBA9|8765432|1111111|2345678|9ABCDEF +; 0F |FEDCBA9|8765432|1000001|2345678|9ABCDEF +; ---+-------+-------+-------+-------+------- +; 10 |FEDCBA9|8765432|1000001|2345678|9ABCDEF +; 11 |FEDCBA9|8765432|1111111|2345678|9ABCDEF +; 12 |FEDCBA9|8765432|2222222|2345678|9ABCDEF +; 13 |FEDCBA9|8765433|3333333|3345678|9ABCDEF +; 14 |FEDCBA9|8765444|4444444|4445678|9ABCDEF +; 15 |FEDCBA9|8765555|5555555|5555678|9ABCDEF +; 16 |FEDCBA9|8766666|6666666|6666678|9ABCDEF +; 17 |FEDCBA9|8777777|7777777|7777778|9ABCDEF +; ---+-------+-------+-------+-------+------- +; 18 |FEDCBA9|8888888|8888888|8888888|9ABCDEF +; 19 |FEDCBA9|9999999|9999999|9999999|9ABCDEF +; 1A |FEDCBAA|AAAAAAA|AAAAAAA|AAAAAAA|AABCDEF +; 1B |FEDCBBB|BBBBBBB|BBBBBBB|BBBBBBB|BBBCDEF +; 1C |FEDCCCC|CCCCCCC|CCCCCCC|CCCCCCC|CCCCDEF +; 1D |FEDDDDD|DDDDDDD|DDDDDDD|DDDDDDD|DDDDDEF +; 1E |FEEEEEE|EEEEEEE|EEEEEEE|EEEEEEE|EEEEEEF +; 1F |FFFFFFF|FFFFFFF|FFFFFFF|FFFFFFF|FFFFFFF +; + +src = $00 ; [word][must be at $00] (drawing phase) +dst = $02 ; [word] (drawing phase) +rowcount = $04 ; [byte] (drawing phase) +BoxesX = $90 ; [$30 bytes] starting row for each box (build phase) +BoxesY = $C0 ; [$30 bytes] starting byte offset for each box (build phase) + +; tokens for code generation +; used as indexes into |codegen_pieces| and |codegen_piece_lengths|, +; so keep all three in sync +k_rts = 0 ; must be 0 +k_inx_and_recalc = 1 +k_recalc = 2 +k_recalc_and_iny = 3 +k_stage_init = 4 +k_maskcopy_pre = 5 +k_maskcopy_post_and_iny = 6 +k_maskcopy_post = 7 +k_copy_and_iny = 8 +k_copy = 9 +k_dey2 = 10 +k_iny2 = 11 +k_middle_branches = 12 +k_outer_branches = 13 +k_edge_left_mask = 14 +k_edge_right_mask = 15 +k_left_mask = 16 +k_right_mask = 17 + + !source "src/fx/macros.a" + +; actual code starts here + + ; drawing routines for each stage are constructed dynamically + ; and stored at copy00..copy0F and clear00..clear0F + jsr BuildDrawingRoutines + + +COPY_TO_0 start-5, end + + jsr iBuildHGRTables + +; Generate |BoxesX| and |BoxesY| arrays +; BoxesX (starting row for each box) +; $00,$00,$00,$00,$00,$00,$00,$00 +; $20,$20,$20,$20,$20,$20,$20,$20 +; $40,$40,$40,$40,$40,$40,$40,$40 +; $60,$60,$60,$60,$60,$60,$60,$60 +; $80,$80,$80,$80,$80,$80,$80,$80 +; $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 +; BoxesY (starting byte offset for each box) +; $00,$05,$0A,$0F,$14,$19,$1E,$23 +; $00,$05,$0A,$0F,$14,$19,$1E,$23 +; $00,$05,$0A,$0F,$14,$19,$1E,$23 +; $00,$05,$0A,$0F,$14,$19,$1E,$23 +; $00,$05,$0A,$0F,$14,$19,$1E,$23 +; $00,$05,$0A,$0F,$14,$19,$1E,$23 + ldx #48 + ldy #$A0 + lda #$23 + pha +- tya + sta BoxesX-1, x + pla + sta BoxesY-1, x + sec + sbc #5 + bcs + + lda #$23 ++ pha + dex + txa + and #7 + bne - + tya + sec + sbc #$20 + tay + txa + bne - + pla + +; These are all the pieces of code we need to construct the drawing routines. +; There are 32 drawing routines, which we construct from +; four templates (below). Templates use tokens to refer to these code pieces. +; Note that several pieces overlap in order to minimize code size. +; Everything from CODEGEN_COPY_START and onward is copied to zero page for +; the code generation phase on program startup. +CODEGEN_COPY_START +!pseudopc 0 { +RTS0 ; 1 byte + rts +RTS0_E +INX_AND_RECALC ; 16 bytes + inx +RECALC_AND_INY ; 16 bytes +RECALC ; 15 bytes + lda hgrlo, x + sta 127 then we're done + +ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 + +ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2 + + iny + lda (<.input), y + +HIGH_3_LOW_5 .input + + ; main 1x2 block in top-left quadrant +.src1=*+1 + lda $FDFD, y + eor (<.dest1), y + and copymasks1bit, x + and (<.evenrow_ptr), y + eor (<.dest1), y +.dest1=*+1 + sta $FDFD, y +.src2=*+1 + lda $FDFD, y + eor (<.dest2), y + and copymasks1bit, x + and (<.oddrow_ptr), y + eor (<.dest2), y +.dest2=*+1 + sta $FDFD, y + + ; corresponding 1x2 block in top-right quadrant (same row, opposite column) + lda mirror_cols, y + tay + +COPY_BIT_DITHER .src1, .dest1, mirror_copymasks1bit, .evenrow_ptr + +COPY_BIT_DITHER .src2, .dest2, mirror_copymasks1bit, .oddrow_ptr + + ; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column) +.mirror_src1=*+1 + lda $FDFD, y + eor (<.mirror_dest1), y + and mirror_copymasks1bit, x + and (<.oddrow_ptr), y + eor (<.mirror_dest1), y +.mirror_dest1=*+1 + sta $FDFD, y +.mirror_src2=*+1 + lda $FDFD, y + eor (<.mirror_dest2), y + and mirror_copymasks1bit, x + and (<.evenrow_ptr), y + eor (<.mirror_dest2), y +.mirror_dest2=*+1 + sta $FDFD, y + + ; corresponding 1x2 block in bottom-left quadrant (opposite row, original column) + lda mirror_cols, y + tay + +COPY_BIT_DITHER .mirror_src1, .mirror_dest1, copymasks1bit, .oddrow_ptr + +COPY_BIT_DITHER .mirror_src2, .mirror_dest2, copymasks1bit, .evenrow_ptr + +.next + inc <.input + inc <.input + bne + + bit KBD + bmi ++ + inc <.input+1 ++ jmp .InputLoop +++ rts +} +.end + +.next2_start +!pseudopc .next { + lda <.input + php + dec <.input + dec <.input + plp + bne + + dec <.input+1 + bit KBD + bmi ++ ++ jmp .InputLoop +++ rts +} +.next2_end diff --git a/src/fx/code.hgr.dither.precomputed.2bit.a b/src/fx/code.hgr.dither.precomputed.2bit.a new file mode 100644 index 0000000..4d8e260 --- /dev/null +++ b/src/fx/code.hgr.dither.precomputed.2bit.a @@ -0,0 +1,126 @@ +!cpu 6502 +!to "build/FXCODE/HGRDITHER2",plain +*=$6200 + + !source "src/fx/macros.a" + +;HGRDitherPrecomputed2Bit + jsr iBuildHGRDitherMasks + jsr iBuildHGRTables + jsr iBuildHGRMirrorCols + jsr iBuildHGRSparseBitmasks2Bit + + ; phase 1 - in reverse, with additional masking (dithering) + jsr .copytozp + + ; set up starting coordinate for reading coordinates in reverse order + +LDADDR EndCoordinates2Bit-2 + sta <.input + sty <.input+1 + + ; set up EOF marker to stop reading coordinates in reverse order + lda #$00 + sta Coordinates2Bit-2 + + ; set up logic to advance to next coordinates in reverse order + ldx #(.next2_end-.next2_start-1) +- lda .next2_start, x + sta <.next, x + dex + bpl - + + jsr .InputLoop + + bit KBD + bmi .start + + ; phase 2 - in order, without additional masking + jsr .copytozp + + ; redirect additional masking pointers to an array that contains #$FFs (so no dithering) + lda # 127 then we're done + +ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 + +ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2 + + inc .input + lda (<.input), y + +HIGH_3_LOW_5 .input + + ; main 1x2 block in top-left quadrant +.src1=*+1 + lda $FDFD, y + eor (<.dest1), y + and copymasks1bit, x + eor (<.dest1), y +.dest1=*+1 + sta $FDFD, y +.src2=*+1 + lda $FDFD, y + eor (<.dest2), y + and copymasks1bit, x + eor (<.dest2), y +.dest2=*+1 + sta $FDFD, y + + ; corresponding 1x2 block in top-right quadrant (same row, opposite column) + lda mirror_cols, y + tay + +COPY_BIT .src1, .dest1, mirror_copymasks1bit + +COPY_BIT .src2, .dest2, mirror_copymasks1bit + + ; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column) +.mirror_src1=*+1 + lda $FDFD, y + eor (<.mirror_dest1), y + and mirror_copymasks1bit, x + eor (<.mirror_dest1), y +.mirror_dest1=*+1 + sta $FDFD, y +.mirror_src2=*+1 + lda $FDFD, y + eor (<.mirror_dest2), y + and mirror_copymasks1bit, x + eor (<.mirror_dest2), y +.mirror_dest2=*+1 + sta $FDFD, y + + ; corresponding 1x2 block in bottom-left quadrant (opposite row, original column) + lda mirror_cols, y + tay + +COPY_BIT .mirror_src1, .mirror_dest1, copymasks1bit + +COPY_BIT .mirror_src2, .mirror_dest2, copymasks1bit + + +INC_INPUT_AND_LOOP .input, .InputLoop +} +.end diff --git a/src/fx/code.hgr.precomputed.2bit.a b/src/fx/code.hgr.precomputed.2bit.a new file mode 100644 index 0000000..a7c76c9 --- /dev/null +++ b/src/fx/code.hgr.precomputed.2bit.a @@ -0,0 +1,56 @@ +!cpu 6502 +!to "build/FXCODE/HGR2",plain +*=$6200 + + !source "src/fx/macros.a" + +;HGRPrecomputed2Bit + jsr iBuildHGRTables + jsr iBuildHGRMirrorCols + jsr iBuildHGRSparseBitmasks2Bit + +COPY_TO_0 .start, .end + jmp .InputLoop +.start +!pseudopc 0 { +.Exit2Bit rts +.InputLoop + ldy #0 +.input=*+1 + ldx Coordinates2Bit ; first value: HGR row + 1 + beq .Exit2Bit ; if 0 then we're done + +ROW_X_TO_2BIT_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 + + inc <.input + lda (<.input), y + +HIGH_3_LOW_5 .input + + ; main 2x2 block in left half +.src1=*+1 + lda $FDFD, y + eor (<.dest1), y + and copymasks2bit, x + eor (<.dest1), y +.dest1=*+1 + sta $FDFD, y +.src2=*+1 + lda $FDFD, y + eor (<.dest2), y + and copymasks2bit, x + eor (<.dest2), y +.dest2=*+1 + sta $FDFD, y + + ; corresponding 2x2 block in right half (same row, opposite column) + lda mirror_cols, y + tay + +COPY_BIT .src1, .dest1, mirror_copymasks2bit + +COPY_BIT .src2, .dest2, mirror_copymasks2bit + + inc <.input + bne .InputLoop + bit KBD + bmi .Exit2Bit + inc <.input+1 + bne .InputLoop ; always branches +} +.end diff --git a/src/fx/code.hgr.precomputed.3bit.a b/src/fx/code.hgr.precomputed.3bit.a new file mode 100644 index 0000000..7fd8124 --- /dev/null +++ b/src/fx/code.hgr.precomputed.3bit.a @@ -0,0 +1,65 @@ +!cpu 6502 +!to "build/FXCODE/HGR3",plain +*=$6200 + + !source "src/fx/macros.a" + +;HGRPrecomputed3Bit + jsr iSetupPrecomputed3Bit + +COPY_TO_0 .start, .end + jmp .InputLoop +.start +!pseudopc 0 { +.Exit3Bit rts +.InputLoop + ldy #0 +.input=*+1 + lda Coordinates3Bit + bmi .Exit3Bit ; if high bit is 1 then we're done + cmp #$40 + php + tax + +ROW_X_TO_3BIT_BASE_ADDRESSES .src1, .src2, .src3, .dest1, .dest2, .dest3 + + inc <.input + lda (<.input), y + and #%11100000 + tax + eor (<.input), y + plp + bcc + + tay + lda extra_cols, y ++ tay + + ; 2x3 block +.src1=*+1 + lda $FDFD, y + eor (<.dest1), y + and copymasks3bit, x + eor (<.dest1), y +.dest1=*+1 + sta $FDFD, y +.src2=*+1 + lda $FDFD, y + eor (<.dest2), y + and copymasks3bit, x + eor (<.dest2), y +.dest2=*+1 + sta $FDFD, y +.src3=*+1 + lda $FDFD, y + eor (<.dest3), y + and copymasks3bit, x + eor (<.dest3), y +.dest3=*+1 + sta $FDFD, y + + inc <.input + bne .InputLoop + bit KBD + bmi .Exit3Bit + inc <.input+1 + bne .InputLoop ; always branches +} +.end diff --git a/src/fx/code.hgr.radial.a b/src/fx/code.hgr.radial.a new file mode 100644 index 0000000..01063ea --- /dev/null +++ b/src/fx/code.hgr.radial.a @@ -0,0 +1,82 @@ +!cpu 6502 +!to "build/FXCODE/HGRRADIAL",plain +*=$6200 + + !source "src/fx/macros.a" + +;HGRRadialPrecomputed1Bit +.mirror_src1 = $E8 ; word +.mirror_dest1 = $EA ; word +.mirror_src2 = $EC ; word +.mirror_dest2 = $EE ; word +.src1 = $F0 ; word +.dest1 = $F2 ; word +.src2 = $F4 ; word +.dest2 = $F6 ; word +.reverse_input = $FC ; word +.input = $FE ; word + + jsr iBuildHGRMirrorCols + jsr iBuildHGRTables + jsr iBuildHGRMirrorTables + jsr iBuildHGRSparseBitmasks1Bit + + +LDADDR Coordinates1Bit + +ST16 .input + +LDADDR EndCoordinates1Bit-2 + +ST16 .reverse_input + +HIDE_NEXT_BYTE +.Exit rts +.Loop ldy #0 + lda (.input),y + bmi .Exit + tax + +ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 + +ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2 + inc .input + lda (.input),y + +HIGH_3_LOW_5 .input + + ; top-left quadrant (original row, original column, original input order) + +COPY_BIT .src1, .dest1, copymasks1bit + +COPY_BIT .src2, .dest2, copymasks1bit + + ; bottom-right quadrant (opposite row, opposite column, original input order) + lda mirror_cols,y + tay + +COPY_BIT .mirror_src1, .mirror_dest1, mirror_copymasks1bit + +COPY_BIT .mirror_src2, .mirror_dest2, mirror_copymasks1bit + + ldy #0 + lda (.reverse_input),y + tax + +ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 + +ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2 + iny + lda (.reverse_input),y + +HIGH_3_LOW_5 .reverse_input + + ; bottom-left quadrant (opposite row, original column, reverse input order) + +COPY_BIT .mirror_src1, .mirror_dest1, copymasks1bit + +COPY_BIT .mirror_src2, .mirror_dest2, copymasks1bit + + ; top-right quadrant (same row, opposite column, reverse input order) + lda mirror_cols,y + tay + +COPY_BIT .src1, .dest1, mirror_copymasks1bit + +COPY_BIT .src2, .dest2, mirror_copymasks1bit + + inc .input + bne + + inc .input+1 ++ lda .reverse_input + php + dec .reverse_input + dec .reverse_input + plp + bne + + dec .reverse_input+1 + bit KBD + bmi ++ ++ jmp .Loop +++ rts diff --git a/src/fx/fx.cover.fade.a b/src/fx/fx.cover.fade.a index 3d457a3..9d44ceb 100755 --- a/src/fx/fx.cover.fade.a +++ b/src/fx/fx.cover.fade.a @@ -10,9 +10,6 @@ page1 = $FC page2 = $FE -dithermasks = $6200 -hgrlo = $6301 -hgrhi = $6401 !source "src/fx/macros.a" @@ -27,8 +24,8 @@ hgrhi = $6401 sta page2+1 } - +BUILD_DITHER_MASKS dithermasks - +BUILD_HGR_LOOKUP_TABLES hgrlo, hgrhi + jsr iBuildHGRDitherMasks + jsr iBuildHGRTables ldx #$80 lda #0 - sta dithermasks, x diff --git a/src/fx/fx.dgr.fizzle.a b/src/fx/fx.dgr.fizzle.a index 8d42dcf..b25479c 100644 --- a/src/fx/fx.dgr.fizzle.a +++ b/src/fx/fx.dgr.fizzle.a @@ -29,9 +29,9 @@ loop2 txa clc adc #$7C sta FXCode + jsr iLoadFXCODE - ; construct drawing routines for each stage - jsr BuildDrawingRoutines - ; A=0 here - - ; set up zero page for drawing phase - tax -- ldy BoxInitialStages-BoxStages, x - sty $00, x - sta EndStagesHi, x - inx - bne - - ; X=0 here - - +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgrhi - ; X=$C0 here - -- lda hgrhi-1, x - clc - adc #$70 - sta auxsrc_hgrhi-1, x - dex - bne - - - sta $C001 ; 80STORE mode so we can bank $2000/aux in & out with STA $C055 & $C054 -MainLoop ldx #48 -BoxLoop ldy BoxStages-1, x ; for each box, get its current stage - inc BoxStages-1, x ; increment every box's stage every time through the loop - lda StagesHi, y - beq NextBox ; if stage's drawing routine is 0, nothing to do - stx box - sta j+2 - lda BoxesX-1, x ; A = starting HGR row for this box - ldy BoxesY-1, x ; Y = starting byte offset for this box - clc -j jsr $0000 ; [SMC] call drawing routine for this stage - ldx box -NextBox dex - bne BoxLoop - lda j+2 - beq + ; if we didn't draw anything in any box, we're done - stx j+2 ; X=0 here - bit $C000 ; check for key - bpl MainLoop -+ sta $C000 ; 80STORE off - ; execution falls through here - -; These are all the pieces of code we need to construct the drawing routines. -; There are 32 drawing routines (16 if USES_CLEAR=0), which we construct from -; four templates (below). Templates use tokens to refer to these code pieces. -; Note that several pieces overlap in order to minimize code size. -; Everything from CODEGEN_COPY_START and onward is copied to zero page for -; the code generation phase on program startup. -EDGE_LEFT_MASK_MAIN = $01 ; address $01 to match token -EDGE_RIGHT_MASK_MAIN = $02 ; address $02 to match token -LEFT_MASK_MAIN = $03 ; address $03 to match token -RIGHT_MASK_MAIN = $04 ; address $04 to match token -EDGE_LEFT_MASK_AUX = $05 ; address $05 to match token -EDGE_RIGHT_MASK_AUX = $06 ; address $06 to match token -LEFT_MASK_AUX = $07 ; address $07 to match token -RIGHT_MASK_AUX = $08 ; address $08 to match token -CODEGEN_COPY_START -!pseudopc 9 { -RTS0 -SWITCH_TO_MAIN - sta $C054 -SWITCH_TO_MAIN_E - rts ; also terminates MainLoop -RTS0_E -; -SWITCH_TO_AUX_AND_BYTE_COPY -SWITCH_TO_AUX - sta $C055 - lda auxsrc_hgrhi, x - sta src+1 -SWITCH_TO_AUX_E -BYTECOPY_AND_INY -BYTECOPY - lda (src), y - sta (dst), y -BYTECOPY_E -SWITCH_TO_AUX_AND_BYTE_COPY_E -INY2 -INY1 - iny -INY1_E -BYTECOPY_AND_INY_E - iny -INY2_E -; -DEY1 - dey -DEY1_E -; -SAVE_Y - sty tmpy -SAVE_Y_E -; -RESTORE_Y - ldy tmpy -RESTORE_Y_E -; -INX_AND_RECALC - inx -RECALC - lda hgrlo, x - sta src - sta dst - lda hgrhi, x - sta dst+1 - eor #$60 - sta src+1 -RECALC_E -INX_AND_RECALC_E -; -SET_ROW_COUNT -ROW_COUNT=*+1 - ldx #$1D ; SMC - stx rowcount -SET_ROW_COUNT_E -; -SET_FIRST_ROW -FIRST_ROW=*+1 - adc #$0E ; SMC - tax -SET_FIRST_ROW_E -; -MASKCOPY_PRE - lda (dst), y -BIT_FOR_CLEAR - eor (src), y - !byte $29 ; (AND #$44 opcode) -MASKCOPY_PRE_E -; - -codegen_pieces ; address of each of the pieces (on zero page, so 1 byte) - !byte do special bitcopy logic during codegen - -BuildDrawingRoutineFrom - sta nothing to generate - bmi + ; copymask>=$80 -> assume full byte - lda #k_mask_copy_pre - jsr ProcessToken - lda #1 - sta =$80 - sta * != >STAGE0 { - !error "Templates are not all on same page" -} BoxInitialStages diff --git a/src/fx/fx.dhgr.48boxes.down.a b/src/fx/fx.dhgr.48boxes.down.a index 4b96c86..a3671c7 100644 --- a/src/fx/fx.dhgr.48boxes.down.a +++ b/src/fx/fx.dhgr.48boxes.down.a @@ -5,8 +5,6 @@ !to "build/FX.INDEXED/DHGR.48.DOWN",plain *=$6000 -USES_CLEAR = 0 - !source "src/fx/fx.dhgr.48boxes.common.a" !byte $00,$FF,$00,$FF,$00,$FF,$00,$FF @@ -17,20 +15,20 @@ USES_CLEAR = 0 !byte $F6,$F5,$F6,$F5,$F6,$F5,$F6,$F5 StagesHi ; high bytes of address of drawing routine for each stage - !byte copy0F - !byte copy0E - !byte copy0D - !byte copy0C - !byte copy0B - !byte copy0A - !byte copy09 - !byte copy08 - !byte copy07 - !byte copy06 - !byte copy05 - !byte copy04 - !byte copy03 - !byte copy02 - !byte copy01 - !byte copy00 + !byte dhgr_copy0F + !byte dhgr_copy0E + !byte dhgr_copy0D + !byte dhgr_copy0C + !byte dhgr_copy0B + !byte dhgr_copy0A + !byte dhgr_copy09 + !byte dhgr_copy08 + !byte dhgr_copy07 + !byte dhgr_copy06 + !byte dhgr_copy05 + !byte dhgr_copy04 + !byte dhgr_copy03 + !byte dhgr_copy02 + !byte dhgr_copy01 + !byte dhgr_copy00 EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.longdiagonal.a b/src/fx/fx.dhgr.48boxes.longdiagonal.a index ccbfa95..72a30cd 100644 --- a/src/fx/fx.dhgr.48boxes.longdiagonal.a +++ b/src/fx/fx.dhgr.48boxes.longdiagonal.a @@ -5,8 +5,6 @@ !to "build/FX.INDEXED/DHGR.48.LDIAGON",plain *=$6000 -USES_CLEAR = 0 - !source "src/fx/fx.dhgr.48boxes.common.a" !byte $00,$FE,$FC,$FA,$F8,$F6,$F4,$F2 @@ -17,20 +15,20 @@ USES_CLEAR = 0 !byte $F6,$F4,$F2,$F0,$EE,$EC,$EA,$E8 StagesHi ; high bytes of address of drawing routine for each stage - !byte copy00 - !byte copy01 - !byte copy02 - !byte copy03 - !byte copy04 - !byte copy05 - !byte copy06 - !byte copy07 - !byte copy08 - !byte copy09 - !byte copy0A - !byte copy0B - !byte copy0C - !byte copy0D - !byte copy0E - !byte copy0F + !byte dhgr_copy00 + !byte dhgr_copy01 + !byte dhgr_copy02 + !byte dhgr_copy03 + !byte dhgr_copy04 + !byte dhgr_copy05 + !byte dhgr_copy06 + !byte dhgr_copy07 + !byte dhgr_copy08 + !byte dhgr_copy09 + !byte dhgr_copy0A + !byte dhgr_copy0B + !byte dhgr_copy0C + !byte dhgr_copy0D + !byte dhgr_copy0E + !byte dhgr_copy0F EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.pageturn.clear.a b/src/fx/fx.dhgr.48boxes.pageturn.clear.a index 257a2d6..60a8f2e 100644 --- a/src/fx/fx.dhgr.48boxes.pageturn.clear.a +++ b/src/fx/fx.dhgr.48boxes.pageturn.clear.a @@ -15,37 +15,37 @@ !byte $FF,$00,$FF,$00,$FF,$00,$FF,$00 StagesHi ; high bytes of address of drawing routine for each stage - !byte clear0F - !byte clear0E - !byte clear0D - !byte clear0C - !byte clear0B - !byte clear0A - !byte clear09 - !byte clear08 - !byte clear07 - !byte clear06 - !byte clear05 - !byte clear04 - !byte clear03 - !byte clear02 - !byte clear01 - !byte clear00 + !byte dhgr_clear0F + !byte dhgr_clear0E + !byte dhgr_clear0D + !byte dhgr_clear0C + !byte dhgr_clear0B + !byte dhgr_clear0A + !byte dhgr_clear09 + !byte dhgr_clear08 + !byte dhgr_clear07 + !byte dhgr_clear06 + !byte dhgr_clear05 + !byte dhgr_clear04 + !byte dhgr_clear03 + !byte dhgr_clear02 + !byte dhgr_clear01 + !byte dhgr_clear00 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0 - !byte copy00 - !byte copy01 - !byte copy02 - !byte copy03 - !byte copy04 - !byte copy05 - !byte copy06 - !byte copy07 - !byte copy08 - !byte copy09 - !byte copy0A - !byte copy0B - !byte copy0C - !byte copy0D - !byte copy0E - !byte copy0F + !byte dhgr_copy00 + !byte dhgr_copy01 + !byte dhgr_copy02 + !byte dhgr_copy03 + !byte dhgr_copy04 + !byte dhgr_copy05 + !byte dhgr_copy06 + !byte dhgr_copy07 + !byte dhgr_copy08 + !byte dhgr_copy09 + !byte dhgr_copy0A + !byte dhgr_copy0B + !byte dhgr_copy0C + !byte dhgr_copy0D + !byte dhgr_copy0E + !byte dhgr_copy0F EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.sidetoside.a b/src/fx/fx.dhgr.48boxes.sidetoside.a index 3eec14e..db24011 100644 --- a/src/fx/fx.dhgr.48boxes.sidetoside.a +++ b/src/fx/fx.dhgr.48boxes.sidetoside.a @@ -5,8 +5,6 @@ !to "build/FX.INDEXED/DHGR.48.SIDES",plain *=$6000 -USES_CLEAR = 0 - !source "src/fx/fx.dhgr.48boxes.common.a" !byte $00,$FC,$F8,$F4,$F0,$EC,$E8,$E4 @@ -17,20 +15,20 @@ USES_CLEAR = 0 !byte $E4,$E8,$EC,$F0,$F4,$F8,$FC,$00 StagesHi ; high bytes of address of drawing routine for each stage - !byte copy00 - !byte copy01 - !byte copy02 - !byte copy03 - !byte copy04 - !byte copy05 - !byte copy06 - !byte copy07 - !byte copy08 - !byte copy09 - !byte copy0A - !byte copy0B - !byte copy0C - !byte copy0D - !byte copy0E - !byte copy0F + !byte dhgr_copy00 + !byte dhgr_copy01 + !byte dhgr_copy02 + !byte dhgr_copy03 + !byte dhgr_copy04 + !byte dhgr_copy05 + !byte dhgr_copy06 + !byte dhgr_copy07 + !byte dhgr_copy08 + !byte dhgr_copy09 + !byte dhgr_copy0A + !byte dhgr_copy0B + !byte dhgr_copy0C + !byte dhgr_copy0D + !byte dhgr_copy0E + !byte dhgr_copy0F EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.snake.a b/src/fx/fx.dhgr.48boxes.snake.a index de982eb..4c8ef4d 100644 --- a/src/fx/fx.dhgr.48boxes.snake.a +++ b/src/fx/fx.dhgr.48boxes.snake.a @@ -5,8 +5,6 @@ !to "build/FX.INDEXED/DHGR.48.SNAKE",plain *=$6000 -USES_CLEAR = 0 - !source "src/fx/fx.dhgr.48boxes.common.a" !byte $00,$FF,$FE,$FD,$FC,$FB,$FA,$F9 @@ -17,20 +15,20 @@ USES_CLEAR = 0 !Byte $D1,$D2,$D3,$D4,$D5,$D6,$D7,$D8 StagesHi ; high bytes of address of drawing routine for each stage - !byte copy0F - !byte copy0E - !byte copy0D - !byte copy0C - !byte copy0B - !byte copy0A - !byte copy09 - !byte copy08 - !byte copy07 - !byte copy06 - !byte copy05 - !byte copy04 - !byte copy03 - !byte copy02 - !byte copy01 - !byte copy00 + !byte dhgr_copy0F + !byte dhgr_copy0E + !byte dhgr_copy0D + !byte dhgr_copy0C + !byte dhgr_copy0B + !byte dhgr_copy0A + !byte dhgr_copy09 + !byte dhgr_copy08 + !byte dhgr_copy07 + !byte dhgr_copy06 + !byte dhgr_copy05 + !byte dhgr_copy04 + !byte dhgr_copy03 + !byte dhgr_copy02 + !byte dhgr_copy01 + !byte dhgr_copy00 EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.snake.clear.a b/src/fx/fx.dhgr.48boxes.snake.clear.a index f89925a..dca7b60 100644 --- a/src/fx/fx.dhgr.48boxes.snake.clear.a +++ b/src/fx/fx.dhgr.48boxes.snake.clear.a @@ -15,39 +15,39 @@ !Byte $D1,$D2,$D3,$D4,$D5,$D6,$D7,$D8 StagesHi ; high bytes of address of drawing routine for each stage - !byte clear0F - !byte clear0E - !byte clear0D - !byte clear0C - !byte clear0B - !byte clear0A - !byte clear09 - !byte clear08 - !byte clear07 - !byte clear06 - !byte clear05 - !byte clear04 - !byte clear03 - !byte clear02 - !byte clear01 - !byte clear00 + !byte dhgr_clear0F + !byte dhgr_clear0E + !byte dhgr_clear0D + !byte dhgr_clear0C + !byte dhgr_clear0B + !byte dhgr_clear0A + !byte dhgr_clear09 + !byte dhgr_clear08 + !byte dhgr_clear07 + !byte dhgr_clear06 + !byte dhgr_clear05 + !byte dhgr_clear04 + !byte dhgr_clear03 + !byte dhgr_clear02 + !byte dhgr_clear01 + !byte dhgr_clear00 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - !byte copy0F - !byte copy0E - !byte copy0D - !byte copy0C - !byte copy0B - !byte copy0A - !byte copy09 - !byte copy08 - !byte copy07 - !byte copy06 - !byte copy05 - !byte copy04 - !byte copy03 - !byte copy02 - !byte copy01 - !byte copy00 + !byte dhgr_copy0F + !byte dhgr_copy0E + !byte dhgr_copy0D + !byte dhgr_copy0C + !byte dhgr_copy0B + !byte dhgr_copy0A + !byte dhgr_copy09 + !byte dhgr_copy08 + !byte dhgr_copy07 + !byte dhgr_copy06 + !byte dhgr_copy05 + !byte dhgr_copy04 + !byte dhgr_copy03 + !byte dhgr_copy02 + !byte dhgr_copy01 + !byte dhgr_copy00 EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.spiral.a b/src/fx/fx.dhgr.48boxes.spiral.a index 80d75e3..7e446ff 100644 --- a/src/fx/fx.dhgr.48boxes.spiral.a +++ b/src/fx/fx.dhgr.48boxes.spiral.a @@ -5,8 +5,6 @@ !to "build/FX.INDEXED/DHGR.48.SPIRAL",plain *=$6000 -USES_CLEAR = 0 - !source "src/fx/fx.dhgr.48boxes.common.a" !byte $00,$E9,$EA,$EB,$EC,$ED,$EE,$EF @@ -17,20 +15,20 @@ USES_CLEAR = 0 !byte $FB,$FA,$F9,$F8,$F7,$F6,$F5,$F4 StagesHi ; high bytes of address of drawing routine for each stage - !byte copy0F - !byte copy0E - !byte copy0D - !byte copy0C - !byte copy0B - !byte copy0A - !byte copy09 - !byte copy08 - !byte copy07 - !byte copy06 - !byte copy05 - !byte copy04 - !byte copy03 - !byte copy02 - !byte copy01 - !byte copy00 + !byte dhgr_copy0F + !byte dhgr_copy0E + !byte dhgr_copy0D + !byte dhgr_copy0C + !byte dhgr_copy0B + !byte dhgr_copy0A + !byte dhgr_copy09 + !byte dhgr_copy08 + !byte dhgr_copy07 + !byte dhgr_copy06 + !byte dhgr_copy05 + !byte dhgr_copy04 + !byte dhgr_copy03 + !byte dhgr_copy02 + !byte dhgr_copy01 + !byte dhgr_copy00 EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.spiral.clear.a b/src/fx/fx.dhgr.48boxes.spiral.clear.a index b265fed..37fc13e 100644 --- a/src/fx/fx.dhgr.48boxes.spiral.clear.a +++ b/src/fx/fx.dhgr.48boxes.spiral.clear.a @@ -15,42 +15,42 @@ !Byte $D8,$DC,$DE,$E0,$E2,$E4,$E6,$E8 StagesHi ; high bytes of address of drawing routine for each stage - !byte clear00 - !byte clear01 - !byte clear02 - !byte clear03 - !byte clear04 - !byte clear05 - !byte clear06 - !byte clear07 - !byte clear08 - !byte clear09 - !byte clear0A - !byte clear0B - !byte clear0C - !byte clear0D - !byte clear0E - !byte clear0F + !byte dhgr_clear00 + !byte dhgr_clear01 + !byte dhgr_clear02 + !byte dhgr_clear03 + !byte dhgr_clear04 + !byte dhgr_clear05 + !byte dhgr_clear06 + !byte dhgr_clear07 + !byte dhgr_clear08 + !byte dhgr_clear09 + !byte dhgr_clear0A + !byte dhgr_clear0B + !byte dhgr_clear0C + !byte dhgr_clear0D + !byte dhgr_clear0E + !byte dhgr_clear0F !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - !byte copy00 - !byte copy01 - !byte copy02 - !byte copy03 - !byte copy04 - !byte copy05 - !byte copy06 - !byte copy07 - !byte copy08 - !byte copy09 - !byte copy0A - !byte copy0B - !byte copy0C - !byte copy0D - !byte copy0E - !byte copy0F + !byte dhgr_copy00 + !byte dhgr_copy01 + !byte dhgr_copy02 + !byte dhgr_copy03 + !byte dhgr_copy04 + !byte dhgr_copy05 + !byte dhgr_copy06 + !byte dhgr_copy07 + !byte dhgr_copy08 + !byte dhgr_copy09 + !byte dhgr_copy0A + !byte dhgr_copy0B + !byte dhgr_copy0C + !byte dhgr_copy0D + !byte dhgr_copy0E + !byte dhgr_copy0F EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.sync.a b/src/fx/fx.dhgr.48boxes.sync.a index 75f4e11..7f47e29 100644 --- a/src/fx/fx.dhgr.48boxes.sync.a +++ b/src/fx/fx.dhgr.48boxes.sync.a @@ -5,8 +5,6 @@ !to "build/FX.INDEXED/DHGR.48.SYNC",plain *=$6000 -USES_CLEAR = 0 - !source "src/fx/fx.dhgr.48boxes.common.a" !byte $00,$FF,$00,$FF,$00,$FF,$00,$FF @@ -17,20 +15,20 @@ USES_CLEAR = 0 !byte $FF,$00,$FF,$00,$FF,$00,$FF,$00 StagesHi ; high bytes of address of drawing routine for each stage - !byte copy0F - !byte copy0E - !byte copy0D - !byte copy0C - !byte copy0B - !byte copy0A - !byte copy09 - !byte copy08 - !byte copy07 - !byte copy06 - !byte copy05 - !byte copy04 - !byte copy03 - !byte copy02 - !byte copy01 - !byte copy00 + !byte dhgr_copy0F + !byte dhgr_copy0E + !byte dhgr_copy0D + !byte dhgr_copy0C + !byte dhgr_copy0B + !byte dhgr_copy0A + !byte dhgr_copy09 + !byte dhgr_copy08 + !byte dhgr_copy07 + !byte dhgr_copy06 + !byte dhgr_copy05 + !byte dhgr_copy04 + !byte dhgr_copy03 + !byte dhgr_copy02 + !byte dhgr_copy01 + !byte dhgr_copy00 EndStagesHi diff --git a/src/fx/fx.dhgr.48boxes.sync.clear.a b/src/fx/fx.dhgr.48boxes.sync.clear.a index 4ecb098..4e9f45a 100644 --- a/src/fx/fx.dhgr.48boxes.sync.clear.a +++ b/src/fx/fx.dhgr.48boxes.sync.clear.a @@ -15,36 +15,36 @@ !byte $FF,$00,$FF,$00,$FF,$00,$FF,$00 StagesHi ; high bytes of address of drawing routine for each stage - !byte clear0F - !byte clear0E - !byte clear0D - !byte clear0C - !byte clear0B - !byte clear0A - !byte clear09 - !byte clear08 - !byte clear07 - !byte clear06 - !byte clear05 - !byte clear04 - !byte clear03 - !byte clear02 - !byte clear01 - !byte clear00 - !byte copy00 - !byte copy01 - !byte copy02 - !byte copy03 - !byte copy04 - !byte copy05 - !byte copy06 - !byte copy07 - !byte copy08 - !byte copy09 - !byte copy0A - !byte copy0B - !byte copy0C - !byte copy0D - !byte copy0E - !byte copy0F + !byte dhgr_clear0F + !byte dhgr_clear0E + !byte dhgr_clear0D + !byte dhgr_clear0C + !byte dhgr_clear0B + !byte dhgr_clear0A + !byte dhgr_clear09 + !byte dhgr_clear08 + !byte dhgr_clear07 + !byte dhgr_clear06 + !byte dhgr_clear05 + !byte dhgr_clear04 + !byte dhgr_clear03 + !byte dhgr_clear02 + !byte dhgr_clear01 + !byte dhgr_clear00 + !byte dhgr_copy00 + !byte dhgr_copy01 + !byte dhgr_copy02 + !byte dhgr_copy03 + !byte dhgr_copy04 + !byte dhgr_copy05 + !byte dhgr_copy06 + !byte dhgr_copy07 + !byte dhgr_copy08 + !byte dhgr_copy09 + !byte dhgr_copy0A + !byte dhgr_copy0B + !byte dhgr_copy0C + !byte dhgr_copy0D + !byte dhgr_copy0E + !byte dhgr_copy0F EndStagesHi diff --git a/src/fx/fx.dhgr.bar.dissolve.a b/src/fx/fx.dhgr.bar.dissolve.a index 93a0763..fbb3482 100644 --- a/src/fx/fx.dhgr.bar.dissolve.a +++ b/src/fx/fx.dhgr.bar.dissolve.a @@ -5,14 +5,14 @@ !to "build/FX.INDEXED/DHGR.BAR.DISSLV",plain *=$6000 -hgrlo = $0200 ; [$C0 bytes, main memory only] -hgr1hi = $0300 ; [$C0 bytes, main memory only] +;hgrlo = $0201 ; [$C0 bytes, main memory only] defined in constants.a +;hgr1hi = $0301 ; [$C0 bytes, main memory only] defined in constants.a !source "src/fx/macros.a" +COPY_TO_0 start, end ;X=0 - +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi + jsr iBuildHGRTables jmp loop start @@ -61,18 +61,16 @@ dst2 sta $FDFD, y ; SMC bcc - jsr tomain lda #$30 - jsr WaitForKeyWithTimeout + jsr iWaitForKeyWithTimeout bmi exit dec row2 inc row1 bne loop -tomain sta $C002 - sta $C004 +tomain sta READMAINMEM + sta WRITEMAINMEM exit rts -toaux sta $C003 - sta $C005 +toaux sta READAUXMEM + sta WRITEAUXMEM rts - - !source "src/wait.a" } end diff --git a/src/fx/fx.dhgr.bubbles.a b/src/fx/fx.dhgr.bubbles.a index 1930e86..ba407c5 100644 --- a/src/fx/fx.dhgr.bubbles.a +++ b/src/fx/fx.dhgr.bubbles.a @@ -7,10 +7,11 @@ !source "src/fx/fx.dhgr.precomputed.1bit.a" - +FX_INITONCE_1BIT CoordinatesFile, Start + +FX_INITONCE_1BIT FXCodeFile, CoordinatesFile, Start Start - +FX_PRECOMPUTED_1BIT_DHGR Coordinates1Bit + jmp FXCode +FXCodeFile + +PSTRING "DHGR1" CoordinatesFile - !byte 15 - !text "FX/BUBBLES.DATA" + +PSTRING "BUBBLES.DATA" diff --git a/src/fx/fx.dhgr.bubbles.in.a b/src/fx/fx.dhgr.bubbles.in.a index 6556416..a3ca3cf 100644 --- a/src/fx/fx.dhgr.bubbles.in.a +++ b/src/fx/fx.dhgr.bubbles.in.a @@ -7,11 +7,12 @@ !source "src/fx/fx.dhgr.precomputed.1bit.a" - +FX_INITONCE_1BIT CoordinatesFile, Start - +FX_REVERSE_1BIT + +FX_INITONCE_1BIT FXCodeFile, CoordinatesFile, Start + jsr iReverseCoordinates1Bit Start - +FX_PRECOMPUTED_1BIT_DHGR Coordinates1Bit + jmp FXCode +FXCodeFile + +PSTRING "DHGR1" CoordinatesFile - !byte 15 - !text "FX/BUBBLES.DATA" + +PSTRING "BUBBLES.DATA" diff --git a/src/fx/fx.dhgr.butterfly.a b/src/fx/fx.dhgr.butterfly.a index 7668ff9..4e1daff 100644 --- a/src/fx/fx.dhgr.butterfly.a +++ b/src/fx/fx.dhgr.butterfly.a @@ -7,10 +7,11 @@ !source "src/fx/fx.dhgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start Start - +FX_PRECOMPUTED_2BIT_DHGR Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "DHGR2" CoordinatesFile - !byte 17 - !text "FX/BUTTERFLY.DATA" + +PSTRING "BUTTERFLY.DATA" diff --git a/src/fx/fx.dhgr.butterfly.in.a b/src/fx/fx.dhgr.butterfly.in.a index f9e2424..3c5c15f 100644 --- a/src/fx/fx.dhgr.butterfly.in.a +++ b/src/fx/fx.dhgr.butterfly.in.a @@ -7,11 +7,12 @@ !source "src/fx/fx.dhgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_REVERSE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iReverseCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT_DHGR Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "DHGR2" CoordinatesFile - !byte 17 - !text "FX/BUTTERFLY.DATA" + +PSTRING "BUTTERFLY.DATA" diff --git a/src/fx/fx.dhgr.butterfly.ripple.a b/src/fx/fx.dhgr.butterfly.ripple.a index 16c9f23..f0f55bc 100644 --- a/src/fx/fx.dhgr.butterfly.ripple.a +++ b/src/fx/fx.dhgr.butterfly.ripple.a @@ -7,11 +7,12 @@ !source "src/fx/fx.dhgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_RIPPLE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iRippleCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT_DHGR Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "DHGR2" CoordinatesFile - !byte 17 - !text "FX/BUTTERFLY.DATA" + +PSTRING "BUTTERFLY.DATA" diff --git a/src/fx/fx.dhgr.corner4.a b/src/fx/fx.dhgr.corner4.a index 433d105..7756c73 100644 --- a/src/fx/fx.dhgr.corner4.a +++ b/src/fx/fx.dhgr.corner4.a @@ -7,10 +7,11 @@ !source "src/fx/fx.dhgr.precomputed.1bit.a" - +FX_INITONCE_1BIT CoordinatesFile, Start + +FX_INITONCE_1BIT FXCodeFile, CoordinatesFile, Start Start - +FX_PRECOMPUTED_1BIT_DHGR Coordinates1Bit + jmp FXCode +FXCodeFile + +PSTRING "DHGR1" CoordinatesFile - !byte 15 - !text "FX/CORNER4.DATA" + +PSTRING "CORNER4.DATA" diff --git a/src/fx/fx.dhgr.corner4.in.a b/src/fx/fx.dhgr.corner4.in.a index f59054a..23d6c5d 100644 --- a/src/fx/fx.dhgr.corner4.in.a +++ b/src/fx/fx.dhgr.corner4.in.a @@ -7,11 +7,12 @@ !source "src/fx/fx.dhgr.precomputed.1bit.a" - +FX_INITONCE_1BIT CoordinatesFile, Start - +FX_REVERSE_1BIT + +FX_INITONCE_1BIT FXCodeFile, CoordinatesFile, Start + jsr iReverseCoordinates1Bit Start - +FX_PRECOMPUTED_1BIT_DHGR Coordinates1Bit + jmp FXCode +FXCodeFile + +PSTRING "DHGR1" CoordinatesFile - !byte 15 - !text "FX/CORNER4.DATA" + +PSTRING "CORNER4.DATA" diff --git a/src/fx/fx.dhgr.corner4.ripple.a b/src/fx/fx.dhgr.corner4.ripple.a index 931d910..96c04b8 100644 --- a/src/fx/fx.dhgr.corner4.ripple.a +++ b/src/fx/fx.dhgr.corner4.ripple.a @@ -7,11 +7,13 @@ !source "src/fx/fx.dhgr.precomputed.1bit.a" - +FX_INITONCE_1BIT CoordinatesFile, Start - jsr EndCoordinates1Bit+1 -Start - +FX_PRECOMPUTED_1BIT_DHGR Coordinates1Bit + +FX_INITONCE_1BIT FXCodeFile, CoordinatesFile, Start + jsr iRippleCoordinates1Bit2 +Start + jmp FXCode + +FXCodeFile + +PSTRING "DHGR1" CoordinatesFile - !byte 15 - !text "FX/CORNER4.DATA" + +PSTRING "CORNER4.DATA" diff --git a/src/fx/fx.dhgr.diagonal.a b/src/fx/fx.dhgr.diagonal.a index c5805c1..9827734 100644 --- a/src/fx/fx.dhgr.diagonal.a +++ b/src/fx/fx.dhgr.diagonal.a @@ -5,23 +5,23 @@ !to "build/FX.INDEXED/DHGR.DIAGONAL",plain *=$6000 -hgrlo = $0200 ; [$C0 bytes, main memory only] -hgr1hi = $0300 ; [$C0 bytes, main memory only] -copymasks= $02C0 ; [$08 bytes, different values in main and auxmem] +;hgrlo = $0201 ; [$C0 bytes, main memory only] defined in constants.a +copymasks= $02C1 ; [$08 bytes, different values in main and auxmem] +;hgr1hi = $0301 ; [$C0 bytes, main memory only] defined in constants.a !source "src/fx/macros.a" +COPY_TO_0 start, end ;X=0 - +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi + jsr iBuildHGRTables ldy #8 ; copy copymask arrays into place in main and auxmem - lda copymasks_main-1, y sta copymasks-1, y lda copymasks_aux-1, y - sta $C005 + sta WRITEAUXMEM sta copymasks-1, y - sta $C004 + sta WRITEMAINMEM dey bne - @@ -76,7 +76,7 @@ rowloop lda 127 then we're done - +ROW_X_TO_BASE_ADDRESSES - +ROW_X_TO_MIRROR_ADDRESSES - - inc input - lda (input), y - +HIGH_3_LOW_5 input - sty 127 then we're done - +ROW_X_TO_BASE_ADDRESSES - +ROW_X_TO_MIRROR_ADDRESSES - - iny - lda (input), y - +HIGH_3_LOW_5 input - sty FXCode + jsr iLoadFXCODE - ; drawing routines for each stage are constructed dynamically - ; and stored at copy00..copy0F and clear00..clear0F - jsr BuildDrawingRoutines - - ; set up zero page for drawing phase - ; A=0 here - tax -- ldy start-5, x - sty $00, x - sta EndStagesHi, x - inx - bne - - - ; X=0 here - +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgrhi - -; Generate |BoxesX| and |BoxesY| arrays -; BoxesX (starting row for each box) -; $00,$00,$00,$00,$00,$00,$00,$00 -; $20,$20,$20,$20,$20,$20,$20,$20 -; $40,$40,$40,$40,$40,$40,$40,$40 -; $60,$60,$60,$60,$60,$60,$60,$60 -; $80,$80,$80,$80,$80,$80,$80,$80 -; $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 -; BoxesY (starting byte offset for each box) -; $00,$05,$0A,$0F,$14,$19,$1E,$23 -; $00,$05,$0A,$0F,$14,$19,$1E,$23 -; $00,$05,$0A,$0F,$14,$19,$1E,$23 -; $00,$05,$0A,$0F,$14,$19,$1E,$23 -; $00,$05,$0A,$0F,$14,$19,$1E,$23 -; $00,$05,$0A,$0F,$14,$19,$1E,$23 - ldx #48 - ldy #$A0 - lda #$23 - pha -- tya - sta BoxesX-1, x - pla - sta BoxesY-1, x - sec - sbc #5 - bcs + - lda #$23 -+ pha - dex - txa - and #7 - bne - - tya - sec - sbc #$20 - tay - txa - bne - - pla - - jmp MainLoop - -; These are all the pieces of code we need to construct the drawing routines. -; There are 32 drawing routines (16 if USES_CLEAR=0), which we construct from -; four templates (below). Templates use tokens to refer to these code pieces. -; Note that several pieces overlap in order to minimize code size. -; Everything from CODEGEN_COPY_START and onward is copied to zero page for -; the code generation phase on program startup. -CODEGEN_COPY_START -!pseudopc 0 { -RTS0 ; 1 byte - rts -RTS0_E -INX_AND_RECALC ; 16 bytes - inx -RECALC_AND_INY ; 16 bytes -RECALC ; 15 bytes - lda hgrlo, x - sta Coordinates1Bit + jsr iLoadFXDATA + + sec + ror EndCoordinates1Bit } -!macro FX_REVERSE_1BIT { - ldy #0 ; Coordinates1Bit - sta $f1 - lda #<(EndCoordinates1Bit - 2) - sta $f2 - lda #>(EndCoordinates1Bit - 2) - sta $f3 - clc - !byte $24 -- sec --- lda ($f0), y - pha - lda ($f2), y - sta ($f0), y - pla - sta ($f2), y - iny - bcc - - ldy #0 - !byte $24 -- clc - inc $f0 - bne + - inc $f1 -+ lda $f1 - eor #>(Coordinates1Bit + $1A40) - bne + - lda $f0 - eor #<(Coordinates1Bit + $1A40) - beq ++ -+ lda $f2 - bne + - dec $f3 -+ dec $f2 - bcs - - bcc -- ; always -++ -} - -!macro FX_RIPPLE_1BIT .target { - lda #2 ; <(Coordinates1Bit + 2) - sta $f0 - ldy #0 - sty $f1 - lda #$16 ; <(Coordinates1Bit + 22) - sta $f2 - sty $f3 - - lda #$1f - sta $ee - lda #$0d - sta $ef - - lda Coordinates1Bit + 2 - sta $e0 - lda Coordinates1Bit + 3 - sta $e1 - lda Coordinates1Bit + 22 - sta $e2 - lda Coordinates1Bit + 23 - sta $e3 - ---- ldx #4 --- ldy $ee, x - lda $ef, x - jsr .target - sty $ee, x - sta $ef, x - sty $ec - clc - adc #>Coordinates1Bit - sta $ed - ldy #0 - !byte $24 -- sec - lda ($ec), y - pha - lda $de, x - sta ($ec), y - pla - sta $de, x - inx - iny - bcc - - dex - dex - dex - dex - bne -- - dec $ee - bne --- - dec $ef - bpl --- - bmi +++ ; always branches -aslmod4 jsr aslmod -aslmod3 jsr aslmod -aslmod2 jsr aslmod -aslmod cmp #$1A - bcc + - bne ++ - cpy #$40 - bcc + -++ iny -+ pha - tya - asl - tay - pla - rol - cmp #$34 - bcc + - bne ++ - cpy #$80 - bcc + -++ pha - tya - sbc #$80 - tay - pla - sbc #$34 -+ rts -+++ -} - -!macro FX_PRECOMPUTED_1BIT .coords { - +BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi - +BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror - +BUILD_MIRROR_COLS mirror_cols - +BUILD_SPARSE_BITMASKS_1BIT - +COPY_TO_0 start, end - jmp InputLoop -start -!pseudopc 0 { -Exit1Bit rts -InputLoop - ldy #0 -input=*+1 - ldx .coords ; first value: HGR row (only 0..95 will be in input array) - bmi Exit1Bit ; if > 127 then we're done - +ROW_X_TO_BASE_ADDRESSES - +ROW_X_TO_MIRROR_ADDRESSES - - inc input - lda (input), y - +HIGH_3_LOW_5 input - - ; main 1x2 block in top-left quadrant -src1=*+1 - lda $FDFD, y - eor ( 127 then we're done - +ROW_X_TO_BASE_ADDRESSES - +ROW_X_TO_MIRROR_ADDRESSES - - iny - lda (FXCode + jsr iLoadFXCODE + + +LDADDR .CoordinatesFile + ldx #>Coordinates1Bit + jsr iLoadFXDATA + + sec + ror EndCoordinates1Bit } diff --git a/src/fx/fx.hgr.precomputed.2bit.a b/src/fx/fx.hgr.precomputed.2bit.a index d72df44..9189138 100644 --- a/src/fx/fx.hgr.precomputed.2bit.a +++ b/src/fx/fx.hgr.precomputed.2bit.a @@ -1,423 +1,40 @@ ;license:MIT -;(c) 2019-2022 by 4am +;(c) 2019-2024 by 4am +; + +;------------------------------------------------------------------------------ +; YE OLDE GRAND UNIFIED MEMORY MAP +; +; 0201..02C0 - hgrlo +; 02C1..02E8 - mirror_cols +; 02E9..0300 +; 0301..03C0 - hgrhi +; 03C1..03EE +; 6000..61FF - module-specific code ($200 max) +; 6200.. - shared FX code (loaded once by module-specific code) +; 80FE..BD00 - Coordinates2Bit (8100 but dither variants clobber Coordinates2Bit-2) +; BD01..BDA7 +; BDA8..BDFF - dithermasks +; BE00..BEFF - copymasks2bit +; BF00..BFFF - ProRWTS glue ; -copymasks = $0200 ; $100 bytes but sparse, index is 0..4 but in high 3 bits, so $00, $20, $40, $60, $80 -mirror_copymasks = $0201 -hgrlo = $0301 ; $C0 bytes -hgrlomirror = $BD40 ; $C0 bytes -mirror_cols = $BE00 ; $28 bytes -hgr1hi = $BE40 ; $C0 bytes -hgr1himirror = $BF40 ; $C0 bytes -dithermasks = $8000 ; $58 bytes -evenrow_masks = dithermasks -oddrow_masks = dithermasks+2 -no_masks = dithermasks+44 -Coordinates2Bit= $8100 ; $3C01 bytes ($3C00 on disk + 1 byte as EOF) -EndCoordinates2Bit = Coordinates2Bit + $3C00 !source "src/fx/macros.a" -!macro BUILD_SPARSE_BITMASKS_2BIT .copymasks, .mirror_copymasks { - ; build sparse lookup tables for bitmasks - lda #%10000011 - sta .copymasks - sta .mirror_copymasks+$E0 - - lda #%10001100 - sta .copymasks+$20 - sta .mirror_copymasks+$C0 - - lda #%10110000 - sta .copymasks+$40 - sta .mirror_copymasks+$A0 - - lda #%11000000 - sta .copymasks+$60 - sta .mirror_copymasks+$80 - - lda #%10000001 - sta .copymasks+$80 - sta .mirror_copymasks+$60 - - lda #%10000110 - sta .copymasks+$A0 - sta .mirror_copymasks+$40 - - lda #%10011000 - sta .copymasks+$C0 - sta .mirror_copymasks+$20 - - lda #%11100000 - sta .copymasks+$E0 - sta .mirror_copymasks -} - -!macro ROW_X_TO_2BIT_BASE_ADDRESSES { - ; X = $01..$C0, mapping to row 0..191 - lda hgrlo-1, x - sta FXCode + jsr iLoadFXCODE + + +LDADDR .CoordinatesFile + ldx #>Coordinates2Bit + jsr iLoadFXDATA + lda #$00 sta EndCoordinates2Bit } - -!macro FX_REVERSE_2BIT { - ldy #0 ; Coordinates2Bit - sta $f1 - lda #<(EndCoordinates2Bit - 2) - sta $f2 - lda #>(EndCoordinates2Bit - 2) - sta $f3 - - ldx #$1E ; #$3C/2 - clc - !byte $24 -- sec --- lda ($f0), y - pha - lda ($f2), y - sta ($f0), y - pla - sta ($f2), y - iny - bcc - - ldy #0 - !byte $24 -- clc - inc $f0 - bne + - inc $f1 - dex - beq ++ -+ lda $f2 - bne + - dec $f3 -+ dec $f2 - bcs - - bcc -- ; always branches -++ -} - -!macro FX_RIPPLE_2BIT { - ldy #0 - - ldx #$33 -- lda ptrtbl, x - sta $c0, x - dex - bpl - - - lda #$9b - sta $fe - iny - sty $ff - - ldx #6 -- lda Coordinates2Bit + 1, x - sta $7f, x - lda Coordinates2Bit + 9, x - sta $85, x - lda Coordinates2Bit + 17, x - sta $8b, x - lda Coordinates2Bit + 65, x - sta $9b, x - dex - bne - - lda Coordinates2Bit + 28 - sta $92 - lda Coordinates2Bit + 29 - sta $93 - ldx #4 -- lda Coordinates2Bit + 33, x - sta $93, x - lda Coordinates2Bit + 41, x - sta $97, x - lda Coordinates2Bit + 83, x - sta $a1, x - dex - bne - - ldx #2 -- lda Coordinates2Bit + 125, x - sta $a5, x - lda Coordinates2Bit + 131, x - sta $a7, x - lda Coordinates2Bit + 139, x - sta $a9, x - lda Coordinates2Bit + 169, x - sta $ab, x - lda Coordinates2Bit + 237, x - sta $ad, x - lda Coordinates2Bit + 2193, x - sta $af, x - lda Coordinates2Bit + 6581, x - sta $b1, x - dex - bne - - ---- ldx #$34 --- lda $be, x - tay - ora $bf, x - beq + - lda $bf, x - jsr aslmod - sty $be, x - sta $bf, x - sty $fc - clc - adc #>Coordinates2Bit - sta $fd - ldy #0 - !byte $24 -- sec - lda ($fc), y - pha - lda $7e, x - sta ($fc), y - pla - sta $7e, x - inx - iny - bcc - - dex - dex -+ dex - dex - bne -- - ldy #1 - lda $fe - eor #<(411 - 2) - beq + - ldy #9 - eor #<(411 - 2) xor <(411 - 136) - bne ++ -+ -- ldx zerotbl, y - sta $0, x - sta $1, x - dey - bpl - -++ dec $fe - bne --- - dec $ff - bpl --- - bmi ++ ; always branches -aslmod - jsr + -+ cmp #$1E - bcc + - iny -+ pha - tya - asl - tay - pla - rol - cmp #$3C - bcc + - sbc #$3C -+ rts -ptrtbl !word 2, 4, 6, 10, 12, 14, 18, 20 - !word 22, 28, 34, 36, 42, 44, 66, 68 - !word 70, 84, 86, 126, 132, 140, 170, 238 - !word 2194, 6582 -zerotbl !byte $f0, $f2, $ca, $d2, $d8, $e0, $e2, $e6, $ea, $ee -++ -} - -!macro FX_PRECOMPUTED_2BIT .coords { - +BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi - +BUILD_MIRROR_COLS mirror_cols - +BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks - +COPY_TO_0 start, end - jmp InputLoop -start -!pseudopc 0 { -Exit2Bit rts -InputLoop - ldy #0 -input=*+1 - ldx .coords ; first value: HGR row + 1 - beq Exit2Bit ; if 0 then we're done - +ROW_X_TO_2BIT_BASE_ADDRESSES - - inc FXCode + jsr iLoadFXCODE + + +LDADDR .CoordinatesFile + ldx #>Coordinates3Bit + jsr iLoadFXDATA + sec - ror Coordinates3Bit + $5000 -} - -!macro FX_REVERSE_3BIT { - ldy #0 ; Coordinates3Bit - sta $f1 - lda #<(Coordinates3Bit + $5000 - 2) - sta $f2 - lda #>(Coordinates3Bit + $5000 - 2) - sta $f3 - - ldx #$28 ; #$50/2 - clc - !byte $24 -- sec --- lda ($f0), y - pha - lda ($f2), y - sta ($f0), y - pla - sta ($f2), y - iny - bcc - - ldy #0 - !byte $24 -- clc - inc $f0 - bne + - inc $f1 - dex - beq ++ -+ lda $f2 - bne + - dec $f3 -+ dec $f2 - bcs - - bcc -- ; always branches -++ -} - -!macro FX_RIPPLE_3BIT { - ldx #$1B -- lda ripplezp, x - sta $e0, x - dex - bpl - - ---- ldx #$0c --- ldy $ee, x - lda $ef, x - jsr aslmod - sty $ee, x - sta $ef, x - sty $ec - clc - adc #>Coordinates3Bit - sta $ed - ldy #0 - !byte $24 -- sec - lda ($ec), y - pha - lda $de, x - sta ($ec), y - pla - sta $de, x - inx - iny - bcc - - dex - dex - dex - dex - bne -- - dec $ee - bne --- - dec $ef - bpl --- - bmi ++ ; always branches -aslmod - jsr + -+ cmp #$28 - bcc + - iny -+ pha - tya - asl - tay - pla - rol - cmp #$50 - bcc + - sbc #$50 -+ rts -ripplezp - !byte $1F,$F3,$20,$F3,$20,$14,$20,$D3 - !byte $1E,$F3,$1F,$54,$00,$00,$AA,$06 - !byte $02,$00,$04,$00,$06,$00,$0C,$00 - !byte $16,$00,$1A,$00 -++ -} - -!macro FX_PRECOMPUTED_3BIT .coords { - +BUILD_3BIT_HGR_LOOKUP_TABLES - +BUILD_EXTRA_COLS - +BUILD_SPARSE_BITMASKS_3BIT - +COPY_TO_0 start, end - jmp InputLoop -start -!pseudopc 0 { -Exit3Bit rts -InputLoop - ldy #0 -input=*+1 - lda .coords - bmi Exit3Bit ; if high bit is 1 then we're done - cmp #$40 - php - tax - +ROW_X_TO_3BIT_BASE_ADDRESSES - - inc #$27 inc row1 @@ -41,5 +41,4 @@ row2 = $ff bpl @loop1 @exit rts - !source "src/wait.a" +HGR_HALF_BLOCK_COPY_ROUTINES diff --git a/src/fx/fx.hgr.stagger.ud.white.a b/src/fx/fx.hgr.stagger.ud.white.a index e83cd21..7374e88 100644 --- a/src/fx/fx.hgr.stagger.ud.white.a +++ b/src/fx/fx.hgr.stagger.ud.white.a @@ -30,7 +30,7 @@ row2 = $ff cpy #$28 bne @loop2 lda #$30 - jsr WaitForKeyWithTimeout + jsr iWaitForKeyWithTimeout bmi @exit dey ; Y -> #$27 inc row1 @@ -59,7 +59,7 @@ row2 = $ff cpy #$28 bne @loop4 lda #$30 - jsr WaitForKeyWithTimeout + jsr iWaitForKeyWithTimeout bmi @exit dey ; Y -> #$27 inc row1 @@ -69,6 +69,5 @@ row2 = $ff bpl @loop3 @exit rts - !source "src/wait.a" +HGR_WHITE_ROUTINES +HGR_HALF_BLOCK_COPY_ROUTINES diff --git a/src/fx/fx.hgr.star.a b/src/fx/fx.hgr.star.a index 4a17ee3..aeab9b5 100644 --- a/src/fx/fx.hgr.star.a +++ b/src/fx/fx.hgr.star.a @@ -7,10 +7,11 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 12 - !text "FX/STAR.DATA" + +PSTRING "STAR.DATA" diff --git a/src/fx/fx.hgr.star.bloom.a b/src/fx/fx.hgr.star.bloom.a index 73b4a5e..c7f11be 100644 --- a/src/fx/fx.hgr.star.bloom.a +++ b/src/fx/fx.hgr.star.bloom.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2019 by 4am +;(c) 2019-2024 by 4am/qkumba ; !cpu 6502 !to "build/FX.INDEXED/STAR.BLOOM",plain @@ -7,11 +7,11 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_PRECOMPUTED_2BIT Coordinates + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start +Start + jmp FXCode -!if * and 1 { - !byte 0 -} -Coordinates - !source "src/fx/fx.hgr.star.bloom.data.a" - !byte $00 +FXCodeFile + +PSTRING "HGR2" +CoordinatesFile + +PSTRING "STAR.BLOOM.DATA" diff --git a/src/fx/fx.hgr.star.bloom.data.a b/src/fx/fx.hgr.star.bloom.data.a index c222926..427bdf1 100644 --- a/src/fx/fx.hgr.star.bloom.data.a +++ b/src/fx/fx.hgr.star.bloom.data.a @@ -1,3 +1,6 @@ +!cpu 6502 +!to "build/FXDATA/STAR.BLOOM.DATA",plain +*=$8100 !byte $A5,%01000000 !byte $01,%00100010 !byte $B3,%00100010 diff --git a/src/fx/fx.hgr.star.data.a b/src/fx/fx.hgr.star.data.a index 13d838a..cc8e6fd 100644 --- a/src/fx/fx.hgr.star.data.a +++ b/src/fx/fx.hgr.star.data.a @@ -1,5 +1,5 @@ !cpu 6502 -!to "build/FX/STAR.DATA",plain +!to "build/FXDATA/STAR.DATA",plain *=$8100 !byte $5F,%11110011 !byte $61,%11110011 diff --git a/src/fx/fx.hgr.star.in.a b/src/fx/fx.hgr.star.in.a index d0bb60e..52639b2 100644 --- a/src/fx/fx.hgr.star.in.a +++ b/src/fx/fx.hgr.star.in.a @@ -7,11 +7,12 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_REVERSE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iReverseCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 12 - !text "FX/STAR.DATA" + +PSTRING "STAR.DATA" diff --git a/src/fx/fx.hgr.star.ripple.a b/src/fx/fx.hgr.star.ripple.a index d4410a7..b9f1d54 100644 --- a/src/fx/fx.hgr.star.ripple.a +++ b/src/fx/fx.hgr.star.ripple.a @@ -7,11 +7,12 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_RIPPLE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iRippleCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 12 - !text "FX/STAR.DATA" + +PSTRING "STAR.DATA" diff --git a/src/fx/fx.hgr.star7.a b/src/fx/fx.hgr.star7.a index 725e5bb..14ecfa2 100644 --- a/src/fx/fx.hgr.star7.a +++ b/src/fx/fx.hgr.star7.a @@ -7,10 +7,11 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 13 - !text "FX/STAR7.DATA" + +PSTRING "STAR7.DATA" diff --git a/src/fx/fx.hgr.star7.data.a b/src/fx/fx.hgr.star7.data.a index 911c46f..2ece2bf 100644 --- a/src/fx/fx.hgr.star7.data.a +++ b/src/fx/fx.hgr.star7.data.a @@ -1,5 +1,5 @@ !cpu 6502 -!to "build/FX/STAR7.DATA",plain +!to "build/FXDATA/STAR7.DATA",plain *=$8100 !byte $61,%11110011 !byte $5F,%11110011 diff --git a/src/fx/fx.hgr.star7.in.a b/src/fx/fx.hgr.star7.in.a index 5aad60c..8fb6304 100644 --- a/src/fx/fx.hgr.star7.in.a +++ b/src/fx/fx.hgr.star7.in.a @@ -7,11 +7,12 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_REVERSE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iReverseCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 13 - !text "FX/STAR7.DATA" + +PSTRING "STAR7.DATA" diff --git a/src/fx/fx.hgr.star7.ripple.a b/src/fx/fx.hgr.star7.ripple.a index 6cff8e5..71c3e42 100644 --- a/src/fx/fx.hgr.star7.ripple.a +++ b/src/fx/fx.hgr.star7.ripple.a @@ -7,11 +7,12 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_RIPPLE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iRippleCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 13 - !text "FX/STAR7.DATA" + +PSTRING "STAR7.DATA" diff --git a/src/fx/fx.hgr.swirl.a b/src/fx/fx.hgr.swirl.a index 49410fe..6258760 100644 --- a/src/fx/fx.hgr.swirl.a +++ b/src/fx/fx.hgr.swirl.a @@ -7,11 +7,13 @@ !source "src/fx/fx.hgr.precomputed.1bit.a" - +FX_INITONCE_1BIT CoordinatesFile, Start - +FX_RIPPLE_1BIT aslmod4 -Start - +FX_PRECOMPUTED_1BIT Coordinates1Bit + +FX_INITONCE_1BIT FXCodeFile, CoordinatesFile, Start + jsr iRippleCoordinates1Bit4 +Start + jmp FXCode + +FXCodeFile + +PSTRING "HGR1" CoordinatesFile - !byte 15 - !text "FX/CORNER4.DATA" + +PSTRING "CORNER4.DATA" diff --git a/src/fx/fx.hgr.thin.bar.dissolve.a b/src/fx/fx.hgr.thin.bar.dissolve.a index 66d665f..b8ffe06 100644 --- a/src/fx/fx.hgr.thin.bar.dissolve.a +++ b/src/fx/fx.hgr.thin.bar.dissolve.a @@ -43,7 +43,7 @@ dst = $26 dey bpl - lda #$30 - jsr WaitForKeyWithTimeout + jsr iWaitForKeyWithTimeout bmi @exit !if 0 { ldx mask1 @@ -62,7 +62,6 @@ dst = $26 bne @loop @exit rts - !source "src/wait.a" +HGR_CALC_ROUTINES mask1 !byte %10110011 diff --git a/src/fx/fx.hgr.tri.fizzle.a b/src/fx/fx.hgr.tri.fizzle.a index 77d743c..23e56a2 100644 --- a/src/fx/fx.hgr.tri.fizzle.a +++ b/src/fx/fx.hgr.tri.fizzle.a @@ -43,7 +43,7 @@ maskindex = $FD ; byte + jsr HGRBlockCopyWithMask @wait lda #$0C - jsr WaitForKeyWithTimeout + jsr iWaitForKeyWithTimeout bmi @exit inc coord bne + @@ -107,6 +107,5 @@ mask4 !byte %11111110 !byte %11111111 - !source "src/wait.a" +HGR_COPY_MASK_ROUTINES +HGR_BLOCK_COPY_ROUTINES diff --git a/src/fx/fx.hgr.wavy.iris.a b/src/fx/fx.hgr.wavy.iris.a index 8bcaed9..127757d 100644 --- a/src/fx/fx.hgr.wavy.iris.a +++ b/src/fx/fx.hgr.wavy.iris.a @@ -7,10 +7,11 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 17 - !text "FX/WAVY.IRIS.DATA" + +PSTRING "WAVY.IRIS.DATA" diff --git a/src/fx/fx.hgr.wavy.iris.bloom.a b/src/fx/fx.hgr.wavy.iris.bloom.a index 1a1fb1a..45ae719 100644 --- a/src/fx/fx.hgr.wavy.iris.bloom.a +++ b/src/fx/fx.hgr.wavy.iris.bloom.a @@ -7,10 +7,11 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 18 - !text "FX/W.IR.BLOOM.DATA" + +PSTRING "W.IR.BLOOM.DATA" diff --git a/src/fx/fx.hgr.wavy.iris.bloom.data.a b/src/fx/fx.hgr.wavy.iris.bloom.data.a index c538f24..4d1f7ad 100644 --- a/src/fx/fx.hgr.wavy.iris.bloom.data.a +++ b/src/fx/fx.hgr.wavy.iris.bloom.data.a @@ -1,5 +1,5 @@ !cpu 6502 -!to "build/FX/W.IR.BLOOM.DATA",plain +!to "build/FXDATA/W.IR.BLOOM.DATA",plain *=$8100 !byte $5F,%11110011 !byte $61,%11110011 diff --git a/src/fx/fx.hgr.wavy.iris.bloom.in.a b/src/fx/fx.hgr.wavy.iris.bloom.in.a index 5d8d976..98432b3 100644 --- a/src/fx/fx.hgr.wavy.iris.bloom.in.a +++ b/src/fx/fx.hgr.wavy.iris.bloom.in.a @@ -7,11 +7,12 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_REVERSE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iReverseCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 18 - !text "FX/W.IR.BLOOM.DATA" + +PSTRING "W.IR.BLOOM.DATA" diff --git a/src/fx/fx.hgr.wavy.iris.data.a b/src/fx/fx.hgr.wavy.iris.data.a index f3d78e9..fa4d753 100644 --- a/src/fx/fx.hgr.wavy.iris.data.a +++ b/src/fx/fx.hgr.wavy.iris.data.a @@ -1,5 +1,5 @@ !cpu 6502 -!to "build/FX/WAVY.IRIS.DATA",plain +!to "build/FXDATA/WAVY.IRIS.DATA",plain *=$8100 !byte $5F,%11110011 !byte $61,%11110011 diff --git a/src/fx/fx.hgr.wavy.iris.in.a b/src/fx/fx.hgr.wavy.iris.in.a index 80752ef..d009c82 100644 --- a/src/fx/fx.hgr.wavy.iris.in.a +++ b/src/fx/fx.hgr.wavy.iris.in.a @@ -7,11 +7,12 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_REVERSE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iReverseCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 17 - !text "FX/WAVY.IRIS.DATA" + +PSTRING "WAVY.IRIS.DATA" diff --git a/src/fx/fx.hgr.wavy.ripple.a b/src/fx/fx.hgr.wavy.ripple.a index 67640d3..e67f50a 100644 --- a/src/fx/fx.hgr.wavy.ripple.a +++ b/src/fx/fx.hgr.wavy.ripple.a @@ -7,11 +7,12 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_RIPPLE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iRippleCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 17 - !text "FX/WAVY.IRIS.DATA" + +PSTRING "WAVY.IRIS.DATA" diff --git a/src/fx/fx.hgr.wavy.ripple.bloom.a b/src/fx/fx.hgr.wavy.ripple.bloom.a index 6e58880..ac04f6a 100644 --- a/src/fx/fx.hgr.wavy.ripple.bloom.a +++ b/src/fx/fx.hgr.wavy.ripple.bloom.a @@ -7,11 +7,12 @@ !source "src/fx/fx.hgr.precomputed.2bit.a" - +FX_INITONCE_2BIT CoordinatesFile, Start - +FX_RIPPLE_2BIT + +FX_INITONCE_2BIT FXCodeFile, CoordinatesFile, Start + jsr iRippleCoordinates2Bit Start - +FX_PRECOMPUTED_2BIT Coordinates2Bit + jmp FXCode +FXCodeFile + +PSTRING "HGR2" CoordinatesFile - !byte 18 - !text "FX/W.IR.BLOOM.DATA" + +PSTRING "W.IR.BLOOM.DATA" diff --git a/src/fx/fx.shr.2pass.lr.a b/src/fx/fx.shr.2pass.lr.a index f755f5e..9ff1da5 100644 --- a/src/fx/fx.shr.2pass.lr.a +++ b/src/fx/fx.shr.2pass.lr.a @@ -32,7 +32,7 @@ dst sta $0000, y ; SMC inx cpx #$C8 bcc loop3 - lda $C000 + lda KBD bmi @exit iny cpy #$A0 diff --git a/src/fx/fx.shr.80boxes.common.a b/src/fx/fx.shr.80boxes.common.a index 3c5fe2a..23ee525 100644 --- a/src/fx/fx.shr.80boxes.common.a +++ b/src/fx/fx.shr.80boxes.common.a @@ -148,7 +148,7 @@ NextBox dex lda palettes sta src+1 ldx #$0F ; palette counter ($0F -> $00, not used as index) @@ -163,25 +163,23 @@ g_step_loop ldx #$1D ldy #$00 copyloop jsr WaitForVBL - sta $C005 + sta WRITEAUXMEM copy1 lda $4400, y ; SMC sta $9E00, y copy2 lda $4500, y ; SMC sta $9F00, y iny bne copy1 - sta $C004 + sta WRITEMAINMEM inc copy1+2 inc copy1+2 inc copy2+2 inc copy2+2 lda incv - jsr WaitForKeyWithTimeout + jsr iWaitForKeyWithTimeout bmi exit dec incv dec incv dex bpl copyloop exit jmp UnwaitForVBL - - !source "src/wait.a" diff --git a/src/fx/fx.shr.fizzle.a b/src/fx/fx.shr.fizzle.a index 3535332..eae7827 100644 --- a/src/fx/fx.shr.fizzle.a +++ b/src/fx/fx.shr.fizzle.a @@ -46,7 +46,7 @@ src lda $FD00, y ; SMC high byte tay bcc loop2 bne loop - bit $C000 + bit KBD bmi exit txa bne loop1 diff --git a/src/fx/fx.shr.iris.a b/src/fx/fx.shr.iris.a index 46fd593..0d2ad7d 100644 --- a/src/fx/fx.shr.iris.a +++ b/src/fx/fx.shr.iris.a @@ -9,28 +9,27 @@ mirror_rows = $106 ; $C8 bytes shrlo = $200 ; $C8 bytes shrhi = $300 ; $C8 bytes coords = $9F00 ; $1F41 bytes -CoordinatesFileCopy = $BE42; $11 bytes -mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction +shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction !source "src/fx/macros.a" - +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols jmp stage2 !pseudopc *-$300 { stage2 - +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy + +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile +SHR_STAGE_2 startzp, endzp rts +CoordinatesFile + +PSTRING "SHR.IRIS.DATA" + startzp !pseudopc 0 { stage3 - +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols } endzp +!if (* - stage2 > $200) { !serious "Stage2 code is too large" } } - -CoordinatesFile - !byte 16 - !text "FX/SHR.IRIS.DATA" diff --git a/src/fx/fx.shr.iris.data.a b/src/fx/fx.shr.iris.data.a index ab5d1d2..0003263 100644 --- a/src/fx/fx.shr.iris.data.a +++ b/src/fx/fx.shr.iris.data.a @@ -1,5 +1,5 @@ !cpu 6502 -!to "build/FX/SHR.IRIS.DATA",plain +!to "build/FXDATA/SHR.IRIS.DATA",plain *=$9F00 !byte 98,79 !byte 98,78 diff --git a/src/fx/fx.shr.iris.in.a b/src/fx/fx.shr.iris.in.a index eefc60e..26fe419 100644 --- a/src/fx/fx.shr.iris.in.a +++ b/src/fx/fx.shr.iris.in.a @@ -9,29 +9,28 @@ mirror_rows = $106 ; $C8 bytes shrlo = $200 ; $C8 bytes shrhi = $300 ; $C8 bytes coords = $9F00 ; $1F41 bytes -CoordinatesFileCopy = $BE42; $11 bytes -mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction +shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction !source "src/fx/macros.a" - +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols jmp stage2 !pseudopc *-$300 { stage2 - +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy + +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile +SHR_REVERSE coords +SHR_STAGE_2 startzp, endzp rts +CoordinatesFile + +PSTRING "SHR.IRIS.DATA" + startzp !pseudopc 0 { stage3 - +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols } endzp +!if (* - stage2 > $200) { !serious "Stage2 code is too large" } } - -CoordinatesFile - !byte 16 - !text "FX/SHR.IRIS.DATA" diff --git a/src/fx/fx.shr.lr.a b/src/fx/fx.shr.lr.a index d08f5f9..dd184ef 100644 --- a/src/fx/fx.shr.lr.a +++ b/src/fx/fx.shr.lr.a @@ -32,7 +32,7 @@ loop2 lda shrlo-1, x dst sta $0000, y ; SMC dex bne loop2 - lda $C000 + lda KBD bmi @exit iny cpy #$A0 diff --git a/src/fx/fx.shr.lr2.a b/src/fx/fx.shr.lr2.a index ce796c0..aa6d90f 100644 --- a/src/fx/fx.shr.lr2.a +++ b/src/fx/fx.shr.lr2.a @@ -30,7 +30,7 @@ loop3 lda shrlo-1, x dst sta $0000, y ; SMC dex bne loop3 - lda $C000 + lda KBD bmi @exit iny iny diff --git a/src/fx/fx.shr.radial.a b/src/fx/fx.shr.radial.a index 080cab1..510bebb 100644 --- a/src/fx/fx.shr.radial.a +++ b/src/fx/fx.shr.radial.a @@ -10,17 +10,16 @@ shrlo = $200 ; $C8 bytes shrhi = $300 ; $C8 bytes coords = $9F00 ; $1F41 bytes last_coords = coords+$1F3E -CoordinatesFileCopy = $BE42; $11 bytes -mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction +shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction !source "src/fx/macros.a" - +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols jmp stage2 !pseudopc *-$300 { stage2 - +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy + +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile ;WRITEMAINMEM active lda #$80 @@ -29,6 +28,9 @@ stage2 +SHR_STAGE_2 startzp, endzp rts +CoordinatesFile + +PSTRING "SHR.RADIAL.DATA" + startzp !pseudopc 0 { ; bottom-left quadrant (opposite row, original column, reverse input order) @@ -47,7 +49,7 @@ LoopBL ldx last_coords ; SMC plp bne LoopBL dec $200) { !serious "Stage2 code is too large" } } - -CoordinatesFile - !byte 18 - !text "FX/SHR.RADIAL.DATA" diff --git a/src/fx/fx.shr.radial.data.a b/src/fx/fx.shr.radial.data.a index ae7619b..3988d0e 100644 --- a/src/fx/fx.shr.radial.data.a +++ b/src/fx/fx.shr.radial.data.a @@ -1,5 +1,5 @@ !cpu 6502 -!to "build/FX/SHR.RADIAL.DATA",plain +!to "build/FXDATA/SHR.RADIAL.DATA",plain *=$9F00 !byte 98,0 !byte 98,1 diff --git a/src/fx/fx.shr.radial2.a b/src/fx/fx.shr.radial2.a index f192794..2f21216 100644 --- a/src/fx/fx.shr.radial2.a +++ b/src/fx/fx.shr.radial2.a @@ -10,17 +10,16 @@ shrlo = $200 ; $C8 bytes shrhi = $300 ; $C8 bytes coords = $9F00 ; $1F41 bytes last_coords = coords+$1F3E -CoordinatesFileCopy = $BE42; $11 bytes -mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction +shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction !source "src/fx/macros.a" - +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols jmp stage2 !pseudopc *-$300 { stage2 - +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy + +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile ;WRITEMAINMEM active lda #$80 @@ -29,6 +28,9 @@ stage2 +SHR_STAGE_2 startzp, endzp rts +CoordinatesFile + +PSTRING "SHR.RADIAL.DATA" + startzp !pseudopc 0 { ; top-left quadrant (original row, original column, original input order) @@ -42,7 +44,7 @@ input ldx coords ; SMC ; bottom-right quadrant (opposite row, opposite column, original input order) lda mirror_rows, x tax - lda mirror_cols, y + lda shr_mirror_cols, y tay jsr copy @@ -59,7 +61,7 @@ reverse_input ; top-right quadrant (original row, opposite column, reverse input order) lda mirror_rows, x ; mirror of the mirror tax - lda mirror_cols, y + lda shr_mirror_cols, y tay jsr copy @@ -74,7 +76,7 @@ reverse_input plp bne + dec $200) { !serious "Stage2 code is too large" } } - -CoordinatesFile - !byte 18 - !text "FX/SHR.RADIAL.DATA" diff --git a/src/fx/fx.shr.ripple.a b/src/fx/fx.shr.ripple.a index 06391ec..4524f2f 100644 --- a/src/fx/fx.shr.ripple.a +++ b/src/fx/fx.shr.ripple.a @@ -9,28 +9,27 @@ mirror_rows = $106 ; $C8 bytes shrlo = $200 ; $C8 bytes shrhi = $300 ; $C8 bytes coords = $9F00 ; $1F41 bytes -CoordinatesFileCopy = $BE42; $11 bytes -mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction +shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction !source "src/fx/macros.a" - +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols jmp stage2 !pseudopc *-$300 { stage2 - +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy + +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile +SHR_STAGE_2 startzp, endzp rts +CoordinatesFile + +PSTRING "SHR.RIPPLE.DATA" + startzp !pseudopc 0 { stage3 - +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols } endzp +!if (* - stage2 > $200) { !serious "Stage2 code is too large" } } - -CoordinatesFile - !byte 18 - !text "FX/SHR.RIPPLE.DATA" diff --git a/src/fx/fx.shr.ripple.data.a b/src/fx/fx.shr.ripple.data.a index 080a3e3..eec720e 100644 --- a/src/fx/fx.shr.ripple.data.a +++ b/src/fx/fx.shr.ripple.data.a @@ -1,5 +1,5 @@ !cpu 6502 -!to "build/FX/SHR.RIPPLE.DATA",plain +!to "build/FXDATA/SHR.RIPPLE.DATA",plain *=$9F00 !byte 98,79 !byte 40,60 diff --git a/src/fx/fx.shr.soft.iris.a b/src/fx/fx.shr.soft.iris.a index a5a35ea..bac869e 100644 --- a/src/fx/fx.shr.soft.iris.a +++ b/src/fx/fx.shr.soft.iris.a @@ -9,28 +9,27 @@ mirror_rows = $106 ; $C8 bytes shrlo = $200 ; $C8 bytes shrhi = $300 ; $C8 bytes coords = $9F00 ; $1F41 bytes -CoordinatesFileCopy = $BE42; $11 bytes -mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction +shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction !source "src/fx/macros.a" - +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols jmp stage2 !pseudopc *-$300 { stage2 - +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy + +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile +SHR_STAGE_2 startzp, endzp rts +CoordinatesFile + +PSTRING "SHR.SFIRIS.DATA" + startzp !pseudopc 0 { stage3 - +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols } endzp +!if (* - stage2 > $200) { !serious "Stage2 code is too large" } } - -CoordinatesFile - !byte 18 - !text "FX/SHR.SFIRIS.DATA" diff --git a/src/fx/fx.shr.soft.iris.data.a b/src/fx/fx.shr.soft.iris.data.a index a8e9f42..a27a6b2 100644 --- a/src/fx/fx.shr.soft.iris.data.a +++ b/src/fx/fx.shr.soft.iris.data.a @@ -1,5 +1,5 @@ !cpu 6502 -!to "build/FX/SHR.SFIRIS.DATA",plain +!to "build/FXDATA/SHR.SFIRIS.DATA",plain *=$9F00 !byte 98,79 !byte 98,78 diff --git a/src/fx/fx.shr.soft.iris.in.a b/src/fx/fx.shr.soft.iris.in.a index 1ce2d12..df56a3b 100644 --- a/src/fx/fx.shr.soft.iris.in.a +++ b/src/fx/fx.shr.soft.iris.in.a @@ -9,29 +9,28 @@ mirror_rows = $106 ; $C8 bytes shrlo = $200 ; $C8 bytes shrhi = $300 ; $C8 bytes coords = $9F00 ; $1F41 bytes -CoordinatesFileCopy = $BE42; $11 bytes -mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction +shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction !source "src/fx/macros.a" - +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols jmp stage2 !pseudopc *-$300 { stage2 - +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy + +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile +SHR_REVERSE coords +SHR_STAGE_2 startzp, endzp rts +CoordinatesFile + +PSTRING "SHR.SFIRIS.DATA" + startzp !pseudopc 0 { stage3 - +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols + +SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols } endzp +!if (* - stage2 > $200) { !serious "Stage2 code is too large" } } - -CoordinatesFile - !byte 18 - !text "FX/SHR.SFIRIS.DATA" diff --git a/src/fx/fx.shr.ud.a b/src/fx/fx.shr.ud.a index 3a8737d..33de90b 100644 --- a/src/fx/fx.shr.ud.a +++ b/src/fx/fx.shr.ud.a @@ -41,7 +41,7 @@ rdst sta $0000, y ; SMC iny cpy #$A0 bcc loop2 - lda $C000 + lda KBD bmi exit dex bne loop diff --git a/src/fx/macros.a b/src/fx/macros.a index eeb0746..a14e559 100644 --- a/src/fx/macros.a +++ b/src/fx/macros.a @@ -8,7 +8,6 @@ !source "src/fx/macros.dhgr.a" !source "src/fx/macros.shr.a" !source "src/fx/macros.copybit.a" - !source "src/fx/macros.dither.a" !source "src/fx/macros.misc.a" _FX_MACROS_=* diff --git a/src/fx/macros.dhgr.a b/src/fx/macros.dhgr.a index c3c2c81..373d06f 100644 --- a/src/fx/macros.dhgr.a +++ b/src/fx/macros.dhgr.a @@ -11,7 +11,7 @@ lda #$00 sta $FE tay - sta $C005 + sta WRITEAUXMEM - lda ($FE),y sta ($FE),y iny @@ -19,23 +19,7 @@ inc $FF dex bne - - sta $C004 -} - -!macro BUILD_MIRROR_COLS_DHGR .mirror_cols { - ; build lookup table to get $27-y for y in $00..$27 - ; duplicate in both mainmem and auxmem - ldx #$28 - ldy #$00 -- tya - sta .mirror_cols-1, x - sta $C005 - sta .mirror_cols-1, x - sta $C004 - iny - dex - bne - -; X=0 + sta WRITEMAINMEM } _FX_MACROS_DHGR_=* diff --git a/src/fx/macros.dither.a b/src/fx/macros.dither.a deleted file mode 100644 index affc80c..0000000 --- a/src/fx/macros.dither.a +++ /dev/null @@ -1,73 +0,0 @@ -;license:MIT -;(c) 2019-2022 by 4am -; - -!ifndef _FX_MACROS_DITHER_ { - -!macro BUILD_DITHER_MASKS .dithermasks { - ldy #40 -- lda #%10110011 - sta .dithermasks, y - lda #%11100110 - sta .dithermasks+1, y - lda #%11001100 - sta .dithermasks+2, y - lda #%10011001 - sta .dithermasks+3, y - dey - dey - dey - dey - bpl - - ldy #39 - lda #$FF -- sta .dithermasks+44, y - dey - bpl - -} - -!macro BUILD_DITHER_MASKS_DHGR .dithermasks { - ldy #40 -- lda #%10011110 - sta .dithermasks, y - lda #%11111000 - sta .dithermasks+1, y - lda #%11100001 - sta .dithermasks+2, y - lda #%10000111 - sta .dithermasks+3, y - dey - dey - dey - dey - bpl - - ldy #39 -- lda #$FF - sta .dithermasks+44, y - dey - bpl - - sta $C005 - ldy #40 -- lda #%10001111 - sta .dithermasks, y - lda #%10111100 - sta .dithermasks+1, y - lda #%11110000 - sta .dithermasks+2, y - lda #%11000011 - sta .dithermasks+3, y - dey - dey - dey - dey - bpl - - ldy #39 -- lda #$FF - sta .dithermasks+44, y - dey - bne - - sta $C004 -} - -_FX_MACROS_DITHER_=* -} diff --git a/src/fx/macros.hgr.a b/src/fx/macros.hgr.a index bfe4e7a..10eabd0 100644 --- a/src/fx/macros.hgr.a +++ b/src/fx/macros.hgr.a @@ -4,80 +4,6 @@ !ifndef _FX_MACROS_HGR_ { -; .hgrlo, .hgr1hi will each be filled with $C0 bytes -; based on routine by John Brooks -; posted on comp.sys.apple2 on 2018-07-11 -; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ -!macro BUILD_HGR_LOOKUP_TABLES .hgrlo, .hgr1hi { -; preserves Y - ldx #0 - +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 .hgrlo, .hgr1hi -} - -; use this macro instead if you know X is already 0 on entry, to save 2 bytes -!macro BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 .hgrlo, .hgr1hi { -; preserves Y -- txa - and #$F8 - bpl + - ora #5 -+ asl - bpl + - ora #5 -+ asl - asl - sta .hgrlo,x - txa - and #7 - rol - asl .hgrlo,x - rol - ora #$20 - sta .hgr1hi,x - inx - cpx #$C0 - bne - -} - -; .hgrlomirror, .hgr1himirror will each be filled with $C0 bytes -!macro BUILD_HGR_MIRROR_LOOKUP_TABLES .hgrlomirror, .hgr1himirror { - ldx #$C0 - ldy #0 -- tya - and #$F8 - bpl + - ora #5 -+ asl - bpl + - ora #5 -+ asl - asl - sta .hgrlomirror-1,x - tya - and #7 - rol - asl .hgrlomirror-1,x - rol - ora #$20 - sta .hgr1himirror-1,x - iny - dex - bne - -} - -!macro BUILD_MIRROR_COLS .mirror_cols { -; in: none -; out: .mirror_cols populated with lookup table to get $27-y for y in $00..$27 -; all registers and flags clobbered - ldx #$27 - ldy #$00 -- tya - sta .mirror_cols, x - iny - dex - bpl - -} - !macro HGR_CALC { ; in: A = HGR row (0x00..0xBF) ; out: A/X clobbered @@ -141,38 +67,81 @@ sta CopyMaskAddr+1 } -!macro ROW_X_TO_BASE_ADDRESSES { +!macro ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2 { lda hgrlo, x - sta .coords + jsr iLoadFXDATA } !macro SHR_STAGE_1 .shrlo, .shrhi, .mirror_rows, .mirror_cols { @@ -168,7 +161,7 @@ input ldx .coords ; first value: SHR row (only 0..99 will be inc $1C0 { !error "code is too large, ends at ", * -} \ No newline at end of file +} diff --git a/src/prelaunch/champ.wrestle.a b/src/prelaunch/champ.wrestle.a index 391d616..bb4f9a4 100644 --- a/src/prelaunch/champ.wrestle.a +++ b/src/prelaunch/champ.wrestle.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/CHAMP.WRESTLE",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL diff --git a/src/prelaunch/checkers.a b/src/prelaunch/checkers.a index c9b0636..aeb59d5 100644 --- a/src/prelaunch/checkers.a +++ b/src/prelaunch/checkers.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/CHECKERS",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/chuck.yeager.a b/src/prelaunch/chuck.yeager.a index 8e5adf1..5621b6a 100644 --- a/src/prelaunch/chuck.yeager.a +++ b/src/prelaunch/chuck.yeager.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/CHUCK.YEAGER",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/common.a b/src/prelaunch/common.a deleted file mode 100644 index d4b4233..0000000 --- a/src/prelaunch/common.a +++ /dev/null @@ -1,36 +0,0 @@ -;license:MIT -;(c) 2019 by 4am -; -; common code used by all prelaunchers -; -; you should include this file with a '!source' directive, not assemble it directly - - !source "src/constants.a" ; no code in these - !source "src/macros.a" - - ldx #0 ; wipe zero page - txa -- sta $00,x - inx - bne - - - lda #$65 ; Initialize 'random' seed. These are - sta RNDSEED ; arbitrary values. Some games like Pooyan - lda #$02 ; require these to be non-zero. Ask me - sta RNDSEED+1 ; how long that one took to debug. - - +READ_ROM_NO_WRITE - - jsr ROM_IN0 ; Initialize machine like a cold boot. - jsr ROM_PR0 ; Many games assume a 'clean slate' and - jsr ROM_NORMAL ; rely on zero page values set by these - sta STOREOFF ; ROM routines, - sta READMAINMEM ; e.g. Wavy Navy just prints out text via - sta WRITEMAINMEM ; $FDED and expects it to work. Having it - sta CLR80VID ; print all null characters is amusing, in - sta PRIMARYCHARSET ; a quiet way, but not really helpful. - jsr ROM_TEXT - jsr ROM_HOME - - bit CLEARKBD - sei diff --git a/src/prelaunch/computer.foosball.a b/src/prelaunch/computer.foosball.a index 62e410d..de29128 100644 --- a/src/prelaunch/computer.foosball.a +++ b/src/prelaunch/computer.foosball.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/CMPTR.FOOSBALL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/dive.bomber.a b/src/prelaunch/dive.bomber.a index 75efb6d..3b140df 100644 --- a/src/prelaunch/dive.bomber.a +++ b/src/prelaunch/dive.bomber.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/DIVE.BOMBER",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/draw.poker.a b/src/prelaunch/draw.poker.a index 88950d3..9e504a4 100644 --- a/src/prelaunch/draw.poker.a +++ b/src/prelaunch/draw.poker.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/DRAW.POKER",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/family.feud.a b/src/prelaunch/family.feud.a index 4ad5aed..8b3db3d 100644 --- a/src/prelaunch/family.feud.a +++ b/src/prelaunch/family.feud.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/FAMILY.FEUD",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL diff --git a/src/prelaunch/fight.night.a b/src/prelaunch/fight.night.a index 18c5518..cec0ffc 100644 --- a/src/prelaunch/fight.night.a +++ b/src/prelaunch/fight.night.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/FIGHT.NIGHT",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/formula.1.racer.a b/src/prelaunch/formula.1.racer.a index 0d09b7a..920a141 100755 --- a/src/prelaunch/formula.1.racer.a +++ b/src/prelaunch/formula.1.racer.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/FORMULA.1.RACER",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/fox.and.geese.a b/src/prelaunch/fox.and.geese.a index 1fe03ff..646b14f 100644 --- a/src/prelaunch/fox.and.geese.a +++ b/src/prelaunch/fox.and.geese.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/FOX.AND.GEESE",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/fs2.a b/src/prelaunch/fs2.a index 640ff0d..a72fb83 100755 --- a/src/prelaunch/fs2.a +++ b/src/prelaunch/fs2.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/FS2",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" ;+ENABLE_ACCEL ; can't diff --git a/src/prelaunch/gfl.football.a b/src/prelaunch/gfl.football.a index 883dcea..d8c9149 100644 --- a/src/prelaunch/gfl.football.a +++ b/src/prelaunch/gfl.football.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/GFL.FOOTBALL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL diff --git a/src/prelaunch/go.a b/src/prelaunch/go.a index 749a0bd..41c5d00 100644 --- a/src/prelaunch/go.a +++ b/src/prelaunch/go.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/GO",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/go.four.it.a b/src/prelaunch/go.four.it.a index 71861b3..d6ab34a 100644 --- a/src/prelaunch/go.four.it.a +++ b/src/prelaunch/go.four.it.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/GO.FOUR.IT",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/hardball.a b/src/prelaunch/hardball.a index a5cdf96..c107dd7 100644 --- a/src/prelaunch/hardball.a +++ b/src/prelaunch/hardball.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/HARDBALL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/hires.football.a b/src/prelaunch/hires.football.a index 91e34d4..92ada6e 100644 --- a/src/prelaunch/hires.football.a +++ b/src/prelaunch/hires.football.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/HIRES.FOOTBALL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/hires.soccer.a b/src/prelaunch/hires.soccer.a index 85265fa..a2dc876 100644 --- a/src/prelaunch/hires.soccer.a +++ b/src/prelaunch/hires.soccer.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/HIRES.SOCCER",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/intl.gran.prix.a b/src/prelaunch/intl.gran.prix.a index b69d910..17f54b9 100755 --- a/src/prelaunch/intl.gran.prix.a +++ b/src/prelaunch/intl.gran.prix.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/INTL.GRAN.PRIX",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" lda #$60 ; RTS instead of JMP sta $201A diff --git a/src/prelaunch/jump.pit.a b/src/prelaunch/jump.pit.a index b1c247f..15787f2 100644 --- a/src/prelaunch/jump.pit.a +++ b/src/prelaunch/jump.pit.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/JUMP.PIT",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/kono.a b/src/prelaunch/kono.a index 1a6d345..8145606 100644 --- a/src/prelaunch/kono.a +++ b/src/prelaunch/kono.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/KONO",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/magnet.madness.a b/src/prelaunch/magnet.madness.a index 0c5d6b0..1faf07a 100644 --- a/src/prelaunch/magnet.madness.a +++ b/src/prelaunch/magnet.madness.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/MAGNET.MADNESS",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/microchess.a b/src/prelaunch/microchess.a index 4508303..9105771 100644 --- a/src/prelaunch/microchess.a +++ b/src/prelaunch/microchess.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/MICROCHESS",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/microgolf.a b/src/prelaunch/microgolf.a index 372bc40..0a93b39 100644 --- a/src/prelaunch/microgolf.a +++ b/src/prelaunch/microgolf.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/MICROGOLF",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/mix.matcher.a b/src/prelaunch/mix.matcher.a index e6c5dbf..8e27d7c 100644 --- a/src/prelaunch/mix.matcher.a +++ b/src/prelaunch/mix.matcher.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/MIX.MATCHER",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/mpl.a b/src/prelaunch/mpl.a index 72fe2cf..f2015de 100644 --- a/src/prelaunch/mpl.a +++ b/src/prelaunch/mpl.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/MPL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/mpt.a b/src/prelaunch/mpt.a index eccb9d1..3318242 100644 --- a/src/prelaunch/mpt.a +++ b/src/prelaunch/mpt.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/MPT",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/mu.torere.a b/src/prelaunch/mu.torere.a index 6586759..15c8850 100644 --- a/src/prelaunch/mu.torere.a +++ b/src/prelaunch/mu.torere.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/MU.TORERE",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/nimwit.a b/src/prelaunch/nimwit.a index f149cbb..64f91fa 100644 --- a/src/prelaunch/nimwit.a +++ b/src/prelaunch/nimwit.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/NIMWIT",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/nine.mens.a b/src/prelaunch/nine.mens.a index 321d133..9b1a311 100644 --- a/src/prelaunch/nine.mens.a +++ b/src/prelaunch/nine.mens.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/NINE.MENS",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/odin.a b/src/prelaunch/odin.a index 8475147..82402e1 100644 --- a/src/prelaunch/odin.a +++ b/src/prelaunch/odin.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/ODIN",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/one.on.one.a b/src/prelaunch/one.on.one.a index 7d965ca..71d20b2 100644 --- a/src/prelaunch/one.on.one.a +++ b/src/prelaunch/one.on.one.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/ONE.ON.ONE",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +READ_RAM2_WRITE_RAM2 jsr EnableAccelerator diff --git a/src/prelaunch/pay.day.a b/src/prelaunch/pay.day.a index f3b3db6..3d4edb2 100644 --- a/src/prelaunch/pay.day.a +++ b/src/prelaunch/pay.day.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/PAY.DAY",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/pensate.a b/src/prelaunch/pensate.a index 6f59579..d2201a2 100644 --- a/src/prelaunch/pensate.a +++ b/src/prelaunch/pensate.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/PENSATE",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/pitstop.ii.a b/src/prelaunch/pitstop.ii.a index 4b0ee6b..7d2e976 100644 --- a/src/prelaunch/pitstop.ii.a +++ b/src/prelaunch/pitstop.ii.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/PITSTOP.II",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" lda #$60 sta $4055 diff --git a/src/prelaunch/place.ball.a b/src/prelaunch/place.ball.a index bb01289..a2f820c 100644 --- a/src/prelaunch/place.ball.a +++ b/src/prelaunch/place.ball.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/PLACE.BALL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/pool.a b/src/prelaunch/pool.a index 9247223..70c4eb5 100644 --- a/src/prelaunch/pool.a +++ b/src/prelaunch/pool.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/POOL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/reversi.a b/src/prelaunch/reversi.a index 71d76df..c513cbf 100644 --- a/src/prelaunch/reversi.a +++ b/src/prelaunch/reversi.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/REVERSI",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/rock.n.scroll.a b/src/prelaunch/rock.n.scroll.a index 8d5a436..e357198 100644 --- a/src/prelaunch/rock.n.scroll.a +++ b/src/prelaunch/rock.n.scroll.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/ROCK.N.SCROLL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/seega.a b/src/prelaunch/seega.a index 40dc837..57fd203 100644 --- a/src/prelaunch/seega.a +++ b/src/prelaunch/seega.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/SEEGA",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/shuffleboard.a b/src/prelaunch/shuffleboard.a index 543f2ec..4cce595 100755 --- a/src/prelaunch/shuffleboard.a +++ b/src/prelaunch/shuffleboard.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SHUFFLEBOARD",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/ski.crazed.a b/src/prelaunch/ski.crazed.a index 1a66cf1..98deeb9 100644 --- a/src/prelaunch/ski.crazed.a +++ b/src/prelaunch/ski.crazed.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SKI.CRAZED",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" lda #$60 sta $A23 diff --git a/src/prelaunch/slicks.a b/src/prelaunch/slicks.a index 63b9063..9833df2 100644 --- a/src/prelaunch/slicks.a +++ b/src/prelaunch/slicks.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SLICKS",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL inc $3F4 ; force reboot diff --git a/src/prelaunch/spdway.classic.a b/src/prelaunch/spdway.classic.a index c3e1394..e5ce99a 100755 --- a/src/prelaunch/spdway.classic.a +++ b/src/prelaunch/spdway.classic.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SPDWAY.CLASSIC",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 ; hook diff --git a/src/prelaunch/ss.baseball.a b/src/prelaunch/ss.baseball.a index 599417b..2da479a 100755 --- a/src/prelaunch/ss.baseball.a +++ b/src/prelaunch/ss.baseball.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SS.BASEBALL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/ss.basketball.a b/src/prelaunch/ss.basketball.a index c8e94bb..623b036 100755 --- a/src/prelaunch/ss.basketball.a +++ b/src/prelaunch/ss.basketball.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SS.BASKETBALL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/standard.a b/src/prelaunch/standard.a index 505881f..a0db449 100644 --- a/src/prelaunch/standard.a +++ b/src/prelaunch/standard.a @@ -7,15 +7,7 @@ !source "src/constants.a" - lda ldrhi2 ; set up game entry point in stack page - pha - lda ldrlo2 ; last ProRWTS load address - pha - - !source "src/prelaunch/common.a" - - php - rti ; Jump to game entry point via stack pop. + jmp (ldrlo2) ; last ProRWTS load address !if * > $1C0 { !error "code is too large, ends at ", * diff --git a/src/prelaunch/stunt.car.racer.a b/src/prelaunch/stunt.car.racer.a index 1c0e170..75ae321 100644 --- a/src/prelaunch/stunt.car.racer.a +++ b/src/prelaunch/stunt.car.racer.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/STUNT.CAR.RACER",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/sudoku.a b/src/prelaunch/sudoku.a index 621b974..3042ce8 100644 --- a/src/prelaunch/sudoku.a +++ b/src/prelaunch/sudoku.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SUDOKU",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/summer.games.a b/src/prelaunch/summer.games.a index aa8b301..0519c46 100755 --- a/src/prelaunch/summer.games.a +++ b/src/prelaunch/summer.games.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SUMMER.GAMES",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/summer.games.ii.a b/src/prelaunch/summer.games.ii.a index 9aad1c4..7464e86 100755 --- a/src/prelaunch/summer.games.ii.a +++ b/src/prelaunch/summer.games.ii.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SUMMER.GAMES.II",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" ;+ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/super.huey.a b/src/prelaunch/super.huey.a index b9221b3..cd337b7 100644 --- a/src/prelaunch/super.huey.a +++ b/src/prelaunch/super.huey.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SUPER.HUEY",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +READ_RAM2_WRITE_RAM2 jsr EnableAccelerator diff --git a/src/prelaunch/super.icehockey.a b/src/prelaunch/super.icehockey.a index 6b7be3d..21adb89 100644 --- a/src/prelaunch/super.icehockey.a +++ b/src/prelaunch/super.icehockey.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/SUPER.ICEHOCKEY",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL diff --git a/src/prelaunch/tag.team.a b/src/prelaunch/tag.team.a index 38c5f13..3833a96 100755 --- a/src/prelaunch/tag.team.a +++ b/src/prelaunch/tag.team.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/TAG.TEAM",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/test.drive.a b/src/prelaunch/test.drive.a index b0094d7..4ff3602 100644 --- a/src/prelaunch/test.drive.a +++ b/src/prelaunch/test.drive.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/TEST.DRIVE",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" inc $3F4 ; force reboot +READ_RAM2_NO_WRITE diff --git a/src/prelaunch/the.dam.busters.a b/src/prelaunch/the.dam.busters.a index 3e3b86f..c3abbf0 100644 --- a/src/prelaunch/the.dam.busters.a +++ b/src/prelaunch/the.dam.busters.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/THE.DAM.BUSTERS",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/tomahawk.a b/src/prelaunch/tomahawk.a index 6d914a2..cb42a96 100755 --- a/src/prelaunch/tomahawk.a +++ b/src/prelaunch/tomahawk.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/TOMAHAWK",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL +READ_RAM2_WRITE_RAM2 diff --git a/src/prelaunch/tsn.baseball.a b/src/prelaunch/tsn.baseball.a index dde1873..985204b 100644 --- a/src/prelaunch/tsn.baseball.a +++ b/src/prelaunch/tsn.baseball.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/TSN.BASEBALL",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/ultracheckers.a b/src/prelaunch/ultracheckers.a index 5e2b7b6..b67179f 100644 --- a/src/prelaunch/ultracheckers.a +++ b/src/prelaunch/ultracheckers.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/ULTRACHECKERS",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/wari.a b/src/prelaunch/wari.a index 80ad07b..ed6a713 100644 --- a/src/prelaunch/wari.a +++ b/src/prelaunch/wari.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/WARI",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/winter.games.a b/src/prelaunch/winter.games.a index 11969eb..42b1d50 100755 --- a/src/prelaunch/winter.games.a +++ b/src/prelaunch/winter.games.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/WINTER.GAMES",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/wipeout.a b/src/prelaunch/wipeout.a index afe20e7..64f689a 100644 --- a/src/prelaunch/wipeout.a +++ b/src/prelaunch/wipeout.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/WIPEOUT",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/prelaunch/world.games.a b/src/prelaunch/world.games.a index 3df3905..146f824 100644 --- a/src/prelaunch/world.games.a +++ b/src/prelaunch/world.games.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/WORLD.GAMES",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +READ_RAM2_NO_WRITE jsr EnableAccelerator diff --git a/src/prelaunch/world.karate.a b/src/prelaunch/world.karate.a index 1f533e1..4e6ca9f 100644 --- a/src/prelaunch/world.karate.a +++ b/src/prelaunch/world.karate.a @@ -5,7 +5,7 @@ !to "build/PRELAUNCH.INDEXED/WORLD.KARATE",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$60 diff --git a/src/prelaunch/zzfs.a b/src/prelaunch/zzfs.a index 857b44b..32456c5 100644 --- a/src/prelaunch/zzfs.a +++ b/src/prelaunch/zzfs.a @@ -4,7 +4,7 @@ !to "build/PRELAUNCH.INDEXED/ZZFS",plain *=$106 - !source "src/prelaunch/common.a" + !source "src/macros.a" +ENABLE_ACCEL lda #$4C diff --git a/src/proboothd/proboothd.a b/src/proboothd/proboothd.a index e3202f7..7a00fdb 100644 --- a/src/proboothd/proboothd.a +++ b/src/proboothd/proboothd.a @@ -353,17 +353,10 @@ put_pixel: } copy_seasons_e -filename - !byte filename_e - filename_b -filename_b - !text "LAUNCHER.SYSTEM" ;your start-up file, file is max 40kb -filename_e +filename +PSTRING "LAUNCHER.SYSTEM" !src "src/4cade.branding.a" -!if (* > $9f7) { +!if (* > $9ff) { !serious "Bootloader is too large" } - -*=$9f8 -!byte $D3,$C1,$CE,$A0,$C9,$CE,$C3,$AE diff --git a/src/prodos.path.a b/src/prodos.path.a index 12d72cb..4cb92be 100644 --- a/src/prodos.path.a +++ b/src/prodos.path.a @@ -88,6 +88,12 @@ kDFXIndexRecord kSFXIndexRecord !source "src/index/sfx.idx.a" +kFXCodeIndexRecord + !source "src/index/fxcode.idx.a" + +kFXDataIndexRecord + !source "src/index/fxdata.idx.a" + kGameHelpIndexRecord !source "src/index/gamehelp.idx.a" @@ -156,25 +162,20 @@ kXSingleRecord !source "src/index/xsingle.idx.a" kTotalDataFile - !byte 10 - !raw "TOTAL.DATA" + +PSTRING "TOTAL.DATA" kAnimatedTitleDirectory - !byte 15 - !raw "TITLE.ANIMATED/" + +PSTRING "TITLE.ANIMATED/" kGameDirectory - !byte 2 - !raw "X/" + +PSTRING "X/" kGameDirectoryLen = 3 ; we need this elsewhere kFXDirectory - !byte 3 - !raw "FX/" + +PSTRING "FX/" kGlobalPrefsFilename - !byte 10 - !raw "PREFS.CONF" + +PSTRING "PREFS.CONF" kStandardPrelaunchRecord !source "src/index/standard.prelaunch.a" @@ -182,12 +183,8 @@ kStandardPrelaunchRecord kCoverFadeRecord !source "src/index/coverfade.idx.a" -kGRFizzleRecord - !source "src/index/gr.fizzle.idx.a" - -kDGRFizzleRecord - !source "src/index/dgr.fizzle.idx.a" - +; following three records must end up on the same page +; after relocation to LC RAM kHelpBackgroundRecord !source "src/index/res.help.idx.a" @@ -196,3 +193,13 @@ kTitleRecord kCoverRecord !source "src/index/res.cover.idx.a" + +!if (RELBASE != $2000) and (>kCoverRecord != >kHelpBackgroundRecord) { + !serious "cover records are not all on the same page: ", kHelpBackgroundRecord, ", ", kTitleRecord, ", ", kCoverRecord +} + +kGRFizzleRecord + !source "src/index/gr.fizzle.idx.a" + +kDGRFizzleRecord + !source "src/index/dgr.fizzle.idx.a" diff --git a/src/ui.animation.a b/src/ui.animation.a index 071c960..3d509df 100644 --- a/src/ui.animation.a +++ b/src/ui.animation.a @@ -41,8 +41,15 @@ MaybeAnimateTitle ; file -- this area part of a 'screen ; hole' and is not displayed on screen) bne @exit ; if not, we're done here + iny + lda (DEST), y + sta @titleAnimJmp + iny + lda (DEST), y + sta @titleAnimJmp+1 txa jsr CopyHGR + jsr HGRMode ; load the animation routine, which is stored in a subdirectory by filename jsr GetGameToLaunch @@ -58,8 +65,10 @@ MaybeAnimateTitle dex bpl - - bit $c050 ; turn on graphics mode (Home set text mode) + lda #OnBrowseSearch !byte >OnBrowsePrevious @@ -158,8 +171,9 @@ BrowseDispatchTableHi !byte >Joystick !byte >OnQuit !byte >AllSHRSlideshow + !byte >OnBrowseRandom -kNumBrowseKeys = 15 +kNumBrowseKeys = 16 ; number of entries in next 2 tables (each) BrowseKeys !byte $80 ; Ctrl-@ = SHR-only slideshow @@ -177,6 +191,7 @@ BrowseKeys !byte $8A ; down arrow = next !byte $88 ; left arrow = previous !byte $95 ; right arrow = next + !byte $AA ; '*' = select random BrowseKeyDispatch !byte kBrowseSHR !byte kBrowseCheat @@ -193,6 +208,61 @@ BrowseKeyDispatch !byte kBrowseNext !byte kBrowsePrevious !byte kBrowseNext + !byte kBrowseRandom -GameCount - !word 0 +;------------------------------------------------------------------------------ +; n_mod_m +; Calculate remainder of dividing two 16-bit numbers (often written in modern +; programming languages as 'n % m') +; +; in: stack contains 4 bytes of parameters: +; +1 [word] n +; +3 [word] m +; out: 16-bit value returned in X (lo) and A (high) +; clobbers Y +; clobbers zp$00..$05 +;------------------------------------------------------------------------------ +;out: X (low), A (high) +;trashes Y, and $0-5 +n_mod_m + pla + tay + pla + tax + iny + bne + + inx ++ sty $0 + stx $1 + ldy #3 + clc + tya + adc $0 + sta $2 + bcc + + inx ++ txa + pha + lda $2 + pha +- lda ($0),y + sta $2,y + dey + bpl - + sec +- lda $2 + sbc $4 + tax + lda $3 + sbc $5 + bcc + + stx $2 + sta $3 + bcs - ; always branches ++ tay + txa + adc $4 + tax + tya + adc $5 + rts diff --git a/src/ui.common.a b/src/ui.common.a index d9cae21..58f8d3e 100755 --- a/src/ui.common.a +++ b/src/ui.common.a @@ -8,7 +8,7 @@ ; - BlankDHGR ; - DHGRMode ; - IsSearchKey -; - IsUpDownOrRightArrow +; - IsKeyThatSwitchesToBrowseMode ; ;------------------------------------------------------------------------------ @@ -137,19 +137,21 @@ IsSearchKey rts ;------------------------------------------------------------------------------ -; IsUpDownOrRightArrow -; test whether accumulator contains ASCII code for up, down, or right arrow -; search +; IsKeyThatSwitchesToBrowseMode +; test whether accumulator contains ASCII code for up, down, or right arrow, +; or asterisk ; ; in: A = key ; out: all registers preserved -; Z = 1 if accumulator was one of those 3 keys +; Z = 1 if accumulator was one of those keys ; Z = 0 otherwise ;------------------------------------------------------------------------------ -IsUpDownOrRightArrow +IsKeyThatSwitchesToBrowseMode cmp #$8B ; up arrow beq @done cmp #$95 ; right arrow beq @done cmp #$8A ; down arrow + beq @done + cmp #$AA ; '*' @done rts diff --git a/src/ui.search.mode.a b/src/ui.search.mode.a index c6f5c17..4a0dbe5 100644 --- a/src/ui.search.mode.a +++ b/src/ui.search.mode.a @@ -132,12 +132,11 @@ SearchMode .SearchModeInputLoop jsr WaitForKeyFor30Seconds - ; Don't clear keyboard strobe yet. If the user pressed an arrow key, - ; we want to switch to Browse Mode with the keyboard still hot so - ; that mode finds and dispatches the arrow key. + ; Don't clear keyboard strobe yet. Certain keys switch to Browse Mode + ; with the keyboard still hot so that mode dispatches it ldx #kInputBrowse - jsr IsUpDownOrRightArrow + jsr IsKeyThatSwitchesToBrowseMode beq .InputDispatch bit CLEARKBD diff --git a/src/wait.a b/src/wait.a deleted file mode 100644 index 594834e..0000000 --- a/src/wait.a +++ /dev/null @@ -1,21 +0,0 @@ -;license:MIT -;(c) 2018-9 by 4am -; - -; This file is included from multiple assembly targets, -; so it should only have 1 function. - -WaitForKeyWithTimeout -; in: A = timeout length (like standard $FCA8 wait routine) -; out: A clobbered -; X/Y preserved - sec -@wait1 pha -@wait2 sbc #1 - bne @wait2 - pla - bit $C000 - bmi @exit - sbc #1 - bne @wait1 -@exit rts diff --git a/winmake.bat b/winmake.bat index cc2baec..a8730a9 100644 --- a/winmake.bat +++ b/winmake.bat @@ -1,363 +1,366 @@ -@echo off -rem -rem 4cade Makefile for Windows -rem assembles source code, optionally builds a disk image -rem note: non-Windows users should probably use Makefile instead -rem -rem a qkumba monstrosity from 2018-10-29 -rem - -setlocal enabledelayedexpansion -set DISK=4sports.hdv -set VOLUME=INSTANT.REPLAY - -rem third-party tools required to build (must be in path) - -rem https://sourceforge.net/projects/acme-crossass/ -rem version 0.96.3 or later -set ACME=acme - -rem https://github.com/mach-kernel/cadius -rem version 1.4.6 or later -set CADIUS=cadius - -rem https://github.com/ -set GIT=git - -rem https://bitbucket.org/magli143/exomizer/wiki/Home -rem version 3.1.0 or later -set EXOMIZER=exomizer mem -q -P23 -lnone - -if "%1" equ "dsk" ( -call :clean -call :index -if "%2". equ "". ( - call :asmproboot - call :asmlauncher - 1>nul copy /y res\blank.hdv "build\%DISK%" >>build\log - 1>nul copy /y res\_FileInformation.txt build\ >>build\log - %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\LAUNCHER.SYSTEM" -C >>build\log - 1>nul copy /y "res\PREFS.CONF" "build" >>build\log - cscript /nologo bin\padto.js 512 build\PREFS.CONF - rem - rem create _FileInformation.txt files for subdirectories - rem - cscript /nologo bin\buildfileinfo.js res\ICONS "CA" "0000" >>build/log - cscript /nologo bin\buildfileinfo.js build\FX "06" "6000" >>build/log - 1>nul copy /y src\prelaunch\_FileInformation.txt build\PRELAUNCH >>build/log - rem - rem add everything to the disk - rem -) -echo|set/p="adding files..." -%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\TOTAL.DATA" -C >>build\log -if "%2". equ "". ( - for %%q in (build\PREFS.CONF res\Finder.Data res\Finder.Root) do %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\%%~nxq" -C >>build\log - for %%q in (res\TITLE.ANIMATED res\ICONS build\FX build\PRELAUNCH) do ( - 1>nul 2>nul del /s "%%q\.DS_Store" - %CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/%%~nxq" %%q -C >>build\log - ) - %CADIUS% CREATEFOLDER "build\%DISK%" "/%VOLUME%/X/" -C >>build\log - %CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/X" "build\X" -C >>build\log - cscript /nologo bin\changebootloader.js "build\%DISK%" build\proboothd -) -echo done -goto :EOF -) - -if "%1" equ "index" ( -call index -goto :EOF -) - -if "%1" equ "clean" ( -if "%2". neq "". ( -1>nul move build\%DISK% -) -:clean -echo y|1>nul 2>nul rd build /s -if "%2". neq "". ( -md build -1>nul move %DISK% build\%DISK% -%CADIUS% DELETEFILE "build\%DISK%" "/%VOLUME%/TOTAL.DATA" >>build\log -) -goto :EOF -) - -if "%1" equ "compress" ( -call :compress -goto :EOF -) - -echo usage: %0 clean / dsk -goto :EOF - -:index -call :md -call :asmfx -call :asmprelaunch -call :asmdemo -rem -rem precompute binary data structure for mega-attract mode configuration file -rem -cscript /nologo bin\buildokvs.js res\ATTRACT.CONF build\ATTRACT.IDX >>build\log -rem -rem precompute binary data structure and substitute special characters -rem in game help and other all-text pages -rem -cscript /nologo bin\converthelp.js res\HELPTEXT build\HELPTEXT >>build\log -cscript /nologo bin\converthelp.js res\CREDITS build\CREDITS >>build\log -echo|set/p="converting gamehelp..." -for %%q in (res\GAMEHELP\*) do cscript /nologo bin\converthelp.js %%q build\GAMEHELP\%%~nxq >>build\log -echo done -rem -rem create a list of all game filenames, without metadata or display names, sorted by game filename -rem -cscript /nologo bin\makesorted.js -cscript /nologo bin\builddisplaynames.js -rem -rem precompute indexed files for prelaunch -rem note: prelaunch must be first in TOTAL.DATA due to a hack in LoadStandardPrelaunch -rem note 2: these can not be padded because they are loaded at $0106 and padding would clobber the stack -rem -echo|set/p="indexing prelaunch..." -1>nul copy /y nul build\TOTAL.DATA -cscript /nologo bin\buildpre.js build\PRELAUNCH.INDEXED build\PRELAUNCH.IDX build\TOTAL.DATA >>build\log -echo done -rem -rem precompute indexed files for HGR & DHGR titles -rem note: these are not padded because they are all an exact block-multiple anyway -rem -echo|set/p="indexing titles..." -cscript /nologo bin\padto.js 512 build\TOTAL.DATA -cscript /nologo bin\buildss.js res\TITLE.HGR build\TITLE.IDX build\HGR.TITLES.LOG build\TOTAL.DATA build\TOTAL.DATA >>build\log -cscript /nologo bin\buildss.js res\TITLE.DHGR build\DTITLE.IDX build\DHGR.TITLES.LOG build\TOTAL.DATA build\TOTAL.DATA >>build\log -cscript /nologo bin\addfile.js res\COVER src\index\res.cover.idx.a -cscript /nologo bin\addfile.js res\TITLE src\index\res.title.idx.a -cscript /nologo bin\addfile.js res\HELP src\index\res.help.idx.a -echo done -rem -rem precompute indexed files for game help -rem note: these can be padded because they're loaded into $800 at a time when $800..$1FFF is clobber-able -rem -echo|set/p="indexing gamehelp..." -cscript /nologo bin\makesorted.js -cscript /nologo bin\buildpre.js build\GAMEHELP build\GAMEHELP.IDX build\TOTAL.DATA pad >>build\log -echo done -rem -rem precompute indexed files for slideshows -rem note: these can be padded because they're loaded into $800 at a time when $800..$1FFF is clobber-able -rem -echo|set/p="indexing slideshows..." -for %%q in (res\SS\*) do ( - set _ss=%%~nxq - set _ss=!_ss:~0,3! - if !_ss!==ACT ( - cscript /nologo bin\buildslideshow.js %%q build\SS\%%~nxq -d >>build\log - ) else ( - cscript /nologo bin\buildslideshow.js %%q build\SS\%%~nxq >>build\log - ) -) -cscript /nologo bin\buildss.js build\SS build\SLIDESHOW.IDX nul build\TOTAL.DATA nul pad >>build\log -for %%q in (A B C D E F G H I J K L M N O P) do for %%k in (res\ATTRACT\%%q*) do cscript /nologo bin\buildokvs.js %%k build\ATTRACT0\%%~nxk >>build\log -for %%q in (Q R S T U V W X Y Z) do for %%k in (res\ATTRACT\%%q*) do cscript /nologo bin\buildokvs.js %%k build\ATTRACT1\%%~nxk >>build\log -cscript /nologo bin\buildss.js build\ATTRACT0 build\MINIATTRACT0.IDX nul build\TOTAL.DATA nul pad >>build\log -cscript /nologo bin\buildss.js build\ATTRACT1 build\MINIATTRACT1.IDX nul build\TOTAL.DATA nul pad >>build\log -echo done -rem -rem precompute indexed files for graphic effects -rem note: these can be padded because they're loaded into $6000 at a time when $6000..$BEFF is clobber-able -rem -echo|set/p="indexing fx..." -cscript /nologo bin\buildfx.js res\FX.CONF build\FX.IDX build\TOTAL.DATA build\FX.INDEXED >>build\log -cscript /nologo bin\buildfx.js res\DFX.CONF build\DFX.IDX build\TOTAL.DATA build\FX.INDEXED >>build\log -cscript /nologo bin\buildfx.js res\SFX.CONF build\SFX.IDX build\TOTAL.DATA build\FX.INDEXED >>build\log -echo done -rem -rem precompute indexed files for HGR & DHGR action screenshots -rem note: these can not be padded because they are compressed and the decompressor needs the exact size -rem -echo|set/p="indexing (d)hgr action..." -1>nul copy /y nul build\ACTIONHGR0 -1>nul copy /y nul build\ACTIONHGR1 -1>nul copy /y nul build\ACTIONHGR2 -1>nul copy /y nul build\ACTIONHGR3 -1>nul copy /y nul build\ACTIONHGR4 -1>nul copy /y nul build\ACTIONHGR5 -1>nul copy /y nul build\ACTIONHGR6 -1>nul copy /y nul build\ACTIONDHGR -for %%q in (A B C D) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR0 echo %%k -for %%q in (E F G H) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR1 echo %%k -for %%q in (I J K L) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR2 echo %%k -for %%q in (M N O P) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR3 echo %%k -for %%q in (Q R S T) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR4 echo %%k -for %%q in (U V W X) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR5 echo %%k -for %%q in (Y Z) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR6 echo %%k -for %%q in (res\ACTION.DHGR\*) do 1>nul >>build\ACTIONDHGR echo %%q -cscript /nologo bin\buildss.js build\ACTIONHGR0* build\HGR0.IDX nul build\TOTAL.DATA nul >>build\log -cscript /nologo bin\buildss.js build\ACTIONHGR1* build\HGR1.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log -cscript /nologo bin\buildss.js build\ACTIONHGR2* build\HGR2.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log -cscript /nologo bin\buildss.js build\ACTIONHGR3* build\HGR3.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log -cscript /nologo bin\buildss.js build\ACTIONHGR4* build\HGR4.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log -cscript /nologo bin\buildss.js build\ACTIONHGR5* build\HGR5.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log -REM cscript /nologo bin\buildss.js build\ACTIONHGR6* build\HGR6.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log -cscript /nologo bin\buildss.js build\ACTIONDHGR* build\DHGR.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log -echo done -rem precompute indexed files for GR and DGR action screenshots -rem note: these can be padded because they are not compressed -rem -echo|set/p="indexing (d)gr action..." -1>nul copy /y nul build\ACTIONGR -1>nul copy /y nul build\ACTIONDGR -for %%q in (res\ACTION.GR\*) do 1>nul >>build\ACTIONGR echo %%q -for %%q in (res\ACTION.DGR\*) do 1>nul >>build\ACTIONDGR echo %%q -cscript /nologo bin\buildss.js build\ACTIONGR* build\GR.IDX nul build\TOTAL.DATA build\TOTAL.DATA pad >>build\log -REM cscript /nologo bin\buildss.js build\ACTIONDGR* build\DGR.IDX nul build\TOTAL.DATA build\TOTAL.DATA pad >>build\log -echo done -rem -rem precompute indexed files for SHR artwork -rem note: these can not be padded because they are compressed and the decompressor needs the exact size -rem -echo|set/p="indexing shr..." -cscript /nologo bin\buildss.js res\ARTWORK.SHR build\ARTWORK.IDX nul build\TOTAL.DATA nul >>build\log -echo done -rem -rem precompute indexed files for demo launchers -rem note: these can not be padded because some of them are loaded too close to $C000 -rem -echo|set/p="indexing demos..." -cscript /nologo bin\buildss.js build\DEMO build\DEMO.IDX nul build\TOTAL.DATA nul >>build\log -cscript /nologo bin\addfile.js build\DEMO.IDX src\index\demo.idx.a -echo done -rem -rem precompute indexed files for single-load game binaries -rem note: these can be padded because they are loaded at a time when all of main memory is clobber-able -rem -echo|set/p="indexing single-loaders..." -for %%q in (res\dsk\*.po) do %CADIUS% EXTRACTVOLUME "%%q" build\X\ >>build\log -1>nul 2>nul del /s build\X\.DS_Store build\X\PRODOS* build\X\LOADER.SYSTEM* -1>nul copy /y nul build\XSINGLE.IDX -cscript /nologo bin\buildsingle.js build\X.INDEXED build\XSINGLE.IDX build\TOTAL.DATA pad >>build\log -cscript /nologo bin\addfile.js build\XSINGLE.IDX src\index\xsingle.idx.a -echo done -rem -rem create search indexes for each variation of (game-requires-joystick) X (game-requires-128K) -rem in the form of OKVS data structures, plus game counts in the form of source files -rem -echo|set/p="indexing search..." -cscript /nologo bin\buildsearch.js "00" src\index\count00.a build\SEARCH00.IDX -cscript /nologo bin\buildsearch.js "0" src\index\count01.a build\SEARCH01.IDX -cscript /nologo bin\buildsearch.js ".0" src\index\count10.a build\SEARCH10.IDX -cscript /nologo bin\buildsearch.js "." src\index\count11.a build\SEARCH11.IDX -echo done -rem -rem add IDX files to the combined index file and generate -rem the index records that callers use to reference them -rem -echo|set/p="preparing index file..." -cscript /nologo bin\addfile.js build\SEARCH00.IDX src\index\search00.idx.a -cscript /nologo bin\addfile.js res\CACHE00.IDX src\index\cache00.idx.a -cscript /nologo bin\addfile.js build\SEARCH01.IDX src\index\search01.idx.a -cscript /nologo bin\addfile.js res\CACHE01.IDX src\index\cache01.idx.a -cscript /nologo bin\addfile.js build\SEARCH10.IDX src\index\search10.idx.a -cscript /nologo bin\addfile.js res\CACHE10.IDX src\index\cache10.idx.a -cscript /nologo bin\addfile.js build\SEARCH11.IDX src\index\search11.idx.a -cscript /nologo bin\addfile.js res\CACHE11.IDX src\index\cache11.idx.a -cscript /nologo bin\addfile.js build\PRELAUNCH.IDX src\index\prelaunch.idx.a -cscript /nologo bin\addfile.js build\ATTRACT.IDX src\index\attract.idx.a -cscript /nologo bin\addfile.js build\FX.IDX src\index\fx.idx.a -cscript /nologo bin\addfile.js build\DFX.IDX src\index\dfx.idx.a -cscript /nologo bin\addfile.js build\SFX.IDX src\index\sfx.idx.a -cscript /nologo bin\addfile.js build\GAMEHELP.IDX src\index\gamehelp.idx.a -cscript /nologo bin\addfile.js build\SLIDESHOW.IDX src\index\slideshow.idx.a -cscript /nologo bin\addfile.js build\MINIATTRACT0.IDX src\index\miniattract0.idx.a -cscript /nologo bin\addfile.js build\MINIATTRACT1.IDX src\index\miniattract1.idx.a -cscript /nologo bin\addfile.js build\TITLE.IDX src\index\title.idx.a -cscript /nologo bin\addfile.js build\DTITLE.IDX src\index\dtitle.idx.a -cscript /nologo bin\addfile.js build\HGR0.IDX src\index\hgr0.idx.a -cscript /nologo bin\addfile.js build\HGR1.IDX src\index\hgr1.idx.a -cscript /nologo bin\addfile.js build\HGR2.IDX src\index\hgr2.idx.a -cscript /nologo bin\addfile.js build\HGR3.IDX src\index\hgr3.idx.a -cscript /nologo bin\addfile.js build\HGR4.IDX src\index\hgr4.idx.a -cscript /nologo bin\addfile.js build\HGR5.IDX src\index\hgr5.idx.a -REM cscript /nologo bin\addfile.js build\HGR6.IDX src\index\hgr6.idx.a -cscript /nologo bin\addfile.js build\DHGR.IDX src\index\dhgr.idx.a -cscript /nologo bin\addfile.js build\GR.IDX src\index\gr.idx.a -REM cscript /nologo bin\addfile.js build\DGR.IDX src\index\dgr.idx.a -cscript /nologo bin\addfile.js build\ARTWORK.IDX src\index\artwork.idx.a -rem -rem add additional miscellaneous files -rem -cscript /nologo bin\addfile.js build\COVERFADE src\index\coverfade.idx.a -cscript /nologo bin\addfile.js build\GR.FIZZLE src\index\gr.fizzle.idx.a -cscript /nologo bin\addfile.js build\DGR.FIZZLE src\index\dgr.fizzle.idx.a -cscript /nologo bin\addfile.js build\HELPTEXT src\index\helptext.idx.a -cscript /nologo bin\addfile.js build\CREDITS src\index\credits.idx.a -cscript /nologo bin\addfile.js res\DECRUNCH src\index\decrunch.idx.a -cscript /nologo bin\addfile.js res\JOYSTICK src\index\joystick.idx.a -echo done -goto :EOF - -:md -2>nul md build -2>nul md build\X -2>nul md build\X.INDEXED -2>nul md build\FX -2>nul md build\FX.INDEXED -2>nul md build\PRELAUNCH -2>nul md build\PRELAUNCH.INDEXED -2>nul md build\ATTRACT0 -2>nul md build\ATTRACT1 -2>nul md build\SS -2>nul md build\GAMEHELP -2>nul md build\DEMO -1>nul copy nul build\log -goto :EOF - -:asmlauncher -2>nul 1>build\buildnum.log %GIT% rev-list --count HEAD -if errorlevel 1 (set _build=0) else for /f "tokens=*" %%q in (build\buildnum.log) do set _build=%%q -2>build\relbase.log %ACME% -DBUILDNUMBER=%_build% src\4cade.a -for /f "tokens=*" %%q in (build\relbase.log) do set _make=%%q -%ACME% -DBUILDNUMBER=%_build% -DRELBASE=$!_make:~-5,4! -r build\4cade.lst src\4cade.a -goto :EOF - -:asmdemo -echo|set/p="building demos..." -for %%q in (src\demo\*.a) do ( - for /f "tokens=* usebackq" %%k in (`find "^!to" %%q`) do set _to=%%k - set _to=!_to:~0,1! - if !_to!==t %ACME% %%q -) -echo done -goto :EOF - -:asmfx -echo|set/p="building fx..." -for %%q in (src\fx\*.a) do ( - for /f "tokens=* usebackq" %%k in (`find "^!to" %%q`) do set _to=%%k - set _to=!_to:~0,1! - if !_to!==t %ACME% %%q -) -echo done -goto :EOF - -:asmprelaunch -echo|set/p="building prelaunch..." -for %%q in (src\prelaunch\*.a) do ( - for /f "tokens=* usebackq" %%k in (`find "^!to" %%q`) do set _to=%%k - set _to=!_to:~0,1! - if !_to!==t %ACME% %%q -) -echo done -goto :EOF - -:asmproboot -%ACME% -r build\proboothd.lst src\proboothd\proboothd.a >> build\log -goto :EOF - -:compress -for %%q in (res\action.dhgr.uncompressed\*) do if not exist res\action.dhgr\%%~nxq %EXOMIZER% res\action.dhgr.uncompressed\%%~nxq@0x4000 -o res\action.hgr\%%~nxq -for %%q in (res\action.hgr.uncompressed\*) do if not exist res\action.hgr\%%~nxq %EXOMIZER% res\action.hgr.uncompressed\%%~nxq@0x4000 -o res\action.hgr\%%~nxq -for %%q in (res\artwork.shr.uncompressed\*) do if not exist res\artwork.shr\%%~nxq %EXOMIZER% res\artwork.shr.uncompressed\%%~nxq@0x2000 -o res\artwork.shr\%%~nxq -for %%q in (res\title.hgr.uncompressed\*) do if not exist res\title.hgr\%%~nxq %EXOMIZER% res\title.hgr.uncompressed\%%~nxq@0x2000 -o res\title.hgr\%%~nxq +@echo off +rem +rem 4cade Makefile for Windows +rem assembles source code, optionally builds a disk image +rem note: non-Windows users should probably use Makefile instead +rem +rem a qkumba monstrosity from 2018-10-29 +rem + +setlocal enabledelayedexpansion +set DISK=4sports.hdv +set VOLUME=INSTANT.REPLAY + +rem third-party tools required to build (must be in path) + +rem https://sourceforge.net/projects/acme-crossass/ +rem version 0.97 or later +set ACME=acme + +rem https://github.com/mach-kernel/cadius +rem version 1.4.6 or later +set CADIUS=cadius + +rem https://github.com/ +set GIT=git + +rem https://bitbucket.org/magli143/exomizer/wiki/Home +rem version 3.1.0 or later +set EXOMIZER=exomizer mem -q -P23 -lnone + +if "%1" equ "dsk" ( +call :clean +call :index +if "%2". equ "". ( + call :asmproboot + call :asmlauncher + 1>nul copy /y res\blank.hdv "build\%DISK%" >>build\log + 1>nul copy /y res\_FileInformation.txt build\ >>build\log + %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\LAUNCHER.SYSTEM" -C >>build\log + 1>nul copy /y "res\PREFS.CONF" "build" >>build\log + cscript /nologo bin\padto.js 512 build\PREFS.CONF + rem + rem create _FileInformation.txt files for subdirectories + rem + 1>nul copy /y src\prelaunch\_FileInformation.txt build\PRELAUNCH >>build/log + rem + rem add everything to the disk + rem +) +echo|set/p="adding files..." +%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\TOTAL.DATA" -C >>build\log +if "%2". equ "". ( + for %%q in (build\PREFS.CONF res\Finder.Data res\Finder.Root) do %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "%%q" -C >>build\log + for %%q in (res\TITLE.ANIMATED res\ICONS build\PRELAUNCH build\X) do ( + 1>nul 2>nul del /s "%%q\.DS_Store" + %CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/%%~nxq" %%q -C >>build\log + ) + cscript /nologo bin\changebootloader.js "build\%DISK%" build\proboothd +) +echo done +goto :EOF +) + +if "%1" equ "index" ( +call :index +goto :EOF +) + +if "%1" equ "clean" ( +if "%2". neq "". ( +1>nul move build\%DISK% +) +:clean +echo y|1>nul 2>nul rd build /s +if "%2". neq "". ( +md build +1>nul move %DISK% build\%DISK% +%CADIUS% DELETEFILE "build\%DISK%" "/%VOLUME%/TOTAL.DATA" >>build\log +) +goto :EOF +) + +if "%1" equ "compress" ( +call :compress +goto :EOF +) + +echo usage: %0 clean / dsk +goto :EOF + +:index +call :md +call :asmfx +call :asmprelaunch +call :asmdemo +rem +rem precompute binary data structure for mega-attract mode configuration file +rem +cscript /nologo bin\buildokvs.js res\ATTRACT.CONF build\ATTRACT.IDX >>build\log +rem +rem precompute binary data structure and substitute special characters +rem in game help and other all-text pages +rem +cscript /nologo bin\converthelp.js res\HELPTEXT build\HELPTEXT >>build\log +cscript /nologo bin\converthelp.js res\CREDITS build\CREDITS >>build\log +echo|set/p="converting gamehelp..." +for %%q in (res\GAMEHELP\*) do cscript /nologo bin\converthelp.js %%q build\GAMEHELP\%%~nxq >>build\log +echo done +rem +rem create a list of all game filenames, without metadata or display names, sorted by game filename +rem +cscript /nologo bin\makesorted.js +cscript /nologo bin\builddisplaynames.js +rem +rem precompute indexed files for prelaunch +rem note: prelaunch must be first in TOTAL.DATA due to a hack in LoadStandardPrelaunch +rem note 2: these can not be padded because they are loaded at $0106 and padding would clobber the stack +rem +echo|set/p="indexing prelaunch..." +1>nul copy /y nul build\TOTAL.DATA +cscript /nologo bin\buildpre.js build\PRELAUNCH.INDEXED build\PRELAUNCH.IDX build\TOTAL.DATA >>build\log +echo done +rem +rem precompute indexed files for HGR & DHGR titles +rem note: these are not padded because they are all an exact block-multiple anyway +rem +echo|set/p="indexing titles..." +cscript /nologo bin\padto.js 512 build\TOTAL.DATA +cscript /nologo bin\buildss.js res\TITLE.HGR build\TITLE.IDX build\HGR.TITLES.LOG build\TOTAL.DATA build\TOTAL.DATA >>build\log +cscript /nologo bin\buildss.js res\TITLE.DHGR build\DTITLE.IDX build\DHGR.TITLES.LOG build\TOTAL.DATA build\TOTAL.DATA >>build\log +cscript /nologo bin\addfile.js res\COVER src\index\res.cover.idx.a +cscript /nologo bin\addfile.js res\TITLE src\index\res.title.idx.a +cscript /nologo bin\addfile.js res\HELP src\index\res.help.idx.a +echo done +rem +rem precompute indexed files for game help +rem note: these can be padded because they're loaded into $800 at a time when $800..$1FFF is clobber-able +rem +echo|set/p="indexing gamehelp..." +cscript /nologo bin\makesorted.js +cscript /nologo bin\buildpre.js build\GAMEHELP build\GAMEHELP.IDX build\TOTAL.DATA pad >>build\log +echo done +rem +rem precompute indexed files for slideshows +rem note: these can be padded because they're loaded into $800 at a time when $800..$1FFF is clobber-able +rem +echo|set/p="indexing slideshows..." +for %%q in (res\SS\*) do ( + set _ss=%%~nxq + set _ss=!_ss:~0,3! + if !_ss!==ACT ( + cscript /nologo bin\buildslideshow.js %%q build\SS\%%~nxq -d >>build\log + ) else ( + cscript /nologo bin\buildslideshow.js %%q build\SS\%%~nxq >>build\log + ) +) +cscript /nologo bin\buildss.js build\SS build\SLIDESHOW.IDX nul build\TOTAL.DATA nul pad >>build\log +for %%q in (A B C D E F G H I J K L M N O P) do for %%k in (res\ATTRACT\%%q*) do cscript /nologo bin\buildokvs.js %%k build\ATTRACT0\%%~nxk >>build\log +for %%q in (Q R S T U V W X Y Z) do for %%k in (res\ATTRACT\%%q*) do cscript /nologo bin\buildokvs.js %%k build\ATTRACT1\%%~nxk >>build\log +cscript /nologo bin\buildss.js build\ATTRACT0 build\MINIATTRACT0.IDX nul build\TOTAL.DATA nul pad >>build\log +cscript /nologo bin\buildss.js build\ATTRACT1 build\MINIATTRACT1.IDX nul build\TOTAL.DATA nul pad >>build\log +echo done +rem +rem precompute indexed files for graphic effects +rem note: these can be padded because they're loaded into $6000 at a time when $6000..$BEFF is clobber-able +rem +echo|set/p="indexing fx..." +cscript /nologo bin\buildfx.js res\FX.CONF build\FX.IDX build\TOTAL.DATA build\FX.INDEXED >>build\log +cscript /nologo bin\buildfx.js res\DFX.CONF build\DFX.IDX build\TOTAL.DATA build\FX.INDEXED >>build\log +cscript /nologo bin\buildfx.js res\SFX.CONF build\SFX.IDX build\TOTAL.DATA build\FX.INDEXED >>build\log +dir /b build\FXCODE >build\fxcode.lst +cscript /nologo bin\buildfx.js build\fxcode.lst build\FXCODE.IDX build\TOTAL.DATA build\FXCODE >>build\log +rem +rem precompute indexed files for coordinates files loaded by graphic effects +rem note: these can not be padded because some of them are loaded into tight spaces near the unclobberable top of main memory +rem +dir /b build\FXDATA >build\fxdata.lst +cscript /nologo bin\buildfx.js build\fxdata.lst build\FXDATA.IDX build\TOTAL.DATA build\FXDATA >>build\log +echo done +rem +rem precompute indexed files for HGR & DHGR action screenshots +rem note: these can not be padded because they are compressed and the decompressor needs the exact size +rem +echo|set/p="indexing (d)hgr action..." +1>nul copy /y nul build\ACTIONHGR0 +1>nul copy /y nul build\ACTIONHGR1 +1>nul copy /y nul build\ACTIONHGR2 +1>nul copy /y nul build\ACTIONHGR3 +1>nul copy /y nul build\ACTIONHGR4 +1>nul copy /y nul build\ACTIONHGR5 +1>nul copy /y nul build\ACTIONHGR6 +1>nul copy /y nul build\ACTIONDHGR +for %%q in (A B C D) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR0 echo %%k +for %%q in (E F G H) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR1 echo %%k +for %%q in (I J K L) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR2 echo %%k +for %%q in (M N O P) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR3 echo %%k +for %%q in (Q R S T) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR4 echo %%k +for %%q in (U V W X) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR5 echo %%k +for %%q in (Y Z) do for %%k in (res\ACTION.HGR\%%q*) do 1>nul >>build\ACTIONHGR6 echo %%k +for %%q in (res\ACTION.DHGR\*) do 1>nul >>build\ACTIONDHGR echo %%q +cscript /nologo bin\buildss.js build\ACTIONHGR0* build\HGR0.IDX nul build\TOTAL.DATA nul >>build\log +cscript /nologo bin\buildss.js build\ACTIONHGR1* build\HGR1.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log +cscript /nologo bin\buildss.js build\ACTIONHGR2* build\HGR2.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log +cscript /nologo bin\buildss.js build\ACTIONHGR3* build\HGR3.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log +cscript /nologo bin\buildss.js build\ACTIONHGR4* build\HGR4.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log +cscript /nologo bin\buildss.js build\ACTIONHGR5* build\HGR5.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log +cscript /nologo bin\buildss.js build\ACTIONHGR6* build\HGR6.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log +cscript /nologo bin\buildss.js build\ACTIONDHGR* build\DHGR.IDX nul build\TOTAL.DATA build\TOTAL.DATA >>build\log +echo done +rem precompute indexed files for GR action screenshots +rem note: these can be padded because they are not compressed +rem +echo|set/p="indexing (d)gr action..." +1>nul copy /y nul build\ACTIONGR +for %%q in (res\ACTION.GR\*) do 1>nul >>build\ACTIONGR echo %%q +cscript /nologo bin\buildss.js build\ACTIONGR* build\GR.IDX nul build\TOTAL.DATA build\TOTAL.DATA pad >>build\log +echo done +rem +rem precompute indexed files for SHR artwork +rem note: these can not be padded because they are compressed and the decompressor needs the exact size +rem +echo|set/p="indexing shr..." +cscript /nologo bin\buildss.js res\ARTWORK.SHR build\ARTWORK.IDX nul build\TOTAL.DATA nul >>build\log +echo done +rem +rem precompute indexed files for demo launchers +rem note: these can not be padded because some of them are loaded too close to $C000 +rem +echo|set/p="indexing demos..." +cscript /nologo bin\buildss.js build\DEMO build\DEMO.IDX nul build\TOTAL.DATA nul >>build\log +echo done +rem +rem precompute indexed files for single-load game binaries +rem note: these can be padded because they are loaded at a time when all of main memory is clobber-able +rem +echo|set/p="indexing single-loaders..." +for %%q in (res\dsk\*.po) do %CADIUS% EXTRACTVOLUME "%%q" build\X\ >>build\log +1>nul 2>nul del /s build\X\.DS_Store build\X\PRODOS* build\X\LOADER.SYSTEM* build\X\_FileInformation.txt +1>nul copy /y nul build\XSINGLE.IDX +cscript /nologo bin\buildsingle.js build\X.INDEXED build\XSINGLE.IDX build\TOTAL.DATA pad >>build\log +cscript /nologo bin\flatten.js +echo done +rem +rem create search indexes for each variation of (game-requires-joystick) X (game-requires-128K) +rem in the form of OKVS data structures, plus game counts in the form of source files +rem +echo|set/p="indexing search..." +cscript /nologo bin\buildsearch.js "00" src\index\count00.a build\SEARCH00.IDX +cscript /nologo bin\buildsearch.js "0" src\index\count01.a build\SEARCH01.IDX +cscript /nologo bin\buildsearch.js ".0" src\index\count10.a build\SEARCH10.IDX +cscript /nologo bin\buildsearch.js "." src\index\count11.a build\SEARCH11.IDX +echo done +rem +rem add IDX files to the combined index file and generate +rem the index records that callers use to reference them +rem +echo|set/p="preparing index file..." +cscript /nologo bin\addfile.js build\SEARCH00.IDX src\index\search00.idx.a +cscript /nologo bin\addfile.js res\CACHE00.IDX src\index\cache00.idx.a +cscript /nologo bin\addfile.js build\SEARCH01.IDX src\index\search01.idx.a +cscript /nologo bin\addfile.js res\CACHE01.IDX src\index\cache01.idx.a +cscript /nologo bin\addfile.js build\SEARCH10.IDX src\index\search10.idx.a +cscript /nologo bin\addfile.js res\CACHE10.IDX src\index\cache10.idx.a +cscript /nologo bin\addfile.js build\SEARCH11.IDX src\index\search11.idx.a +cscript /nologo bin\addfile.js res\CACHE11.IDX src\index\cache11.idx.a +cscript /nologo bin\addfile.js build\PRELAUNCH.IDX src\index\prelaunch.idx.a +cscript /nologo bin\addfile.js build\ATTRACT.IDX src\index\attract.idx.a +cscript /nologo bin\addfile.js build\DEMO.IDX src\index\demo.idx.a +cscript /nologo bin\addfile.js build\XSINGLE.IDX src\index\xsingle.idx.a +cscript /nologo bin\addfile.js build\FX.IDX src\index\fx.idx.a +cscript /nologo bin\addfile.js build\DFX.IDX src\index\dfx.idx.a +cscript /nologo bin\addfile.js build\SFX.IDX src\index\sfx.idx.a +cscript /nologo bin\addfile.js build\FXCODE.IDX src\index\fxcode.idx.a +cscript /nologo bin\addfile.js build\FXDATA.IDX src\index\fxdata.idx.a +cscript /nologo bin\addfile.js build\GAMEHELP.IDX src\index\gamehelp.idx.a +cscript /nologo bin\addfile.js build\SLIDESHOW.IDX src\index\slideshow.idx.a +cscript /nologo bin\addfile.js build\MINIATTRACT0.IDX src\index\miniattract0.idx.a +cscript /nologo bin\addfile.js build\MINIATTRACT1.IDX src\index\miniattract1.idx.a +cscript /nologo bin\addfile.js build\TITLE.IDX src\index\title.idx.a +cscript /nologo bin\addfile.js build\DTITLE.IDX src\index\dtitle.idx.a +cscript /nologo bin\addfile.js build\HGR0.IDX src\index\hgr0.idx.a +cscript /nologo bin\addfile.js build\HGR1.IDX src\index\hgr1.idx.a +cscript /nologo bin\addfile.js build\HGR2.IDX src\index\hgr2.idx.a +cscript /nologo bin\addfile.js build\HGR3.IDX src\index\hgr3.idx.a +cscript /nologo bin\addfile.js build\HGR4.IDX src\index\hgr4.idx.a +cscript /nologo bin\addfile.js build\HGR5.IDX src\index\hgr5.idx.a +cscript /nologo bin\addfile.js build\HGR6.IDX src\index\hgr6.idx.a +cscript /nologo bin\addfile.js build\DHGR.IDX src\index\dhgr.idx.a +cscript /nologo bin\addfile.js build\GR.IDX src\index\gr.idx.a +cscript /nologo bin\addfile.js build\ARTWORK.IDX src\index\artwork.idx.a +rem +rem add additional miscellaneous files +rem +cscript /nologo bin\addfile.js build\COVERFADE src\index\coverfade.idx.a +cscript /nologo bin\addfile.js build\GR.FIZZLE src\index\gr.fizzle.idx.a +cscript /nologo bin\addfile.js build\HELPTEXT src\index\helptext.idx.a +cscript /nologo bin\addfile.js build\CREDITS src\index\credits.idx.a +cscript /nologo bin\addfile.js res\DECRUNCH src\index\decrunch.idx.a +cscript /nologo bin\addfile.js res\JOYSTICK src\index\joystick.idx.a +echo done +goto :EOF + +:md +2>nul md build +2>nul md build\X +2>nul md build\X.INDEXED +2>nul md build\FX.INDEXED +2>nul md build\FXDATA +2>nul md build\FXCODE +2>nul md build\PRELAUNCH +2>nul md build\PRELAUNCH.INDEXED +2>nul md build\ATTRACT0 +2>nul md build\ATTRACT1 +2>nul md build\SS +2>nul md build\GAMEHELP +2>nul md build\DEMO +1>nul copy nul build\log +goto :EOF + +:asmlauncher +2>nul 1>build\buildnum.log %GIT% rev-list --count HEAD +if errorlevel 1 (set _build=0) else for /f "tokens=*" %%q in (build\buildnum.log) do set _build=%%q +2>build\relbase.log %ACME% -DBUILDNUMBER=%_build% src/4cade.a +for /f "tokens=*" %%q in (build\relbase.log) do set _make=%%q +%ACME% -DBUILDNUMBER=%_build% -DRELBASE=$!_make:~-5,4! -r build/4cade.lst src/4cade.a +goto :EOF + +:asmdemo +echo|set/p="building demos..." +for %%q in (src\demo\*.a) do ( + for /f "tokens=* usebackq" %%k in (`find "^!to" %%q`) do set _to=%%k + set _to=!_to:~0,1! + if !_to!==t %ACME% %%q +) +echo done +goto :EOF + +:asmfx +echo|set/p="building fx..." +for %%q in (src\fx\*.a) do ( + for /f "tokens=* usebackq" %%k in (`find "^!to" %%q`) do set _to=%%k + set _to=!_to:~0,1! + if !_to!==t %ACME% %%q +) +echo done +goto :EOF + +:asmprelaunch +echo|set/p="building prelaunch..." +for %%q in (src\prelaunch\*.a) do ( + for /f "tokens=* usebackq" %%k in (`find "^!to" %%q`) do set _to=%%k + set _to=!_to:~0,1! + if !_to!==t %ACME% %%q +) +echo done +goto :EOF + +:asmproboot +%ACME% -r build/proboothd.lst src/proboothd/proboothd.a >> build\log +goto :EOF + +:compress +for %%q in (res\action.dhgr.uncompressed\*) do if not exist res\action.dhgr\%%~nxq %EXOMIZER% res\action.dhgr.uncompressed\%%~nxq@0x4000 -o res\action.hgr\%%~nxq +for %%q in (res\action.hgr.uncompressed\*) do if not exist res\action.hgr\%%~nxq %EXOMIZER% res\action.hgr.uncompressed\%%~nxq@0x4000 -o res\action.hgr\%%~nxq +for %%q in (res\artwork.shr.uncompressed\*) do if not exist res\artwork.shr\%%~nxq %EXOMIZER% res\artwork.shr.uncompressed\%%~nxq@0x2000 -o res\artwork.shr\%%~nxq +for %%q in (res\title.hgr.uncompressed\*) do if not exist res\title.hgr\%%~nxq %EXOMIZER% res\title.hgr.uncompressed\%%~nxq@0x2000 -o res\title.hgr\%%~nxq