mirror of
https://github.com/a2-4am/4sports.git
synced 2025-04-06 12:38:01 +00:00
sync code and build improvements with 4cade build 4012
This commit is contained in:
parent
56b1917196
commit
9f71c29aa6
478
Makefile
478
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:
|
||||
|
@ -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"
|
40
bin/addfiles.py
Executable file
40
bin/addfiles.py
Executable file
@ -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))
|
@ -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)
|
@ -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
|
94
bin/buildindexedfile.py
Executable file
94
bin/buildindexedfile.py
Executable file
@ -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('<H', rec_size)
|
||||
|
||||
if addr:
|
||||
# for extended index record, yield load address (2 bytes, little-endian, unsigned short)
|
||||
yield bytes.fromhex(addr)[::-1]
|
||||
|
||||
if args.log_file:
|
||||
with open(args.log_file, 'a') as log_file_handle:
|
||||
log_file_handle.write(f'{key},{rec_offset},{rec_size}\n')
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Build indexed OKVS structure with links to data stored in TOTAL.DATA file")
|
||||
parser.add_argument("output_file")
|
||||
parser.add_argument("input_directory")
|
||||
parser.add_argument("log_file", nargs='?', default=None)
|
||||
parser.add_argument("-p", "--pad", action="store_true", default=False, help="pad file sizes to multiples of 512 (default: use exact size)")
|
||||
args = parser.parse_args()
|
||||
records = [x.strip() for x in sys.stdin.readlines()]
|
||||
records = [x for x in records if x and x[0] not in ('#', '[')]
|
||||
for b in build(records, args):
|
||||
sys.stdout.buffer.write(b)
|
@ -1,96 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# flags
|
||||
# -a append to data file (default off = truncate)
|
||||
# -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
|
||||
|
||||
pad=false
|
||||
append=false
|
||||
standardoffset=0
|
||||
standardsize=0
|
||||
while getopts ":ap" opt; do
|
||||
case $opt in
|
||||
a) append=true
|
||||
;;
|
||||
p) pad=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ "$append" = false ]; then
|
||||
rm -f "$1"
|
||||
fi
|
||||
touch "$1"
|
||||
|
||||
if [ "${#3}" -ne "0" ]; then
|
||||
rm -f "$3"
|
||||
touch "$3"
|
||||
fi
|
||||
|
||||
# if there is a file called "STANDARD" in the input directory, add it now
|
||||
# because we will reuse it for any files that don't exist
|
||||
if [ -f "$2"/STANDARD ]; then
|
||||
standardoffset=$(wc -c < "$1")
|
||||
standardsize=$(wc -c < "$2/STANDARD")
|
||||
cat "$2"/STANDARD >> "$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"
|
28
bin/buildokvs.py
Executable file
28
bin/buildokvs.py
Executable file
@ -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)
|
@ -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"
|
105
bin/buildsearch.py
Executable file
105
bin/buildsearch.py
Executable file
@ -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('<H', rec_size)
|
||||
|
||||
# yield lookup table
|
||||
yield pack(f'<{record_count}H', *key_addresses)
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Build indexed OKVS structure for search index")
|
||||
parser.add_argument("output_game_count_file")
|
||||
parser.add_argument("input_hgr_log_file")
|
||||
parser.add_argument("input_dhgr_log_file")
|
||||
args = parser.parse_args()
|
||||
records = [x.strip() for x in sys.stdin.readlines()]
|
||||
records = [x.replace('=',',').split(',')
|
||||
for x in records
|
||||
if x and x[0] not in ('#', '[')]
|
||||
for b in build(records, args):
|
||||
sys.stdout.buffer.write(b)
|
@ -1,77 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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
|
||||
|
||||
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
|
||||
records=$(mktemp)
|
||||
tr -d "\r" | awk '!/^$|^#|^\[/' > "$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"
|
63
bin/buildslideshow.py
Executable file
63
bin/buildslideshow.py
Executable file
@ -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)
|
@ -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"
|
@ -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)
|
||||
}
|
||||
}
|
13
bin/flatten.js
Normal file
13
bin/flatten.js
Normal file
@ -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)
|
||||
}
|
19
bin/rsync.js
19
bin/rsync.js
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
@ -155,5 +155,3 @@ ACTGHIJ2.CONF=2
|
||||
TITLENOPQR.CONF=1
|
||||
ACTNOPQR2.CONF=2
|
||||
#5
|
||||
|
||||
[eof]
|
||||
|
@ -22,4 +22,3 @@ testing & patches* * * * * * * * * * * *
|
||||
|
||||
|
||||
archive.org/details/TotalReplay2
|
||||
[eof]
|
||||
|
@ -106,4 +106,3 @@ DHGR.BLOOM.RIP
|
||||
DHGR.DITHRAD4
|
||||
DHGR.48.SYNC
|
||||
DHGR.FLICK
|
||||
[eof]
|
||||
|
@ -170,4 +170,3 @@ SLOW.STAR.RIP
|
||||
BOXES48.ARROW
|
||||
REDLINES
|
||||
FLICK
|
||||
[eof]
|
||||
|
@ -17,4 +17,3 @@
|
||||
[Ctrl-P] joystick
|
||||
|
||||
[Ctrl-A] credits
|
||||
[eof]
|
||||
|
@ -61,5 +61,3 @@ SHR.LR2
|
||||
SHR.80.ARROW
|
||||
SHR.IRIS
|
||||
SHR.UD
|
||||
|
||||
[eof]
|
||||
|
BIN
res/proboothd
BIN
res/proboothd
Binary file not shown.
81
src/4cade.a
81
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 #<PrelaunchInit ; reset prelaunch vector (animated titles change it)
|
||||
sta iPrelaunchInit+1
|
||||
ldx #5
|
||||
- lda ResetVector,x ; copy reentry wrapper to bottom of stack
|
||||
sta $100,x ; (used as reset vector because //e always
|
||||
@ -106,7 +115,6 @@ ResetVector ; 6 bytes, copied to $100
|
||||
; these routines will only be called after relocating to language card
|
||||
!source "src/ui.search.mode.a" ; \__ execution falls through
|
||||
!source "src/ui.animation.a" ; /
|
||||
|
||||
!source "src/ui.browse.mode.a"
|
||||
!source "src/ui.attract.mode.a"
|
||||
!source "src/ui.attract.hgr.a"
|
||||
@ -127,7 +135,7 @@ ResetVector ; 6 bytes, copied to $100
|
||||
!source "src/glue.decompress.a"
|
||||
!source "src/textrank.a"
|
||||
!source "src/okvs.a"
|
||||
!source "src/wait.a"
|
||||
!source "src/prodos.path.a"
|
||||
|
||||
; add new files above here
|
||||
!source "src/hw.vbl.a"
|
||||
@ -152,32 +160,51 @@ gGlobalPrefsStore
|
||||
; flips out if it has certain values (it will
|
||||
; be set to $55 as part of the 64K memory test,
|
||||
; which is apparently one of the acceptable values)
|
||||
|
||||
+DEFINE_INDIRECT_VECTOR iPrelaunchInit, PrelaunchInit
|
||||
+DEFINE_INDIRECT_VECTOR iSetupPrecomputed3Bit, SetupPrecomputed3Bit
|
||||
+DEFINE_INDIRECT_VECTOR iRippleCoordinates3Bit, RippleCoordinates3Bit
|
||||
+DEFINE_INDIRECT_VECTOR iReverseCoordinates3Bit, ReverseCoordinates3Bit
|
||||
+DEFINE_INDIRECT_VECTOR iRippleCoordinates2Bit, RippleCoordinates2Bit
|
||||
+DEFINE_INDIRECT_VECTOR iReverseCoordinates2Bit, ReverseCoordinates2Bit
|
||||
+DEFINE_INDIRECT_VECTOR iBuildDHGRSparseBitmasks2Bit, BuildDHGRSparseBitmasks2Bit
|
||||
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks2Bit, BuildHGRSparseBitmasks2Bit
|
||||
+DEFINE_INDIRECT_VECTOR iBuildDHGRSparseBitmasks1Bit, BuildDHGRSparseBitmasks1Bit
|
||||
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks1Bit, BuildHGRSparseBitmasks1Bit
|
||||
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit4, RippleCoordinates1Bit4
|
||||
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit3, RippleCoordinates1Bit3
|
||||
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit2, RippleCoordinates1Bit2
|
||||
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit, RippleCoordinates1Bit
|
||||
+DEFINE_INDIRECT_VECTOR iReverseCoordinates1Bit, ReverseCoordinates1Bit
|
||||
+DEFINE_INDIRECT_VECTOR iWaitForKeyWithTimeout, WaitForKeyWithTimeout
|
||||
+DEFINE_INDIRECT_VECTOR iBuildDHGRDitherMasks, BuildDHGRDitherMasks
|
||||
+DEFINE_INDIRECT_VECTOR iBuildHGRDitherMasks, BuildHGRDitherMasks
|
||||
+DEFINE_INDIRECT_VECTOR iBuildDHGRMirrorCols, BuildDHGRMirrorCols
|
||||
+DEFINE_INDIRECT_VECTOR iBuildHGRMirrorCols, BuildHGRMirrorCols
|
||||
+DEFINE_INDIRECT_VECTOR iBuildHGRMirrorTables, BuildHGRMirrorTables
|
||||
+DEFINE_INDIRECT_VECTOR iBuildHGRTables, BuildHGRTables
|
||||
+DEFINE_INDIRECT_VECTOR iLoadFXDATA, LoadFXDATA
|
||||
+DEFINE_INDIRECT_VECTOR iLoadFXCODE, LoadFXCODE
|
||||
+DEFINE_INDIRECT_VECTOR iLoadXSingle, LoadXSingle
|
||||
+DEFINE_INDIRECT_VECTOR iAddToPath, AddToPath
|
||||
+DEFINE_INDIRECT_VECTOR iLoadFileDirect, LoadFileDirect
|
||||
; SMC to RTS on a II+
|
||||
+DEFINE_INDIRECT_VECTOR WaitForVBL, WaitForVBL_iie
|
||||
!if (RELBASE != $2000) and (* != UnwaitForVBL) { !serious "UnwaitForVBL=",*,", fix constants.a" }
|
||||
rts ; SMC to JMP on a IIc
|
||||
!word iUnwaitForVBL
|
||||
|
||||
SwitchToBank2
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
rts
|
||||
!source "src/prodos.path.a" ; paths end up on the same page
|
||||
|
||||
; iLoadXSingle (label is in constants.a)
|
||||
jmp LoadXSingle ; no direct calling - target can move
|
||||
|
||||
; iAddToPath (label is in constants.a)
|
||||
jmp AddToPath ; no direct calling - target can move
|
||||
|
||||
; iLoadFileDirect (label is in constants.a)
|
||||
jmp LoadFileDirect ; no direct calling - target can move
|
||||
|
||||
; WaitForVBL (label is in constants.a)
|
||||
jmp WaitForVBL_iie ; SMC to RTS on a II+
|
||||
|
||||
; UnwaitForVBL (label is in constants.a)
|
||||
rts ; SMC to JMP on a IIc
|
||||
!word iUnwaitForVBL
|
||||
|
||||
; MockingboardStuff (label is in constants.a)
|
||||
; slot number where Mockingboard was detected and type of board
|
||||
; #$00 if no Mockingboard detected
|
||||
!byte $FD ; MockingboardStuff ($FFF8)
|
||||
; MachineStatus (label is in constants.a so prelaunchers can use it)
|
||||
!if (RELBASE != $2000) and (* != MockingboardStuff) { !serious "MockingboardStuff=",*,", fix constants.a" }
|
||||
!byte $FD
|
||||
|
||||
; MachineStatus (label is in constants.a)
|
||||
; 7 6 5 4 3 2 1 0
|
||||
; | | | | | | | +- bit 0 reserved
|
||||
; | | | | | | +--- bit 1 reserved
|
||||
@ -188,7 +215,10 @@ SwitchToBank2
|
||||
; | +------------- bit 6 = 1 if 128K
|
||||
; +--------------- bit 7 = 1 if joystick
|
||||
; Use the bit masks defined in constants.a
|
||||
!byte $FD ; MachineStatus ($FFF9)
|
||||
!if (RELBASE != $2000) and (* != MachineStatus) { !serious "MachineStatus=",*,", fix constants.a" }
|
||||
!byte $FD
|
||||
|
||||
!if (RELBASE != $2000) and (* != $FFFA) { !serious "Expected LC vectors to start at $FFFA, found ",* }
|
||||
!word Reenter ; NMI vector ($FFFA-B)
|
||||
!word Reenter ; reset vector ($FFFC-D)
|
||||
!word Ignore ; IRQ vector ($FFFE-F)
|
||||
@ -207,7 +237,7 @@ COPYSRC = *
|
||||
!if LCRAM2_END >= 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
215
src/4cade.init.a
Normal file → Executable file
215
src/4cade.init.a
Normal file → Executable file
@ -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 $3FE
|
||||
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
|
||||
|
@ -13,3 +13,4 @@
|
||||
sta STOREOFF
|
||||
sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
sta SETSTDZP
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
}
|
||||
|
234
src/constants.a
234
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
|
||||
|
822
src/fx.lib.a
Normal file
822
src/fx.lib.a
Normal file
@ -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
|
||||
sty $f0
|
||||
lda #>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
|
||||
sty $f0
|
||||
lda #>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
|
||||
sty $f0
|
||||
lda #>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 #<aslmod4
|
||||
+HIDE_NEXT_2_BYTES
|
||||
RippleCoordinates1Bit3
|
||||
lda #<aslmod3
|
||||
+HIDE_NEXT_2_BYTES
|
||||
RippleCoordinates1Bit2
|
||||
lda #<aslmod2
|
||||
+HIDE_NEXT_2_BYTES
|
||||
RippleCoordinates1Bit
|
||||
lda #<aslmod
|
||||
sta @jsr+1
|
||||
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 jsr aslmod ; SMC on entry
|
||||
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 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
|
||||
}
|
677
src/fx/code.dhgr.48boxes.a
Normal file
677
src/fx/code.dhgr.48boxes.a
Normal file
@ -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 <RTS0
|
||||
;
|
||||
MIDDLE_BRANCH
|
||||
dec rowcount
|
||||
!byte $10,$C8
|
||||
MIDDLE_BRANCH_E
|
||||
;
|
||||
OUTER_BRANCH
|
||||
dec rowcount
|
||||
!byte $10,$C6
|
||||
OUTER_BRANCH_E
|
||||
;
|
||||
!byte <codegen_dst ; current page
|
||||
!byte <SWITCH_TO_MAIN
|
||||
!byte <SWITCH_TO_AUX
|
||||
!byte <SWITCH_TO_AUX_AND_BYTE_COPY
|
||||
!byte <INX_AND_RECALC
|
||||
!byte <RECALC
|
||||
!byte <SET_ROW_COUNT
|
||||
!byte <SET_FIRST_ROW
|
||||
!byte <INY2
|
||||
!byte <INY1
|
||||
!byte <DEY1
|
||||
!byte <SAVE_Y
|
||||
!byte <RESTORE_Y
|
||||
!byte <MIDDLE_JSR
|
||||
!byte <OUTER_JSR
|
||||
!byte <MIDDLE_BRANCH
|
||||
!byte <OUTER_BRANCH
|
||||
!byte <MASKCOPY_PRE
|
||||
!byte <MASKCOPY_POST
|
||||
!byte <BYTECOPY
|
||||
!byte <BYTECOPY_AND_INY
|
||||
|
||||
codegen_piece_lengths ; length of each of the pieces
|
||||
!byte RTS0_E-RTS0
|
||||
;
|
||||
MASKCOPY_POST
|
||||
eor (dst), y
|
||||
sta (dst), y
|
||||
MASKCOPY_POST_E
|
||||
;
|
||||
MIDDLE_JSR
|
||||
!byte $20,$46
|
||||
MIDDLE_JSR_E
|
||||
OUTER_JSR
|
||||
!byte $20,$47
|
||||
OUTER_JSR_E
|
||||
;
|
||||
!byte 1 ; current page
|
||||
!byte SWITCH_TO_MAIN_E-SWITCH_TO_MAIN
|
||||
!byte SWITCH_TO_AUX_E-SWITCH_TO_AUX
|
||||
!byte SWITCH_TO_AUX_AND_BYTE_COPY_E-SWITCH_TO_AUX_AND_BYTE_COPY
|
||||
!byte INX_AND_RECALC_E-INX_AND_RECALC
|
||||
!byte RECALC_E-RECALC
|
||||
!byte SET_ROW_COUNT_E-SET_ROW_COUNT
|
||||
!byte SET_FIRST_ROW_E-SET_FIRST_ROW
|
||||
!byte INY2_E-INY2
|
||||
!byte INY1_E-INY1
|
||||
!byte DEY1_E-DEY1
|
||||
!byte SAVE_Y_E-SAVE_Y
|
||||
!byte RESTORE_Y_E-RESTORE_Y
|
||||
!byte MIDDLE_JSR_E-MIDDLE_JSR
|
||||
!byte OUTER_JSR_E-OUTER_JSR
|
||||
!byte MIDDLE_BRANCH_E-MIDDLE_BRANCH
|
||||
!byte OUTER_BRANCH_E-OUTER_BRANCH
|
||||
!byte MASKCOPY_PRE_E-MASKCOPY_PRE
|
||||
!byte MASKCOPY_POST_E-MASKCOPY_POST
|
||||
!byte BYTECOPY_E-BYTECOPY
|
||||
!byte BYTECOPY_AND_INY_E-BYTECOPY_AND_INY
|
||||
|
||||
BuildDrawingRoutineFrom
|
||||
sta <codegen_token_src ; STA opcode ($85) also serves as 'length' of k_bitcopy token
|
||||
BuildDrawingRoutine
|
||||
ldy #0
|
||||
sty <codegen_token_x
|
||||
- jsr GetNextToken
|
||||
pha
|
||||
jsr ProcessToken
|
||||
pla
|
||||
bne -
|
||||
dec <codegen_dst
|
||||
inc <FIRST_ROW
|
||||
rts
|
||||
|
||||
GetNextToken
|
||||
codegen_token_x=*+1
|
||||
ldx #$00
|
||||
codegen_token_src=*+1
|
||||
lda OUTER_STAGE, x
|
||||
inc <codegen_token_x
|
||||
rts
|
||||
|
||||
ProcessBitcopyToken
|
||||
jsr GetNextToken
|
||||
sta <bitcopy_mask
|
||||
bitcopy_mask=*+1
|
||||
lda $FD ; SMC
|
||||
beq ExitProcessToken ; copymask=0 -> nothing to generate
|
||||
bmi + ; copymask>=$80 -> assume full byte
|
||||
lda #k_mask_copy_pre
|
||||
jsr ProcessToken
|
||||
lda #1
|
||||
sta <piece_length
|
||||
lda <bitcopy_mask
|
||||
jsr ProcessMaskToken
|
||||
lda #k_mask_copy_post
|
||||
+HIDE_NEXT_2_BYTES
|
||||
+ lda #k_byte_copy
|
||||
; execution falls through here
|
||||
ProcessToken
|
||||
tax
|
||||
lda <codegen_piece_lengths, x
|
||||
bmi ProcessBitcopyToken ; only bitcopy has length>=$80
|
||||
sta <piece_length
|
||||
lda <codegen_pieces, x
|
||||
; execution falls through here
|
||||
ProcessMaskToken
|
||||
sta <piece_src
|
||||
ldx #0
|
||||
-
|
||||
piece_src=*+1
|
||||
lda $FD, x ; SMC
|
||||
!byte $99,$00 ; STA $4400, Y
|
||||
codegen_dst
|
||||
!byte dhgr_copy01 ; SMC
|
||||
iny
|
||||
inx
|
||||
piece_length=*+1
|
||||
cpx #$FD ; SMC
|
||||
bcc -
|
||||
ExitProcessToken
|
||||
rts
|
||||
|
||||
codegen_stage
|
||||
!byte 27
|
||||
codegen_maskindex
|
||||
!byte 0
|
||||
|
||||
CopyAuxDHGRToMain
|
||||
; X=0
|
||||
sta READAUXMEM ; copy $4000-5FFF/aux to $9000-AFFF/main
|
||||
ldy #$20
|
||||
@a lda $4000, x
|
||||
@b sta $9000, x
|
||||
inx
|
||||
bne @a
|
||||
inc <@a+2
|
||||
inc <@b+2
|
||||
dey
|
||||
bne @a
|
||||
sta READMAINMEM
|
||||
; X=0,Y=0
|
||||
rts
|
||||
}
|
||||
|
||||
EdgeRightMasks
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000001
|
||||
!byte %00000111
|
||||
!byte %00011111
|
||||
!byte %11111111
|
||||
LeftMasks
|
||||
!byte %01100000
|
||||
!byte %00011000
|
||||
!byte %00000111
|
||||
!byte %00000000
|
||||
RightMasks
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000 ; also terminates LeftMasks
|
||||
!byte %00000001
|
||||
!byte %00000110
|
||||
!byte %00011000
|
||||
EdgeLeftMasks
|
||||
!byte %01100000 ; also terminates RightMasks
|
||||
!byte %01111000
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
EdgeLeftMasksAux
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %01000000
|
||||
!byte %01110000
|
||||
!byte %01111100
|
||||
!byte %11111111
|
||||
RightMasksAux
|
||||
!byte %00000011
|
||||
!byte %00001100
|
||||
!byte %01110000
|
||||
!byte %00000000
|
||||
LeftMasksAux
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000 ; also terminates RightMasksAux
|
||||
!byte %01000000
|
||||
!byte %00110000
|
||||
!byte %00001100
|
||||
EdgeRightMasksAux
|
||||
!byte %00000011 ; also terminates LeftMasksAux
|
||||
!byte %00001111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
|
||||
BuildDrawingRoutines
|
||||
; copy codegen data to zero page
|
||||
ldx #0
|
||||
- lda CODEGEN_COPY_START, x
|
||||
sta $09, x
|
||||
inx
|
||||
bne -
|
||||
;X=0 here
|
||||
|
||||
; copy the half of the source image from $4000/aux to main memory
|
||||
jsr CopyAuxDHGRToMain
|
||||
;X,Y=0 here
|
||||
|
||||
; generate drawing routines for copy01, then copy00
|
||||
jsr BuildStage1And0
|
||||
; A=0 here
|
||||
sta <FIRST_ROW
|
||||
|
||||
; generate drawing routines for copy0F..copy02, then clear0F..clear02
|
||||
lda #<MIDDLE_STAGE
|
||||
--- eor #(<OUTER_STAGE XOR <MIDDLE_STAGE)
|
||||
sta <codegen_token_src
|
||||
ldx #6
|
||||
-- stx <codegen_maskindex
|
||||
lda EdgeLeftMasks, x
|
||||
sta <EDGE_LEFT_MASK_MAIN
|
||||
lda EdgeRightMasks, x
|
||||
sta <EDGE_RIGHT_MASK_MAIN
|
||||
lda LeftMasks, x
|
||||
sta <LEFT_MASK_MAIN
|
||||
lda RightMasks, x
|
||||
sta <RIGHT_MASK_MAIN
|
||||
lda EdgeLeftMasksAux, x
|
||||
sta <EDGE_LEFT_MASK_AUX
|
||||
lda EdgeRightMasksAux, x
|
||||
sta <EDGE_RIGHT_MASK_AUX
|
||||
lda LeftMasksAux, x
|
||||
sta <LEFT_MASK_AUX
|
||||
lda RightMasksAux, x
|
||||
sta <RIGHT_MASK_AUX
|
||||
jsr BuildDrawingRoutine
|
||||
dec <ROW_COUNT
|
||||
dec <ROW_COUNT
|
||||
dec <codegen_stage
|
||||
bmi BuildStage1And0
|
||||
lda <codegen_stage
|
||||
eor #13
|
||||
bne +
|
||||
; reset counts and switch from copy to clear
|
||||
sta <FIRST_ROW
|
||||
lda #$1D
|
||||
sta <ROW_COUNT
|
||||
lda #$A9
|
||||
sta <BYTECOPY
|
||||
lda #$24
|
||||
sta <BIT_FOR_CLEAR
|
||||
+ lda <codegen_token_src
|
||||
ldx <codegen_maskindex
|
||||
dex
|
||||
bmi ---
|
||||
bpl -- ; always branches
|
||||
|
||||
; generate drawing routines for copy01, copy00 (or clear01, clear00)
|
||||
BuildStage1And0
|
||||
lda #%00011111
|
||||
sta <LEFT_MASK_MAIN
|
||||
lda #%01111100
|
||||
sta <LEFT_MASK_AUX
|
||||
lda #<STAGE1
|
||||
jsr BuildDrawingRoutineFrom
|
||||
lda #<STAGE0
|
||||
jmp BuildDrawingRoutineFrom
|
160
src/fx/code.dhgr.dither.precomputed.1bit.a
Normal file
160
src/fx/code.dhgr.dither.precomputed.1bit.a
Normal file
@ -0,0 +1,160 @@
|
||||
!cpu 6502
|
||||
!to "build/FXCODE/DHGRDITHER1",plain
|
||||
*=$6200
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
;DHGRDitherPrecomputed1Bit
|
||||
jsr iBuildDHGRDitherMasks
|
||||
jsr iBuildDHGRSparseBitmasks1Bit
|
||||
jsr iBuildHGRTables
|
||||
jsr iBuildHGRMirrorTables
|
||||
jsr iBuildDHGRMirrorCols
|
||||
|
||||
; phase 1 - in reverse, with additional masking
|
||||
+COPY_TO_0 .start, .end
|
||||
|
||||
; set up starting coordinate for reading coordinates in reverse order
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
sta <.input
|
||||
sty <.input+1
|
||||
|
||||
; set up EOF marker to stop reading coordinates in reverse order
|
||||
lda #$80
|
||||
sta Coordinates1Bit-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
|
||||
+COPY_TO_0 .start, .end
|
||||
|
||||
; redirect additional masking pointers to an array that contains #$FFs (so no masking)
|
||||
lda #<no_masks
|
||||
sta <.evenrow_ptr
|
||||
sta <.oddrow_ptr
|
||||
|
||||
jmp .InputLoop
|
||||
.start
|
||||
!pseudopc 0 {
|
||||
.Exit1Bit rts
|
||||
.evenrow_ptr
|
||||
!word evenrow_masks
|
||||
.oddrow_ptr
|
||||
!word oddrow_masks
|
||||
.InputLoop
|
||||
ldy #0
|
||||
.input=*+1
|
||||
ldx Coordinates1Bit ; 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 .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
|
138
src/fx/code.dhgr.dither.precomputed.2bit.a
Normal file
138
src/fx/code.dhgr.dither.precomputed.2bit.a
Normal file
@ -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 #<no_masks
|
||||
sta <.evenrow_ptr
|
||||
sta <.oddrow_ptr
|
||||
|
||||
jmp .InputLoop
|
||||
|
||||
.copytozp
|
||||
+COPY_TO_0 .start, .end
|
||||
.start
|
||||
!pseudopc 0 {
|
||||
.Exit2Bit rts
|
||||
.evenrow_ptr
|
||||
!word evenrow_masks
|
||||
.oddrow_ptr
|
||||
!word oddrow_masks
|
||||
.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
|
||||
|
||||
iny
|
||||
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
|
||||
and (<.evenrow_ptr), y
|
||||
eor (<.dest1), y
|
||||
.dest1=*+1
|
||||
sta $FDFD, y
|
||||
.src2=*+1
|
||||
lda $FDFD, y
|
||||
eor (<.dest2), y
|
||||
and copymasks2bit, x
|
||||
and (<.oddrow_ptr), y
|
||||
eor (<.dest2), y
|
||||
.dest2=*+1
|
||||
sta $FDFD, y
|
||||
+ bcs +
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
sec
|
||||
bcs -
|
||||
+ sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
|
||||
; corresponding 2x2 block in right half (same row, opposite column)
|
||||
lda mirror_cols, y
|
||||
tay
|
||||
clc
|
||||
- lda mirror_copymasks2bit, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER .src1, .dest1, mirror_copymasks2bit, .evenrow_ptr
|
||||
+COPY_BIT_DITHER .src2, .dest2, mirror_copymasks2bit, .oddrow_ptr
|
||||
+ bcs +
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
sec
|
||||
bcs -
|
||||
+ 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
|
@ -2,6 +2,13 @@
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
!cpu 6502
|
||||
!to "build/FXCODE/DHGRDITHRAD",plain
|
||||
*=$6200
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
;DHGRDitherRadialPrecomputed1Bit
|
||||
evenrow_ptr = $E4 ; word
|
||||
oddrow_ptr = $E6 ; word
|
||||
mirror_src1 = $E8 ; word
|
||||
@ -15,12 +22,12 @@ dest2 = $F6 ; word
|
||||
reverse_input = $FC ; word
|
||||
input = $FE ; word
|
||||
|
||||
+BUILD_DITHER_MASKS_DHGR dithermasks
|
||||
+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
|
||||
jsr iBuildDHGRDitherMasks
|
||||
jsr iBuildDHGRSparseBitmasks1Bit
|
||||
jsr iBuildHGRTables
|
||||
jsr iBuildHGRMirrorTables
|
||||
jsr iBuildDHGRMirrorCols
|
||||
+COPY_TO_AUXMEM $62, 4
|
||||
|
||||
+LDADDR evenrow_masks
|
||||
+ST16 evenrow_ptr
|
||||
@ -34,9 +41,9 @@ input = $FE ; word
|
||||
sta <oddrow_ptr
|
||||
; /!\ execution falls through here
|
||||
FullRadial
|
||||
+LDADDR Coordinates
|
||||
+LDADDR Coordinates1Bit
|
||||
+ST16 input
|
||||
+LDADDR EndCoordinates-2
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
+ST16 reverse_input
|
||||
+HIDE_NEXT_BYTE
|
||||
Exit rts
|
||||
@ -44,80 +51,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_DITHER src1, dest1, copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER src1, dest1, copymasks1bit, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, copymasks1bit, oddrow_ptr
|
||||
+ 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_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks1bit, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks1bit, evenrow_ptr
|
||||
+ 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_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks1bit, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks1bit, evenrow_ptr
|
||||
+ 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_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER src1, dest1, mirror_copymasks1bit, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks1bit, oddrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+ sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
|
||||
inc input
|
||||
bne +
|
95
src/fx/code.dhgr.precomputed.1bit.a
Normal file
95
src/fx/code.dhgr.precomputed.1bit.a
Normal file
@ -0,0 +1,95 @@
|
||||
!cpu 6502
|
||||
!to "build/FXCODE/DHGR1",plain
|
||||
*=$6200
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
;DHGRPrecomputed1Bit
|
||||
jsr iBuildDHGRSparseBitmasks1Bit
|
||||
jsr iBuildHGRTables
|
||||
jsr iBuildHGRMirrorTables
|
||||
jsr iBuildDHGRMirrorCols
|
||||
+COPY_TO_0 .start, .end
|
||||
jmp .InputLoop
|
||||
.start
|
||||
!pseudopc 0 {
|
||||
.Exit1Bit rts
|
||||
.InputLoop
|
||||
ldy #0
|
||||
.input=*+1
|
||||
ldx Coordinates1Bit ; 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 .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
|
78
src/fx/code.dhgr.precomputed.2bit.a
Normal file
78
src/fx/code.dhgr.precomputed.2bit.a
Normal file
@ -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
|
@ -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 +
|
496
src/fx/code.hgr.48boxes.a
Normal file
496
src/fx/code.hgr.48boxes.a
Normal file
@ -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 <src
|
||||
sta <dst
|
||||
lda hgrhi, x
|
||||
sta <dst+1
|
||||
eor #$60
|
||||
sta <src+1
|
||||
RECALC_E
|
||||
INX_AND_RECALC_E
|
||||
iny
|
||||
RECALC_AND_INY_E
|
||||
STAGE_INIT ; 8 bytes
|
||||
ROW_COUNT=*+1
|
||||
ldx #$1F ; SMC
|
||||
stx <rowcount
|
||||
FIRST_ROW=*+1
|
||||
adc #$0E ; SMC
|
||||
tax
|
||||
STAGE_INIT_E
|
||||
MASKCOPY_PRE ; 5 bytes
|
||||
lda (dst), y
|
||||
BIT_FOR_CLEAR
|
||||
eor (src), y
|
||||
!byte $29 ; (AND #$44 opcode)
|
||||
MASKCOPY_PRE_E
|
||||
MASKCOPY_POST_AND_INY ; 5 bytes
|
||||
MASKCOPY_POST ; 4 bytes
|
||||
eor (dst), y
|
||||
sta (dst), y
|
||||
MASKCOPY_POST_E
|
||||
iny
|
||||
MASKCOPY_POST_AND_INY_E
|
||||
COPY_AND_INY ; 5 bytes
|
||||
COPY ; 4 bytes
|
||||
lda (src), y
|
||||
sta (dst), y
|
||||
COPY_E
|
||||
INY2 ; 2 bytes
|
||||
iny
|
||||
COPY_AND_INY_E
|
||||
iny
|
||||
INY2_E
|
||||
DEY2 ; 2 bytes
|
||||
dey
|
||||
dey
|
||||
DEY2_E
|
||||
MIDDLE_BRANCHES ; 6 bytes
|
||||
dec <rowcount
|
||||
; these monsters avoid hard-coded branching
|
||||
; trailing -2 for dec rowcount, -2 for branch itself
|
||||
!byte $F0,MASKCOPY_PRE-MASKCOPY_PRE_E+EDGE_LEFT_MASK-EDGE_LEFT_MASK_E+MASKCOPY_POST_AND_INY-MASKCOPY_POST_AND_INY_E+COPY_AND_INY-COPY_AND_INY_E+MASKCOPY_PRE-MASKCOPY_PRE_E+EDGE_RIGHT_MASK-EDGE_RIGHT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+DEY2-DEY2_E+MASKCOPY_PRE-MASKCOPY_PRE_E+LEFT_MASK-LEFT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+INY2-INY2_E+MASKCOPY_PRE-MASKCOPY_PRE_E+RIGHT_MASK-RIGHT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+DEY2-DEY2_E+INX_AND_RECALC-INX_AND_RECALC_E-2-2
|
||||
; another -2 for the previous branch as well
|
||||
!byte $10,MASKCOPY_PRE-MASKCOPY_PRE_E+LEFT_MASK-LEFT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+INY2-INY2_E+MASKCOPY_PRE-MASKCOPY_PRE_E+RIGHT_MASK-RIGHT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+DEY2-DEY2_E+INX_AND_RECALC-INX_AND_RECALC_E-2-2-2
|
||||
MIDDLE_BRANCHES_E
|
||||
OUTER_BRANCHES ; 6 bytes
|
||||
dec <rowcount
|
||||
; these monsters avoid hard-coded branching
|
||||
; trailing -2 for dec rowcount, -2 for branch itself
|
||||
!byte $F0,MASKCOPY_PRE-MASKCOPY_PRE_E+EDGE_LEFT_MASK-EDGE_LEFT_MASK_E+MASKCOPY_POST_AND_INY-MASKCOPY_POST_AND_INY_E+COPY_AND_INY-COPY_AND_INY_E+COPY_AND_INY-COPY_AND_INY_E+COPY_AND_INY-COPY_AND_INY_E+MASKCOPY_PRE-MASKCOPY_PRE_E+EDGE_RIGHT_MASK-EDGE_RIGHT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+DEY2-DEY2_E+DEY2-DEY2_E+MASKCOPY_PRE-MASKCOPY_PRE_E+LEFT_MASK-LEFT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+INY2-INY2_E+INY2-INY2_E+MASKCOPY_PRE-MASKCOPY_PRE_E+RIGHT_MASK-RIGHT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+DEY2-DEY2_E+DEY2-DEY2_E+INX_AND_RECALC-INX_AND_RECALC_E-2-2
|
||||
; another -2 for the previous branch as well
|
||||
!byte $10,MASKCOPY_PRE-MASKCOPY_PRE_E+LEFT_MASK-LEFT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+INY2-INY2_E+INY2-INY2_E+MASKCOPY_PRE-MASKCOPY_PRE_E+RIGHT_MASK-RIGHT_MASK_E+MASKCOPY_POST-MASKCOPY_POST_E+DEY2-DEY2_E+DEY2-DEY2_E+INX_AND_RECALC-INX_AND_RECALC_E-2-2-2
|
||||
OUTER_BRANCHES_E
|
||||
EDGE_LEFT_MASK = $FC
|
||||
EDGE_LEFT_MASK_E = $FD
|
||||
EDGE_RIGHT_MASK = $FD
|
||||
EDGE_RIGHT_MASK_E = $FE
|
||||
LEFT_MASK = $FE
|
||||
LEFT_MASK_E = $FF
|
||||
RIGHT_MASK = $FF
|
||||
RIGHT_MASK_E = $100
|
||||
|
||||
codegen_piece_lengths ; length of each of the pieces
|
||||
!byte RTS0_E-RTS0
|
||||
!byte INX_AND_RECALC_E-INX_AND_RECALC
|
||||
!byte RECALC_E-RECALC
|
||||
!byte RECALC_AND_INY_E-RECALC_AND_INY
|
||||
!byte STAGE_INIT_E-STAGE_INIT
|
||||
!byte MASKCOPY_PRE_E-MASKCOPY_PRE
|
||||
!byte MASKCOPY_POST_AND_INY_E-MASKCOPY_POST_AND_INY
|
||||
!byte MASKCOPY_POST_E-MASKCOPY_POST
|
||||
!byte COPY_AND_INY_E-COPY_AND_INY
|
||||
!byte COPY_E-COPY
|
||||
!byte DEY2_E-DEY2
|
||||
!byte INY2_E-INY2
|
||||
!byte MIDDLE_BRANCHES_E-MIDDLE_BRANCHES
|
||||
!byte OUTER_BRANCHES_E-OUTER_BRANCHES
|
||||
!byte EDGE_LEFT_MASK_E-EDGE_LEFT_MASK
|
||||
!byte EDGE_RIGHT_MASK_E-EDGE_RIGHT_MASK
|
||||
!byte LEFT_MASK_E-LEFT_MASK
|
||||
!byte RIGHT_MASK_E-RIGHT_MASK
|
||||
|
||||
codegen_pieces ; address of each of the pieces (on zero page, so 1 byte)
|
||||
!byte <RTS0
|
||||
!byte <INX_AND_RECALC
|
||||
!byte <RECALC
|
||||
!byte <RECALC_AND_INY
|
||||
!byte <STAGE_INIT
|
||||
!byte <MASKCOPY_PRE
|
||||
!byte <MASKCOPY_POST_AND_INY
|
||||
!byte <MASKCOPY_POST
|
||||
!byte <COPY_AND_INY
|
||||
!byte <COPY
|
||||
!byte <DEY2
|
||||
!byte <INY2
|
||||
!byte <MIDDLE_BRANCHES
|
||||
!byte <OUTER_BRANCHES
|
||||
!byte <EDGE_LEFT_MASK
|
||||
!byte <EDGE_RIGHT_MASK
|
||||
!byte <LEFT_MASK
|
||||
!byte <RIGHT_MASK
|
||||
|
||||
; Template for 'stage 0' routine (copy00), which copies the innermost
|
||||
; part of the box (labeled '0' in diagram above).
|
||||
STAGE0
|
||||
!byte k_stage_init
|
||||
!byte k_recalc
|
||||
!byte k_iny2
|
||||
!byte k_maskcopy_pre, k_left_mask, k_maskcopy_post
|
||||
!byte k_inx_and_recalc
|
||||
!byte k_maskcopy_pre, k_left_mask, k_maskcopy_post
|
||||
!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_stage_init
|
||||
!byte k_recalc
|
||||
!byte k_iny2
|
||||
!byte k_copy
|
||||
!byte k_inx_and_recalc
|
||||
!byte k_copy
|
||||
!byte k_inx_and_recalc
|
||||
!byte k_copy
|
||||
!byte k_inx_and_recalc
|
||||
!byte k_copy
|
||||
!byte k_rts ; also serves as an end-of-template marker
|
||||
|
||||
; Template for stages 2-8 (copy02..copy08)
|
||||
MIDDLE_STAGE
|
||||
!byte k_stage_init
|
||||
!byte k_recalc_and_iny
|
||||
!byte k_maskcopy_pre, k_edge_left_mask, k_maskcopy_post_and_iny
|
||||
!byte k_copy_and_iny
|
||||
!byte k_maskcopy_pre, k_edge_right_mask, k_maskcopy_post
|
||||
!byte k_dey2
|
||||
!byte k_maskcopy_pre, k_left_mask, k_maskcopy_post
|
||||
!byte k_iny2
|
||||
!byte k_maskcopy_pre, k_right_mask, k_maskcopy_post
|
||||
!byte k_dey2
|
||||
!byte k_inx_and_recalc
|
||||
!byte k_middle_branches
|
||||
!byte k_rts ; also serves as an end-of-template marker
|
||||
|
||||
; Template for stages 9-15 (copy09..copy0F)
|
||||
OUTER_STAGE
|
||||
!byte k_stage_init
|
||||
!byte k_recalc
|
||||
!byte k_maskcopy_pre, k_edge_left_mask, k_maskcopy_post_and_iny
|
||||
!byte k_copy_and_iny
|
||||
!byte k_copy_and_iny
|
||||
!byte k_copy_and_iny
|
||||
!byte k_maskcopy_pre, k_edge_right_mask, k_maskcopy_post
|
||||
!byte k_dey2
|
||||
!byte k_dey2
|
||||
!byte k_maskcopy_pre, k_left_mask, k_maskcopy_post
|
||||
!byte k_iny2
|
||||
!byte k_iny2
|
||||
!byte k_maskcopy_pre, k_right_mask, k_maskcopy_post
|
||||
!byte k_dey2
|
||||
!byte k_dey2
|
||||
!byte k_inx_and_recalc
|
||||
!byte k_outer_branches
|
||||
!byte k_rts ; also serves as an end-of-template marker
|
||||
|
||||
EdgeRightMasks
|
||||
!byte %10000001
|
||||
!byte %10000011
|
||||
!byte %10000111
|
||||
!byte %10001111
|
||||
!byte %10011111
|
||||
!byte %10111111
|
||||
!byte %11111111
|
||||
LeftMasks
|
||||
!byte %11000000
|
||||
!byte %10100000
|
||||
!byte %10010000
|
||||
!byte %10001000
|
||||
!byte %10000100
|
||||
!byte %10000010
|
||||
RightMasks
|
||||
!byte %10000001 ; also the last item in LeftMasks
|
||||
!byte %10000010
|
||||
!byte %10000100
|
||||
!byte %10001000
|
||||
!byte %10010000
|
||||
!byte %10100000
|
||||
EdgeLeftMasks
|
||||
!byte %11000000 ; also the last item in RightMasks
|
||||
!byte %11100000
|
||||
!byte %11110000
|
||||
!byte %11111000
|
||||
!byte %11111100
|
||||
!byte %11111110
|
||||
!byte %11111111
|
||||
|
||||
codegen_stage
|
||||
!byte 27
|
||||
codegen_maskindex
|
||||
!byte 0
|
||||
|
||||
BuildDrawingRoutineFrom
|
||||
sta <codegen_token_src
|
||||
BuildDrawingRoutine
|
||||
ldy #0
|
||||
sty <codegen_token_x
|
||||
BuildTokenLoop
|
||||
codegen_token_x=*+1
|
||||
ldx #$00
|
||||
codegen_token_src=*+1
|
||||
lda <OUTER_STAGE, x
|
||||
inc <codegen_token_x
|
||||
pha
|
||||
tax
|
||||
lda <codegen_piece_lengths, x
|
||||
sta <piece_length
|
||||
lda <codegen_pieces, x
|
||||
sta <piece_src
|
||||
ldx #0
|
||||
BuildPieceLoop
|
||||
piece_src=*+1
|
||||
lda $FD, x ; SMC
|
||||
!byte $99,$00 ; STA $4400, Y
|
||||
codegen_dst
|
||||
!byte copy01 ; SMC
|
||||
iny
|
||||
inx
|
||||
piece_length=*+1
|
||||
cpx #$FD ; SMC
|
||||
bcc BuildPieceLoop
|
||||
pla
|
||||
bne BuildTokenLoop
|
||||
dec <codegen_dst
|
||||
inc <FIRST_ROW
|
||||
rts
|
||||
}
|
||||
|
||||
BuildDrawingRoutines
|
||||
; copy codegen data to zero page
|
||||
ldx #0
|
||||
- lda CODEGEN_COPY_START, x
|
||||
sta $00, x
|
||||
inx
|
||||
bne -
|
||||
|
||||
; generate drawing routines for copy01, then copy00
|
||||
jsr BuildStage1And0
|
||||
; A=0 here
|
||||
sta <FIRST_ROW
|
||||
|
||||
; generate drawing routines for copy0F..copy02, then clear0F..clear02
|
||||
lda #<MIDDLE_STAGE
|
||||
--- eor #(<OUTER_STAGE XOR <MIDDLE_STAGE)
|
||||
sta <codegen_token_src
|
||||
ldx #6
|
||||
-- stx <codegen_maskindex
|
||||
lda <EdgeLeftMasks, x
|
||||
sta <EDGE_LEFT_MASK
|
||||
lda <EdgeRightMasks, x
|
||||
sta <EDGE_RIGHT_MASK
|
||||
lda <LeftMasks, x
|
||||
sta <LEFT_MASK
|
||||
lda <RightMasks, x
|
||||
sta <RIGHT_MASK
|
||||
jsr BuildDrawingRoutine
|
||||
dec <ROW_COUNT
|
||||
dec <ROW_COUNT
|
||||
dec <codegen_stage
|
||||
bmi BuildStage1And0
|
||||
lda <codegen_stage
|
||||
eor #13
|
||||
bne +
|
||||
sta <FIRST_ROW
|
||||
lda #$1F
|
||||
sta <ROW_COUNT
|
||||
lda #$A9
|
||||
sta <COPY
|
||||
lda #$24
|
||||
sta <BIT_FOR_CLEAR
|
||||
+ lda <codegen_token_src
|
||||
ldx <codegen_maskindex
|
||||
dex
|
||||
bmi ---
|
||||
bpl -- ; always branches
|
||||
|
||||
; generate drawing routines for copy01, copy00 (or clear01, clear00)
|
||||
BuildStage1And0
|
||||
lda #%10111110
|
||||
sta <LEFT_MASK
|
||||
lda #<STAGE1
|
||||
jsr BuildDrawingRoutineFrom
|
||||
lda #<STAGE0
|
||||
jmp BuildDrawingRoutineFrom
|
||||
|
||||
start
|
||||
!pseudopc 5 {
|
||||
MainLoop ldx #47
|
||||
BoxLoop ldy <BoxStages, x ; for each box, get its current stage
|
||||
inc <BoxStages, x ; increment every box's stage every time through the loop
|
||||
lda HGR48StageDrawingRoutines, y
|
||||
beq <NextBox ; if stage's drawing routine is 0, nothing to do
|
||||
sta <j+2
|
||||
lda <BoxesX, x ; A = starting HGR row for this box
|
||||
ldy <BoxesY, x ; Y = starting byte offset for this box
|
||||
clc
|
||||
stx <ReBox+1
|
||||
j jsr $0000 ; [SMC] call drawing routine for this stage
|
||||
ReBox ldx #$FD ; [SMC]
|
||||
NextBox dex
|
||||
bpl <BoxLoop
|
||||
lda <j+2
|
||||
bpl + ; if we didn't draw anything in any box, we're done
|
||||
lda KBD
|
||||
sta <j+2
|
||||
bpl <MainLoop
|
||||
+ rts
|
||||
BoxStages
|
||||
!if (BoxStages != $2D) { !serious "BoxStages=",* }
|
||||
}
|
||||
end
|
140
src/fx/code.hgr.dither.precomputed.1bit.a
Normal file
140
src/fx/code.hgr.dither.precomputed.1bit.a
Normal file
@ -0,0 +1,140 @@
|
||||
!cpu 6502
|
||||
!to "build/FXCODE/HGRDITHER1",plain
|
||||
*=$6200
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
;HGRDitherPrecomputed1Bit
|
||||
jsr iBuildHGRDitherMasks
|
||||
jsr iBuildHGRTables
|
||||
jsr iBuildHGRMirrorTables
|
||||
jsr iBuildHGRMirrorCols
|
||||
jsr iBuildHGRSparseBitmasks1Bit
|
||||
|
||||
; phase 1 - in reverse, with additional masking
|
||||
+COPY_TO_0 .start, .end
|
||||
|
||||
; set up starting coordinate for reading coordinates in reverse order
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
sta <.input
|
||||
sty <.input+1
|
||||
|
||||
; set up EOF marker to stop reading coordinates in reverse order
|
||||
lda #$80
|
||||
sta Coordinates1Bit-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
|
||||
+COPY_TO_0 .start, .end
|
||||
|
||||
; redirect additional masking pointers to an array that contains #$FFs (so no masking)
|
||||
lda #<no_masks
|
||||
sta <.evenrow_ptr
|
||||
sta <.oddrow_ptr
|
||||
|
||||
jmp .InputLoop
|
||||
.start
|
||||
!pseudopc 0 {
|
||||
.Exit1Bit rts
|
||||
.evenrow_ptr
|
||||
!word evenrow_masks
|
||||
.oddrow_ptr
|
||||
!word oddrow_masks
|
||||
.InputLoop
|
||||
ldy #0
|
||||
.input=*+1
|
||||
ldx Coordinates1Bit ; 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 .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
|
126
src/fx/code.hgr.dither.precomputed.2bit.a
Normal file
126
src/fx/code.hgr.dither.precomputed.2bit.a
Normal file
@ -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 #<no_masks
|
||||
sta <.evenrow_ptr
|
||||
sta <.oddrow_ptr
|
||||
|
||||
jmp .InputLoop
|
||||
|
||||
.copytozp
|
||||
+COPY_TO_0 .start, .end
|
||||
.start
|
||||
!pseudopc 0 {
|
||||
.Exit2Bit rts
|
||||
.evenrow_ptr
|
||||
!word evenrow_masks
|
||||
.oddrow_ptr
|
||||
!word oddrow_masks
|
||||
.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
|
||||
|
||||
iny
|
||||
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
|
||||
and (<.evenrow_ptr), y
|
||||
eor (<.dest1), y
|
||||
.dest1=*+1
|
||||
sta $FDFD, y
|
||||
.src2=*+1
|
||||
lda $FDFD, y
|
||||
eor (<.dest2), y
|
||||
and copymasks2bit, x
|
||||
and (<.oddrow_ptr), y
|
||||
eor (<.dest2), y
|
||||
.dest2=*+1
|
||||
sta $FDFD, y
|
||||
|
||||
; corresponding 2x2 block in right half (same row, opposite column)
|
||||
lda mirror_cols, y
|
||||
tay
|
||||
lda (<.src1), y
|
||||
eor (<.dest1), y
|
||||
and mirror_copymasks2bit, x
|
||||
and (<.evenrow_ptr), y
|
||||
eor (<.dest1), y
|
||||
sta (<.dest1), y
|
||||
|
||||
lda (<.src2), y
|
||||
eor (<.dest2), y
|
||||
and mirror_copymasks2bit, x
|
||||
and (<.oddrow_ptr), y
|
||||
eor (<.dest2), y
|
||||
sta (<.dest2), y
|
||||
|
||||
.next
|
||||
inc <.input
|
||||
inc <.input
|
||||
bne .InputLoop
|
||||
bit KBD
|
||||
bmi .Exit2Bit
|
||||
inc <.input+1
|
||||
bne .InputLoop ; always branches
|
||||
}
|
||||
.end
|
||||
|
||||
.next2_start
|
||||
!pseudopc .next {
|
||||
lda <.input
|
||||
php
|
||||
dec <.input
|
||||
dec <.input
|
||||
plp
|
||||
bne .InputLoop
|
||||
dec <.input+1
|
||||
bit KBD
|
||||
bpl .InputLoop
|
||||
rts
|
||||
}
|
||||
.next2_end
|
148
src/fx/code.hgr.dither.precomputed.3bit.a
Normal file
148
src/fx/code.hgr.dither.precomputed.3bit.a
Normal file
@ -0,0 +1,148 @@
|
||||
!cpu 6502
|
||||
!to "build/FXCODE/HGRDITHER3",plain
|
||||
*=$6200
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
;HGRDitherPrecomputed3Bit
|
||||
jsr iBuildHGRDitherMasks
|
||||
jsr iSetupPrecomputed3Bit
|
||||
|
||||
; phase 1 - in reverse, with additional masking
|
||||
+COPY_TO_0 .start, .end
|
||||
|
||||
; set up starting coordinate for reading coordinates in reverse order
|
||||
+LDADDR EndCoordinates3Bit-2
|
||||
sta <.input
|
||||
sty <.input+1
|
||||
|
||||
; set up EOF marker to stop reading coordinates in reverse order
|
||||
lda #$80
|
||||
sta Coordinates3Bit-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 -
|
||||
|
||||
; set up pointers to dither mask pointers so even rows do even-row dithering and odd rows do odd-row dithering
|
||||
ldx #$7F
|
||||
- lda #<evenrow_masks
|
||||
sta dither1_lo, x
|
||||
sta dither2_lo-1, x
|
||||
sta dither3_lo, x
|
||||
lda #<oddrow_masks
|
||||
sta dither1_lo-1, x
|
||||
sta dither2_lo, x
|
||||
sta dither3_lo-1, x
|
||||
dex
|
||||
dex
|
||||
bpl -
|
||||
jsr .InputLoop
|
||||
|
||||
bit KBD
|
||||
bmi .start
|
||||
|
||||
; phase 2 - in order, without additional masking
|
||||
+COPY_TO_0 .start, .end
|
||||
|
||||
; set up pointers to dither mask pointers so all rows do no dithering
|
||||
ldx #$7F
|
||||
- lda #<no_masks
|
||||
sta dither1_lo, x
|
||||
sta dither2_lo, x
|
||||
sta dither3_lo, x
|
||||
dex
|
||||
bpl -
|
||||
jmp .InputLoop
|
||||
.start
|
||||
!pseudopc 0 {
|
||||
.Exit3Bit rts
|
||||
.dither1_ptr
|
||||
!word evenrow_masks
|
||||
.dither2_ptr
|
||||
!word oddrow_masks
|
||||
.dither3_ptr
|
||||
!word evenrow_masks
|
||||
.InputLoop
|
||||
ldy #0
|
||||
.input=*+1
|
||||
lda Coordinates3Bit
|
||||
bmi .Exit3Bit ; if high bit is 1 then we're done
|
||||
cmp #$40
|
||||
php
|
||||
tax
|
||||
lda dither1_lo, x
|
||||
sta .dither1_ptr
|
||||
lda dither2_lo, x
|
||||
sta .dither2_ptr
|
||||
lda dither3_lo, x
|
||||
sta .dither3_ptr
|
||||
+ROW_X_TO_3BIT_BASE_ADDRESSES .src1, .src2, .src3, .dest1, .dest2, .dest3
|
||||
|
||||
iny
|
||||
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
|
||||
and (<.dither1_ptr), y
|
||||
eor (<.dest1), y
|
||||
.dest1=*+1
|
||||
sta $FDFD, y
|
||||
.src2=*+1
|
||||
lda $FDFD, y
|
||||
eor (<.dest2), y
|
||||
and copymasks3bit, x
|
||||
and (<.dither2_ptr), y
|
||||
eor (<.dest2), y
|
||||
.dest2=*+1
|
||||
sta $FDFD, y
|
||||
.src3=*+1
|
||||
lda $FDFD, y
|
||||
eor (<.dest3), y
|
||||
and copymasks3bit, x
|
||||
and (<.dither3_ptr), y
|
||||
eor (<.dest3), y
|
||||
.dest3=*+1
|
||||
sta $FDFD, y
|
||||
|
||||
.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
|
@ -1,6 +1,11 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FXCODE/HGRDITHERRADIAL",plain
|
||||
*=$6200
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
evenrow_ptr = $E4 ; word
|
||||
oddrow_ptr = $E6 ; word
|
||||
@ -15,11 +20,12 @@ dest2 = $F6 ; word
|
||||
reverse_input = $FC ; word
|
||||
input = $FE ; word
|
||||
|
||||
+BUILD_DITHER_MASKS dithermasks
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_SPARSE_BITMASKS_1BIT
|
||||
;HGRDitherRadialPrecomputed1Bit
|
||||
jsr iBuildHGRDitherMasks
|
||||
jsr iBuildHGRMirrorCols
|
||||
jsr iBuildHGRTables
|
||||
jsr iBuildHGRMirrorTables
|
||||
jsr iBuildHGRSparseBitmasks1Bit
|
||||
|
||||
+LDADDR evenrow_masks
|
||||
+ST16 evenrow_ptr
|
||||
@ -33,9 +39,9 @@ input = $FE ; word
|
||||
sta <oddrow_ptr
|
||||
; /!\ execution falls through here
|
||||
FullRadial
|
||||
+LDADDR Coordinates
|
||||
+LDADDR Coordinates1Bit
|
||||
+ST16 input
|
||||
+LDADDR EndCoordinates-2
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
+ST16 reverse_input
|
||||
+HIDE_NEXT_BYTE
|
||||
Exit rts
|
||||
@ -43,40 +49,40 @@ 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)
|
||||
+COPY_BIT_DITHER src1, dest1, copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER src1, dest1, copymasks1bit, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, copymasks1bit, oddrow_ptr
|
||||
|
||||
; bottom-right quadrant (opposite row, opposite column, original input order)
|
||||
lda mirror_cols,y
|
||||
tay
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks1bit, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks1bit, evenrow_ptr
|
||||
|
||||
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)
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks1bit, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks1bit, evenrow_ptr
|
||||
|
||||
; top-right quadrant (same row, opposite column, reverse input order)
|
||||
lda mirror_cols,y
|
||||
tay
|
||||
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER src1, dest1, mirror_copymasks1bit, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks1bit, oddrow_ptr
|
||||
|
||||
inc input
|
||||
bne +
|
75
src/fx/code.hgr.precomputed.1bit.a
Normal file
75
src/fx/code.hgr.precomputed.1bit.a
Normal file
@ -0,0 +1,75 @@
|
||||
!cpu 6502
|
||||
!to "build/FXCODE/HGR1",plain
|
||||
*=$6200
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
;HGRPrecomputed1Bit
|
||||
jsr iBuildHGRTables
|
||||
jsr iBuildHGRMirrorTables
|
||||
jsr iBuildHGRMirrorCols
|
||||
jsr iBuildHGRSparseBitmasks1Bit
|
||||
+COPY_TO_0 .start, .end
|
||||
jmp .InputLoop
|
||||
.start
|
||||
!pseudopc 0 {
|
||||
.Exit1Bit rts
|
||||
.InputLoop
|
||||
ldy #0
|
||||
.input=*+1
|
||||
ldx Coordinates1Bit ; 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 .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
|
56
src/fx/code.hgr.precomputed.2bit.a
Normal file
56
src/fx/code.hgr.precomputed.2bit.a
Normal file
@ -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
|
65
src/fx/code.hgr.precomputed.3bit.a
Normal file
65
src/fx/code.hgr.precomputed.3bit.a
Normal file
@ -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
|
82
src/fx/code.hgr.radial.a
Normal file
82
src/fx/code.hgr.radial.a
Normal file
@ -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
|
@ -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
|
||||
|
@ -29,9 +29,9 @@ loop2 txa
|
||||
clc
|
||||
adc #$7C
|
||||
sta <src+2
|
||||
sta $C004
|
||||
sta WRITEMAINMEM
|
||||
bmi +
|
||||
sta $C005
|
||||
sta WRITEAUXMEM
|
||||
+ jsr src
|
||||
txa
|
||||
lsr
|
||||
@ -41,7 +41,7 @@ loop2 txa
|
||||
tay
|
||||
bcc loop2
|
||||
bne loop
|
||||
bit $C000
|
||||
bit KBD
|
||||
bmi exit
|
||||
txa
|
||||
bne loop1
|
||||
|
@ -16,9 +16,9 @@ copymasks = $6200 ; [256 bytes, page-aligned, duplicated in a
|
||||
-- ldy #$40 ; create identical copymask tables in main and aux memory
|
||||
ora #%10000000
|
||||
- sta copymasks, x
|
||||
sta $C005
|
||||
sta WRITEAUXMEM
|
||||
sta copymasks, x
|
||||
sta $C004
|
||||
sta WRITEMAINMEM
|
||||
inx
|
||||
dey
|
||||
bne -
|
||||
@ -29,14 +29,14 @@ copymasks = $6200 ; [256 bytes, page-aligned, duplicated in a
|
||||
-- ldy #$20 ; create identical address tables in main and aux memory
|
||||
tya
|
||||
- sta addrs, x
|
||||
sta $C005
|
||||
sta WRITEAUXMEM
|
||||
sta addrs, x
|
||||
sta $C004
|
||||
sta WRITEMAINMEM
|
||||
eor #$A0
|
||||
sta addrs+1, x
|
||||
sta $C005
|
||||
sta WRITEAUXMEM
|
||||
sta addrs+1, x
|
||||
sta $C004
|
||||
sta WRITEMAINMEM
|
||||
eor #$A0
|
||||
adc #1
|
||||
inx
|
||||
@ -51,7 +51,7 @@ start
|
||||
!pseudopc 0 {
|
||||
!byte %00000011
|
||||
;Y=0 on entry to copyaux
|
||||
copyaux sta $C003 ; copy $4000/aux to $8000/main
|
||||
copyaux sta READAUXMEM ; copy $4000/aux to $8000/main
|
||||
ldx #$20
|
||||
a lda $4000, y
|
||||
b sta $8000, y
|
||||
@ -61,7 +61,7 @@ b sta $8000, y
|
||||
inc b+2
|
||||
dex
|
||||
bne a
|
||||
sta $C002
|
||||
sta READMAINMEM
|
||||
sta $C001 ; 80STORE mode
|
||||
; X,Y=0 on entry to LFSR
|
||||
loop txa
|
||||
@ -86,7 +86,7 @@ dst sta $FD00, y ; write the result
|
||||
tay
|
||||
bcc loop2 ; C modified by ror
|
||||
bne loop ; Z modified by tay
|
||||
lda $C000
|
||||
lda KBD
|
||||
bmi exit
|
||||
txa
|
||||
bne loop1
|
||||
@ -112,7 +112,7 @@ auxdst sta $FD00, y
|
||||
tay
|
||||
bcc loop2
|
||||
bne loop
|
||||
lda $C000
|
||||
lda KBD
|
||||
bmi exit
|
||||
txa
|
||||
bne loop1
|
||||
|
@ -5,14 +5,13 @@
|
||||
!to "build/FX.INDEXED/DHGR.TWOPASS.LR",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
|
||||
@ -35,17 +34,17 @@ rowloop
|
||||
- sec
|
||||
src lda $FDFD, y ; SMC
|
||||
dst sta $FDFD ,y ; SMC
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
bcc -
|
||||
sta $C002
|
||||
sta $C004
|
||||
sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
inx
|
||||
inx
|
||||
cpx #$C0
|
||||
bcc rowloop
|
||||
lda #$10
|
||||
jsr WaitForKeyWithTimeout
|
||||
jsr iWaitForKeyWithTimeout
|
||||
bmi exit
|
||||
iny
|
||||
cpy #$28
|
||||
@ -53,7 +52,5 @@ dst sta $FDFD ,y ; SMC
|
||||
lda <startx
|
||||
beq loop
|
||||
exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
}
|
||||
end
|
||||
|
@ -5,8 +5,6 @@
|
||||
!to "build/FX.INDEXED/DHGR.48.2SNAKES",plain
|
||||
*=$6000
|
||||
|
||||
USES_CLEAR = 0
|
||||
|
||||
!source "src/fx/fx.dhgr.48boxes.common.a"
|
||||
|
||||
!byte $00,$FE,$FC,$FA,$D8,$D6,$D4,$D2
|
||||
@ -17,20 +15,20 @@ USES_CLEAR = 0
|
||||
!byte $D2,$D4,$D6,$D8,$FA,$FC,$FE,$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
|
||||
|
@ -15,38 +15,38 @@
|
||||
!byte $00,$FC,$F8,$F4,$F0,$EC,$E8,$E4
|
||||
|
||||
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 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
|
||||
|
@ -5,8 +5,6 @@
|
||||
!to "build/FX.INDEXED/DHGR.48.ARROW",plain
|
||||
*=$6000
|
||||
|
||||
USES_CLEAR = 0
|
||||
|
||||
!source "src/fx/fx.dhgr.48boxes.common.a"
|
||||
|
||||
!byte $FA,$F6,$F4,$F0,$EE,$EA,$E8,$E4
|
||||
@ -17,20 +15,20 @@ USES_CLEAR = 0
|
||||
!byte $F9,$F7,$F3,$F1,$ED,$EB,$E7,$E5
|
||||
|
||||
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
|
||||
|
@ -2,752 +2,42 @@
|
||||
;(c) 2020 by 4am & qkumba
|
||||
;
|
||||
|
||||
; 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
|
||||
;
|
||||
|
||||
!ifndef USES_CLEAR {
|
||||
; if an effect doesn't use any clear stages, you can reduce code size
|
||||
; by setting USES_CLEAR=0 before including this file
|
||||
USES_CLEAR = 1
|
||||
}
|
||||
|
||||
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
|
||||
BoxStages = $10 ; [$30 bytes] current stage for each box
|
||||
auxsrc_hgrhi = $BC00 ; [$C0 bytes] HGR base addresses (hi) starting at $9000
|
||||
hgrhi = $BD00 ; [$C0 bytes] HGR base addresses (hi) starting at $2000
|
||||
hgrlo = $BE00 ; [$C0 bytes] HGR base addresses (lo) starting at $2000
|
||||
BoxesX = $BDC0 ; [$30 bytes] starting row for each box
|
||||
BoxesY = $BEC0 ; [$30 bytes] starting byte offset for each box
|
||||
|
||||
; 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 = $70
|
||||
clear01 = $71
|
||||
clear02 = $72
|
||||
clear03 = $73
|
||||
clear04 = $74
|
||||
clear05 = $75
|
||||
clear06 = $76
|
||||
clear07 = $77
|
||||
clear08 = $78
|
||||
clear09 = $79
|
||||
clear0A = $7A
|
||||
clear0B = $7B
|
||||
clear0C = $7C
|
||||
clear0D = $7D
|
||||
clear0E = $7E
|
||||
clear0F = $7F
|
||||
copy02 = $80
|
||||
copy03 = $81
|
||||
copy04 = $82
|
||||
copy05 = $83
|
||||
copy06 = $84
|
||||
copy07 = $85
|
||||
copy08 = $86
|
||||
copy09 = $87
|
||||
copy0A = $88
|
||||
copy0B = $89
|
||||
copy0C = $8A
|
||||
copy0D = $8B
|
||||
copy0E = $8C
|
||||
copy0F = $8D
|
||||
copy00 = $8E
|
||||
copy01 = $8F
|
||||
|
||||
; 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"
|
||||
|
||||
; 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
|
||||
InitOnce
|
||||
bit .Start
|
||||
lda #$4C
|
||||
sta InitOnce
|
||||
+LDADDR .FXCodeFile
|
||||
ldx #>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 <RTS0
|
||||
; these 8 addresses are never used so we stuff 8 bytes of unrelated data here
|
||||
;!byte <EDGE_LEFT_MASK_MAIN
|
||||
;!byte <EDGE_RIGHT_MASK_MAIN
|
||||
;!byte <LEFT_MASK_MAIN
|
||||
;!byte <RIGHT_MASK_MAIN
|
||||
;!byte <EDGE_LEFT_MASK_AUX
|
||||
;!byte <EDGE_RIGHT_MASK_AUX
|
||||
;!byte <LEFT_MASK_AUX
|
||||
;!byte <RIGHT_MASK_AUX
|
||||
;
|
||||
MIDDLE_BRANCH
|
||||
dec rowcount
|
||||
!byte $10,$C8
|
||||
MIDDLE_BRANCH_E
|
||||
;
|
||||
OUTER_BRANCH
|
||||
dec rowcount
|
||||
!byte $10,$C6
|
||||
OUTER_BRANCH_E
|
||||
;
|
||||
!byte <codegen_dst ; current page
|
||||
!byte <SWITCH_TO_MAIN
|
||||
!byte <SWITCH_TO_AUX
|
||||
!byte <SWITCH_TO_AUX_AND_BYTE_COPY
|
||||
!byte <INX_AND_RECALC
|
||||
!byte <RECALC
|
||||
!byte <SET_ROW_COUNT
|
||||
!byte <SET_FIRST_ROW
|
||||
!byte <INY2
|
||||
!byte <INY1
|
||||
!byte <DEY1
|
||||
!byte <SAVE_Y
|
||||
!byte <RESTORE_Y
|
||||
!byte <MIDDLE_JSR
|
||||
!byte <OUTER_JSR
|
||||
!byte <MIDDLE_BRANCH
|
||||
!byte <OUTER_BRANCH
|
||||
!byte <MASKCOPY_PRE
|
||||
!byte <MASKCOPY_POST
|
||||
!byte <BYTECOPY
|
||||
!byte <BYTECOPY_AND_INY
|
||||
;!byte 0 ; bitcopy pseudo-opcode has no piece of its own
|
||||
|
||||
codegen_piece_lengths ; length of each of the pieces
|
||||
!byte RTS0_E-RTS0
|
||||
; these 8 lengths are never used so we stuff 8 bytes of unrelated data here
|
||||
;!byte 1 ; edge left mask main
|
||||
;!byte 1 ; edge right mask main
|
||||
;!byte 1 ; left mask main
|
||||
;!byte 1 ; right mask main
|
||||
;!byte 1 ; edge left mask aux
|
||||
;!byte 1 ; edge right mask aux
|
||||
;!byte 1 ; left mask aux
|
||||
;!byte 1 ; right mask aux
|
||||
;
|
||||
MASKCOPY_POST
|
||||
eor (dst), y
|
||||
sta (dst), y
|
||||
MASKCOPY_POST_E
|
||||
;
|
||||
MIDDLE_JSR
|
||||
!byte $20,$46
|
||||
MIDDLE_JSR_E
|
||||
OUTER_JSR
|
||||
!byte $20,$47
|
||||
OUTER_JSR_E
|
||||
;
|
||||
!byte 1 ; current page
|
||||
!byte SWITCH_TO_MAIN_E-SWITCH_TO_MAIN
|
||||
!byte SWITCH_TO_AUX_E-SWITCH_TO_AUX
|
||||
!byte SWITCH_TO_AUX_AND_BYTE_COPY_E-SWITCH_TO_AUX_AND_BYTE_COPY
|
||||
!byte INX_AND_RECALC_E-INX_AND_RECALC
|
||||
!byte RECALC_E-RECALC
|
||||
!byte SET_ROW_COUNT_E-SET_ROW_COUNT
|
||||
!byte SET_FIRST_ROW_E-SET_FIRST_ROW
|
||||
!byte INY2_E-INY2
|
||||
!byte INY1_E-INY1
|
||||
!byte DEY1_E-DEY1
|
||||
!byte SAVE_Y_E-SAVE_Y
|
||||
!byte RESTORE_Y_E-RESTORE_Y
|
||||
!byte MIDDLE_JSR_E-MIDDLE_JSR
|
||||
!byte OUTER_JSR_E-OUTER_JSR
|
||||
!byte MIDDLE_BRANCH_E-MIDDLE_BRANCH
|
||||
!byte OUTER_BRANCH_E-OUTER_BRANCH
|
||||
!byte MASKCOPY_PRE_E-MASKCOPY_PRE
|
||||
!byte MASKCOPY_POST_E-MASKCOPY_POST
|
||||
!byte BYTECOPY_E-BYTECOPY
|
||||
!byte BYTECOPY_AND_INY_E-BYTECOPY_AND_INY
|
||||
;!byte $FF ; negative length -> do special bitcopy logic during codegen
|
||||
|
||||
BuildDrawingRoutineFrom
|
||||
sta <codegen_token_src ; STA opcode ($85) also serves as 'length' of k_bitcopy token
|
||||
BuildDrawingRoutine
|
||||
ldy #0
|
||||
sty <codegen_token_x
|
||||
- jsr GetNextToken
|
||||
pha
|
||||
jsr ProcessToken
|
||||
pla
|
||||
bne -
|
||||
dec <codegen_dst
|
||||
inc <FIRST_ROW
|
||||
rts
|
||||
|
||||
GetNextToken
|
||||
codegen_token_x=*+1
|
||||
ldx #$00
|
||||
codegen_token_src=*+1
|
||||
lda OUTER_STAGE, x
|
||||
inc <codegen_token_x
|
||||
rts
|
||||
|
||||
ProcessBitcopyToken
|
||||
jsr GetNextToken
|
||||
sta <bitcopy_mask
|
||||
bitcopy_mask=*+1
|
||||
lda $FD ; SMC
|
||||
beq ExitProcessToken ; copymask=0 -> nothing to generate
|
||||
bmi + ; copymask>=$80 -> assume full byte
|
||||
lda #k_mask_copy_pre
|
||||
jsr ProcessToken
|
||||
lda #1
|
||||
sta <piece_length
|
||||
lda <bitcopy_mask
|
||||
jsr ProcessMaskToken
|
||||
lda #k_mask_copy_post
|
||||
+HIDE_NEXT_2_BYTES
|
||||
+ lda #k_byte_copy
|
||||
; execution falls through here
|
||||
ProcessToken
|
||||
tax
|
||||
lda <codegen_piece_lengths, x
|
||||
bmi ProcessBitcopyToken ; only bitcopy has length>=$80
|
||||
sta <piece_length
|
||||
lda <codegen_pieces, x
|
||||
; execution falls through here
|
||||
ProcessMaskToken
|
||||
sta <piece_src
|
||||
; initialize and copy stage drawing routines table into place
|
||||
ldx #0
|
||||
-
|
||||
piece_src=*+1
|
||||
lda $FD, x ; SMC
|
||||
!byte $99,$00 ; STA $4400, Y
|
||||
codegen_dst
|
||||
!byte copy01 ; SMC
|
||||
iny
|
||||
inx
|
||||
piece_length=*+1
|
||||
cpx #$FD ; SMC
|
||||
bcc -
|
||||
ExitProcessToken
|
||||
rts
|
||||
|
||||
codegen_stage
|
||||
!byte 27
|
||||
codegen_maskindex
|
||||
!byte 0
|
||||
|
||||
CopyAuxDHGRToMain
|
||||
; X=0
|
||||
sta $C003 ; copy $4000-5FFF/aux to $9000-AFFF/main
|
||||
ldy #$20
|
||||
@a lda $4000, x
|
||||
@b sta $9000, x
|
||||
inx
|
||||
bne @a
|
||||
inc <@a+2
|
||||
inc <@b+2
|
||||
dey
|
||||
bne @a
|
||||
sta $C002
|
||||
; X=0,Y=0
|
||||
rts
|
||||
}
|
||||
|
||||
EdgeRightMasks
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000001
|
||||
!byte %00000111
|
||||
!byte %00011111
|
||||
!byte %11111111
|
||||
LeftMasks
|
||||
!byte %01100000
|
||||
!byte %00011000
|
||||
!byte %00000111
|
||||
!byte %00000000
|
||||
RightMasks
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000 ; also terminates LeftMasks
|
||||
!byte %00000001
|
||||
!byte %00000110
|
||||
!byte %00011000
|
||||
EdgeLeftMasks
|
||||
!byte %01100000 ; also terminates RightMasks
|
||||
!byte %01111000
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
EdgeLeftMasksAux
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %01000000
|
||||
!byte %01110000
|
||||
!byte %01111100
|
||||
!byte %11111111
|
||||
RightMasksAux
|
||||
!byte %00000011
|
||||
!byte %00001100
|
||||
!byte %01110000
|
||||
!byte %00000000
|
||||
LeftMasksAux
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000 ; also terminates RightMasksAux
|
||||
!byte %01000000
|
||||
!byte %00110000
|
||||
!byte %00001100
|
||||
EdgeRightMasksAux
|
||||
!byte %00000011 ; also terminates LeftMasksAux
|
||||
!byte %00001111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
|
||||
BuildDrawingRoutines
|
||||
; copy codegen data to zero page
|
||||
ldx #0
|
||||
- lda CODEGEN_COPY_START, x
|
||||
sta $09, x
|
||||
txa
|
||||
- sta EndStagesHi, x
|
||||
inx
|
||||
bne -
|
||||
;X=0 here
|
||||
- lda StagesHi, x
|
||||
sta DHGR48StageDrawingRoutines, x
|
||||
inx
|
||||
bne -
|
||||
beq .Start ; always branches
|
||||
|
||||
; copy the half of the source image from $4000/aux to main memory
|
||||
jsr CopyAuxDHGRToMain
|
||||
;X,Y=0 here
|
||||
.FXCodeFile
|
||||
+PSTRING "DHGR48"
|
||||
|
||||
; generate drawing routines for copy01, then copy00
|
||||
jsr BuildStage1And0
|
||||
; A=0 here
|
||||
sta <FIRST_ROW
|
||||
.Start
|
||||
jsr FXCode ; vector to building phase
|
||||
; to inititalize drawing routines and tables
|
||||
|
||||
; generate drawing routines for copy0F..copy02, then clear0F..clear02
|
||||
lda #<MIDDLE_STAGE
|
||||
--- eor #(<OUTER_STAGE XOR <MIDDLE_STAGE)
|
||||
sta <codegen_token_src
|
||||
ldx #6
|
||||
-- stx <codegen_maskindex
|
||||
lda EdgeLeftMasks, x
|
||||
sta <EDGE_LEFT_MASK_MAIN
|
||||
lda EdgeRightMasks, x
|
||||
sta <EDGE_RIGHT_MASK_MAIN
|
||||
lda LeftMasks, x
|
||||
sta <LEFT_MASK_MAIN
|
||||
lda RightMasks, x
|
||||
sta <RIGHT_MASK_MAIN
|
||||
lda EdgeLeftMasksAux, x
|
||||
sta <EDGE_LEFT_MASK_AUX
|
||||
lda EdgeRightMasksAux, x
|
||||
sta <EDGE_RIGHT_MASK_AUX
|
||||
lda LeftMasksAux, x
|
||||
sta <LEFT_MASK_AUX
|
||||
lda RightMasksAux, x
|
||||
sta <RIGHT_MASK_AUX
|
||||
jsr BuildDrawingRoutine
|
||||
dec <ROW_COUNT
|
||||
dec <ROW_COUNT
|
||||
dec <codegen_stage
|
||||
bmi BuildStage1And0
|
||||
lda <codegen_stage
|
||||
eor #13
|
||||
bne +
|
||||
!if USES_CLEAR {
|
||||
; reset counts and switch from copy to clear
|
||||
sta <FIRST_ROW
|
||||
lda #$1D
|
||||
sta <ROW_COUNT
|
||||
lda #$A9
|
||||
sta <BYTECOPY
|
||||
lda #$24
|
||||
sta <BIT_FOR_CLEAR
|
||||
} else {
|
||||
rts
|
||||
}
|
||||
+ lda <codegen_token_src
|
||||
ldx <codegen_maskindex
|
||||
; copy this effect's initial stages to zp
|
||||
ldx #47
|
||||
- ldy BoxInitialStages, x
|
||||
sty DHGR48BoxStages, x
|
||||
dex
|
||||
bmi ---
|
||||
bpl -- ; always branches
|
||||
bpl -
|
||||
|
||||
; generate drawing routines for copy01, copy00 (or clear01, clear00)
|
||||
BuildStage1And0
|
||||
lda #%00011111
|
||||
sta <LEFT_MASK_MAIN
|
||||
lda #%01111100
|
||||
sta <LEFT_MASK_AUX
|
||||
lda #<STAGE1
|
||||
jsr BuildDrawingRoutineFrom
|
||||
lda #<STAGE0
|
||||
jmp BuildDrawingRoutineFrom
|
||||
jmp FXCode+3 ; exit via vector to drawing phase
|
||||
|
||||
; 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"
|
||||
}
|
||||
BoxInitialStages
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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 <row
|
||||
jsr DHGRBlockCopy
|
||||
+ dec <row
|
||||
bpl rowloop
|
||||
lda $C000
|
||||
lda KBD
|
||||
bmi exit
|
||||
dec <col
|
||||
dec <counter
|
||||
@ -111,12 +111,12 @@ dst sta $FDFD, y
|
||||
sta <src+2
|
||||
eor #$60
|
||||
sta <dst+2
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
dec <pass
|
||||
bne --
|
||||
sta $C002
|
||||
sta $C004
|
||||
sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
rts
|
||||
|
||||
DHGRBlockCopy
|
||||
@ -137,8 +137,8 @@ DHGRBlockCopy
|
||||
sta <src+2
|
||||
eor #$60
|
||||
sta <dst+2
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
ldx #7
|
||||
clc
|
||||
- lda (<src+1), y
|
||||
@ -150,8 +150,8 @@ DHGRBlockCopy
|
||||
sta <dst+2
|
||||
dex
|
||||
bpl -
|
||||
sta $C002
|
||||
sta $C004
|
||||
sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
rts
|
||||
|
||||
row !byte 23
|
||||
|
@ -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_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER1"
|
||||
CoordinatesFile
|
||||
!byte 15
|
||||
!text "FX/BUBBLES.DATA"
|
||||
+PSTRING "BUBBLES.DATA"
|
||||
|
@ -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_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER2"
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/BUTTERFLY.DATA"
|
||||
+PSTRING "BUTTERFLY.DATA"
|
||||
|
@ -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_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER1"
|
||||
CoordinatesFile
|
||||
!byte 15
|
||||
!text "FX/CORNER4.DATA"
|
||||
+PSTRING "CORNER4.DATA"
|
||||
|
@ -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_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER2"
|
||||
CoordinatesFile
|
||||
!byte 13
|
||||
!text "FX/HEART.DATA"
|
||||
+PSTRING "HEART.DATA"
|
||||
|
@ -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_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER1"
|
||||
CoordinatesFile
|
||||
!byte 12
|
||||
!text "FX/IRIS.DATA"
|
||||
+PSTRING "IRIS.DATA"
|
||||
|
@ -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_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER2"
|
||||
CoordinatesFile
|
||||
!byte 13
|
||||
!text "FX/MAPLE.DATA"
|
||||
+PSTRING "MAPLE.DATA"
|
||||
|
@ -24,11 +24,11 @@ input = $FE ; word
|
||||
sta Coordinates1Bit-2
|
||||
|
||||
Start
|
||||
+BUILD_DITHER_MASKS_DHGR dithermasks
|
||||
+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
|
||||
jsr iBuildDHGRDitherMasks
|
||||
jsr iBuildDHGRSparseBitmasks1Bit
|
||||
jsr iBuildHGRTables
|
||||
jsr iBuildHGRMirrorTables
|
||||
jsr iBuildDHGRMirrorCols
|
||||
+COPY_TO_AUXMEM $60, 4
|
||||
|
||||
+LDADDR evenrow_masks
|
||||
@ -51,23 +51,23 @@ LoopBL ; bottom-left quadrant (opposite row, origi
|
||||
lda (input),y
|
||||
bmi DoneBL
|
||||
tax
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
+ROW_X_TO_MIRROR_ADDRESSES mirror_src1, mirror_src2, mirror_dest1, mirror_dest2
|
||||
iny
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
clc
|
||||
- lda copymasks, x
|
||||
- lda copymasks1bit, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks1bit, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks1bit, evenrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+DEC_INPUT_AND_LOOP LoopBL
|
||||
+ sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
+DEC_INPUT_AND_LOOP input, LoopBL
|
||||
DoneBL
|
||||
|
||||
+LDADDR Coordinates1Bit
|
||||
@ -77,23 +77,23 @@ LoopTL ; top-left quadrant
|
||||
lda (input),y
|
||||
bmi DoneTL
|
||||
tax
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
+ROW_X_TO_BASE_ADDRESSES src1, src2, dest1, dest2
|
||||
inc input
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
clc
|
||||
- lda copymasks, x
|
||||
- lda copymasks1bit, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER src1, dest1, copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER src1, dest1, copymasks1bit, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, copymasks1bit, oddrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+INC_INPUT_AND_LOOP LoopTL
|
||||
+ sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
+INC_INPUT_AND_LOOP input, LoopTL
|
||||
DoneTL
|
||||
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
@ -103,25 +103,25 @@ LoopTR ; top-right quadrant (same row, opposite co
|
||||
lda (input),y
|
||||
bmi DoneTR
|
||||
tax
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
+ROW_X_TO_BASE_ADDRESSES src1, src2, dest1, dest2
|
||||
iny
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
lda mirror_cols,y
|
||||
tay
|
||||
clc
|
||||
- lda mirror_copymasks, x
|
||||
- lda mirror_copymasks1bit, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER src1, dest1, mirror_copymasks1bit, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks1bit, oddrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+DEC_INPUT_AND_LOOP LoopTR
|
||||
+ sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
+DEC_INPUT_AND_LOOP input, LoopTR
|
||||
DoneTR
|
||||
|
||||
+LDADDR Coordinates1Bit
|
||||
@ -131,28 +131,27 @@ LoopBR ; bottom-right quadrant (opposite row, oppo
|
||||
lda (input),y
|
||||
bmi DoneBR
|
||||
tax
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
+ROW_X_TO_MIRROR_ADDRESSES mirror_src1, mirror_src2, mirror_dest1, mirror_dest2
|
||||
inc input
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
lda mirror_cols,y
|
||||
tay
|
||||
clc
|
||||
- lda mirror_copymasks, x
|
||||
- lda mirror_copymasks1bit, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks1bit, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks1bit, evenrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+INC_INPUT_AND_LOOP LoopBR
|
||||
+ sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
+INC_INPUT_AND_LOOP input, LoopBR
|
||||
DoneBR
|
||||
rts
|
||||
|
||||
CoordinatesFile
|
||||
!byte 14
|
||||
!text "FX/RADIAL.DATA"
|
||||
+PSTRING "RADIAL.DATA"
|
||||
|
@ -7,14 +7,13 @@
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
+FX_RIPPLE_1BIT aslmod
|
||||
+FX_INITONCE_1BIT FXCodeFile, CoordinatesFile, Start
|
||||
jsr iRippleCoordinates1Bit
|
||||
|
||||
Start
|
||||
!source "src/fx/fx.dhgr.dither.radial.common.a"
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHRAD"
|
||||
CoordinatesFile
|
||||
!byte 14
|
||||
!text "FX/RADIAL.DATA"
|
||||
Coordinates=Coordinates1Bit
|
||||
EndCoordinates=EndCoordinates1Bit
|
||||
+PSTRING "RADIAL.DATA"
|
||||
|
@ -7,14 +7,13 @@
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
jsr EndCoordinates1Bit+1
|
||||
+FX_INITONCE_1BIT FXCodeFile, CoordinatesFile, Start
|
||||
jsr iRippleCoordinates1Bit2
|
||||
|
||||
Start
|
||||
!source "src/fx/fx.dhgr.dither.radial.common.a"
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHRAD"
|
||||
CoordinatesFile
|
||||
!byte 14
|
||||
!text "FX/RADIAL.DATA"
|
||||
Coordinates=Coordinates1Bit
|
||||
EndCoordinates=EndCoordinates1Bit
|
||||
+PSTRING "RADIAL.DATA"
|
||||
|
@ -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_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER1"
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/SLOW.STAR.DATA"
|
||||
+PSTRING "SLOW.STAR.DATA"
|
||||
|
@ -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_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER1"
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/SNOWFLAKE.DATA"
|
||||
+PSTRING "SNOWFLAKE.DATA"
|
||||
|
@ -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_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER2"
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/SOFT.IRIS.DATA"
|
||||
+PSTRING "SOFT.IRIS.DATA"
|
||||
|
@ -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_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER2"
|
||||
CoordinatesFile
|
||||
!byte 12
|
||||
!text "FX/STAR.DATA"
|
||||
+PSTRING "STAR.DATA"
|
||||
|
@ -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_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER2"
|
||||
CoordinatesFile
|
||||
!byte 13
|
||||
!text "FX/STAR7.DATA"
|
||||
+PSTRING "STAR7.DATA"
|
||||
|
@ -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_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER2"
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/WAVY.IRIS.DATA"
|
||||
+PSTRING "WAVY.IRIS.DATA"
|
||||
|
@ -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_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
jmp FXCode
|
||||
|
||||
FXCodeFile
|
||||
+PSTRING "DHGRDITHER2"
|
||||
CoordinatesFile
|
||||
!byte 18
|
||||
!text "FX/W.IR.BLOOM.DATA"
|
||||
+PSTRING "W.IR.BLOOM.DATA"
|
||||
|
@ -27,7 +27,7 @@ addrs=$BF ; [$40 bytes]
|
||||
start
|
||||
!pseudopc 0 {
|
||||
;Y=0 on entry to copyaux
|
||||
copyaux sta $C003 ; copy $4000/aux to $8000/main
|
||||
copyaux sta READAUXMEM ; copy $4000/aux to $8000/main
|
||||
ldx #$20
|
||||
a lda $4000, y
|
||||
b sta $8000, y
|
||||
@ -37,7 +37,7 @@ b sta $8000, y
|
||||
inc b+2
|
||||
dex
|
||||
bne a
|
||||
sta $C002
|
||||
sta READMAINMEM
|
||||
sta $C001 ; 80STORE mode
|
||||
;X,Y=0 on entry to LFSR
|
||||
loop txa
|
||||
@ -59,7 +59,7 @@ dst sta $FD00, y
|
||||
tay
|
||||
bcc loop2
|
||||
bne loop
|
||||
bit $C000
|
||||
bit KBD
|
||||
bmi exit
|
||||
txa
|
||||
bne loop1
|
||||
@ -81,7 +81,7 @@ auxdst sta $FD00, y
|
||||
tay
|
||||
bcc loop2
|
||||
bne loop
|
||||
lda $C000
|
||||
lda KBD
|
||||
bmi exit
|
||||
txa
|
||||
bne loop1
|
||||
|
@ -5,9 +5,9 @@
|
||||
!to "build/FX.INDEXED/DHGR.FLICK",plain
|
||||
*=$6000
|
||||
|
||||
hgrlo = $200 ; [$C0 bytes, main memory only]
|
||||
startrows_by_column = $2C0 ; [$28 bytes, main memory only]
|
||||
hgr1hi = $300 ; [$C0 bytes, main memory only]
|
||||
;hgrlo = $201 ; [$C0 bytes, main memory only] defined in constants.a
|
||||
startrows_by_column = $2C1 ; [$28 bytes, main memory only]
|
||||
;hgr1hi = $301 ; [$C0 bytes, main memory only] defined in constants.a
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
@ -18,9 +18,7 @@ hgr1hi = $300 ; [$C0 bytes, main memory only]
|
||||
sta startrows_by_column-1, x
|
||||
dex
|
||||
bne -
|
||||
;X=0
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
|
||||
jsr iBuildHGRTables
|
||||
jmp loop
|
||||
|
||||
start
|
||||
@ -47,11 +45,11 @@ rowloop lda hgrlo, x
|
||||
bankloop sec
|
||||
src lda $FDFD, y
|
||||
dst sta $FDFD, y
|
||||
sta $C003
|
||||
sta $C005
|
||||
sta READAUXMEM
|
||||
sta WRITEAUXMEM
|
||||
bcc bankloop
|
||||
sta $C002
|
||||
sta $C004
|
||||
sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
inx
|
||||
dec <rowcount
|
||||
bne rowloop
|
||||
@ -75,7 +73,7 @@ nextcolumn
|
||||
sta <rowcounts_by_column, y
|
||||
++ dey
|
||||
bpl -
|
||||
lda $C000
|
||||
lda KBD
|
||||
bmi exit
|
||||
lda <rowcounts_by_column+$27
|
||||
cmp #$80
|
||||
|
@ -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 13
|
||||
!text "FX/HEART.DATA"
|
||||
+PSTRING "HEART.DATA"
|
||||
|
@ -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 13
|
||||
!text "FX/HEART.DATA"
|
||||
+PSTRING "HEART.DATA"
|
||||
|
@ -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 13
|
||||
!text "FX/HEART.DATA"
|
||||
+PSTRING "HEART.DATA"
|
||||
|
@ -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 12
|
||||
!text "FX/IRIS.DATA"
|
||||
+PSTRING "IRIS.DATA"
|
||||
|
@ -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 12
|
||||
!text "FX/IRIS.DATA"
|
||||
+PSTRING "IRIS.DATA"
|
||||
|
@ -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 13
|
||||
!text "FX/MAPLE.DATA"
|
||||
+PSTRING "MAPLE.DATA"
|
||||
|
@ -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 13
|
||||
!text "FX/MAPLE.DATA"
|
||||
+PSTRING "MAPLE.DATA"
|
||||
|
@ -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 13
|
||||
!text "FX/MAPLE.DATA"
|
||||
+PSTRING "MAPLE.DATA"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user