From 537d79810b0b7b5e5a8de13955772023304e8555 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 4 Dec 2023 20:28:25 -0800 Subject: [PATCH] Jumbo: Patch ThunderClock driver for 2023-2028 If ProDOS finds a ThunderClock it installs a built-in driver for it. The ThunderClock card gives day-of-week but not year. So the driver uses the day/month/day-of-week to infer the year, using a 7-entry table. This means the driver gives the wrong year unless it is reasonably updated. ProDOS 2.4.2 includes an update to handle 2018-2023 but that's about to run out. https://github.com/ProDOS-8/ProDOS8-Testing/issues/72 Make the CLOCK.SYSTEM jumbo driver do the extra work of updating the year table for the ThunderClock driver. This handles old versions of ProDOS from 1.1 through 2.4.2, and the update handles 2023 through 2028. (In 2027 we can update again to handle through 2032.) --- clocks/jumbo/README.md | 4 +- clocks/jumbo/clock.system.s | 87 ++++++++++++++++++++++++++++++++++++- 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/clocks/jumbo/README.md b/clocks/jumbo/README.md index e04dfcd..d45fa33 100644 --- a/clocks/jumbo/README.md +++ b/clocks/jumbo/README.md @@ -10,4 +10,6 @@ The drivers are (in order): * DClock * Cricket! -The installer is silent - no output is shown on either failure or success. +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. diff --git a/clocks/jumbo/clock.system.s b/clocks/jumbo/clock.system.s index ebfc36d..0a3819d 100644 --- a/clocks/jumbo/clock.system.s +++ b/clocks/jumbo/clock.system.s @@ -50,7 +50,7 @@ .proc maybe_install_driver lda MACHID and #$01 ; existing clock card? - bne ret + bne check_thunderclock jsr ns_clock::maybe_install_driver bcc ret @@ -70,6 +70,91 @@ ret: rts .endproc +.proc check_thunderclock + ;; Look for Thunderclock year table + bit RWRAM1 + bit RWRAM1 + + lda #table_1982 + jsr check_sig + beq update_table + + lda #table_1986 + jsr check_sig + beq update_table + + lda #table_1993 + jsr check_sig + beq update_table + + lda #table_2018 + jsr check_sig + beq update_table + + ;; Table not found - we have a clock but don't + ;; know what it is, so don't log anything. + bit ROMIN2 + rts + + ;; ---------------------------------------- + + ;; Copy the latest table into place +update_table: + ldx #SIG_LEN-1 +: lda table_2023,x + sta SIG_ADDR,x + dex + bpl :- + + bit ROMIN2 +.if ::LOG_SUCCESS + ;; Display success message, to confirm table updates. + jsr log_message + scrcode "ThunderClock - " + .byte 0 + + ;; Display the current date + jsr cout_date +.endif ; ::LOG_SUCCESS + rts + + ;; ---------------------------------------- + +check_sig: + ptr := $06 + sta ptr + stx ptr+1 + ldy #SIG_LEN-1 +: lda (ptr),y + cmp SIG_ADDR,y + bne :+ ; Z=0 for no match + dey + bpl :- + iny ; Z=1 for match +: rts + +SIG_LEN = 7 +SIG_ADDR := $D7B8 + +table_1982: ; ProDOS 1.1.1 + .byte $54, $54, $53, $52, $57, $56, $55 + +table_1986: ; ProDOS 1.3 - 1.9 + .byte $5A, $59, $58, $58, $57, $56, $5B + +table_1993: ; ProDOS 2.0.3 + .byte $60, $5F, $5E, $5D, $62, $61, $60 + +table_2018: ; ProDOS 2.4.2 + .byte $12, $17, $16, $15, $14, $14, $13 + +table_2023: + .byte $18, $17, $1C, $1B, $1A, $19, $18 +.endproc ;;; ************************************************************ .include "../../inc/driver_postamble.inc"