pgm: adapt to recent blkdev change

With fsGetC becoming a "random address" API, it broke pgm. This commit
fixes it. To avoid adding the weight of a blkdev in pgm, I manage the
read offset directly in pgm.
This commit is contained in:
Virgil Dupras 2019-06-05 14:45:38 -04:00
parent c18d42f08b
commit a7ce9f6fc6
2 changed files with 12 additions and 4 deletions

View File

@ -452,15 +452,21 @@ fsGetC:
xor a
jp unsetZ ; returns
.proceed:
push hl
call fsPlaceH
jp fsblkGetC ; returns
call fsblkGetC
pop hl
ret
; Write byte A in handle (IX) and advance the handle's position.
; Z is set on success, unset if handle is at the end of the file.
; TODO: detect end of block alloc
fsPutC:
push hl
call fsPlaceH
jp fsblkPutC ; returns
call fsblkPutC
pop hl
ret
; Mount the fs subsystem upon the currently selected blockdev at current offset.
; Verify is block is valid and error out if its not, mounting nothing.

View File

@ -57,11 +57,13 @@ pgmRun:
push hl ; unparsed args
ld ix, PGM_HANDLE
call fsOpen
ld hl, PGM_CODEADDR
ld hl, 0 ; addr that we read in file handle
ld de, PGM_CODEADDR ; addr in mem we write to
.loop:
call fsGetC ; we use Z at end of loop
ld (hl), a ; Z preserved
ld (de), a ; Z preserved
inc hl ; Z preserved in 16-bit
inc de ; Z preserved in 16-bit
jr z, .loop
pop hl ; recall args