From 2483ee699d883e54e3e7c6652240b19de2396ff5 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 5 Jun 2019 15:40:56 -0400 Subject: [PATCH] fs: fix broken fopn on id > 0 --- kernel/fs.asm | 1 + kernel/fs_cmds.asm | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/fs.asm b/kernel/fs.asm index 485030d..f774d97 100644 --- a/kernel/fs.asm +++ b/kernel/fs.asm @@ -461,6 +461,7 @@ fsGetC: ; 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 +; TODO: grow file size if appropriate fsPutC: push hl call fsPlaceH diff --git a/kernel/fs_cmds.asm b/kernel/fs_cmds.asm index 0eb3840..7cf63a8 100644 --- a/kernel/fs_cmds.asm +++ b/kernel/fs_cmds.asm @@ -71,7 +71,15 @@ fopnCmd: push de ld a, (hl) ; file handle index ld de, FS_HANDLES - call addDE ; DE now stores pointer to file handle + or a ; cp 0 + jr z, .noInc ; DE already point to correct handle + ld b, a +.loop: + ld a, FS_HANDLE_SIZE + call addDE + djnz .loop +.noInc: + ; DE now stores pointer to file handle inc hl call intoHL ; HL now holds the string we look for call fsFindFN