From 5fbe03a882970f59e176be94bbb34837d560e5c8 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sat, 2 Dec 2017 21:35:50 -0800 Subject: [PATCH] Increase read delay. Resolves #4 --- Makefile | 2 +- common.inc | 1 + cricket.system.s | 12 +++--- get.time.s | 102 ++++++++++++++++++++++++++++++++++++++++++++++ ns.clock.system.s | 1 + test.s | 4 +- 6 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 get.time.s diff --git a/Makefile b/Makefile index 18fd86c..cd4a358 100644 --- a/Makefile +++ b/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") diff --git a/common.inc b/common.inc index 006d2ee..f85bb0b 100644 --- a/common.inc +++ b/common.inc @@ -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 diff --git a/cricket.system.s b/cricket.system.s index f141b7a..9e677a9 100644 --- a/cricket.system.s +++ b/cricket.system.s @@ -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 #= 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 diff --git a/ns.clock.system.s b/ns.clock.system.s index 0913fb9..1f583ab 100644 --- a/ns.clock.system.s +++ b/ns.clock.system.s @@ -711,6 +711,7 @@ unlock: .byte $00 sizeof_driver := * - driver + .assert sizeof_driver <= 125, error, "Clock code must be <= 125 bytes" ;;; ------------------------------------------------------------ diff --git a/test.s b/test.s index 71f4085..a07033c 100644 --- a/test.s +++ b/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 #