diff --git a/kernel/fs.asm b/kernel/fs.asm index c5130d4..485030d 100644 --- a/kernel/fs.asm +++ b/kernel/fs.asm @@ -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. diff --git a/kernel/pgm.asm b/kernel/pgm.asm index cd93945..188fc2b 100644 --- a/kernel/pgm.asm +++ b/kernel/pgm.asm @@ -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