commit 6483d9cd3ab8e8c8e7061cb0914a8125334ed827
parent e6e821d66191046a366dc005416d811743279882
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sat, 23 Jul 2022 08:07:42 -0400
i386: we're rollin'! ESP, EBP set. (val) implemented
Diffstat:
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/fs/xcomp/i386.fs b/fs/xcomp/i386.fs
@@ -4,15 +4,41 @@
\ ESP and EBP are uninitialized.
?f<< /xcomp/tools.fs
+: pspush, ( regid -- ) bp CELLSZ i) sub, bp 0 d) r! mov, ;
+: pspop, ( regid -- ) r! bp 0 d) mov, bp CELLSZ i) add, ;
+
+0 to realmode
0 value L1
$8000 to binstart \ This code lives at $8000.
here to org
-forward8 jmp, to L1
+forward16 jmp, to L1
xcode bye 0 jmp,
+xcode noop ret,
+
+xcode (cell)
+ ax pop,
+ AX pspush,
+ ret,
+
+xcode (val)
+ ax pop,
+ bx ax 0 d) mov,
+ BX pspush,
+ ret,
+
+xcode fooval
+ xwordlbl (val) abs>rel call,
+ $07690748 ,
+
xcode mainloop
L1 forward!
- ax $07690748 i) mov,
+ bp $8000 i) mov,
+ sp $6000 i) mov,
+ xwordlbl fooval abs>rel call,
+ AX pspop,
$b8000 m) ax mov,
xwordlbl bye abs>rel call,
+
+xbindict orgifydict
diff --git a/fs/xcomp/tools.fs b/fs/xcomp/tools.fs
@@ -18,6 +18,8 @@ newxdict xbindict
\ to current org+binstart. Once this is done, the xdict can't be traversed
\ anymore and becomes opaque binary contents.
: orgifydict ( xdict -- )
- begin ( a )
- ?dup while ( a ) @ dup xoffset + over ! ( prev ) repeat ;
+ @ begin ( a )
+ ?dup while ( a )
+ 5 - dup @ dup ( 'prev prev prev )
+ xoffset + ( 'prev oldprev newprev ) rot ! ( prev ) repeat ;