diff --git a/Makefile b/Makefile index 9ca103d..d3b8286 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -targets := clocks selectors accelerators ram.drv util textcolors +targets := clocks selectors accelerators ram.drv setup util textcolors .PHONY: all $(targets) package diff --git a/README.md b/README.md index 61c4df6..b8bb724 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,10 @@ The intent is that you use a tool like Copy II Plus or [Apple II DeskTop](https: Alternately, you might want to install some drivers then immediately launch into BASIC. In that case, put `BASIC.SYSTEM` after the drivers in place of `QUIT.SYSTEM`. +## Alternate Approach + +If you want to keep your volume directory tidier, consider using [SETUP.SYSTEM](./setups/README.md) instead. + # Building Fetch, build, and install [cc65](http://cc65.github.io/cc65/): diff --git a/accelerators/zipchip/Makefile b/accelerators/zipchip/Makefile index 69740b1..b85aa5c 100644 --- a/accelerators/zipchip/Makefile +++ b/accelerators/zipchip/Makefile @@ -7,7 +7,8 @@ OUTDIR = ../../out HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc) TARGETS = \ - $(OUTDIR)/zipchip.system.SYS + $(OUTDIR)/zipchip.system.SYS \ + $(OUTDIR)/zipchip.setup.SYS LOG_SUCCESS=1 LOG_FAILURE=1 @@ -35,6 +36,9 @@ clean: $(OUTDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.BIN $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< ifdef XATTR diff --git a/clocks/cricket/Makefile b/clocks/cricket/Makefile index 7cf4122..0c3c4b7 100644 --- a/clocks/cricket/Makefile +++ b/clocks/cricket/Makefile @@ -10,6 +10,7 @@ HEADERS = $(wildcard *.inc) $(wildcard ../../inc/*.inc) TARGETS = \ $(UTILDIR)/prodos.mod.BIN \ $(OUTDIR)/cricket.system.SYS \ + $(OUTDIR)/cricket.setup.SYS \ $(UTILDIR)/test.BIN \ $(UTILDIR)/set.datetime.BIN \ $(UTILDIR)/set.time.BIN \ @@ -43,6 +44,9 @@ clean: $(OUTDIR)/%.o $(UTILDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< diff --git a/clocks/cricket/README.md b/clocks/cricket/README.md index 019e473..f9e494f 100644 --- a/clocks/cricket/README.md +++ b/clocks/cricket/README.md @@ -42,6 +42,8 @@ These `BRUN`able files are also built: * [SET.DATE](set.date.s) sets the Cricket's current date. * [SET.TIME](set.time.s) sets the Cricket's current time. +`CRICKET.SETUP` is for use with [SETUP.SYSTEM](../../setup/README.md) + ## Resources Cricket disks on Asimov: diff --git a/clocks/dclock/Makefile b/clocks/dclock/Makefile index a7ce57e..1068425 100644 --- a/clocks/dclock/Makefile +++ b/clocks/dclock/Makefile @@ -7,7 +7,8 @@ OUTDIR = ../../out HEADERS = $(wildcard *.inc) $(wildcard ../../inc/*.inc) TARGETS = \ - $(OUTDIR)/dclock.system.SYS + $(OUTDIR)/dclock.system.SYS \ + $(OUTDIR)/dclock.setup.SYS LOG_SUCCESS=1 LOG_FAILURE=1 @@ -35,6 +36,9 @@ clean: $(OUTDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< ifdef XATTR diff --git a/clocks/dclock/README.md b/clocks/dclock/README.md index 7a9d21e..6b1dc6c 100644 --- a/clocks/dclock/README.md +++ b/clocks/dclock/README.md @@ -11,3 +11,5 @@ Like other drivers here, this one will: * Only attempts detection if the system is a an Apple IIc * If detected, installs into ProDOS directly, following Technical Reference Manual requirements. * Chains to the next `.SYSTEM` file in the directory. + +`DCLOCK.SETUP` is for use with [SETUP.SYSTEM](../../setup/README.md). diff --git a/clocks/fujinet/Makefile b/clocks/fujinet/Makefile index 065d686..9da0c73 100644 --- a/clocks/fujinet/Makefile +++ b/clocks/fujinet/Makefile @@ -7,7 +7,8 @@ OUTDIR = ../../out HEADERS = $(wildcard *.inc) $(wildcard ../../inc/*.inc) TARGETS = \ - $(OUTDIR)/fn.clock.system.SYS + $(OUTDIR)/fn.clock.system.SYS \ + $(OUTDIR)/fn.clock.setup.SYS LOG_SUCCESS=1 LOG_FAILURE=1 @@ -35,6 +36,9 @@ clean: $(OUTDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.BIN $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< ifdef XATTR diff --git a/clocks/fujinet/README.md b/clocks/fujinet/README.md index 523c3f6..4c8a61a 100644 --- a/clocks/fujinet/README.md +++ b/clocks/fujinet/README.md @@ -4,6 +4,4 @@ This driver is an adaptation of the other drivers in https://github.com/a2stuff/prodos-drivers - - - +`FN.CLOCK.SETUP` is for use with [SETUP.SYSTEM](../../setup/README.md). diff --git a/clocks/jumbo/Makefile b/clocks/jumbo/Makefile index f650d20..6e776f6 100644 --- a/clocks/jumbo/Makefile +++ b/clocks/jumbo/Makefile @@ -12,9 +12,9 @@ HEADERS = $(wildcard *.inc) $(wildcard ../../inc/*.inc) \ ../fujinet/smartport.inc \ ../cricket/cricket.system.s - TARGETS = \ - $(OUTDIR)/clock.system.SYS + $(OUTDIR)/clock.system.SYS \ + $(OUTDIR)/clock.setup.SYS LOG_SUCCESS=1 LOG_FAILURE=1 @@ -42,6 +42,9 @@ clean: $(OUTDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< ifdef XATTR diff --git a/clocks/jumbo/README.md b/clocks/jumbo/README.md index d45fa33..0503f4f 100644 --- a/clocks/jumbo/README.md +++ b/clocks/jumbo/README.md @@ -13,3 +13,5 @@ The drivers are (in order): By default, the installer logs on success so you can tell what clock was detected, but you can build with `LOG_SUCCESS=0` to prevent that. If ProDOS _already_ has a clock driver installed, the driver is checked for common Thunderclock year tables. If found, the table is updated in memory to cover 2023-2028. + +`CLOCK.SETUP` is for use with [SETUP.SYSTEM](../../setup/README.md). diff --git a/clocks/ns.clock/Makefile b/clocks/ns.clock/Makefile index 87fb954..ce6b643 100644 --- a/clocks/ns.clock/Makefile +++ b/clocks/ns.clock/Makefile @@ -9,6 +9,7 @@ HEADERS = $(wildcard *.inc) $(wildcard ../../inc/*.inc) TARGETS = \ $(OUTDIR)/ns.clock.system.SYS \ + $(OUTDIR)/ns.clock.setup.SYS \ $(UTILDIR)/set.datetime.BIN LOG_SUCCESS=1 @@ -39,6 +40,9 @@ clean: $(OUTDIR)/%.o $(UTILDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< diff --git a/clocks/ns.clock/README.md b/clocks/ns.clock/README.md index d0ca7b9..c8c96e7 100644 --- a/clocks/ns.clock/README.md +++ b/clocks/ns.clock/README.md @@ -12,3 +12,5 @@ Adapted from `NS.CLOCK.SYSTEM` (by "CAP"), with these changes: These `BRUN`able files are also built: * [SET.DATETIME](set.datetime.s) sets the No Slot Clock date/time. + +`NS.CLOCK.SETUP` is for use with [SETUP.SYSTEM](../../setup/README.md). diff --git a/clocks/romx/Makefile b/clocks/romx/Makefile index 04008c7..9a42dfc 100644 --- a/clocks/romx/Makefile +++ b/clocks/romx/Makefile @@ -7,7 +7,8 @@ OUTDIR = ../../out HEADERS = $(wildcard *.inc) $(wildcard ../../inc/*.inc) TARGETS = \ - $(OUTDIR)/romxrtc.system.SYS + $(OUTDIR)/romxrtc.system.SYS \ + $(OUTDIR)/romxrtc.setup.SYS LOG_SUCCESS=1 LOG_FAILURE=1 @@ -35,6 +36,9 @@ clean: $(OUTDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< ifdef XATTR diff --git a/clocks/romx/README.md b/clocks/romx/README.md index 1dd9ca4..a6d6752 100644 --- a/clocks/romx/README.md +++ b/clocks/romx/README.md @@ -1,3 +1,5 @@ # ROMX ProDOS Clock Driver Original source c/o Jeff Mazur. + +`ROMXRTC.SETUP` is for use with [SETUP.SYSTEM](../../setup/README.md). diff --git a/inc/driver_postamble.inc b/inc/driver_postamble.inc index 95e7ebd..ca2ea95 100644 --- a/inc/driver_postamble.inc +++ b/inc/driver_postamble.inc @@ -1,3 +1,6 @@ +.ifndef BUILD_SETUP_FILE poporg reloc_end := * + +.endif diff --git a/inc/driver_preamble.inc b/inc/driver_preamble.inc index 9f89176..84b7f8c 100644 --- a/inc/driver_preamble.inc +++ b/inc/driver_preamble.inc @@ -4,14 +4,17 @@ ;; SYS files load at $2000; relocates self to $1000 .org SYS_ADDR + +.ifndef BUILD_SETUP_FILE dst_addr := $1000 - -;;; ------------------------------------------------------------ - jmp relocate +.else + jmp main +.endif .byte MM, DD, YY ; version date stamp +.ifndef BUILD_SETUP_FILE ;;; ------------------------------------------------------------ ;;; Relocate this code from $2000 (.SYSTEM start location) to $1000 ;;; and start executing there. This is done so that the next .SYSTEM @@ -389,6 +392,23 @@ suffix: found_self_flag: .byte 0 +.else + +;;; ============================================================ +;;; Main routine +;;; ============================================================ + +.proc main + jsr maybe_install_driver + + MLI_CALL QUIT, quit_params + brk ; crash if QUIT fails + + DEFINE_QUIT_PARAMS quit_params +.endproc + +.endif + ;;; ============================================================ ;;; Common Routines ;;; ============================================================ diff --git a/package.sh b/package.sh index cd81957..ce3423b 100755 --- a/package.sh +++ b/package.sh @@ -11,39 +11,47 @@ VOLNAME="drivers" rm -f "$IMGFILE" cadius CREATEVOLUME "$IMGFILE" "$VOLNAME" 140KB --no-case-bits --quiet -cadius CREATEFOLDER "$IMGFILE" "/$VOLNAME/CRICKET.UTIL" --no-case-bits --quiet -cadius CREATEFOLDER "$IMGFILE" "/$VOLNAME/NSCLOCK.UTIL" --no-case-bits --quiet +cadius CREATEFOLDER "$IMGFILE" "/$VOLNAME/SETUPS" --no-case-bits --quiet add_file () { cp "$1" "$PACKDIR/$2" cadius ADDFILE "$IMGFILE" "$3" "$PACKDIR/$2" --no-case-bits --quiet } -add_file "out/cricket.system.SYS" "cricket.system#FF0000" "/$VOLNAME" -add_file "out/cricket.util/set.datetime.BIN" "set.datetime#062000" "/$VOLNAME/CRICKET.UTIL" -add_file "out/cricket.util/set.date.BIN" "set.date#062000" "/$VOLNAME/CRICKET.UTIL" -add_file "out/cricket.util/set.time.BIN" "set.time#062000" "/$VOLNAME/CRICKET.UTIL" -add_file "out/cricket.util/test.BIN" "test#062000" "/$VOLNAME/CRICKET.UTIL" -add_file "out/dclock.system.SYS" "dclock.system#FF0000" "/$VOLNAME" -add_file "out/ns.clock.system.SYS" "ns.clock.system#FF0000" "/$VOLNAME" -add_file "out/nsclock.util/set.datetime.BIN" "set.datetime#062000" "/$VOLNAME/NSCLOCK.UTIL" -add_file "out/romxrtc.system.SYS" "romxrtc.system#FF0000" "/$VOLNAME" -add_file "out/fn.clock.system.SYS" "fn.clock.system#FF0000" "/$VOLNAME" -add_file "out/clock.system.SYS" "clock.system#FF0000" "/$VOLNAME" -add_file "out/ram.drv.system.SYS" "ram.drv.system#FF0000" "/$VOLNAME" -add_file "out/bbb.system.SYS" "bbb.system#FF0000" "/$VOLNAME" -add_file "out/buhbye.system.SYS" "buhbye.system#FF0000" "/$VOLNAME" -add_file "out/bye.system.SYS" "bye.system#FF0000" "/$VOLNAME" -add_file "out/selector.system.SYS" "selector.system#FF0000" "/$VOLNAME" -add_file "out/zipchip.system.SYS" "zipchip.system#FF0000" "/$VOLNAME" -add_file "out/quit.system.SYS" "quit.system#FF0000" "/$VOLNAME" -add_file "out/pause.system.SYS" "pause.system#FF0000" "/$VOLNAME" -add_file "out/me.first.system.SYS" "me.first.system#FF0000" "/$VOLNAME" -add_file "out/date.BIN" "date#062000" "/$VOLNAME" +# Drivers + +for file in \ + "bbb" "buhbye" "bye" "selector" \ + "clock" "cricket" "dclock" "fn.clock" "ns.clock" "romxrtc" \ + "ram.drv" \ + "zipchip" \ + "me.first" "pause"; do + add_file "out/$file.system.SYS" "$file.system#FF0000" "/$VOLNAME" + add_file "out/$file.setup.SYS" "$file.setup#FF0000" "/$VOLNAME/SETUPS" +done +add_file "out/setup.system.SYS" "setup.system#FF0000" "/$VOLNAME" +add_file "out/quit.system.SYS" "quit.system#FF0000" "/$VOLNAME" + +# Utilities + +add_file "out/date.BIN" "date#062000" "/$VOLNAME" + +cadius CREATEFOLDER "$IMGFILE" "/$VOLNAME/CRICKET.UTIL" --no-case-bits --quiet +add_file "out/cricket.util/set.datetime.BIN" "set.datetime#062000" "/$VOLNAME/CRICKET.UTIL" +add_file "out/cricket.util/set.date.BIN" "set.date#062000" "/$VOLNAME/CRICKET.UTIL" +add_file "out/cricket.util/set.time.BIN" "set.time#062000" "/$VOLNAME/CRICKET.UTIL" +add_file "out/cricket.util/test.BIN" "test#062000" "/$VOLNAME/CRICKET.UTIL" + +cadius CREATEFOLDER "$IMGFILE" "/$VOLNAME/NSCLOCK.UTIL" --no-case-bits --quiet +add_file "out/nsclock.util/set.datetime.BIN" "set.datetime#062000" "/$VOLNAME/NSCLOCK.UTIL" + + cadius CREATEFOLDER "$IMGFILE" "/$VOLNAME/TEXTCOLORS" --no-case-bits --quiet +cadius CREATEFOLDER "$IMGFILE" "/$VOLNAME/SETUPS/TEXTCOLORS" --no-case-bits --quiet for file in a2green bw deepblue gray gsblue mint pink wb; do - add_file "out/${file}.system.SYS" "${file}.system#FF0000" "/$VOLNAME/TEXTCOLORS" + add_file "out/${file}.system.SYS" "${file}.system#FF0000" "/$VOLNAME/TEXTCOLORS" + add_file "out/${file}.setup.SYS" "${file}.setup#FF0000" "/$VOLNAME/TEXTCOLORS/SETUPS" done rm -r "$PACKDIR" diff --git a/ram.drv/Makefile b/ram.drv/Makefile index 7c4111c..a72bf51 100644 --- a/ram.drv/Makefile +++ b/ram.drv/Makefile @@ -7,7 +7,8 @@ OUTDIR = ../out HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc) TARGETS = \ - $(OUTDIR)/ram.drv.system.SYS + $(OUTDIR)/ram.drv.system.SYS \ + $(OUTDIR)/ram.drv.setup.SYS export LOG_SUCCESS=1 export LOG_FAILURE=1 @@ -35,8 +36,8 @@ clean: $(OUTDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< -ifdef XATTR - xattr -wx prodos.AuxType '00 20' $@ -endif diff --git a/ram.drv/ram.drv.system.s b/ram.drv/ram.drv.system.s index 62db3f9..515cf09 100644 --- a/ram.drv/ram.drv.system.s +++ b/ram.drv/ram.drv.system.s @@ -38,7 +38,6 @@ zp_sig_addr := $06 zpproc_addr := $B0 zpproc_relay_addr := $2D0 -data_buf := $1C00 ; I/O when chaining to next SYS file driver_target := $FF00 ; Install location in ProDOS @@ -711,8 +710,6 @@ map2 := *+2+$80 ; len: $80 stash_00 := *+2+$100 ; len: $80 stash_01 := *+2+$180 ; len: $80 - .assert stash_01+$80 < data_buf, error, "Too long" - ;;; ************************************************************ .include "../inc/driver_postamble.inc" ;;; ************************************************************ diff --git a/selectors/Makefile b/selectors/Makefile index b68b9a2..b462283 100644 --- a/selectors/Makefile +++ b/selectors/Makefile @@ -8,9 +8,13 @@ HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc) TARGETS = \ $(OUTDIR)/selector.system.SYS \ + $(OUTDIR)/selector.setup.SYS \ $(OUTDIR)/bye.system.SYS \ + $(OUTDIR)/bye.setup.SYS \ $(OUTDIR)/bbb.system.SYS \ - $(OUTDIR)/buhbye.system.SYS + $(OUTDIR)/bbb.setup.SYS \ + $(OUTDIR)/buhbye.system.SYS \ + $(OUTDIR)/buhbye.setup.SYS # For timestamps MM = $(shell date "+%-m") @@ -34,8 +38,8 @@ clean: $(OUTDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< +$(OUTDIR)/%.setup.o: %.system.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) -D BUILD_SETUP_FILE --listing $(basename $@).list -o $@ $< + $(OUTDIR)/%.SYS: $(OUTDIR)/%.o ld65 $(LDFLAGS) -o $@ $< -ifdef XATTR - xattr -wx prodos.AuxType '00 20' $@ -endif diff --git a/setup/Makefile b/setup/Makefile new file mode 100644 index 0000000..2269565 --- /dev/null +++ b/setup/Makefile @@ -0,0 +1,35 @@ + +CAFLAGS = --target apple2enh --list-bytes 0 +LDFLAGS = --config apple2-asm.cfg + +OUTDIR = ../out + +HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc) + +TARGETS = \ + $(OUTDIR)/setup.system.SYS + +# For timestamps +MM = $(shell date "+%-m") +DD = $(shell date "+%-d") +YY = $(shell date "+%-y") +DEFINES = -D DD=$(DD) -D MM=$(MM) -D YY=$(YY) + +XATTR := $(shell command -v xattr 2> /dev/null) + +.PHONY: clean all +all: $(OUTDIR) $(TARGETS) + +$(OUTDIR): + mkdir -p $(OUTDIR) + +clean: + rm -f $(OUTDIR)/*.o + rm -f $(OUTDIR)/*.list + rm -f $(TARGETS) + +$(OUTDIR)/%.o: %.s $(HEADERS) + ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< + +$(OUTDIR)/%.SYS: $(OUTDIR)/%.o + ld65 $(LDFLAGS) -o $@ $< diff --git a/setup/README.md b/setup/README.md new file mode 100644 index 0000000..f870ed3 --- /dev/null +++ b/setup/README.md @@ -0,0 +1,30 @@ +# SETUP.SYSTEM + +The November 1987 edition of Call-A.P.P.L.E features an article by Sean Nolan, ["SYSTEM.SETUP - A Proposed Startup File Standard"](https://www.callapple.org/magazines-4/call-a-p-p-l-e/setup-system-a-proposed-startup-file-standard/). The article was reprinted in [Beneath Apple DOS ProDOS 2020](https://archive.org/details/beneath-apple-dos-prodos-2020). The proposal combines the ProDOS-8 notion of running the first .SYSTEM file found on disk and the convention of chaining to the next .SYSTEM file, with the ProDOS-16 notion of enumerating a directory of startup files. A main `SETUP.SYSTEM` file is provided which enumerates all files in a `SETUPS/` directory. These "setup files" are BIN or SYS files which work like standard ProDOS-8 drivers. The advantages of this approach are: + +* The top level directory only needs one SYSTEM file plus `SETUPS/`, which reduces clutter. +* Each individual setup file is simpler than stand-alone SYSTEM files, as they don't need to implement chaining. + +Which approach you use is a matter of taste. + +## How do you use these? + +If you choose this approach, use a tool like Copy II Plus or [Apple II DeskTop](https://github.com/a2stuff/a2d) to copy and arrange `SETUP.SYSTEM` as the first `.SYSTEM` file in your root directory. Create a `SETUPS/` directory, and copy the appropriate `.SETUPS` files there. A boot disk image catalog that is used on multiple different hardware configurations might include: + +* `PRODOS` - the operating system, e.g. [ProDOS 2.4](https://prodos8.com/) +* `SETUP.SYSTEM` - install No-Slot clock driver, if present +* `QUIT.SYSTEM` - invoke the Quit handler immediately, as a program selector +* `BASIC.SYSTEM` - which will not be automatically invoked, but is available to manually invoke +* `SETUPS/NS.CLOCK.SYSTEM` - install No-Slot clock driver, if present +* `SETUPS/ROMXRTC.SYSTEM` - install ROMX clock driver, if present +* `SETUPS/FN.CLOCK.SYSTEM` - install FujiNet clock driver, if present +* `SETUPS/DCLOCK.SYSTEM` - install DClock clock driver, if present +* `SETUPS/CRICKET.SYSTEM` - install Cricket! clock driver, if present +* `SETUPS/ZIPCHIP.SYSTEM` - slow the ZIP CHIP on speaker access, if present +* `SETUPS/RAM.DRV.SYSTEM` - install RamWorks RAM disk driver, if present +* `SETUPS/BUHBYE.SYSTEM` - install a customized Quit handler to replace the built-in one +* `SETUPS/PAUSE.SYSTEM` - pause for a moment, so that you can inspect the output of the above + +## Notes + +The `SETUP.SYSTEM` program is not modified from the published version except that it no longer clears the screen between running each file in `SETUPS/`, so that any logged output remains visible. diff --git a/setup/setup.system.s b/setup/setup.system.s new file mode 100644 index 0000000..e092913 --- /dev/null +++ b/setup/setup.system.s @@ -0,0 +1,329 @@ +;;; +;;; SETUP.SYSTEM by Sean Nolan +;;; +;;; A Proposed Startup File Standard +;;; +;;; Published in Call-APPLE, November, 1987 +;;; This program is in the public domain. +;;; +;;; This program mimics the ProDOS 16 +;;; SYSTEM.SETUP convention. It can be used +;;; to install RAM disk drivers, clock +;;; drivers, and IIGS Classic Desk +;;; Accessories on bootup under ProDOS 8. +;;; +;;; This program loads and calls all BINary +;;; and SYStem files in a subdirectory named +;;; SETUPS. It then looks for the second +;;; system program in the volume directory +;;; whose name ends in ".SYSTEM", and runs +;;; that. +;;; +;;; + +;;; Original code clears the screen before/after each driver. Skip it. +NO_HOME = 1 + +.define ORG .org +.define DFB .byte +.define DA .addr +.define DS .res +.define ASC .byte +.define ASCH scrcode +.feature labels_without_colons + +.feature loose_string_term + +.include "apple2.mac" + +.if 0 + TYP $FF ;save as a system file +.endif + ORG $BD00 ;load at $2000, but run at $BD00 +;;; ****************** equates +CH = $24 +IN2 = $280 +FILETYPE = IN2+16 +AUXCODE = IN2+31 +RESET = $3F2 +IOBUFFER = $B900 +PRODOS = $BF00 +QUITVECT = $BF03 +DEVNUM = $BF30 +BITMAP = $BF58 +INIT = $FB2F +VTABZ = $FC24 +HOME = $FC58 +RDKEY = $FD0C +SETVID = $FE93 +SETKBD = $FE89 +SETNORM = $FE84 +;;; ****************** boot code +VOLNAME = * ;The first 17 bytes are overwritten with the + ;name of the volume from which this was run. + LDX #1 ;mark page $BD as free in the system bitmap + STX BITMAP+23 ;so we can put Online result in our code. + DEX ;relocate this program to $BD00-BEFF +LOOP1 LDA $2000,X + STA $BD00,X + LDA $2100,X + STA $BE00,X + INX + BNE LOOP1 + DEX + TXS ;init stack pointer + JMP ENTER ;jump to relocated code +DIRNAME DFB 6 ;DirName and VolName must be in the same page + ASCH "SETUPS" + +;;; ****** Get name of boot volume +ENTER LDA DEVNUM ;get name of last volume accessed + STA ONLINEN + JSR PRODOS + DFB $C5 ;ONLINE + DA ONLINEP + LDA VOLNAME+1 ;insert a slash nefore the name + AND #$0F + TAX + INX + STX VOLNAME + LDA #$2F ;/ + STA VOLNAME+1 + LDA QUITVECT+1 ;save original quit vector + STA QUITMOD1+1 + LDA QUITVECT+2 + STA QUITMOD2+1 +;;; ****** Clean up before & after calling files +MAINLOOP LDX #2 ;point Reset vector and ProDOS +LOOP3 LDA JUMP+1,X ;Quit vectors to MainLoop + STA RESET,X + LDA JUMP,X + STA QUITVECT,X + DEX + BPL LOOP3 + TXS ;fix stack pointer (X=$FF) + JSR CLOSE ;close all open files + LDX #23 ;clear system bit map + LDA #0 +LOOP2 STA BITMAP,X + DEX + BPL LOOP2 + LDA #$CF ;mark pages 0,1,4-7 as used + STA BITMAP + LDA #%111 ;mark pages $BD-$BF as used + STA BITMAP+23 + LDA $C082 ;Language card off + STA $C00C ;40-column + STA $C00E ;normal character set + STA $C000 ;80STORE off + JSR SETNORM ;normal + JSR INIT ;display text page 1 + JSR SETVID ;PR#0 + JSR SETKBD ;IN#0 +;;; Make sure boot volume is around +;;; AND set prefix to the boot volume +.if NO_HOME +VOLMOUNT +.else +VOLMOUNT JSR HOME +.endif + JSR PRODOS ;set prefix to volume + DFB $C6 ;SET PREFIX + DA PFX2P + BCC VOLOK + LDX #13 +LOOP6 LDA VOLTEXT-1,X ;print message "insert volume" + STA $5A8+4,X + DEX + BNE LOOP6 +LOOP7 LDA VOLNAME+1,X ;print volume name + ORA #$80 + STA $5A8+19,X + INX + CPX VOLNAME + BCC LOOP7 + LDA #35 ;go to CH=35, CV=11 + STA CH + LDA #11 + JSR VTABZ + JSR RDKEY ;wait for keypress + JMP VOLMOUNT +;;; ****** Get name of next file at IN2 +VOLOK JSR NEXTFILE ;get name of next file at IN2 + BCS EXITLOOP ;if error, we're done with setup files +;;; ****** Load and call setup file + JSR PRODOS ;set prefix to SETUPS + DFB $C6 ;SET PREFIX + DA PFX1P + JSR READFILE ;read in file whose name is at IN@ + ;and call it if there was no error. +JUMP JMP MAINLOOP ;3 bytes here copied into ProDOS quit vector + DFB $BD^$A5 ;3 bytes here are copied into reset vector +EXITLOOP INC RESET+2 ;scramble reset vector +QUITMOD1 LDA #0 ;restore original quit vector + STA QUITVECT+1 +QUITMOD2 LDA #0 + STA QUITVECT+2 +;;; ****** Look for second system program on disk + LDA #0 ;modify NextFile routine so that it searches + STA NUMBER+1 ;the volume directory for system files only. + STA CHEKTYPE+1 + LDA #