From a7ce9f6fc6859dd90b2da893bc2c62057cc53592 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 5 Jun 2019 14:45:38 -0400 Subject: [PATCH] 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. --- kernel/fs.asm | 10 ++++++++-- kernel/pgm.asm | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) 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