working irl decoding

This commit is contained in:
Joppe Blondel
2026-10-09 14:51:56 +02:00
parent b8c6eaf4c9
commit c84b3fdc97
7 changed files with 352 additions and 70 deletions
+30 -16
View File
@@ -4667,7 +4667,6 @@ CLOADB: inc hl ; skip #
call PRS ; print filename
; de contains the nr of blocks to load
; TODO check de>0
pop de
1$: push de ; save repeat counter
call CLREADBLOCK ; hl = new data
@@ -4675,7 +4674,6 @@ CLOADB: inc hl ; skip #
inc hl ; goto start of data
pop de ; get repeat counter
push hl ; save stored data
exx
pop hl ; get stored data back
pop de ; get destination
@@ -4683,7 +4681,6 @@ CLOADB: inc hl ; skip #
ldir ; copy data to memory
push de ; store destination address
exx
dec de
ld a,e
cp 0
@@ -4691,7 +4688,6 @@ CLOADB: inc hl ; skip #
ld a,d
cp 0
jr nz,1$ ; repeat if not done yet
pop de
pop bc
pop hl
@@ -4699,19 +4695,31 @@ CLOADB: inc hl ; skip #
CLREADBLOCK:
call BIOS_CAS_READ_BLOCK
jr nc,1$
jr c,3$
ld a,'.' ; block read correctly
call OUTC
jr 1$
3$: ld a,'x' ; block failed, try redundant block
call OUTC
call BIOS_CAS_WAIT_SILENCE
call BIOS_CAS_READ_BLOCK
push hl
jr nc,2$
jr c,4$
ld a,'.' ; redundant block read correctly
call OUTC
jr 2$
4$: push af ; preserve error code
push bc ; preserve specific error code
ld a,'x' ; redundant block failed
call OUTC
; error, make sure it is silent again
push af
push bc ; save specific error code
call BIOS_CAS_WAIT_SILENCE
pop bc
pop af
jr CLERR
1$: push hl ; save hl
ld a,'o' ; skip redundant block
call OUTC
call BIOS_CAS_READ_BLOCK_DRY
; Ignore errors on this block
2$: ; but make sure it is silent again
@@ -4734,9 +4742,15 @@ CLECAL: ld h,0
call PRNTHL ; print specific error code
ld hl, CLECALMSG
jr CLEPRINT
CLESYN: ld hl, CLESYNMSG
CLESYN: ld h,0
ld l,b ; get specific error code
call PRNTHL ; print specific error code
ld hl, CLESYNMSG
jr CLEPRINT
CLERED: ld hl, CLEREDMSG
CLERED: ld h,0
ld l,b ; get specific error code
call PRNTHL ; print specific error code
ld hl, CLEREDMSG
jr CLEPRINT
CLECHS: ld hl, CLECHSMSG
jr CLEPRINT
@@ -4750,12 +4764,12 @@ CLEPRINT:
jp FCERR
CLSTARTMSG: .db "Play tape...",0ah,0dh,00h
CLECALMSG: .db " - Calibration failed",0ah,0dh,00h
CLESYNMSG: .db "Synchronization failed",0ah,0dh,00h
CLEREDMSG: .db "Read failed",0ah,0dh,00h
CLECHSMSG: .db "Checksum error",0ah,0dh,00h
CLNOHDRMSG: .db "No header found", 0ah,0dh,00h
CLBLOCKSMSG: .db " blocks to load", 0ah,0dh,00h
CLECALMSG: .db "CE",0ah,0dh,00h
CLESYNMSG: .db "SE",0ah,0dh,00h
CLEREDMSG: .db "RE",0ah,0dh,00h
CLECHSMSG: .db "CSE",0ah,0dh,00h
CLNOHDRMSG: .db "HE", 0ah,0dh,00h
CLBLOCKSMSG: .db " blocks", 0ah,0dh,00h
CLCLRF: .db 0ah,0dh,00h
.end