1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 15:58:05 +11:00

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

View File

@ -57,11 +57,13 @@ pgmRun:
push hl ; unparsed args push hl ; unparsed args
ld ix, PGM_HANDLE ld ix, PGM_HANDLE
call fsOpen 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: .loop:
call fsGetC ; we use Z at end of 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 hl ; Z preserved in 16-bit
inc de ; Z preserved in 16-bit
jr z, .loop jr z, .loop
pop hl ; recall args pop hl ; recall args