updated documentation, added synchronization and pilot support to tape load
This commit is contained in:
1 parent
8b0eff74a2
commit
58d5ba54c2
10 files changed
+108
-33
No files matched your search
+2
-1
@@ -1,2 +1,3 @@
|
|||||||
|
|
||||||
Although the project itself is LGPL3, I (FeralChild64) allow to redistribute my contributions to this project under any OSI (Open Source Initiative) approved open source license.
|
Although the project itself is LGPL3, I (FeralChild64 - Roman St********ski) allow to redistribute
|
||||||
|
my contributions to this project under any OSI (Open Source Initiative) approved open source license.
|
||||||
@@ -117,7 +117,7 @@ build/target_generic/OUTB.BIN build/target_generic/BASIC_combined.vs: \
|
|||||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \
|
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \
|
||||||
c64/,,config_generic.s build/target_generic/KERNAL_combined.sym \
|
c64/,,config_generic.s build/target_generic/KERNAL_combined.sym \
|
||||||
$(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s))
|
$(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s))
|
||||||
build/target_testing/OUTB.BIN build/target_generic/BASIC_combined.vs: \
|
build/target_testing/OUTB.BIN build/target_testing/BASIC_combined.vs: \
|
||||||
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \
|
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(GEN_BASIC) $(SRCDIR_BASIC) \
|
||||||
c64/,,config_testing.s build/target_testing/KERNAL_combined.sym \
|
c64/,,config_testing.s build/target_testing/KERNAL_combined.sym \
|
||||||
$(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s))
|
$(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s))
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
.label TBTCNT = $A4 // temporary variable for tape and IEC, [!] our usage probably differs in details
|
.label TBTCNT = $A4 // temporary variable for tape and IEC, [!] our usage probably differs in details
|
||||||
.label CNTDN = $A5 // -- NOT IMPLEMENTED --
|
.label CNTDN = $A5 // -- NOT IMPLEMENTED --
|
||||||
.label BUFPNT = $A6 // -- NOT IMPLEMENTED --
|
.label BUFPNT = $A6 // -- NOT IMPLEMENTED --
|
||||||
.label INBIT = $A7 // -- NOT IMPLEMENTED --
|
.label INBIT = $A7 // temporary storage for tape / RS-232 received bits
|
||||||
#if !CONFIG_LEGACY_SCNKEY
|
#if !CONFIG_LEGACY_SCNKEY
|
||||||
.label BITCI = $A8 // -- NOT IMPLEMENTED --
|
.label BITCI = $A8 // -- NOT IMPLEMENTED --
|
||||||
.label RINONE = $A9 // -- WIP -- (UP9600 only) RS-232 check for start bit flag
|
.label RINONE = $A9 // -- WIP -- (UP9600 only) RS-232 check for start bit flag
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
// (L,S) = end-of-data marker
|
// (L,S) = end-of-data marker
|
||||||
|
|
||||||
|
|
||||||
|
// XXX use pilot to calibrate reading speed
|
||||||
|
|
||||||
|
|
||||||
#if CONFIG_TAPE_NORMAL
|
#if CONFIG_TAPE_NORMAL
|
||||||
|
|
||||||
|
|
||||||
@@ -58,10 +61,18 @@ load_tape_normal:
|
|||||||
|
|
||||||
load_tape_normal_header:
|
load_tape_normal_header:
|
||||||
|
|
||||||
// XXX replace this placeholder by a real routine
|
lda #$00
|
||||||
|
sta ROPRTY // initialize EOR checksum
|
||||||
|
!:
|
||||||
|
jsr tape_normal_pilot
|
||||||
|
ldy #$89
|
||||||
|
jsr tape_normal_sync
|
||||||
|
bcs !-
|
||||||
|
|
||||||
|
// XXX replace this placeholder with a real routine
|
||||||
|
!:
|
||||||
jsr tape_normal_get_byte
|
jsr tape_normal_get_byte
|
||||||
jmp load_tape_normal_header
|
jmp !-
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -14,17 +14,17 @@ tape_normal_get_bit:
|
|||||||
// Fetch the first pulse
|
// Fetch the first pulse
|
||||||
|
|
||||||
jsr tape_normal_get_pulse
|
jsr tape_normal_get_pulse
|
||||||
bcc tape_normal_get_bit_0
|
bcc tape_normal_get_bit_1
|
||||||
|
|
||||||
// First impulse was short, second should be long
|
// First impulse was short, second should be medium
|
||||||
|
|
||||||
jsr tape_normal_get_pulse
|
jsr tape_normal_get_pulse
|
||||||
bcs tape_normal_get_bit_error
|
bcs tape_normal_get_bit_error
|
||||||
|
|
||||||
// We have a bit '1'
|
// We have a bit '0'
|
||||||
|
|
||||||
// Carry flag already clear
|
// Carry flag already clear
|
||||||
lda #$06
|
lda #$00
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
@@ -34,21 +34,22 @@ tape_normal_get_bit_done:
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
tape_normal_get_bit_0:
|
tape_normal_get_bit_1:
|
||||||
|
|
||||||
// First impulse was long, second should be short
|
// First impulse was medium, second should be short
|
||||||
|
|
||||||
jsr tape_normal_get_pulse
|
jsr tape_normal_get_pulse
|
||||||
bcc tape_normal_get_bit_error
|
bcc tape_normal_get_bit_error
|
||||||
|
|
||||||
// We have a bit '0'
|
// We have a bit '1'
|
||||||
|
|
||||||
clc
|
clc
|
||||||
lda #$00
|
lda #$06
|
||||||
beq tape_normal_get_bit_done // branch always
|
bne tape_normal_get_bit_done // branch always
|
||||||
|
|
||||||
|
|
||||||
tape_normal_get_bit_error:
|
tape_normal_get_bit_error:
|
||||||
|
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ tape_normal_get_byte:
|
|||||||
|
|
||||||
// Init byte checksum and canary bit
|
// Init byte checksum and canary bit
|
||||||
lda #$01
|
lda #$01
|
||||||
sta ROPRTY
|
sta PRTY
|
||||||
lda #%01111111 // canary bit is 0
|
lda #%01111111 // canary bit is 0
|
||||||
pha
|
sta INBIT
|
||||||
|
|
||||||
// First we need a byte marker - (L,M)
|
// First we need a byte marker - (L,M)
|
||||||
!:
|
!:
|
||||||
@@ -35,16 +35,13 @@ tape_normal_get_byte_loop:
|
|||||||
|
|
||||||
// Handle parity bit
|
// Handle parity bit
|
||||||
lda #$01
|
lda #$01
|
||||||
eor ROPRTY
|
eor PRTY
|
||||||
sta ROPRTY
|
sta PRTY
|
||||||
|
|
||||||
sec
|
sec
|
||||||
!: // moved bit state from Zero to Carry flag
|
!: // moved bit state from Zero to Carry flag
|
||||||
|
|
||||||
pla
|
ror INBIT // put the bit in
|
||||||
ror // put the bit in
|
|
||||||
pha
|
|
||||||
|
|
||||||
bcs tape_normal_get_byte_loop // loop if no canary bit reached
|
bcs tape_normal_get_byte_loop // loop if no canary bit reached
|
||||||
|
|
||||||
// Byte retrieved (on stack), now we need to validate the checksum
|
// Byte retrieved (on stack), now we need to validate the checksum
|
||||||
@@ -54,8 +51,8 @@ tape_normal_get_byte_loop:
|
|||||||
beq !+
|
beq !+
|
||||||
lda #$01
|
lda #$01
|
||||||
!:
|
!:
|
||||||
eor ROPRTY
|
eor PRTY
|
||||||
beq tape_normal_get_byte_error
|
bne tape_normal_get_byte_error
|
||||||
|
|
||||||
// Checksum validated succesfully
|
// Checksum validated succesfully
|
||||||
|
|
||||||
@@ -66,8 +63,8 @@ tape_normal_get_byte_loop:
|
|||||||
|
|
||||||
tape_normal_get_byte_done:
|
tape_normal_get_byte_done:
|
||||||
|
|
||||||
pla
|
|
||||||
stx VIC_EXTCOL
|
stx VIC_EXTCOL
|
||||||
|
lda INBIT
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Tape (turbo) helper routine - handling the pilot
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL
|
||||||
|
|
||||||
|
|
||||||
|
tape_normal_pilot:
|
||||||
|
|
||||||
|
// Injest the pilot - series of short pulses. According to http://sidpreservation.6581.org/tape-format/
|
||||||
|
// it consist of the foollowing number of pulses:
|
||||||
|
// - $6A00 for header
|
||||||
|
// - $1A00 for data and seq block header
|
||||||
|
// - $4F for repeated header/data
|
||||||
|
|
||||||
|
ldy #$05 // this should be enough
|
||||||
|
!:
|
||||||
|
jsr tape_normal_get_pulse
|
||||||
|
bcc tape_normal_pilot // not a pilot - try again
|
||||||
|
|
||||||
|
dey
|
||||||
|
bne !-
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Tape (turbo) helper routine - synchronization handling
|
||||||
|
//
|
||||||
|
// .Y should contain start value (either $89 or $09)
|
||||||
|
// Carry set = failed
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL
|
||||||
|
|
||||||
|
|
||||||
|
tape_normal_sync:
|
||||||
|
|
||||||
|
// Injest bytes of decreasing values
|
||||||
|
|
||||||
|
jsr tape_normal_get_byte
|
||||||
|
bcs tape_normal_sync_fail
|
||||||
|
|
||||||
|
cpy INBIT // INBIT contains same value as .A
|
||||||
|
bne tape_normal_sync_fail
|
||||||
|
|
||||||
|
dey
|
||||||
|
and #%01111110
|
||||||
|
bne tape_normal_sync // branch if not $80 and not $00
|
||||||
|
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
tape_normal_sync_fail:
|
||||||
|
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -15,12 +15,12 @@
|
|||||||
tape_turbo_get_byte:
|
tape_turbo_get_byte:
|
||||||
|
|
||||||
lda #$01
|
lda #$01
|
||||||
sta ROPRTY // init the to-be-read byte with 1 (canary bit to mark loop end)
|
sta INBIT // init the to-be-read byte with 1 (canary bit to mark loop end)
|
||||||
!:
|
!:
|
||||||
jsr tape_turbo_get_bit
|
jsr tape_turbo_get_bit
|
||||||
rol ROPRTY
|
rol INBIT
|
||||||
bcc !- // is the initial 1 shifted into carry already?
|
bcc !- // is the initial 1 shifted into carry already?
|
||||||
lda ROPRTY // much nicer than ldx #8: dex: loop
|
lda INBIT // much nicer than ldx #8: dex: loop
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
tape_turbo_sync_common:
|
tape_turbo_sync_common:
|
||||||
|
|
||||||
jsr tape_turbo_get_bit
|
jsr tape_turbo_get_bit
|
||||||
rol ROPRTY
|
rol INBIT
|
||||||
lda ROPRTY
|
lda INBIT
|
||||||
cmp #$02
|
cmp #$02
|
||||||
bne tape_turbo_sync_common
|
bne tape_turbo_sync_common
|
||||||
rts
|
rts
|
||||||
@@ -37,14 +37,14 @@ tape_turbo_sync_payload:
|
|||||||
|
|
||||||
jsr tape_turbo_sync_common
|
jsr tape_turbo_sync_common
|
||||||
!:
|
!:
|
||||||
ldx #$09 // 9,8,... is real turboTape
|
ldx #$09 // 9, 8, ...
|
||||||
!: // I sometimes used 8,7,6... to avoid it being listed in vice :)
|
!:
|
||||||
jsr tape_turbo_get_byte
|
jsr tape_turbo_get_byte
|
||||||
cmp #$02
|
cmp #$02
|
||||||
beq !-
|
beq !-
|
||||||
ldy #$00
|
ldy #$00
|
||||||
!:
|
!:
|
||||||
cpx ROPRTY
|
cpx INBIT
|
||||||
bne tape_turbo_sync_payload
|
bne tape_turbo_sync_payload
|
||||||
jsr tape_turbo_get_byte
|
jsr tape_turbo_get_byte
|
||||||
dex
|
dex
|
||||||
|
|||||||
Reference in new issue
Block a user