Full file transfer, no mem loading yet
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
TAPE_PORT = 0x18
|
||||
MAX_CYCLE_COUNT = 20
|
||||
MAX_BLOCK_SIZE = 0x100
|
||||
MAX_BLOCK_SIZE = 0x200
|
||||
|
||||
STACK_TOP = 0xBFFF
|
||||
WORK_BASE = 0xB000
|
||||
@@ -19,6 +19,7 @@ SHORT_COUNT = WORK_BASE + 0x06 ; byte
|
||||
LONG_COUNT = WORK_BASE + 0x07 ; byte
|
||||
BLOCK_LENGTH = WORK_BASE + 0x08 ; word
|
||||
BLOCK_NUMBER = WORK_BASE + 0x0a ; byte
|
||||
NR_OF_BLOCKS = WORK_BASE + 0x0b ; word
|
||||
|
||||
BLOCK_BUFFER = WORK_BASE + 0x100 ; MAX_BLOCK_SIZE
|
||||
|
||||
@@ -54,13 +55,66 @@ save_iff:
|
||||
di
|
||||
jp exit
|
||||
1$:
|
||||
; Filename stored in buffer
|
||||
; nr of blocks and filename stored in buffer
|
||||
ld hl,(BLOCK_BUFFER)
|
||||
ld (NR_OF_BLOCKS),hl
|
||||
|
||||
; Print info of blocks
|
||||
ei
|
||||
ld hl,#msg_filename
|
||||
call print_string
|
||||
ld hl,#BLOCK_BUFFER
|
||||
inc hl
|
||||
inc hl
|
||||
call print_string
|
||||
call print_crlf
|
||||
ld hl,#msg_nr_of_blocks
|
||||
call print_string
|
||||
ld hl,(NR_OF_BLOCKS)
|
||||
call print_hex16
|
||||
call print_crlf
|
||||
|
||||
call BIOS_FLUSH
|
||||
di
|
||||
|
||||
; #################################################3
|
||||
; Read a consecutive list of blocks
|
||||
; #################################################3
|
||||
read_consecutive_blocks:
|
||||
ld bc,(NR_OF_BLOCKS)
|
||||
push bc
|
||||
1$:
|
||||
call read_block
|
||||
jr z,2$
|
||||
ei
|
||||
ld a,#'x'
|
||||
call BIOS_PUTC
|
||||
call BIOS_FLUSH
|
||||
di
|
||||
jr 3$
|
||||
2$:
|
||||
ei
|
||||
ld a,#'*'
|
||||
call BIOS_PUTC
|
||||
call BIOS_FLUSH
|
||||
di
|
||||
|
||||
3$:
|
||||
pop bc
|
||||
dec bc
|
||||
push bc
|
||||
; Check for zero
|
||||
ld a,b
|
||||
or a,c
|
||||
jr nz,1$
|
||||
pop bc
|
||||
|
||||
; All blocks are read
|
||||
ei
|
||||
ld a,#'V'
|
||||
call BIOS_PUTC
|
||||
call print_crlf
|
||||
call BIOS_FLUSH
|
||||
di
|
||||
|
||||
; #################################################3
|
||||
@@ -358,6 +412,12 @@ read_block:
|
||||
pop bc
|
||||
ld c,a
|
||||
ld (BLOCK_LENGTH),bc
|
||||
|
||||
; Check block length against max length
|
||||
ld hl,#MAX_BLOCK_SIZE
|
||||
and a,a
|
||||
sbc hl, bc
|
||||
jp c,error_block_too_big
|
||||
|
||||
exx
|
||||
|
||||
@@ -406,6 +466,14 @@ read_block:
|
||||
ld l,e
|
||||
cp a,e
|
||||
ret
|
||||
|
||||
error_block_too_big:
|
||||
ei
|
||||
ld hl,#msg_error_block_too_big
|
||||
call print_string
|
||||
call print_crlf
|
||||
di
|
||||
jp exit
|
||||
|
||||
|
||||
; #################################################3
|
||||
@@ -506,3 +574,11 @@ msg_filename:
|
||||
.ascii "Filename: "
|
||||
.db 0
|
||||
|
||||
msg_nr_of_blocks:
|
||||
.ascii "Blocks: "
|
||||
.db 0
|
||||
|
||||
msg_error_block_too_big:
|
||||
.ascii "Block too big"
|
||||
.db 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user