commit 709bd005473496bfac1b279c22fb7170c71ea74d
parent e2a4ed86a6c8fe824f538ca7b3684b0f237de1cc
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Wed, 1 Jun 2022 13:51:41 -0400
Add sysval const syscell
Diffstat:
4 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dusk.asm b/dusk.asm
@@ -15,6 +15,10 @@ GLOBAL here
here: resd 1
GLOBAL compiling
compiling: resd 1
+GLOBAL curword
+curword: resb 6
+GLOBAL inptr
+inptr: resd 1
rs_top:
resd PS_SZ
ps_top:
diff --git a/f2asm.py b/f2asm.py
@@ -25,6 +25,8 @@ aliases = {
'A-': 'adec',
'Ac@+': 'acfetchplus',
'Ac!+': 'acstoreplus',
+ 'in>': 'inptr',
+ "'curword": 'curword',
}
knownwords = set()
@@ -66,7 +68,7 @@ def newword(name=None, imm=False):
if alias == '_':
anoncount += 1
alias = f'_{anoncount}'
- out(f"defword '{name}', {count}, word_{alias}, word_{prevword}\n")
+ out(f"defword `{name}`, {count}, word_{alias}, word_{prevword}\n")
prevword = alias
return alias
@@ -132,6 +134,12 @@ def _const_():
val = litparse(nextt())
out(f'constant {val}\n')
+def _syscell_():
+ newword()
+ lbl = nextt()
+ out(f'EXTERN {lbl}\n')
+ out(f'constant {lbl}\n')
+
def _alias_():
newword()
out('call aliasword\n')
@@ -167,6 +175,7 @@ special = {
'next': _next_,
'create': _create_,
'sysval': _sysval_,
+ 'syscell': _syscell_,
'const': _const_,
'alias': _alias_,
'opwriter': _opwriter_,
diff --git a/words/to.asm b/words/to.asm
@@ -0,0 +1,7 @@
+defword 'to', 2, word_to, word_adec
+GLOBAL word_asmlast
+word_asmlast:
+EXTERN toflag
+ mov byte [toflag], 1
+ ret
+
diff --git a/xcomp2.txt b/xcomp2.txt
@@ -1,7 +1,9 @@
sysval current
sysval here
sysval compiling
-const foo '!'
+const SPC $20 const CR $0d const LF $0a const BS $08
+sysval in>
+syscell 'curword curword
: 2drop drop drop ;
: 2dup over over ;
@@ -12,4 +14,4 @@ const foo '!'
: Ac@+ Ac@ A+ ;
: Ac!+ Ac! A+ ;
create _ ," foo"
-: boot _ >A Ac@+ emit Ac@+ emit Ac@+ emit foo emit bye ;
+: boot _ >A Ac@+ emit Ac@+ emit Ac@+ emit bye ;