zipoff.com as a standalone Forth executable, with stub

This commit is contained in:
Jeremy Penner 2023-09-15 16:10:12 -04:00
parent 6521a2127b
commit b751763331
6 changed files with 27 additions and 12 deletions

View file

@ -1,2 +1,2 @@
assemble.com < game.jrt
zipoff.com < game.jrt

View file

@ -1,9 +1,9 @@
s" zipoff.jrt" loadfile
s" text.jrt" loadfile
key fill-page
nextline nextline nextline
t" Hello, inline assembler!" draw-text nextline
t" What a lovely day it is!" draw-text
( nextline nextline nextline )
t" Hello, inline assembler!" draw-text ( nextline )
( t" What a lovely day it is!" draw-text )
terminate

View file

@ -18,17 +18,18 @@
NEXT
0 VAR, textpos
: textx textpos @ pagew % ;
: texty textpos @ pagew / ;
: textx! texty pagew * + textpos ! ;
: texty! pagew * textx + textpos ! ;
: nextline texty 1+ pagew * textpos ! ;
:t textx textpos @ pagew % ;
:t texty textpos @ pagew / ;
:t textx! texty pagew * + textpos ! ;
:t texty! pagew * textx + textpos ! ;
:t nextline texty 1+ pagew * textpos ! ;
: PREP-TEXTCOPY-XY
PREP-TEXTCOPY
ADD SI textpos @+ ;
:ASM draw-text ( s -- )
INT 3 #
MOV BX SI
POP SI
PREP-TEXTCOPY-XY

BIN
zipoff.com Executable file

Binary file not shown.

View file

@ -59,7 +59,8 @@ asm-com
|tcomp
: DEF tcomp| new-word latest wordname lastlabel ! |tcomp $DOFAR , target , ;
: DEF asm-com tcomp| new-word latest wordname lastlabel ! |tcomp $DOFAR , target , ;
: :asm asm-here new-word here cell + , ;
s" coredefs.jrt" loadfile
@ -90,7 +91,20 @@ s" coredefs.jrt" loadfile
: FINISHCREATE tcomp| latest |tcomp codepointer cell + @ cell + !t ;
: DOES> target lit ' FINISHCREATE , ' return , tcomp| ; immediate
: t" target begin key dup [ key " lit ] != while >t repeat ;
: t" target begin key dup [ key " lit ] != while >t repeat 0 >t drop ;
s" logic.jrt" loadfile
var comfilename
: readcom ( filename ) open 0x100 target!
begin dup fgetc dup EOF != while >t repeat drop close ;
:init comfilename @ readcom ;
: writeenv ( comfile wrapper -- )
swap comfilename !
dup type cr writeself
comfilename @ dup type cr writecom ;
here s", zipstub.seg" s" zipoff.com" writeenv

BIN
zipstub.seg Executable file

Binary file not shown.