Skip to content

Instantly share code, notes, and snippets.

@mistificator
Last active August 16, 2021 13:41
Show Gist options
  • Save mistificator/ec4c39cd4b4231040fc00bb55b3659ff to your computer and use it in GitHub Desktop.
Save mistificator/ec4c39cd4b4231040fc00bb55b3659ff to your computer and use it in GitHub Desktop.
ZX Spectrum tape pulses measure
;
; Tape bit lengths
;
org 0x8000
di
ld sp, stack
restart:
ld ix, values ; start loading address
call wait_for_start
loop:
call get_bit_length
ld (ix + 0), e
inc ix
ld a, ixh
or a
jr z, stop
jr loop
stop:
halt ; watch'em at 0x9000
jp restart
wait_for_start:
xor a
in a, (0xFE) ; initial read
and 0x40
ld d, a
get_bit_length: ;
ld e, 0
loop_bit:
ld c, a
inc e
in a, (0xFE)
and 0x40
cp d
jr z, loop_bit
ld d, a
ret
defs 32
stack:
org 0x9000
values:
END 0x8000
@mistificator
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment