Compare commits

...

3 Commits

Author SHA1 Message Date
Joshua Bell caeb237321 The Cricket!: Reset SSC ACIA before probing/setting
... and don't bother saving/restoring registers during install,
as this will only follow a boot or OS restart.

Suggested by @frankmilliron

Also inhibit interrupts in the SET.XXX utilities for good measure.
2023-06-25 12:06:40 -07:00
Joshua Bell c01d26042a The Cricket!: Add unified SET.DATETIME util 2023-06-25 11:46:35 -07:00
Joshua Bell 8ca57b2fac NSClock: Incorporate @bobbimanners Ultrawarp bug workaround
For context, see:
https://github.com/bobbimanners/ProDOS-Utils/blob/master/No_Slot_Clock/README.md
2023-06-25 11:37:59 -07:00
9 changed files with 178 additions and 16 deletions

View File

@ -10,6 +10,7 @@ TARGETS = \
$(OUTDIR)/prodos.mod.BIN \
$(OUTDIR)/cricket.system.SYS \
$(OUTDIR)/test.BIN \
$(OUTDIR)/set.datetime.BIN \
$(OUTDIR)/set.time.BIN \
$(OUTDIR)/set.date.BIN

View File

@ -38,6 +38,7 @@ I ended up disassembling both [NS.CLOCK.SYSTEM](../ns.clock/ns.clock.system.s) (
These `BRUN`able files are also built:
* [TEST](test.s) attempts to identify an SSC in Slot 2 and the Cricket via the ID sequence, to test routines.
* [SET.DATETIME](set.datetime.s) sets the Cricket's current date and time.
* [SET.DATE](set.date.s) sets the Cricket's current date.
* [SET.TIME](set.time.s) sets the Cricket's current time.

View File

@ -77,10 +77,12 @@ ssc_not_found:
init_ssc:
php
sei
lda COMMAND ; save status of SSC registers
sta saved_command
lda CONTROL
sta saved_control
;; Reset SSC
sta KBDSTRB ; Port 2 DSR line connected to KBDSTRB
lda #0
sta COMMAND
sta CONTROL
;; Configure SSC
lda #%00001011 ; no parity/echo/interrupts, RTS low, DTR low
@ -114,12 +116,10 @@ digit: cmp #HI('0') ; < '0' ?
bcc :-
cricket_found:
jsr restore_cmd_ctl
plp
jmp install_driver
cricket_not_found:
jsr restore_cmd_ctl
plp
;; fall through...
@ -135,16 +135,6 @@ not_found:
sec ; failure
rts
restore_cmd_ctl:
lda saved_control
sta CONTROL
lda saved_command
sta COMMAND
rts
saved_command: .byte 0
saved_control: .byte 0
.endproc
;; Write byte in A

View File

@ -21,6 +21,15 @@
jsr GETLN2
php
sei
;; Reset SSC
sta KBDSTRB ; Port 2 DSR line connected to KBDSTRB
lda #0
sta COMMAND
sta CONTROL
;; Configure SSC
lda #%00001011 ; no parity/echo/interrupts, RTS low, DTR low
sta COMMAND
@ -43,6 +52,8 @@ loop: lda INPUT_BUFFER,x
cmp #HI(ASCII_CR)
bne loop
plp
rts
.endproc

View File

@ -0,0 +1,144 @@
;;; SET.DATETIME utility for The Cricket!
;;; Prompts for date and time and updates Cricket.
.setcpu "6502"
.linecont +
.feature string_escapes
.include "apple2.inc"
.include "apple2.mac"
.include "../../inc/apple2.inc"
.include "../../inc/macros.inc"
.include "../../inc/ascii.inc"
.org $2000
.proc main
;; --------------------------------------------------
;; Date
jsr zstrout
scrcode "\rDate: WWW MM/DD/YY\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08"
.byte 0
jsr GETLN2
php
sei
;; Reset SSC
sta KBDSTRB ; Port 2 DSR line connected to KBDSTRB
lda #0
sta COMMAND
sta CONTROL
;; Configure SSC
lda #%00001011 ; no parity/echo/interrupts, RTS low, DTR low
sta COMMAND
lda #%10011110 ; 9600 baud, 8 data bits, 2 stop bits
sta CONTROL
;; Clock Commands
;; Set Date "SD WWW MM/DD/YY"
lda #HI('S')
jsr sendbyte
lda #HI('D')
jsr sendbyte
lda #HI(' ')
jsr sendbyte
ldx #0
: lda INPUT_BUFFER,x
jsr sendbyte
inx
cmp #HI(ASCII_CR)
bne :-
plp
;; --------------------------------------------------
;; Time
jsr zstrout
scrcode "\rTime: HH:MM:SS XM\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08"
.byte 0
jsr GETLN2
php
sei
;; Reset SSC
sta KBDSTRB ; Port 2 DSR line connected to KBDSTRB
lda #0
sta COMMAND
sta CONTROL
;; Configure SSC
lda #%00001011 ; no parity/echo/interrupts, RTS low, DTR low
sta COMMAND
lda #%10011110 ; 9600 baud, 8 data bits, 2 stop bits
sta CONTROL
;; Clock Commands
;; Set Time "ST HH:MM:SS:XM"
lda #HI('S')
jsr sendbyte
lda #HI('T')
jsr sendbyte
lda #HI(' ')
jsr sendbyte
ldx #0
: lda INPUT_BUFFER,x
jsr sendbyte
inx
cmp #HI(ASCII_CR)
bne :-
plp
rts
.endproc
;; Write byte in A to SSC
.proc sendbyte
pha
: lda STATUS
and #(1 << 4) ; transmit register empty? (bit 4)
beq :- ; nope, keep waiting
pla
sta TDREG
rts
.endproc
;;; ------------------------------------------------------------
;;; Output a high-ascii, null-terminated string.
;;; String immediately follows the JSR.
.proc zstrout
ptr := $A5
pla ; read address from stack
sta ptr
pla
sta ptr+1
bne skip ; always (since data not on ZP)
next: jsr COUT
skip: inc ptr
bne :+
inc ptr+1
: ldy #0
lda (ptr),y
bne next
lda ptr+1 ; restore address to stack
pha
lda ptr
pha
rts
.endproc

View File

@ -21,6 +21,15 @@
jsr GETLN2
php
sei
;; Reset SSC
sta KBDSTRB ; Port 2 DSR line connected to KBDSTRB
lda #0
sta COMMAND
sta CONTROL
;; Configure SSC
lda #%00001011 ; no parity/echo/interrupts, RTS low, DTR low
sta COMMAND
@ -43,6 +52,8 @@ loop: lda INPUT_BUFFER,x
cmp #HI(ASCII_CR)
bne loop
plp
rts
.endproc

View File

@ -278,6 +278,7 @@ loop: lda driver,y
driver:
php
sei
lda $C00B ; Ultrawarp bug workaround c/o @bobbimanners
ld4: lda $CFFF ; self-modified ($CFFF or RDCXROM)
pha
st1: sta $C300 ; self-modified ($Cn00 or INTCXROM)

View File

@ -349,6 +349,7 @@ slot: .byte 0
driver:
php
sei
lda $C00B ; Ultrawarp bug workaround c/o @bobbimanners
ld4: lda $CFFF ; self-modified ($CFFF or RDCXROM)
pha
st1: sta $C300 ; self-modified ($Cn00 or INTCXROM)
@ -456,6 +457,7 @@ unlock:
php
sei
lda $C00B ; Ultrawarp bug workaround c/o @bobbimanners
ld4: lda $CFFF ; self-modified ($CFFF or RDCXROM)
pha
st1: sta $C300 ; self-modified ($Cn00 or INTCXROM)

View File

@ -20,6 +20,7 @@ add_file () {
}
add_file "clocks/cricket/out/cricket.system.SYS" "cricket.system#FF0000" "/$VOLNAME"
add_file "clocks/cricket/out/set.datetime.BIN" "set.datetime#062000" "/$VOLNAME/CRICKET.UTIL"
add_file "clocks/cricket/out/set.date.BIN" "set.date#062000" "/$VOLNAME/CRICKET.UTIL"
add_file "clocks/cricket/out/set.time.BIN" "set.time#062000" "/$VOLNAME/CRICKET.UTIL"
add_file "clocks/cricket/out/test.BIN" "test#062000" "/$VOLNAME/CRICKET.UTIL"