mirror of
https://github.com/a2stuff/prodos-drivers.git
synced 2025-01-08 08:29:57 +00:00
Increase read delay. Resolves #4
This commit is contained in:
parent
f507432fef
commit
5fbe03a882
2
Makefile
2
Makefile
@ -3,7 +3,7 @@ CC65 = ~/dev/cc65/bin
|
||||
CAFLAGS = --target apple2enh --list-bytes 0
|
||||
CCFLAGS = --config apple2-asm.cfg
|
||||
|
||||
TARGETS = prodos.mod.BIN ns.clock.system.SYS cricket.system.SYS test.BIN
|
||||
TARGETS = prodos.mod.BIN ns.clock.system.SYS cricket.system.SYS test.BIN get.time.BIN
|
||||
|
||||
# For timestamps
|
||||
MM = $(shell date "+%m")
|
||||
|
@ -35,6 +35,7 @@ PATHNAME := $0280 ; Pathname of loaded system file
|
||||
;;; MLI commands
|
||||
MLI_QUIT := $65
|
||||
MLI_READ_BLOCK := $80
|
||||
MLI_GET_TIME := $82
|
||||
MLI_OPEN := $C8
|
||||
MLI_READ := $CA
|
||||
MLI_CLOSE := $CC
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
data_buffer = $1800
|
||||
|
||||
read_delay_hi = $3 * 3 ; ($300 iterations is normal * 3.6MHz)
|
||||
|
||||
.define SYSTEM_SUFFIX ".SYSTEM"
|
||||
.define PRODUCT "Cricket Clock"
|
||||
|
||||
@ -246,7 +248,7 @@ saved_control: .byte 0
|
||||
|
||||
;; Read byte into A, or carry set if timed out
|
||||
.proc readbyte
|
||||
tries := $300
|
||||
tries := $100 * read_delay_hi
|
||||
counter := $A5
|
||||
|
||||
lda #<tries
|
||||
@ -651,7 +653,7 @@ self_name:
|
||||
pha
|
||||
|
||||
;; Configure SSC
|
||||
lda #%00001011
|
||||
lda #%00001011 ; no parity/echo/interrupts, RTS low, DTR low
|
||||
sta COMMAND
|
||||
lda #%10011110 ; 9600 baud, 8 data bits, 2 stop bits
|
||||
sta CONTROL
|
||||
@ -669,8 +671,8 @@ self_name:
|
||||
ldy #(read_len-1)
|
||||
|
||||
rloop: ldx #0 ; x = retry loop counter low byte
|
||||
lda #3 ; scratch = retry loop counter high byte
|
||||
sta scratch ; ($300 iterations total)
|
||||
lda #read_delay_hi ; scratch = retry loop counter high byte
|
||||
sta scratch
|
||||
|
||||
check: lda STATUS ; did we get it?
|
||||
and #(1 << 3) ; receive register full? (bit 3)
|
||||
@ -729,7 +731,7 @@ done: pla ; restore saved command state
|
||||
rts
|
||||
.endproc
|
||||
sizeof_driver := .sizeof(driver)
|
||||
|
||||
.assert sizeof_driver <= 125, error, "Clock code must be <= 125 bytes"
|
||||
;;; ------------------------------------------------------------
|
||||
|
||||
sys_end:
|
||||
|
102
get.time.s
Normal file
102
get.time.s
Normal file
@ -0,0 +1,102 @@
|
||||
|
||||
|
||||
.setcpu "6502"
|
||||
.org $2000
|
||||
|
||||
.include "apple2.inc"
|
||||
.include "common.inc"
|
||||
|
||||
|
||||
start:
|
||||
PRODOS_CALL MLI_GET_TIME, 0
|
||||
|
||||
jsr zstrout
|
||||
HIASCIIZ "Time: "
|
||||
|
||||
lda TIMELO+1 ; hour
|
||||
jsr cout_number
|
||||
|
||||
lda #HI(':') ; ':'
|
||||
jsr COUT
|
||||
|
||||
lda TIMELO ; minute
|
||||
jsr cout_number
|
||||
|
||||
jsr CROUT
|
||||
|
||||
jsr zstrout
|
||||
HIASCIIZ "Date: "
|
||||
|
||||
lda DATELO+1 ; month
|
||||
ror a
|
||||
pha
|
||||
lda DATELO
|
||||
pha
|
||||
rol a
|
||||
rol a
|
||||
rol a
|
||||
rol a
|
||||
and #%00001111
|
||||
jsr cout_number
|
||||
|
||||
lda #(HI '/') ; /
|
||||
jsr COUT
|
||||
|
||||
pla ; day
|
||||
and #%00011111
|
||||
jsr cout_number
|
||||
|
||||
lda #(HI '/') ; /
|
||||
jsr COUT
|
||||
|
||||
pla ; year
|
||||
jsr cout_number
|
||||
|
||||
jsr CROUT
|
||||
|
||||
rts
|
||||
|
||||
.proc cout_number
|
||||
ldx #(HI '0')
|
||||
cmp #10 ; >= 10?
|
||||
bcc tens
|
||||
|
||||
;; divide by 10, dividend(+'0') in x remainder in a
|
||||
: sbc #10
|
||||
inx
|
||||
cmp #10
|
||||
bcs :-
|
||||
|
||||
tens: pha
|
||||
txa
|
||||
jsr COUT
|
||||
|
||||
units: pla
|
||||
ora #(HI '0')
|
||||
jsr COUT
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.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
|
@ -711,6 +711,7 @@ unlock:
|
||||
.byte $00
|
||||
|
||||
sizeof_driver := * - driver
|
||||
.assert sizeof_driver <= 125, error, "Clock code must be <= 125 bytes"
|
||||
|
||||
;;; ------------------------------------------------------------
|
||||
|
||||
|
4
test.s
4
test.s
@ -9,6 +9,8 @@
|
||||
|
||||
.org $2000
|
||||
|
||||
read_delay_hi = $3 * 3 ; ($300 iterations is normal * 3.6MHz)
|
||||
|
||||
.proc detect_cricket
|
||||
;; Check Slot 2 for SSC. ID bytes per:
|
||||
;; Apple II Technical Note #8: Pascal 1.1 Firmware Protocol ID Bytes
|
||||
@ -118,7 +120,7 @@ saved_control: .byte 0
|
||||
|
||||
;; Read byte into A, or carry set if timed out
|
||||
.proc readbyte
|
||||
tries := $300
|
||||
tries := $100 * read_delay_hi
|
||||
counter := $A5
|
||||
|
||||
lda #<tries
|
||||
|
Loading…
Reference in New Issue
Block a user