commit d560889338cf6aa43162dd3a9b24264e2ef30114
parent 440b05709569840146b39843b525e8c6ce432d34
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Wed, 1 Jun 2022 13:51:41 -0400
Add a bunch of words
Diffstat:
4 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/aliases.txt b/aliases.txt
@@ -16,7 +16,7 @@ A- adec
Ac@+ acfetchplus
Ac!+ acstoreplus
in> inptr
-'curword curword
+'curword curwordaddr
1+ inc
1- dec
c@ cfetch
@@ -41,3 +41,8 @@ c, cwrite
>> shr
move, movewr
?dup cdup
+ws? wsc
+boot< bootrd
+in<? inrdc
+in< inrd
+word! wordset
diff --git a/dusk.asm b/dusk.asm
@@ -78,8 +78,20 @@ or eax, eax
jz %$if
%endmacro
+%macro _else_ 0
+%ifctx if
+ %repl else
+ jmp %$else
+ %$if:
+%endif
+%endmacro
+
%macro _then_ 0
-%$if:
+%ifctx if
+ %$if:
+%else
+ %$else:
+%endif
%pop
%endmacro
diff --git a/f2asm.py b/f2asm.py
@@ -128,7 +128,8 @@ def _syscell_():
def _alias_():
newword()
out('call aliasword\n')
- initial_tgt = nextt()
+ t = nextt()
+ initial_tgt = aliases.get(t, t)
out(f'dd word_{initial_tgt}\n')
def _opwriter_():
diff --git a/xcomp2.txt b/xcomp2.txt
@@ -28,5 +28,16 @@ syscell 'curword curword
>r >A begin ( src ) c@+ Ac!+ next drop then ;
: move, ( a u -- ) here over allot swap move ;
: stype >r begin c@+ emit next drop ;
-create _ ," foo"
+: ws? SPC <= ;
+: boot< in> c@+ swap to in> ;
+alias in<? boot<
+alias in< boot<
+: toword ( -- ) begin in< ws? not until ;
+: curword ( -- sa sl ) 'curword 1+ @ 'curword c@ ;
+: _ ( f sa sl -- ) 'curword c!+ tuck ! 4 + c! ;
+: word ( -- sa sl )
+ 'curword 5 + c@ if curword else
+ toword in> 1- 0 ( sa sl ) begin 1+ in<? ws? until then
+ ( sa sl ) 2dup 0 rot> _ ;
+: word! 1 rot> _ ;
: boot S" Dusk OS" stype bye ;