Last active
August 16, 2021 13:41
-
-
Save mistificator/ec4c39cd4b4231040fc00bb55b3659ff to your computer and use it in GitHub Desktop.
ZX Spectrum tape pulses measure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; 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 |
Author
mistificator
commented
Aug 16, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment