Add NOCLOCK.SYSTEM/NOCLOCK.SETUP

Prompts for date/time if no real-time clock is present.

Resolves #24
This commit is contained in:
Joshua Bell
2025-08-04 12:14:54 -07:00
parent 32989d4fef
commit e992c8cb92
5 changed files with 171 additions and 1 deletions
+2
View File
@@ -46,6 +46,8 @@ This repo includes the following drivers/modifications:
In addition, `QUIT.SYSTEM` is present which isn't a driver but which immediately invokes the QUIT handler (a.k.a. program selector). This will happen automatically if the last driver can't find another `.SYSTEM` file, but `QUIT.SYSTEM` can be used to stop the chain if you have other `.SYSTEM` files in your root directory.
If you don't have a real-time clock, `NOCLOCK.SYSTEM` will prompt you for the date/time on boot and set the ProDOS date/time, which will be used to record file creation/modification times.
There's also `PAUSE.SYSTEM` which just waits for a fraction of a second before invoking the next driver file in case the log messages from the other installers goes by too fast for your taste, and `HOME.SYSTEM` in case you want the log messages to start off with a blank screen.
Non-drivers that are included:
+1 -1
View File
@@ -25,7 +25,7 @@ for file in \
"clock" "cricket" "dclock" "fn.clock" "ns.clock" "romxrtc" \
"ram.drv" \
"zipchip" \
"me.first" "pause" "home"; do
"me.first" "pause" "home" "noclock"; do
add_file "out/$file.system.SYS" "$file.system#FF0000" "/$VOLNAME"
add_file "out/$file.setup.SYS" "$file.setup#FF0000" "/$VOLNAME/SETUPS"
done
+2
View File
@@ -14,6 +14,8 @@ TARGETS = \
$(OUTDIR)/home.setup.SYS \
$(OUTDIR)/me.first.system.SYS \
$(OUTDIR)/me.first.setup.SYS \
$(OUTDIR)/noclock.system.SYS \
$(OUTDIR)/noclock.setup.SYS \
$(OUTDIR)/date.BIN
# For timestamps
+2
View File
@@ -10,3 +10,5 @@
* Moves the current volume to the end of DEVLST. Niche, but useful in some circumstances.
* [HOME.SYSTEM](home.system.s)
* Clears the screen before invoking the next driver file. Useful if you want to start or end driver installs with a clear screen.
* [NOCLOCK.SYSTEM](noclock.system.s)
* If no real-time clock is present, prompt the user then set the ProDOS date/time.
+164
View File
@@ -0,0 +1,164 @@
.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/driver_preamble.inc"
;;; ************************************************************
;;; ============================================================
;;; Ensure there is not a previous clock driver installed.
.proc maybe_install_driver
lda MACHID
and #$01 ; existing clock card?
beq prompt ; no, prompt for date/time
rts ; yes, done!
.endproc
.proc prompt
date:
jsr log_message
scrcode "Date: MM/DD/YY\x08\x08\x08\x08\x08\x08\x08\x08"
;; Offsets: .....01234567
.byte 0
jsr GETLN2
lda INPUT_BUFFER+1
jsr shift_into_tmp
lda INPUT_BUFFER+0
jsr shift_into_tmp
jsr bcd_to_binary
beq date
cmp #13
bcs date
sta set_month
lda INPUT_BUFFER+4
jsr shift_into_tmp
lda INPUT_BUFFER+3
jsr shift_into_tmp
jsr bcd_to_binary
beq date
cmp #32
bcs date
sta set_day
lda INPUT_BUFFER+7
jsr shift_into_tmp
lda INPUT_BUFFER+6
jsr shift_into_tmp
jsr bcd_to_binary
sta set_year
;; --------------------------------------------------
;; Prompt for Time
time:
jsr log_message
scrcode "Time: HH:MM\x08\x08\x08\x08\x08"
;; Offsets: .....01234567
.byte 0
jsr GETLN2
lda INPUT_BUFFER+1
jsr shift_into_tmp
lda INPUT_BUFFER+0
jsr shift_into_tmp
jsr bcd_to_binary
cmp #24
bcs time
sta set_hours
lda INPUT_BUFFER+4
jsr shift_into_tmp
lda INPUT_BUFFER+3
jsr shift_into_tmp
jsr bcd_to_binary
cmp #60
bcs time
sta set_minutes
;; --------------------------------------------------
;; Set date/time
;; | DATEHI | | DATELO |
;; 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;; | Year | Month | Day |
;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
lda set_month
asl
asl
asl
asl
asl
ora set_day
sta DATELO
lda set_year
rol
sta DATEHI
lda set_minutes
sta TIMELO
lda set_hours
sta TIMEHI
;;; --------------------------------------------------
bcd_to_binary:
ldy #$FF ; result = -1
sec
sed
: iny ; result += 1
sbc #1 ; value -= 1
bcs :-
cld
tya ; A = result
rts
;;; --------------------------------------------------
shift_into_tmp:
and #$0F
ror
ror tmp
ror
ror tmp
ror
ror tmp
ror
ror tmp
lda tmp
rts
tmp: .byte 0
.endproc
;;; ------------------------------------------------------------
set_year: .byte 0
set_month: .byte 0
set_day: .byte 0
set_hours: .byte 0
set_minutes: .byte 0
set_seconds: .byte 0
;;; ************************************************************
.include "../inc/driver_postamble.inc"
;;; ************************************************************