Working config found for apple2enh target

This commit is contained in:
Luxferre
2022-08-06 19:01:18 +03:00
parent c653bf6f73
commit ee6d75ca24
2 changed files with 28 additions and 9 deletions
+11 -2
View File
@@ -16,10 +16,19 @@ apple2-build:
cl65 --standard c89 -O -Os -t apple2 -o $(PROJNAME).apple2 $(CFILES) $(DFLAGS)
apple2: apple2-build
cp $(PBTDIR)/apple2/tpl.dsk equi.dsk
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
rm *.o *.apple2
apple2enh-build:
cl65 --standard c89 -O -Os -t apple2enh -o $(PROJNAME).a2enh $(CFILES) $(DFLAGS)
apple2enh: apple2enh-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
rm *.o *.a2enh
clean:
rm -f ./$(PROJNAME) *.o *.apple2
rm -f ./$(PROJNAME) *.dsk *.o *.apple2 *.a2enh
+17 -7
View File
@@ -144,7 +144,9 @@ The following constants can be adjusted at compile time:
Please keep in mind that the reference implementation code primarily serves as a, well, reference on how the specification should be implemented, so it emphasizes on code portability and readability over performance whenever such a choice arises.
### Building with GCC/Clang/MinGW (for current mainstream targets)
The project Makefile, provided for convenience, supports passing these constants with `-DFLAGS="..."` switch. Below are the steps to build Equi without a Makefile from the `equi.c` source file alone, with a corresponding `make` target specified as well.
### Building with GCC/Clang/MinGW (for current mainstream targets): `make`
Build with default parameters (you can override any of the above constants with `-D` switch:
@@ -153,7 +155,7 @@ cc -std=c89 -Os -o equi equi.c [-DSTACK_SIZE=... ...]
strip equi
```
### Building with TCC (TinyCC, Tiny C Compiler)
### Building with TCC (TinyCC, Tiny C Compiler): `make tcc`
Equi's codebase detects TCC and attempts to save size by linking against tcclib instead of the standard libraries. Note that TCC doesn't support size optimization switches and C89 standard in the most recent versions, so it will fall back to C99 instead. Anyway, the most sensible command to build Equi with TCC is:
@@ -161,21 +163,29 @@ 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 6502-based targets)
### Building with CC65 for Enhanced Apple IIe: `make apple2enh`
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 Apple II, so the command to build it would be:
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 apple2 -o equi.apple2 equi.c
cl65 --standard c89 -O -Os -t apple2enh -o equi.a2enh 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):
```
cp platform-build-tools/apple2/tpl.dsk equi.dsk
java -jar platform-build-tools/apple2/ac.jar -p equi.dsk equi.system sys < $(cl65 --print-target-path)/apple2/util/loader.system
java -jar platform-build-tools/apple2/ac.jar -as equi.dsk equi bin < equi.apple2
java -jar platform-build-tools/apple2/ac.jar -p equi.dsk equi.system sys < $(cl65 --print-target-path)/apple2enh/util/loader.system
java -jar platform-build-tools/apple2/ac.jar -as equi.dsk equi bin < equi.a2enh
```
This will build a bootable disk image with Equi for Apple II that can be tested on emulators or real hardware.
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.
# Credits
Created by Luxferre in 2022, released into public domain.
Made in Ukraine.