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
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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:
|
||||
|
||||
lda #$0B
|
||||
sta VIC_EXTCOL
|
||||
// Init byte checksum and canary bit
|
||||
lda #$01
|
||||
sta ROPRTY
|
||||
lda #%01111111 // canary bit is 0
|
||||
pha
|
||||
|
||||
// First we need a byte marker - (L,M)
|
||||
|
||||
!:
|
||||
jsr tape_normal_get_pulse
|
||||
cmp #($100 - $95 - $05)
|
||||
@@ -25,25 +27,55 @@ tape_normal_get_byte:
|
||||
|
||||
// Now fetch individual bits
|
||||
|
||||
// XXX finish this
|
||||
tape_normal_get_byte_loop:
|
||||
|
||||
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
|
||||
jsr tape_normal_get_bit
|
||||
jsr tape_normal_get_bit
|
||||
jsr tape_normal_get_bit
|
||||
jsr tape_normal_get_bit
|
||||
|
||||
|
||||
|
||||
|
||||
bcs tape_normal_get_byte_error
|
||||
beq !+
|
||||
lda #$01
|
||||
!:
|
||||
eor ROPRTY
|
||||
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
|
||||
|
||||
|
||||
tape_normal_get_byte_error:
|
||||
|
||||
ldx #$09
|
||||
sec // make sure Carry is set to indicate error
|
||||
bcs tape_normal_get_byte_done
|
||||
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user