byte decoding for normal tape finished
This commit is contained in:
1 parent
c81b04d923
commit
3ac17185f1
3 files changed
+50
-22
No files matched your search
@@ -50,9 +50,6 @@ load_tape_normal:
|
|||||||
|
|
||||||
ldx #%00010001 // start timer, force latch reload
|
ldx #%00010001 // start timer, force latch reload
|
||||||
stx CIA2_CRA // $DD0E
|
stx CIA2_CRA // $DD0E
|
||||||
|
|
||||||
// Prepare for sound effects
|
|
||||||
jsr tape_clean_sid // XXX implement some effects
|
|
||||||
|
|
||||||
// Start playing
|
// Start playing
|
||||||
jsr tape_ask_play
|
jsr tape_ask_play
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Tape (turbo) helper routine - bit reading
|
// Tape (turbo) helper routine - bit reading
|
||||||
//
|
//
|
||||||
// Returns bit in Zero flag, Carry set means error
|
// Returns bit in Zero flag, Carry set means error, on 0 bit .A is 0 too
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ tape_normal_get_bit:
|
|||||||
|
|
||||||
// We have a bit '1'
|
// We have a bit '1'
|
||||||
|
|
||||||
clc
|
// Carry flag already clear
|
||||||
lda #$06
|
lda #$06
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
@@ -43,13 +43,12 @@ tape_normal_get_bit_0:
|
|||||||
|
|
||||||
// We have a bit '0'
|
// We have a bit '0'
|
||||||
|
|
||||||
// Carry flag already clear
|
clc
|
||||||
lda #$00
|
lda #$00
|
||||||
beq tape_normal_get_bit_done // branch always
|
beq tape_normal_get_bit_done // branch always
|
||||||
|
|
||||||
|
|
||||||
tape_normal_get_bit_error:
|
tape_normal_get_bit_error:
|
||||||
|
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Tape (turbo) helper routine - byte reading
|
// Tape (turbo) helper routine - byte reading
|
||||||
//
|
//
|
||||||
// Returns byte in .A
|
// Returns byte in .A, Carry flag set = error
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@@ -11,11 +11,13 @@
|
|||||||
|
|
||||||
tape_normal_get_byte:
|
tape_normal_get_byte:
|
||||||
|
|
||||||
lda #$0B
|
// Init byte checksum and canary bit
|
||||||
sta VIC_EXTCOL
|
lda #$01
|
||||||
|
sta ROPRTY
|
||||||
|
lda #%01111111 // canary bit is 0
|
||||||
|
pha
|
||||||
|
|
||||||
// First we need a byte marker - (L,M)
|
// First we need a byte marker - (L,M)
|
||||||
|
|
||||||
!:
|
!:
|
||||||
jsr tape_normal_get_pulse
|
jsr tape_normal_get_pulse
|
||||||
cmp #($100 - $95 - $05)
|
cmp #($100 - $95 - $05)
|
||||||
@@ -25,25 +27,55 @@ tape_normal_get_byte:
|
|||||||
|
|
||||||
// Now fetch individual bits
|
// Now fetch individual bits
|
||||||
|
|
||||||
// XXX finish this
|
tape_normal_get_byte_loop:
|
||||||
|
|
||||||
jsr tape_normal_get_bit
|
jsr tape_normal_get_bit
|
||||||
|
bcs tape_normal_get_byte_error
|
||||||
|
beq !+
|
||||||
|
|
||||||
|
// Handle parity bit
|
||||||
|
lda #$01
|
||||||
|
eor ROPRTY
|
||||||
|
sta ROPRTY
|
||||||
|
|
||||||
|
sec
|
||||||
|
!: // moved bit state from Zero to Carry flag
|
||||||
|
|
||||||
|
pla
|
||||||
|
ror // put the bit in
|
||||||
|
pha
|
||||||
|
|
||||||
|
bcs tape_normal_get_byte_loop // loop if no canary bit reached
|
||||||
|
|
||||||
|
// Byte retrieved (on stack), now we need to validate the checksum
|
||||||
|
|
||||||
jsr tape_normal_get_bit
|
jsr tape_normal_get_bit
|
||||||
jsr tape_normal_get_bit
|
bcs tape_normal_get_byte_error
|
||||||
jsr tape_normal_get_bit
|
beq !+
|
||||||
jsr tape_normal_get_bit
|
lda #$01
|
||||||
jsr tape_normal_get_bit
|
!:
|
||||||
jsr tape_normal_get_bit
|
eor ROPRTY
|
||||||
jsr tape_normal_get_bit
|
beq tape_normal_get_byte_error
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Checksum validated succesfully
|
||||||
|
|
||||||
|
ldx #$0B
|
||||||
|
// Carry already clear
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
tape_normal_get_byte_done:
|
||||||
|
|
||||||
|
pla
|
||||||
|
stx VIC_EXTCOL
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
tape_normal_get_byte_error:
|
||||||
|
|
||||||
|
ldx #$09
|
||||||
|
sec // make sure Carry is set to indicate error
|
||||||
|
bcs tape_normal_get_byte_done
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user