csave-cload roundtrip irl works
This commit is contained in:
+44
-3
@@ -4815,10 +4815,10 @@ CSAVEB: inc hl ; skip #
|
|||||||
inc hl
|
inc hl
|
||||||
call BYTESTOBLOCKS
|
call BYTESTOBLOCKS
|
||||||
push bc
|
push bc
|
||||||
ld a,b ; nr of blocks low byte
|
ld a,c ; nr of blocks low byte
|
||||||
ld (hl),a
|
ld (hl),a
|
||||||
inc hl
|
inc hl
|
||||||
ld a,c ; nr of blocks high byte
|
ld a,b ; nr of blocks high byte
|
||||||
ld (hl),a
|
ld (hl),a
|
||||||
inc hl
|
inc hl
|
||||||
push hl
|
push hl
|
||||||
@@ -4834,6 +4834,7 @@ CSAVEB: inc hl ; skip #
|
|||||||
inc hl
|
inc hl
|
||||||
push hl
|
push hl
|
||||||
dec e ; count down str len
|
dec e ; count down str len
|
||||||
|
ld a,e
|
||||||
cp 0
|
cp 0
|
||||||
jr nz,1$ ; repeat for the whole string
|
jr nz,1$ ; repeat for the whole string
|
||||||
exx
|
exx
|
||||||
@@ -4843,9 +4844,49 @@ CSAVEB: inc hl ; skip #
|
|||||||
inc hl
|
inc hl
|
||||||
; Header block complete (rest of block is accepted garbage)
|
; Header block complete (rest of block is accepted garbage)
|
||||||
call BIOS_CAS_WRITE_BLOCK
|
call BIOS_CAS_WRITE_BLOCK
|
||||||
|
ld a,'.'
|
||||||
|
call OUTC
|
||||||
|
call BIOS_CAS_WRITE_BLOCK
|
||||||
|
ld a,'.'
|
||||||
|
call OUTC
|
||||||
|
ld a,250
|
||||||
|
call BIOS_DELAY_MS
|
||||||
|
ld a,250
|
||||||
|
call BIOS_DELAY_MS
|
||||||
|
ld a,250
|
||||||
|
call BIOS_DELAY_MS ; add a 750ms delay
|
||||||
pop bc ; get back block count
|
pop bc ; get back block count
|
||||||
pop de ; get back start address
|
pop de ; get back start address
|
||||||
|
ld a,b
|
||||||
|
or c
|
||||||
|
jr z,3$ ; no data blocks for a zero length
|
||||||
|
2$:
|
||||||
|
; load data into buffer
|
||||||
|
push bc
|
||||||
|
call BIOS_CAS_GET_BUFFER
|
||||||
|
ld bc,128 ; block size
|
||||||
|
ld a,0 ; raw type
|
||||||
|
ld (hl),a
|
||||||
|
inc hl
|
||||||
|
ex de,hl ; hl=src,de=dest
|
||||||
|
ldir ; copy the bytes
|
||||||
|
ex de,hl ; de back to being the src addr
|
||||||
|
call BIOS_CAS_WRITE_BLOCK
|
||||||
|
ld a,'.'
|
||||||
|
call OUTC
|
||||||
|
call BIOS_CAS_WRITE_BLOCK
|
||||||
|
ld a,'.'
|
||||||
|
call OUTC
|
||||||
|
pop bc
|
||||||
|
dec bc
|
||||||
|
ld a,b
|
||||||
|
or c
|
||||||
|
jr nz,2$ ; repeat if not done
|
||||||
|
3$:
|
||||||
|
; All blocks are written
|
||||||
|
|
||||||
|
ld hl,CLCLRF
|
||||||
|
call PRS
|
||||||
|
|
||||||
pop hl
|
pop hl
|
||||||
pop de
|
pop de
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ BIOS_ROM_START := 0x0080
|
|||||||
BIOS_ROM_SIZE := 0x0780
|
BIOS_ROM_SIZE := 0x0780
|
||||||
|
|
||||||
BASIC_ROM_START := 0x0800
|
BASIC_ROM_START := 0x0800
|
||||||
BASIC_ROM_SIZE := 0x2000
|
BASIC_ROM_SIZE := 0x2200
|
||||||
|
|
||||||
BIOS_RAM_START := 0xc000
|
BIOS_RAM_START := 0xc000
|
||||||
BIOS_WP_RAM_START := 0xc800
|
BIOS_WP_RAM_START := 0xc800
|
||||||
BASIC_RAM_START := 0xcc00
|
BASIC_RAM_START := 0xce00
|
||||||
|
|||||||
@@ -636,7 +636,7 @@ gen_byte:
|
|||||||
; -------------------------------------------------------
|
; -------------------------------------------------------
|
||||||
gen_leader:
|
gen_leader:
|
||||||
; short leader
|
; short leader
|
||||||
ld b,50 ; generate 50 short pulses
|
ld b,100 ; generate 100 short pulses
|
||||||
1$:
|
1$:
|
||||||
call gen_short
|
call gen_short
|
||||||
dec b
|
dec b
|
||||||
@@ -644,7 +644,7 @@ gen_leader:
|
|||||||
cp 0
|
cp 0
|
||||||
jr nz,1$ ; repeat if not done
|
jr nz,1$ ; repeat if not done
|
||||||
; long leader
|
; long leader
|
||||||
ld b,50 ; generate 50 long pulses
|
ld b,100 ; generate 100 long pulses
|
||||||
2$:
|
2$:
|
||||||
call gen_long
|
call gen_long
|
||||||
dec b
|
dec b
|
||||||
@@ -669,8 +669,9 @@ gen_leader:
|
|||||||
; Writes the block stored in the block buffer
|
; Writes the block stored in the block buffer
|
||||||
; -------------------------------------------------------
|
; -------------------------------------------------------
|
||||||
write_block:
|
write_block:
|
||||||
push de
|
|
||||||
push bc
|
push bc
|
||||||
|
push de
|
||||||
|
push hl
|
||||||
; calculate the crc16 over the block
|
; calculate the crc16 over the block
|
||||||
ld hl, BLOCK_BUFFER
|
ld hl, BLOCK_BUFFER
|
||||||
ld a, BLOCK_SIZE-2 ; dont use crc value in block
|
ld a, BLOCK_SIZE-2 ; dont use crc value in block
|
||||||
@@ -706,8 +707,9 @@ write_block:
|
|||||||
ld a,200
|
ld a,200
|
||||||
call delay_ms
|
call delay_ms
|
||||||
|
|
||||||
pop bc
|
pop hl
|
||||||
pop de
|
pop de
|
||||||
|
pop bc
|
||||||
ret
|
ret
|
||||||
; -------------------------------------------------------
|
; -------------------------------------------------------
|
||||||
; Strings
|
; Strings
|
||||||
|
|||||||
Reference in New Issue
Block a user