Add "jumbo" clock driver, an amalgamation of the others

This one driver pulls in the installers for each other clock driver,
and invokes each in turn:

* No-Slot Clock
* ROMX
* FujiNet
* DClock
* Cricket!

This requires adding `.ifndef JUMBO` guards in the other drivers for
when they pull in include files (symbols, macros, etc). The other
drivers are adjusted to return with carry clear on successful install,
failure otherwise.
This commit is contained in:
Joshua Bell 2022-11-26 20:29:38 -08:00
parent 6f142c08d6
commit f2ea11fcde
10 changed files with 212 additions and 6 deletions

View File

@ -1,4 +1,4 @@
targets := ns.clock cricket dclock romx fujinet targets := ns.clock cricket dclock romx fujinet jumbo
.PHONY: all $(targets) .PHONY: all $(targets)

View File

@ -30,3 +30,5 @@ This directory includes drivers for the following real-time clocks:
* Cricket! * Cricket!
All follow the above protocol: install only if there is not already a clock, probe for the clock before installing, and chain to the next driver. All follow the above protocol: install only if there is not already a clock, probe for the clock before installing, and chain to the next driver.
In addition, the "jumbo" directory combines the other driver installers to create a single unified clock driver installer. See its [README](jumbo/README.md) for more details.

View File

@ -6,6 +6,7 @@
;;; Original by "CAP" 04/21/91 ;;; Original by "CAP" 04/21/91
;;; http://www.apple2.org.za/gswv/a2zine/GS.WorldView/v1999/Oct/MISC/NSC.Disk.TXT ;;; http://www.apple2.org.za/gswv/a2zine/GS.WorldView/v1999/Oct/MISC/NSC.Disk.TXT
.ifndef JUMBO_CLOCK_DRIVER
.setcpu "6502" .setcpu "6502"
.linecont + .linecont +
.feature string_escapes .feature string_escapes
@ -18,9 +19,12 @@
.include "../../inc/macros.inc" .include "../../inc/macros.inc"
.include "../../inc/prodos.inc" .include "../../inc/prodos.inc"
.include "../../inc/ascii.inc" .include "../../inc/ascii.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_preamble.inc" .include "../../inc/driver_preamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************
;;; ============================================================ ;;; ============================================================
@ -31,7 +35,9 @@
read_delay_hi = $3 * 3 ; ($300 iterations is normal * 3.6MHz) read_delay_hi = $3 * 3 ; ($300 iterations is normal * 3.6MHz)
.ifndef JUMBO_CLOCK_DRIVER
.define PRODUCT "Cricket Clock" .define PRODUCT "Cricket Clock"
.endif ; JUMBO_CLOCK_DRIVER
;;; ============================================================ ;;; ============================================================
;;; Ensure there is not a previous clock driver installed. ;;; Ensure there is not a previous clock driver installed.
@ -115,10 +121,14 @@ cricket_not_found:
;; fall through... ;; fall through...
not_found: not_found:
.ifndef JUMBO_CLOCK_DRIVER
;; Show failure message ;; Show failure message
jsr log_message jsr log_message
scrcode PRODUCT, " - Not Found." scrcode PRODUCT, " - Not Found."
.byte 0 .byte 0
.endif ; JUMBO_CLOCK_DRIVER
sec ; failure
rts rts
restore_cmd_ctl: restore_cmd_ctl:
@ -204,6 +214,7 @@ loop: lda driver,y
lda ROMIN2 lda ROMIN2
.ifndef JUMBO_CLOCK_DRIVER
;; Display success message ;; Display success message
jsr log_message jsr log_message
scrcode PRODUCT, " - " scrcode PRODUCT, " - "
@ -211,7 +222,9 @@ loop: lda driver,y
;; Display the current date ;; Display the current date
jsr cout_date jsr cout_date
.endif ; JUMBO_CLOCK_DRIVER
clc ; success
rts ; done! rts ; done!
.endproc .endproc
@ -310,5 +323,7 @@ done: pla ; restore saved command state
.assert sizeof_driver <= 125, error, "Clock code must be <= 125 bytes" .assert sizeof_driver <= 125, error, "Clock code must be <= 125 bytes"
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_postamble.inc" .include "../../inc/driver_postamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************

View File

@ -12,7 +12,8 @@
; - John Brooks spotted this, [M.G.] totally missed this. ; - John Brooks spotted this, [M.G.] totally missed this.
; This version of the code has fixes permanently applied. ; This version of the code has fixes permanently applied.
.setcpu "65C02" .ifndef JUMBO_CLOCK_DRIVER
.setcpu "6502" ; changed below
.linecont + .linecont +
.feature string_escapes .feature string_escapes
@ -23,6 +24,7 @@
.include "../../inc/apple2.inc" .include "../../inc/apple2.inc"
.include "../../inc/macros.inc" .include "../../inc/macros.inc"
.include "../../inc/prodos.inc" .include "../../inc/prodos.inc"
.endif ; JUMBO_CLOCK_DRIVER
; zero page locations ; zero page locations
SCRATCH := $0B ; scratch value for BCD range checks SCRATCH := $0B ; scratch value for BCD range checks
@ -43,7 +45,9 @@ DPTRH := SLOT4IO+2 ; Slinky data ptr high
DATA := SLOT4IO+3 ; Slinky data byte DATA := SLOT4IO+3 ; Slinky data byte
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_preamble.inc" .include "../../inc/driver_preamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************
;;; ============================================================ ;;; ============================================================
@ -52,11 +56,14 @@ DATA := SLOT4IO+3 ; Slinky data byte
;;; ;;;
;;; ============================================================ ;;; ============================================================
.ifndef JUMBO_CLOCK_DRIVER
.define PRODUCT "DClock" .define PRODUCT "DClock"
.endif ; JUMBO_CLOCK_DRIVER
;;; ============================================================ ;;; ============================================================
;;; Ensure there is not a previous clock driver installed. ;;; Ensure there is not a previous clock driver installed.
;;; And that this is a IIc. And that the clock is present. ;;; And that this is a IIc. And that the clock is present.
;;; NOTE: Safe to run on a non-IIc (6502 opcodes, etc)
.proc maybe_install_driver .proc maybe_install_driver
lda MACHID lda MACHID
@ -70,16 +77,23 @@ DATA := SLOT4IO+3 ; Slinky data byte
cmp #$00 cmp #$00
bne done bne done
;;; Since this is a IIc, okay to rely on 65C02 opcodes from here.
.pushcpu
.setcpu "65C02"
jsr ClockRead jsr ClockRead
jsr ValidTime jsr ValidTime
bcc InstallDriver bcc InstallDriver
.ifndef JUMBO_CLOCK_DRIVER
;; Show failure message ;; Show failure message
jsr log_message jsr log_message
scrcode PRODUCT, " - Not Found." scrcode PRODUCT, " - Not Found."
.byte 0 .byte 0
.endif ; JUMBO_CLOCK_DRIVER
done: rts done: sec ; failure
rts
.endproc .endproc
; ---------------------------------------------------------------------------- ; ----------------------------------------------------------------------------
@ -124,6 +138,7 @@ loop: lda driver,y
lda ROMIN2 lda ROMIN2
.ifndef JUMBO_CLOCK_DRIVER
;; Display success message ;; Display success message
jsr log_message jsr log_message
scrcode PRODUCT, " - " scrcode PRODUCT, " - "
@ -131,7 +146,9 @@ loop: lda driver,y
;; Display the current date ;; Display the current date
jsr cout_date jsr cout_date
.endif ; JUMBO_CLOCK_DRIVER
clc ; success
rts ; done! rts ; done!
.endproc .endproc
@ -379,6 +396,10 @@ regulk = * - 1
sizeof_driver := * - driver sizeof_driver := * - driver
.assert sizeof_driver <= 125, error, "Clock code must be <= 125 bytes" .assert sizeof_driver <= 125, error, "Clock code must be <= 125 bytes"
.popcpu
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_postamble.inc" .include "../../inc/driver_postamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************

View File

@ -1,6 +1,7 @@
;;; ProDOS driver for the Fujinet clock ;;; ProDOS driver for the Fujinet clock
;;; Adapted from: https://github.com/a2stuff/prodos-drivers/blob/main/cricket/cricket.system.s ;;; Adapted from: https://github.com/a2stuff/prodos-drivers/blob/main/cricket/cricket.system.s
.ifndef JUMBO_CLOCK_DRIVER
.setcpu "6502" .setcpu "6502"
.linecont + .linecont +
.feature string_escapes .feature string_escapes
@ -13,22 +14,27 @@
.include "../../inc/macros.inc" .include "../../inc/macros.inc"
.include "../../inc/prodos.inc" .include "../../inc/prodos.inc"
.include "../../inc/ascii.inc" .include "../../inc/ascii.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_preamble.inc" .include "../../inc/driver_preamble.inc"
.include "./smartport.inc" .endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************
.include "./smartport.inc"
FN_CLOCK_DEVICE_TYPE := $13 ; As defined on the Fujinet firmware FN_CLOCK_DEVICE_TYPE := $13 ; As defined on the Fujinet firmware
;;; ============================================================ ;;; ============================================================
;;; ;;;
;;; Driver Installer ;;; Driver Installer
;;; ;;;
;;; ============================================================ ;;; ============================================================
.ifndef JUMBO_CLOCK_DRIVER
.define PRODUCT "Fujinet Clock" .define PRODUCT "Fujinet Clock"
.endif ; JUMBO_CLOCK_DRIVER
;;; ============================================================ ;;; ============================================================
;;; Ensure there is not a previous clock driver installed. ;;; Ensure there is not a previous clock driver installed.
@ -115,12 +121,15 @@ found:
jmp install_driver jmp install_driver
not_found: not_found:
.ifndef JUMBO_CLOCK_DRIVER
;; Show failure message ;; Show failure message
jsr log_message jsr log_message
scrcode PRODUCT, " - Not Found." scrcode PRODUCT, " - Not Found."
.byte 0 .byte 0
rts .endif ; JUMBO_CLOCK_DRIVER
sec ; failure
rts
.endproc .endproc
;;; ------------------------------------------------------------ ;;; ------------------------------------------------------------
@ -169,6 +178,7 @@ loop: lda driver,y
lda ROMIN2 lda ROMIN2
.ifndef JUMBO_CLOCK_DRIVER
;; Display success message ;; Display success message
jsr log_message jsr log_message
scrcode PRODUCT, " - " scrcode PRODUCT, " - "
@ -176,11 +186,15 @@ loop: lda driver,y
;; Display the current date ;; Display the current date
jsr cout_date jsr cout_date
.endif ; JUMBO_CLOCK_DRIVER
clc ; success
rts ; done! rts ; done!
.endproc .endproc
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_postamble.inc" .include "../../inc/driver_postamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************

38
clocks/jumbo/Makefile Normal file
View File

@ -0,0 +1,38 @@
CAFLAGS = --target apple2enh --list-bytes 0
LDFLAGS = --config apple2-asm.cfg
OUTDIR = out
HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc)
TARGETS = \
$(OUTDIR)/clock.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 $@ $<
ifdef XATTR
xattr -wx prodos.AuxType '00 20' $@
endif

13
clocks/jumbo/README.md Normal file
View File

@ -0,0 +1,13 @@
# "Jumbo" ProDOS Clock Driver
This is an amalgamation of the other clock driver installers. Each one is tried in turn, until one successfully installs a clock driver.
The drivers are (in order):
* No-Slot Clock
* ROMX
* FujiNet
* DClock
* Cricket!
The installer is silent - no output is shown on either failure or success.

View File

@ -0,0 +1,75 @@
;;; "Jumbo" Clock Driver
;;;
;;; Pulls in several clock drivers sources and tries each one in sequence.
;;;
JUMBO_CLOCK_DRIVER = 1
.setcpu "6502"
.linecont +
.feature string_escapes
.include "apple2.inc"
.include "apple2.mac"
.include "opcodes.inc"
.include "../../inc/apple2.inc"
.include "../../inc/macros.inc"
.include "../../inc/prodos.inc"
.include "../../inc/ascii.inc"
;;; ************************************************************
.include "../../inc/driver_preamble.inc"
;;; ************************************************************
.scope ns_clock
.include "../ns.clock/ns.clock.system.s"
.endscope
.scope romx
.include "../romx/romxrtc.system.s"
.endscope
.scope dclock
.include "../dclock/dclock.system.s"
.endscope
.scope fujinet
.include "../fujinet/fn.clock.system.s"
.endscope
.scope cricket
.include "../cricket/cricket.system.s"
.endscope
;;; ============================================================
;;;
;;; Driver Installer
;;;
;;; ============================================================
.define PRODUCT "Jumbo Clock Driver"
.proc maybe_install_driver
lda MACHID
and #$01 ; existing clock card?
bne ret
jsr ns_clock::maybe_install_driver
bcc ret
jsr romx::maybe_install_driver
bcc ret
jsr dclock::maybe_install_driver
bcc ret
jsr fujinet::maybe_install_driver
bcc ret
jsr cricket::maybe_install_driver
bcc ret
ret: rts
.endproc
;;; ************************************************************
.include "../../inc/driver_postamble.inc"
;;; ************************************************************

View File

@ -5,6 +5,7 @@
;;; Modification history available at: ;;; Modification history available at:
;;; https://github.com/a2stuff/prodos-drivers ;;; https://github.com/a2stuff/prodos-drivers
.ifndef JUMBO_CLOCK_DRIVER
.setcpu "6502" .setcpu "6502"
.linecont + .linecont +
.feature string_escapes .feature string_escapes
@ -16,9 +17,12 @@
.include "../../inc/apple2.inc" .include "../../inc/apple2.inc"
.include "../../inc/macros.inc" .include "../../inc/macros.inc"
.include "../../inc/prodos.inc" .include "../../inc/prodos.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_preamble.inc" .include "../../inc/driver_preamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************
;;; ============================================================ ;;; ============================================================
@ -27,7 +31,9 @@
;;; ;;;
;;; ============================================================ ;;; ============================================================
.ifndef JUMBO_CLOCK_DRIVER
.define PRODUCT "No-Slot Clock" .define PRODUCT "No-Slot Clock"
.endif ; JUMBO_CLOCK_DRIVER
;;; ============================================================ ;;; ============================================================
;;; Ensure there is not a previous clock driver installed. ;;; Ensure there is not a previous clock driver installed.
@ -126,11 +132,14 @@ not_found:
dey dey
bpl :- bpl :-
.ifndef JUMBO_CLOCK_DRIVER
;; Show failure message ;; Show failure message
jsr log_message jsr log_message
scrcode PRODUCT, " - Not Found." scrcode PRODUCT, " - Not Found."
.byte 0 .byte 0
.endif ; JUMBO_CLOCK_DRIVER
sec ; failure
rts rts
saved: .byte 0, 0, 0, 0 saved: .byte 0, 0, 0, 0
@ -180,6 +189,7 @@ loop: lda driver,y
lda ROMIN2 lda ROMIN2
.ifndef JUMBO_CLOCK_DRIVER
;; Display success message ;; Display success message
jsr log_message jsr log_message
scrcode PRODUCT, " - " scrcode PRODUCT, " - "
@ -187,7 +197,9 @@ loop: lda driver,y
;; Display the current date ;; Display the current date
jsr cout_date jsr cout_date
.endif ; JUMBO_CLOCK_DRIVER
clc ; success
rts ; done! rts ; done!
.endproc .endproc
@ -289,5 +301,7 @@ unlock:
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_postamble.inc" .include "../../inc/driver_postamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************

View File

@ -8,6 +8,7 @@
;;; Modifications by Joshua Bell inexorabletash@gmail.com ;;; Modifications by Joshua Bell inexorabletash@gmail.com
;;; * Converted to ca65 syntax and adapted to driver wrapper. ;;; * Converted to ca65 syntax and adapted to driver wrapper.
.ifndef JUMBO_CLOCK_DRIVER
.setcpu "6502" .setcpu "6502"
.linecont + .linecont +
.feature string_escapes .feature string_escapes
@ -19,13 +20,16 @@
.include "../../inc/apple2.inc" .include "../../inc/apple2.inc"
.include "../../inc/macros.inc" .include "../../inc/macros.inc"
.include "../../inc/prodos.inc" .include "../../inc/prodos.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; Uncomment the following to "fake" a clock with a fixed date. ;;; Uncomment the following to "fake" a clock with a fixed date.
;;; Used for testing without a real ROMX around. ;;; Used for testing without a real ROMX around.
;;; FAKE_CLOCK = 1 ;;; FAKE_CLOCK = 1
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_preamble.inc" .include "../../inc/driver_preamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************
ZipSlo := $C0E0 ; ZIP CHIP slowdown ZipSlo := $C0E0 ; ZIP CHIP slowdown
@ -41,7 +45,9 @@ SEL_MBANK := $F851 ; Select Main bank reg
;;; ;;;
;;; ============================================================ ;;; ============================================================
.ifndef JUMBO_CLOCK_DRIVER
.define PRODUCT "ROMX Clock" .define PRODUCT "ROMX Clock"
.endif ; JUMBO_CLOCK_DRIVER
;;; ============================================================ ;;; ============================================================
;;; Ensure there is not a previous clock driver installed. ;;; Ensure there is not a previous clock driver installed.
@ -85,11 +91,14 @@ nope: sec ; not found
: bit SEL_MBANK ; restore original bank (unconditionally) : bit SEL_MBANK ; restore original bank (unconditionally)
bcc install_driver ; found clock! bcc install_driver ; found clock!
.ifndef JUMBO_CLOCK_DRIVER
;; Show failure message ;; Show failure message
jsr log_message jsr log_message
scrcode PRODUCT, " - Not Found." scrcode PRODUCT, " - Not Found."
.byte 0 .byte 0
.endif ; JUMBO_CLOCK_DRIVER
sec ; failure
rts rts
.endproc .endproc
@ -148,6 +157,7 @@ loop: lda ClockDrv,y
lda ROMIN2 lda ROMIN2
.ifndef JUMBO_CLOCK_DRIVER
;; Display success message ;; Display success message
jsr log_message jsr log_message
scrcode PRODUCT, " - " scrcode PRODUCT, " - "
@ -155,7 +165,9 @@ loop: lda ClockDrv,y
;; Display the current date ;; Display the current date
jsr cout_date jsr cout_date
.endif ; JUMBO_CLOCK_DRIVER
clc ; success
rts ; done! rts ; done!
.endproc .endproc
@ -313,5 +325,7 @@ ClockDrvSize = ClockDrvEnd - ClockDrv
.sprintf("Clock driver must be <= 125 bytes, was %d bytes", ClockDrvSize) .sprintf("Clock driver must be <= 125 bytes, was %d bytes", ClockDrvSize)
;;; ************************************************************ ;;; ************************************************************
.ifndef JUMBO_CLOCK_DRIVER
.include "../../inc/driver_postamble.inc" .include "../../inc/driver_postamble.inc"
.endif ; JUMBO_CLOCK_DRIVER
;;; ************************************************************ ;;; ************************************************************