From 8e759067376d6c45e5d11d5af274eaea42ca9403 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 7 Mar 2018 23:04:33 +0100 Subject: [PATCH] Switched Apple II output format to AppleSingle. Although the primary target OS for the Apple II for sure isn't DOS 3.3 but ProDOS 8 the Apple II binary files contained a DOS 3.3 4-byte header. Recently I was made aware of the AppleSingle file format. That format is a much better way to transport Apple II meta data from the cc65 toolchain to the ProDOS 8 file system. Therefore I asked AppleCommander to support the AppleSingle file format. Now that there's an AppleCommander BETA with AppleSingle support it's the right time for this change. I bumped version to 2.17 because of this from the perspective of Apple II users of course incompatible change. --- cfg/apple2-asm.cfg | 5 +++- cfg/apple2-hgr.cfg | 3 ++- cfg/apple2-overlay.cfg | 13 ++++++----- cfg/apple2-system.cfg | 14 ++++++++---- cfg/apple2.cfg | 3 ++- cfg/apple2enh-asm.cfg | 5 +++- cfg/apple2enh-hgr.cfg | 3 ++- cfg/apple2enh-overlay.cfg | 13 ++++++----- cfg/apple2enh-system.cfg | 14 ++++++++---- cfg/apple2enh.cfg | 3 ++- doc/apple2.sgml | 48 +++++++++++++++++---------------------- doc/apple2enh.sgml | 48 +++++++++++++++++---------------------- doc/intro.sgml | 13 +++++------ libsrc/apple2/exehdr.s | 32 ++++++++++++++++++++++---- samples/Makefile | 8 +++---- src/common/version.c | 2 +- 16 files changed, 129 insertions(+), 98 deletions(-) diff --git a/cfg/apple2-asm.cfg b/cfg/apple2-asm.cfg index 8e5abefc5..76bca1b86 100644 --- a/cfg/apple2-asm.cfg +++ b/cfg/apple2-asm.cfg @@ -3,9 +3,12 @@ FEATURES { STARTADDRESS: default = $0803; } +SYMBOLS { + __FILETYPE__: type = weak, value = $0006; # ProDOS file type +} MEMORY { ZP: file = "", start = $0000, size = $00FF; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = $C000 - %S; BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__; } diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg index b11dd12bc..3ccf7b6f3 100644 --- a/cfg/apple2-hgr.cfg +++ b/cfg/apple2-hgr.cfg @@ -5,6 +5,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -12,7 +13,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2-overlay.cfg b/cfg/apple2-overlay.cfg index d5476d264..a0b7678c1 100644 --- a/cfg/apple2-overlay.cfg +++ b/cfg/apple2-overlay.cfg @@ -1,10 +1,10 @@ # Configuration for overlay programs (overlays located below main program) -# The overlay files don't include the 4 byte DOS 3.3 header so use AppleCommander like this: -# java -jar ac.jar -cc65 mydisk.dsk myprog bin < myprog -# java -jar ac.jar -p mydisk.dsk myprog.1 bin < myprog.1 -# java -jar ac.jar -p mydisk.dsk myprog.2 bin < myprog.2 -# java -jar ac.jar -p mydisk.dsk myprog.3 bin < myprog.3 +# The overlay files are raw binary files so use AppleCommander like this: +# java -jar ac.jar -as mydisk.dsk myprog < myprog +# java -jar ac.jar -p mydisk.dsk myprog.1 bin < myprog.1 +# java -jar ac.jar -p mydisk.dsk myprog.2 bin < myprog.2 +# java -jar ac.jar -p mydisk.dsk myprog.3 bin < myprog.3 # ... FEATURES { @@ -12,6 +12,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -20,7 +21,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2-system.cfg b/cfg/apple2-system.cfg index f4684d9c2..0170feb93 100644 --- a/cfg/apple2-system.cfg +++ b/cfg/apple2-system.cfg @@ -1,18 +1,22 @@ -# Configuration for ProDOS 8 system programs (without the header) +# Configuration for ProDOS 8 system programs (allowing for 3KB in LC) SYMBOLS { + __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $00FF; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __LCADDR__: type = weak, value = $D400; # Behind quit code __LCSIZE__: type = weak, value = $0C00; # Rest of bank two } MEMORY { - ZP: file = "", define = yes, start = $0080, size = $001A; - MAIN: file = %O, start = $2000, size = $BF00 - $2000; - BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; - LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; + ZP: file = "", define = yes, start = $0080, size = $001A; + HEADER: file = %O, start = $2000 - $003A, size = $003A; + MAIN: file = %O, define = yes, start = $2000, size = $BF00 - $2000; + BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; + LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2.cfg b/cfg/apple2.cfg index bbe45839d..a6809cf89 100644 --- a/cfg/apple2.cfg +++ b/cfg/apple2.cfg @@ -5,6 +5,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -12,7 +13,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2enh-asm.cfg b/cfg/apple2enh-asm.cfg index 8e5abefc5..76bca1b86 100644 --- a/cfg/apple2enh-asm.cfg +++ b/cfg/apple2enh-asm.cfg @@ -3,9 +3,12 @@ FEATURES { STARTADDRESS: default = $0803; } +SYMBOLS { + __FILETYPE__: type = weak, value = $0006; # ProDOS file type +} MEMORY { ZP: file = "", start = $0000, size = $00FF; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = $C000 - %S; BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__; } diff --git a/cfg/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg index b11dd12bc..3ccf7b6f3 100644 --- a/cfg/apple2enh-hgr.cfg +++ b/cfg/apple2enh-hgr.cfg @@ -5,6 +5,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -12,7 +13,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2enh-overlay.cfg b/cfg/apple2enh-overlay.cfg index d5476d264..a0b7678c1 100644 --- a/cfg/apple2enh-overlay.cfg +++ b/cfg/apple2enh-overlay.cfg @@ -1,10 +1,10 @@ # Configuration for overlay programs (overlays located below main program) -# The overlay files don't include the 4 byte DOS 3.3 header so use AppleCommander like this: -# java -jar ac.jar -cc65 mydisk.dsk myprog bin < myprog -# java -jar ac.jar -p mydisk.dsk myprog.1 bin < myprog.1 -# java -jar ac.jar -p mydisk.dsk myprog.2 bin < myprog.2 -# java -jar ac.jar -p mydisk.dsk myprog.3 bin < myprog.3 +# The overlay files are raw binary files so use AppleCommander like this: +# java -jar ac.jar -as mydisk.dsk myprog < myprog +# java -jar ac.jar -p mydisk.dsk myprog.1 bin < myprog.1 +# java -jar ac.jar -p mydisk.dsk myprog.2 bin < myprog.2 +# java -jar ac.jar -p mydisk.dsk myprog.3 bin < myprog.3 # ... FEATURES { @@ -12,6 +12,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -20,7 +21,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/cfg/apple2enh-system.cfg b/cfg/apple2enh-system.cfg index f4684d9c2..0170feb93 100644 --- a/cfg/apple2enh-system.cfg +++ b/cfg/apple2enh-system.cfg @@ -1,18 +1,22 @@ -# Configuration for ProDOS 8 system programs (without the header) +# Configuration for ProDOS 8 system programs (allowing for 3KB in LC) SYMBOLS { + __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $00FF; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __LCADDR__: type = weak, value = $D400; # Behind quit code __LCSIZE__: type = weak, value = $0C00; # Rest of bank two } MEMORY { - ZP: file = "", define = yes, start = $0080, size = $001A; - MAIN: file = %O, start = $2000, size = $BF00 - $2000; - BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; - LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; + ZP: file = "", define = yes, start = $0080, size = $001A; + HEADER: file = %O, start = $2000 - $003A, size = $003A; + MAIN: file = %O, define = yes, start = $2000, size = $BF00 - $2000; + BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; + LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2enh.cfg b/cfg/apple2enh.cfg index bbe45839d..a6809cf89 100644 --- a/cfg/apple2enh.cfg +++ b/cfg/apple2enh.cfg @@ -5,6 +5,7 @@ FEATURES { } SYMBOLS { __EXEHDR__: type = import; + __FILETYPE__: type = weak, value = $0006; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __HIMEM__: type = weak, value = $9600; # Presumed RAM end __LCADDR__: type = weak, value = $D400; # Behind quit code @@ -12,7 +13,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; - HEADER: file = %O, start = %S - 4, size = $0004; + HEADER: file = %O, start = %S - $003A, size = $003A; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 43651c7fa..eef0eed3d 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -34,20 +34,14 @@ more information. Binary format

The standard binary file format generated by the linker for the -Apple ][ target is a binary program with a 4 byte DOS 3.3 header -containing the load address and load length. The default load address is -$803. +Apple ][ target is an file. +The default load address is $803. -) includes the option for those programs -omits the DOS 3.3 header. The right AppleCommander option to put system files -without a header on a ProDOS 8 disk image is ) includes the option Memory layout

@@ -121,9 +115,8 @@ Parameters: Default: $803. Use - Default: DOS 3.3 header (address and length). Use + Default: Yes. Use Default: $800. Use + + Default: Yes. Use Default: $800. Use Default: $803. Use - Default: DOS 3.3 header (address and length). Use + Default: Yes. Use Default: $800. Use Configuration for an overlay program with up to nine overlays. The overlay files -don't include the DOS 3.3 header. See samples/overlaydemo.c for more +don't include the AppleSingle header. See samples/overlaydemo.c for more information on overlays. Parameters: @@ -216,9 +211,8 @@ Parameters: Default: $803. Use - Default: DOS 3.3 header (address and length). Use + Default: Yes. Use Default: $800. Use Default: $803. Use - Default: No header. Use + Default: No. Use

@@ -281,7 +274,8 @@ program (i.e. quits to the ProDOS dispatcher). Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the program to load under name <program>.SYSTEM as a system program. For -example the program Heap

diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 3f335d028..b40523aba 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -34,20 +34,14 @@ more information. Binary format

The standard binary file format generated by the linker for the -enhanced Apple //e target is a binary program with a 4 byte DOS 3.3 header -containing the load address and load length. The default load address is -$803. +enhanced Apple //e target is an file. +The default load address is $803. -) includes the option for those programs -omits the DOS 3.3 header. The right AppleCommander option to put system files -without a header on a ProDOS 8 disk image is ) includes the option Memory layout

@@ -121,9 +115,8 @@ Parameters: Default: $803. Use - Default: DOS 3.3 header (address and length). Use + Default: Yes. Use Default: $800. Use + + Default: Yes. Use Default: $800. Use Default: $803. Use - Default: DOS 3.3 header (address and length). Use + Default: Yes. Use Default: $800. Use Configuration for an overlay program with up to nine overlays. The overlay files -don't include the DOS 3.3 header. See samples/overlaydemo.c for more +don't include the AppleSingle header. See samples/overlaydemo.c for more information on overlays. Parameters: @@ -216,9 +211,8 @@ Parameters: Default: $803. Use - Default: DOS 3.3 header (address and length). Use + Default: Yes. Use Default: $800. Use Default: $803. Use - Default: No header. Use + Default: No. Use

@@ -281,7 +274,8 @@ program (i.e. quits to the ProDOS dispatcher). Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the program to load under name <program>.SYSTEM as a system program. For -example the program Heap

diff --git a/doc/intro.sgml b/doc/intro.sgml index bb8965c60..47516e671 100644 --- a/doc/intro.sgml +++ b/doc/intro.sgml @@ -246,13 +246,13 @@ varies in its start and exit conditions. AppleWin

Available at : +url="https://github.com/AppleWin/AppleWin">: Emulates Apple ][/enhanced Apple //e computers, with sound, video, joysticks, serial port, and disk images. Includes monitor. Only for Windows. The package comes with a DOS 3.3 disk (called "master.dsk") image; -however, you will need ). +however, you will need ). Compile the tutorial with @@ -270,14 +270,13 @@ the -java -jar ac.jar -cc65 cc65.dsk test B < hello +java -jar ac.jar -as cc65.dsk test < hello Note that a convention in the Apple world is that "hello" is the file which is run automatically upon booting a DOS disk, sort of like the "autoexec.bat" of -the MSDOS/Windows world. We've avoided that in the example, however. Also, -the ID01_OFFSET, ID01_LENGTH, ID11_OFFSET, ID11_LENGTH, __FILETYPE__, <__FILETYPE__ ; File Type + .byte 0, 0 ; Auxiliary Type high + .byte >__MAIN_START__, <__MAIN_START__ ; Auxiliary Type low +ID01: diff --git a/samples/Makefile b/samples/Makefile index 2bcfa08c3..6a6d93bc1 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -188,15 +188,15 @@ samples.d64: samples $(foreach file,$(EMD) $(MOU) $(TGI),$(D64_WRITE_recipe)) # -------------------------------------------------------------------------- -# Rule to make an Apple II disk with all samples. Needs the Apple Commander -# program available at http://applecommander.sourceforge.net/ and a template -# disk named 'prodos.dsk'. +# Rule to make an Apple II disk with all samples. Needs the AppleCommander +# program available at https://applecommander.github.io/ and a template disk +# named 'prodos.dsk'. define DSK_WRITE_BIN_recipe $(if $(findstring BF00,$(LDFLAGS_$(notdir $(file))_$(SYS))), \ java -jar $(AC) -p $@ $(notdir $(file)).system sys <$(TARGET_PATH)/$(SYS)/util/loader.system) -java -jar $(AC) -cc65 $@ $(notdir $(file)) bin <$(file) +java -jar $(AC) -as $@ $(notdir $(file)) <$(file) endef # DSK_WRITE_BIN_recipe diff --git a/src/common/version.c b/src/common/version.c index bf0a6bf71..1f1e8093e 100644 --- a/src/common/version.c +++ b/src/common/version.c @@ -47,7 +47,7 @@ #define VER_MAJOR 2U -#define VER_MINOR 16U +#define VER_MINOR 17U -- 2.39.2