duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 6c38e0cb5299907fabdda579775df14588f1df1b
parent a75ab48f39ab4289aeab9ac78e01c6db4de78e9f
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sun,  2 Jul 2023 09:16:09 -0400

hal i386: +) can compound

It doesn't fix the ar/ungz tests, but it's still something...

Diffstat:
Mfs/tests/hal.fs | 6++++++
Mfs/xcomp/i386/kernel.fs | 20++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/fs/tests/hal.fs b/fs/tests/hal.fs @@ -245,4 +245,10 @@ code test26 ( -- 42 ) exit, test26 42 #eq + +\ Test that +) can compound +code test27 ( a b c d -- a+d ) + PSP) 5 +) 3 +) +, nip, nip, nip, exit, + +20 54 12 22 test27 42 #eq testend diff --git a/fs/xcomp/i386/kernel.fs b/fs/xcomp/i386/kernel.fs @@ -19,7 +19,8 @@ \ b18 immediate? ( value in bank ) \ b19 "<>)" flag \ b23:20 Number bank index -\ b31:24 zeroes +\ b24 Has number in bank +\ b31:25 zeroes ?f<< /asm/i386.fs ?f<< /xcomp/tools.fs @@ -61,6 +62,7 @@ $20000 const HAL16B $40000 const HALIMM $10000 const HALDEREF $80000 const HALINV +$1000000 const HALHASBANK $10 const HBANKSZ : _ dx lblhere m) mov, dx 0 d) swap mov, ; @@ -174,6 +176,7 @@ xcode hbank@ ( slot -- n ) pc to lblnewbankedop ( n -- operand ) wcall, hbank! ax 20 i) shl, + ax HALHASBANK i) or, ret, \ Get banked value from operand @@ -191,11 +194,20 @@ xcode i) ( n -- operand ) ax HALIMM i) or, ret, -\ TODO: allow multiple applications +\ When the operation already has a banked op, add to it instead of replacing it. +pc to L1 ( operand n -- operand ) + ax push, xdrop, ax push, + ax 20 i) shr, + wcall, hbank' + dx pop, ( operand ) cx pop, ( n ) + ax 0 d) cx add, + ax dx mov, + ret, + \ TODO: allow disp32 offsets -pc to L1 xdrop, ret, xcode +) ( operand n -- operand ) - ax ax test, L1 abs>rel jz, + ax ax test, forward8 jnz, xdrop, ret, forward! + si 0 d) HALHASBANK i) test, L1 abs>rel jnz, lblnewbankedop abscall, dx si 0 d) mov, xnip, ax dx or,