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.
This commit is contained in:
Joshua Bell 2023-06-25 12:06:40 -07:00
parent c01d26042a
commit caeb237321
4 changed files with 50 additions and 16 deletions

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

@ -24,6 +24,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
@ -46,6 +55,8 @@
cmp #HI(ASCII_CR)
bne :-
plp
;; --------------------------------------------------
;; Time
@ -55,6 +66,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
@ -77,6 +97,8 @@
cmp #HI(ASCII_CR)
bne :-
plp
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