duskos

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

commit 440b05709569840146b39843b525e8c6ce432d34
parent c6d32810613ae6b115ddb95bc968dd6fe5b25775
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Wed,  1 Jun 2022 13:51:41 -0400

Add string literals

Diffstat:
Mdusk.asm | 11++++++++++-
Mf2asm.py | 11++++++++---
Mxcomp2.txt | 2+-
3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/dusk.asm b/dusk.asm @@ -126,6 +126,15 @@ aliasword: jnz to_is_set jmp [eax] +strlit: + pop esi ; addr of str + mov eax, 0 + lodsb ; len + pspush esi ; addr of first char + pspush eax ; len + add esi, eax ; ret to PC right after str + jmp esi + defword 'bye', 3, word_bye, 0 mov eax,1 ; 'exit' system call mov ebx,0 ; exit with error code 0 @@ -184,7 +193,7 @@ defword '>A', 2, word_aset, word_rot defword 'A>', 2, word_aget, word_aset mov eax, [areg] pspush eax - net + ret defword 'Ac@', 3, word_acfetch, word_aget mov eax, [areg] diff --git a/f2asm.py b/f2asm.py @@ -90,17 +90,22 @@ def _next_(): def exitwr(): out('ret\n') -def strwr(): +def rdstr(): s = '' c = fp.read(1) while c and c != '"': s += c c = fp.read(1) - out(f"db '{s}'\n") return s +def strwr(): + s = rdstr() + out(f"db '{s}'\n") + def slitwr(): - out('TODO\n') + s = rdstr() + out(f'call strlit\n') + out(f'db {len(s)}, `{s}`\n') def _create_(): newword() diff --git a/xcomp2.txt b/xcomp2.txt @@ -29,4 +29,4 @@ syscell 'curword curword : move, ( a u -- ) here over allot swap move ; : stype >r begin c@+ emit next drop ; create _ ," foo" -: boot _ 3 stype bye ; +: boot S" Dusk OS" stype bye ;