bit decoding for tape normal system

This commit is contained in:
FeralChild64 committed 2019-12-18 20:52:04 +01:00
1 parent 782a7c63a0
commit c81b04d923
13 files changed
+135 -28

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
//
// Tape (turbo) helper routine - bit reading
//
// Returns bit in Zero flag, Carry set means error
//
#if CONFIG_TAPE_NORMAL
tape_normal_get_bit:
// Fetch the first pulse
jsr tape_normal_get_pulse
bcc tape_normal_get_bit_0
// First impulse was short, second should be long
jsr tape_normal_get_pulse
bcs tape_normal_get_bit_error
// We have a bit '1'
clc
lda #$06
// FALLTROUGH
tape_normal_get_bit_done:
sta VIC_EXTCOL
rts
tape_normal_get_bit_0:
// First impulse was long, second should be short
jsr tape_normal_get_pulse
bcc tape_normal_get_bit_error
// We have a bit '0'
// Carry flag already clear
lda #$00
beq tape_normal_get_bit_done // branch always
tape_normal_get_bit_error:
sec
rts
#endif // CONFIG_TAPE_NORMAL