Some small bugfixes

This commit is contained in:
Joppe Blondel
2026-10-10 15:08:36 +02:00
parent ff5918b1ab
commit acf5b0b30d
5 changed files with 21 additions and 9 deletions
+16 -6
View File
@@ -11,7 +11,9 @@ SHORT_MAX .equ TAPE_WORKSPACE + 002h ; byte
LONG_AVG .equ TAPE_WORKSPACE + 003h ; byte
LONG_MIN .equ TAPE_WORKSPACE + 004h ; byte
LONG_MAX .equ TAPE_WORKSPACE + 005h ; byte
BLOCK_BUFFER .equ TAPE_WORKSPACE + 006h ; BLOCK_SIZE
SHORT_OUT .equ TAPE_WORKSPACE + 006h ; byte
LONG_OUT .equ TAPE_WORKSPACE + 007h ; byte
BLOCK_BUFFER .equ TAPE_WORKSPACE + 008h ; BLOCK_SIZE
; -------------------------------------------------------
; Error return callback macro
@@ -26,9 +28,17 @@ create_error_return MACRO &name, &code
ENDM
; -------------------------------------------------------
; -------------------------------------------------------
tape_init:
ld a,18
ld (SHORT_OUT),a
ld a,37
ld (LONG_OUT),a
ret
; -------------------------------------------------------
; Measure edge-to-edge pulse
; needs d (comparator state)
; returns b (loop count)
; returns b (loop count)80
; carry is timeout
; uses a
; loop is 36T extra 22T (0.6 loops)
@@ -567,14 +577,14 @@ get_buffer:
; needs d (output state)
; uses a
; before edge 20T
; after edge 402T
; after edge 408T
; -------------------------------------------------------
gen_short:
ld a,d ; 4T
xor 1 ; 7T
out (TAPE_PORT),a ; 12T
ld d,a ; 4T
ld a,18 ; 7T
ld a,(SHORT_OUT) ; 13T
1$: ; loop: 21*a
dec a ; 4T
cp 0 ; 7T
@@ -586,14 +596,14 @@ gen_short:
; needs d (output state)
; uses a
; before edge 20T
; after edge 801T
; after edge 807T
; -------------------------------------------------------
gen_long:
ld a,d ; 4T
xor 1 ; 7T
out (TAPE_PORT),a ; 12T
ld d,a ; 4T
ld a,37 ; 7T
ld a,(LONG_OUT) ; 13T
1$: ; loop: 21*a
dec a ; 4T
cp 0 ; 7T