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

+1 -1
View File
@@ -2,7 +2,7 @@
# Test files
TESTDISK = testsuite/testdisk.d64
TESTTAPE = testsuite/testtape-turbo.tap
TESTTAPE = testsuite/testtape-normal.tap
# Source files
+3 -1
View File
@@ -44,8 +44,10 @@
#define CONFIG_IEC_BLANK_SCREEN
// #define CONFIG_IEC_DOLPHINDOS // please keep disabled for now
#define CONFIG_IEC_JIFFYDOS
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
#define CONFIG_TAPE_NORMAL // not finished yet!
#define CONFIG_TAPE_TURBO
// #define CONFIG_RS232_UP2400 // please keep disabled for now
// #define CONFIG_RS232_UP9600 // please keep disabled for now
+2
View File
@@ -46,8 +46,10 @@
#define CONFIG_IEC_BLANK_SCREEN
// #define CONFIG_IEC_DOLPHINDOS // please keep disabled for now
#define CONFIG_IEC_JIFFYDOS
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
// #define CONFIG_TAPE_TURBO
// #define CONFIG_RS232_UP2400 // please keep disabled for now
// #define CONFIG_RS232_UP9600 // please keep disabled for now
+2
View File
@@ -45,8 +45,10 @@
// #define CONFIG_IEC_BLANK_SCREEN
// #define CONFIG_IEC_DOLPHINDOS // please keep disabled for now
#define CONFIG_IEC_JIFFYDOS
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
#define CONFIG_TAPE_TURBO
// #define CONFIG_RS232_UP2400 // please keep disabled for now
// #define CONFIG_RS232_UP9600 // please keep disabled for now
+3 -1
View File
@@ -44,8 +44,10 @@
#define CONFIG_IEC_BLANK_SCREEN
// #define CONFIG_IEC_DOLPHINDOS // please keep disabled for now
#define CONFIG_IEC_JIFFYDOS
// #define CONFIG_TAPE_NORMAL // please keep disabled for now
#define CONFIG_TAPE_TURBO
// #define CONFIG_RS232_UP2400 // please keep disabled for now
// #define CONFIG_RS232_UP9600 // please keep disabled for now
@@ -114,7 +116,7 @@
// Eye candy
// #define CONFIG_COLORS_BRAND
#define CONFIG_COLORS_BRAND
// #define CONFIG_BANNER_SIMPLE
#define CONFIG_BANNER_FANCY
// #define CONFIG_BANNER_BRAND
+7 -5
View File
@@ -303,12 +303,14 @@
{
.var features_str = ""
#if CONFIG_TAPE_NORMAL
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL")
#elif CONFIG_TAPE_TURBO
#if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL-DEV")
#endif
#if !CONFIG_TAPE_NORMAL && CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD TURBO")
#elif CONFIG_TAPE_NORMAL && CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL TURBO")
#endif
#if CONFIG_TAPE_NORMAL && CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL-DEV TURBO")
#endif
.eval feature_new_line = true
+4 -15
View File
@@ -51,9 +51,10 @@ load_tape_normal:
ldx #%00010001 // start timer, force latch reload
stx CIA2_CRA // $DD0E
// Prepare for sound effects
jsr tape_clean_sid // XXX implement some effects
// Start playing
jsr tape_clean_sid
jsr tape_ask_play
// FALLTROUGH
@@ -62,19 +63,7 @@ load_tape_normal_header:
// XXX replace this placeholder by a real routine
jsr tape_load_get_pulse
ldx #$00
cmp #($100 - $6C - $05)
bcs !+
#if CONFIG_COLORS_BRAND && CONFIG_BRAND_ULTIMATE_64
ldx #$0B
#else
ldx #$06
#endif
!:
stx VIC_EXTCOL
jsr tape_normal_get_byte
jmp load_tape_normal_header
+3
View File
@@ -22,7 +22,10 @@ load_tape_turbo:
lda #$FE // timer threshold for TurboTape
sta CIA2_TIMALO // $DD04
// Prepare for sound effects
jsr tape_clean_sid
// Start playing
jsr tape_ask_play
// FALLTROUGH
+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
+49
View File
@@ -0,0 +1,49 @@
//
// Tape (turbo) helper routine - byte reading
//
// Returns byte in .A
//
#if CONFIG_TAPE_NORMAL
tape_normal_get_byte:
lda #$0B
sta VIC_EXTCOL
// First we need a byte marker - (L,M)
!:
jsr tape_normal_get_pulse
cmp #($100 - $95 - $05)
bcs !- // too short for a long pulse
jsr tape_normal_get_pulse
bcs !- // too short for a medium pulse
// Now fetch individual bits
// XXX finish this
jsr tape_normal_get_bit
jsr tape_normal_get_bit
jsr tape_normal_get_bit
jsr tape_normal_get_bit
jsr tape_normal_get_bit
jsr tape_normal_get_bit
jsr tape_normal_get_bit
jsr tape_normal_get_bit
rts
#endif
+2 -1
View File
@@ -9,7 +9,7 @@
#if CONFIG_TAPE_NORMAL
tape_load_get_pulse:
tape_normal_get_pulse:
// Contrary to original ROM implementation we do not use interrupts
// (see http://unusedino.de/ec64/technical/formats/tap.html) - busy wait
@@ -36,6 +36,7 @@ tape_load_get_pulse:
// this is total 19 cycles, or $5 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
rts
-4
View File
@@ -26,11 +26,7 @@ tape_turbo_get_bit:
asl
sta SID_SIGVOL
beq !+
#if CONFIG_COLORS_BRAND && CONFIG_BRAND_ULTIMATE_64
lda #$0B
#else
lda #$06
#endif
!:
sta VIC_EXTCOL
pla
+2
View File
@@ -2,6 +2,8 @@
//
// Tape (turbo) helper routine - byte reading
//
// Returns byte in .A
//
// Based on routine by enthusi/Onslaught, found here:
// - https://codebase64.pokefinder.org/doku.php?id=base:turbotape_loader_source