A self-descriptive stack-based PC platform
git clone git://git.luxferre.top/equi.git
Log | Files | Refs | README | LICENSE

commit 984ced33960044aa5c5f43f4f917cc48d43a2cd0
parent 71eb5bafa8817b5ecad5e0661f27c0bea1068baa
Author: Luxferre <lux@ferre>
Date:   Sun, 14 Aug 2022 21:26:04 +0300

Apple IIe config figured out

MMakefile | 19+++++--------------
MREADME.md | 6++----
Mequi.c | 2+-
3 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile @@ -4,8 +4,8 @@ PROJNAME=equi CFILES=equi.c PBTDIR=platform-build-tools PERSFILE=PERS.DAT -# Apple II target configuration -A2FLAGS=-DSTACK_SIZE=256 -DLIT_STACK_SIZE=32 -DGPD_AREA_SIZE=3072 -DCMD_BUF_SIZE=20000 -DCLT_ENTRIES_MAX=512 -DEQUI_TASKS_MAX=8 +# Apple IIe target configuration +A2FLAGS=-DSTACK_SIZE=256 -DLIT_STACK_SIZE=32 -DGPD_AREA_SIZE=1024 -DCMD_BUF_SIZE=13500 -DCLT_ENTRIES_MAX=256 -DEQUI_TASKS_MAX=4 # POSIX desktop target configuration PDFLAGS=-DSTACK_SIZE=256 -DLIT_STACK_SIZE=32 -DGPD_AREA_SIZE=3072 -DCMD_BUF_SIZE=20000 -DCLT_ENTRIES_MAX=512 -DEQUI_TASKS_MAX=8 # Common flags @@ -18,19 +18,10 @@ desktopcc: perscopy tcc: perscopy tcc -std=c89 -o $(PROJNAME) $(CFILES) $(PDFLAGS) $(DFLAGS) -apple2-build: - cl65 --standard c89 -O -Os -t apple2 -C apple2-system.cfg -o $(PROJNAME).apple2 $(CFILES) $(A2FLAGS) $(DFLAGS) +a2-build: + cl65 --standard c89 -O -Os -t apple2enh -C apple2enh-system.cfg -o $(PROJNAME).a2enh $(A2FLAGS) $(DFLAGS) $(CFILES) -apple2: apple2-build - cp $(PBTDIR)/apple2/tpl.dsk $(PROJNAME).dsk - java -jar $(PBTDIR)/apple2/ac.jar -p $(PROJNAME).dsk $(PROJNAME).system sys < $$(cl65 --print-target-path)/apple2/util/loader.system - java -jar $(PBTDIR)/apple2/ac.jar -as $(PROJNAME).dsk $(PROJNAME) bin < $(PROJNAME).apple2 - java -jar $(PBTDIR)/apple2/ac.jar -dos $(PROJNAME).dsk $(PERSFILE) bin < $(PBTDIR)/$(PERSFILE) - -apple2enh-build: - cl65 --standard c89 -O -Os -t apple2enh -C apple2enh-system.cfg -o $(PROJNAME).a2enh $(CFILES) $(A2FLAGS) $(DFLAGS) - -apple2enh: apple2enh-build +a2: a2-build cp $(PBTDIR)/apple2/tpl.dsk $(PROJNAME)-enh.dsk java -jar $(PBTDIR)/apple2/ac.jar -p $(PROJNAME)-enh.dsk $(PROJNAME).system sys < $$(cl65 --print-target-path)/apple2enh/util/loader.system java -jar $(PBTDIR)/apple2/ac.jar -as $(PROJNAME)-enh.dsk $(PROJNAME) bin < $(PROJNAME).a2enh diff --git a/README.md b/README.md @@ -172,12 +172,12 @@ Equi's codebase detects TCC and attempts to save size by linking against tcclib tcc -std=c89 -o equi equi.c [-DSTACK_SIZE=... ...] ``` -### Building with CC65 for Enhanced Apple IIe: `make apple2enh` +### Building with CC65 for Enhanced Apple IIe: `make a2` This is where things start to get interesting, as we need to specify the exact target machine for CC65 and perform certain target-dependent post-build manipulation. For now, Equi reference implementation is only being tested for 65C02-based Enhanced Apple IIe (as the earliest model both supported by CC65 suite and supporting lowercase character I/O), so the command to build it would be: ``` -cl65 --standard c89 -O -Os -t apple2enh -o equi.a2enh equi.c +cl65 --standard c89 -O -Os -t apple2enh -o equi.a2enh [-DSTACK_SIZE=... ...] equi.c ``` Then, if there are no compiler/linker errors, we can proceed with building the image (assuming we're using Java and AppleCommander with an empty 140K ProDOS 8 image bundled in the repo for image assembly): @@ -196,8 +196,6 @@ You can also add a 96K-sized `PERS.DAT` file shipped in the repo to use the pers java -jar platform-build-tools/apple2/ac.jar -dos equi.dsk PERS.DAT bin < platform-build-tools/PERS.DAT ``` -The Makefile also provides a usual `apple2` target and the disk image will run on a "normal" Apple IIe, however the environment is not guaranteed to work correctly due to the way CC65 compiler converts string literals for this target. - ## FAQ ### Why does the world need another Forth-like system? diff --git a/equi.c b/equi.c @@ -441,7 +441,7 @@ void portIO(ushort port, ushort p2, ushort p1) { ushort equi_find_free_task_slot() { ushort slotid = 0; /* iterate over task table */ - for(;slotid < EQUI_TASKS_MAX;slotid++) + for(;slotid < EQUI_TASKS_MAX;++slotid) if(!ram.tasks[slotid].active) return slotid; /* and error out if all slots are busy and active */