|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
lua-until EOL
dofile("macro2.lua") -- (find-miniforth "macro2.lua")
dofile("crim/crim.lua") -- (find-miniforth "crim/crim.lua")
dofile("crim/crimextras.lua") -- (find-miniforth "crim/crimextras.lua")
dofile("crim/crimlabels.lua") -- (find-miniforth "crim/crimlabels.lua")
externdecl = function( heads, Cname )
fwordclass:declare(Cname)
mf(heads)
nasm(0, format(" extern %s\n", Cname))
nasm(4, format("\tdd %s\n", Cname))
end
luaword("externdecl")
zdotquo = function( ... ) mf[[ 0<."> ]]; call(dbstuff, arg) end
luaword("zdotquo")
litw = function( n ) mf("LITW"); nasm(2, format("\tdw %s\n", n)) end
luaword("litw")
EOL
externdecl( "H_C1", "strlen" )
:RSR 0<.">
: S0<."> S> DUP strlen 2DUP TYPE + 1 + >S ;
:RSR LITW H_COL SGOBBLE2 ;
:RSR BRANCH H_COL SBRANCH ;
:RSR 0BRANCH H_COL S0BRANCH ;
: YES/NO if zdotquo( "yes\n", 0 )
else zdotquo( "no\n", 0 )
then ;
: DEMO zdotquo( "Hello\n", 0 )
litw( 22 ) YES/NO litw( 0 ) YES/NO ;
asm/C-files: crim/demo4.asm crim/demo4.c
e exit()
#*
cd ~/miniforth/crim/
make clean
make CFLAGS=-g demo4
./demo4 7
#*