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
+2 -2
View File
@@ -4759,10 +4759,10 @@ CLPRINTHEADER:
; uses a,h,l ; uses a,h,l
; ------------------------------------------------------- ; -------------------------------------------------------
CLLOADBLOCKS: CLLOADBLOCKS:
ld a,b 1$: ld a,b
or c or c
ret z ret z
1$: push bc push bc
push de push de
call CLREADBLOCK call CLREADBLOCK
inc hl ; skip block type inc hl ; skip block type
+2
View File
@@ -144,6 +144,8 @@ init:
call ctc_uart_init call ctc_uart_init
ei ei
call tape_init
; Print header message ; Print header message
ld hl,msg_header ld hl,msg_header
call puts call puts
+1 -1
View File
@@ -46,7 +46,7 @@ class PulseWriter:
self.space(0.1) self.space(0.1)
def space(self, time: float) -> None: def space(self, time: float) -> None:
self._level(0, int(time*self.sample_rate)) self._level(self.low, int(time*self.sample_rate))
def _duration_samples(self, duration_us: float) -> int: def _duration_samples(self, duration_us: float) -> int:
sample_count = round(duration_us * self.sample_rate / 1_000_000) sample_count = round(duration_us * self.sample_rate / 1_000_000)
+16 -6
View File
@@ -11,7 +11,9 @@ SHORT_MAX .equ TAPE_WORKSPACE + 002h ; byte
LONG_AVG .equ TAPE_WORKSPACE + 003h ; byte LONG_AVG .equ TAPE_WORKSPACE + 003h ; byte
LONG_MIN .equ TAPE_WORKSPACE + 004h ; byte LONG_MIN .equ TAPE_WORKSPACE + 004h ; byte
LONG_MAX .equ TAPE_WORKSPACE + 005h ; 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 ; Error return callback macro
@@ -26,9 +28,17 @@ create_error_return MACRO &name, &code
ENDM ENDM
; ------------------------------------------------------- ; -------------------------------------------------------
; -------------------------------------------------------
tape_init:
ld a,18
ld (SHORT_OUT),a
ld a,37
ld (LONG_OUT),a
ret
; -------------------------------------------------------
; Measure edge-to-edge pulse ; Measure edge-to-edge pulse
; needs d (comparator state) ; needs d (comparator state)
; returns b (loop count) ; returns b (loop count)80
; carry is timeout ; carry is timeout
; uses a ; uses a
; loop is 36T extra 22T (0.6 loops) ; loop is 36T extra 22T (0.6 loops)
@@ -567,14 +577,14 @@ get_buffer:
; needs d (output state) ; needs d (output state)
; uses a ; uses a
; before edge 20T ; before edge 20T
; after edge 402T ; after edge 408T
; ------------------------------------------------------- ; -------------------------------------------------------
gen_short: gen_short:
ld a,d ; 4T ld a,d ; 4T
xor 1 ; 7T xor 1 ; 7T
out (TAPE_PORT),a ; 12T out (TAPE_PORT),a ; 12T
ld d,a ; 4T ld d,a ; 4T
ld a,18 ; 7T ld a,(SHORT_OUT) ; 13T
1$: ; loop: 21*a 1$: ; loop: 21*a
dec a ; 4T dec a ; 4T
cp 0 ; 7T cp 0 ; 7T
@@ -586,14 +596,14 @@ gen_short:
; needs d (output state) ; needs d (output state)
; uses a ; uses a
; before edge 20T ; before edge 20T
; after edge 801T ; after edge 807T
; ------------------------------------------------------- ; -------------------------------------------------------
gen_long: gen_long:
ld a,d ; 4T ld a,d ; 4T
xor 1 ; 7T xor 1 ; 7T
out (TAPE_PORT),a ; 12T out (TAPE_PORT),a ; 12T
ld d,a ; 4T ld d,a ; 4T
ld a,37 ; 7T ld a,(LONG_OUT) ; 13T
1$: ; loop: 21*a 1$: ; loop: 21*a
dec a ; 4T dec a ; 4T
cp 0 ; 7T cp 0 ; 7T
BIN
View File
Binary file not shown.