duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit fe7cbdf69d36d1ddbb9634177954959297a468b7
parent 9c5432b38e026c486cb24ca7a9804e5076becc43
Author: binarycat <binarycat@envs.net>
Date:   Sun, 26 Jun 2022 10:23:40 -0400

fix error messages properly

This patch fixes the multi-error problem by resetting the input buffer
when quit is called.  It does so with a sysalias word currently called
main, which allows code to be injected between quit and mainloop.

rdln then uses this to call rdln$ (then mainloop).
currently it assumes no other code is modifying main, this can be
fixed by chaining main properly, although i'm not sure how to
do that without `defer@`, `[`, `]`, and `compile,`.

Diffstat:
Mdusk.asm | 7++++++-
Mfs/sys/rdln.fs | 2++
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dusk.asm b/dusk.asm @@ -70,6 +70,7 @@ curword: resb 0x20 ; 1b len, then contents iinrd: resd 1 ; iin< inrd: resd 1 ; in< emit: resd 1 +main: resd 1 resd PS_SZ ps_top: resd RS_SZ @@ -89,6 +90,7 @@ _start: mov dword [bootptr], bootsrc mov dword [here], herestart mov dword [current], word_mainloop + mov dword [main], word_mainloop mov dword [iinrd], word_bootrd mov dword [inrd], word_iinrd mov dword [emit], word__emit @@ -105,12 +107,15 @@ firstword 'bye', 3, word_bye defword 'noop', 4, word_noop ret +defword 'main', 4, word_main + sysalias main + defword 'quit', 4, word_quit cld mov dword [toptr], 0 mov dword [inrd], word_iinrd ; make sure input is interactive after a quit mov esp, rs_top - jmp word_mainloop + jmp word_main defword 'abort', 5, word_abort test byte [exitonabort], -1 diff --git a/fs/sys/rdln.fs b/fs/sys/rdln.fs @@ -20,3 +20,5 @@ in) value in> : rdln< ( -- c ) rdln<? ?dup not if rdln in( to in> SPC then ; : rdln$ ['] rdln< dup to iin< to in< in) to in> ; +: _ rdln$ mainloop ; +' _ to main