slightly more precise pulse measurement

This commit is contained in:
FeralChild64 committed 2019-12-18 21:45:13 +01:00
1 parent 3ac17185f1
commit 8b0eff74a2
3 files changed
+6 -5

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ load_tape_normal:
// Let timer A run continuously
ldx #%00010001 // start timer, force latch reload
stx CIA2_CRA // $DD0E
stx CIA2_CRA // $DD0E
// Start playing
jsr tape_ask_play
+1 -1
View File
@@ -20,7 +20,7 @@ tape_normal_get_byte:
// First we need a byte marker - (L,M)
!:
jsr tape_normal_get_pulse
cmp #($100 - $95 - $05)
cmp #($100 - $95 - $04)
bcs !- // too short for a long pulse
jsr tape_normal_get_pulse
bcs !- // too short for a medium pulse
+4 -3
View File
@@ -32,11 +32,12 @@ tape_normal_get_pulse:
// lda - 4 cycles
// ldx - 2 cycles
// stx - 4 cycles
// plus approx. 3 cycles (bit + beq time divided by 2) from value change to 'bit' instruction,
// this is total 19 cycles, or $5 periods of 4 ticks (timer A) each - we need to take it into account
// plus average 3 cycles (bit + beq time divided by 2) from value change to 'bit' instruction
// minus average 2 cycles due to timer A running continouslyy (might start before the pulse)
// this is total 17 cycles, or $4 periods of 4 ticks (timer A) each - we need to take it into account
// every time we check the pulse length
cmp #($100 - $6C - $05) // short vs medium is the default check
cmp #($100 - $6C - $04) // short vs medium is the default check
rts