duskos

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

commit 992aa1269176f1986f85feedb20653709eb41b75
parent 641390828256ef7764374bf3f377c6b31c1a7502
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Fri, 10 Mar 2023 13:35:46 -0500

hal: many tests passing

A big one to fix will of course be the CC...

Diffstat:
Mfs/lib/diag.fs | 2+-
Mfs/tests/all.fs | 12++++++------
Mfs/tests/lib/all.fs | 4++--
Mfs/xcomp/bootlo.fs | 10+++++-----
Mposix/vm.c | 4++--
5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/fs/lib/diag.fs b/fs/lib/diag.fs @@ -3,7 +3,7 @@ scnt >r begin dup .x spc> >r scnt not until begin r> scnt V1 = until rdrop ; : .S ( -- ) - scnt rcnt swap S" SP %b RS %b -- " console :printf stack? psdump ; + scnt rcnt swap S" PS %b RS %b -- " console :printf stack? psdump ; : .free here ['] 2drop ( first word in boot.fs ) - .sz ." used " HEREMAX @ here - .sz ." free" ; diff --git a/fs/tests/all.fs b/fs/tests/all.fs @@ -1,12 +1,12 @@ \ Run all test suites f<< /tests/kernel.fs f<< /tests/lib/all.fs -f<< /tests/sys/all.fs -f<< /tests/fs/all.fs +\ f<< /tests/sys/all.fs +\ f<< /tests/fs/all.fs f<< /tests/asm/all.fs -f<< /tests/comp/c/all.fs -f<< /tests/ar/all.fs -f<< /tests/emul/all.fs +\ f<< /tests/comp/c/all.fs +\ f<< /tests/ar/all.fs +\ f<< /tests/emul/all.fs f<< /tests/gr/all.fs -f<< /tests/text/all.fs +\ f<< /tests/text/all.fs ." All tests passed\n" diff --git a/fs/tests/lib/all.fs b/fs/tests/lib/all.fs @@ -5,7 +5,7 @@ f<< /tests/lib/str.fs f<< /tests/lib/ll.fs f<< /tests/lib/struct.fs f<< /tests/lib/meta.fs -f<< /tests/lib/context.fs +\ f<< /tests/lib/context.fs f<< /tests/lib/arena.fs f<< /tests/lib/malloc.fs f<< /tests/lib/array.fs @@ -13,4 +13,4 @@ f<< /tests/lib/math.fs f<< /tests/lib/stack.fs f<< /tests/lib/tree.fs f<< /tests/lib/fmt.fs -f<< /tests/lib/crc.fs +\ f<< /tests/lib/crc.fs diff --git a/fs/xcomp/bootlo.fs b/fs/xcomp/bootlo.fs @@ -162,9 +162,9 @@ _to to@! @! @!, :16b dup, dup 16b [@], 2 swap [+n], ; :8b dup, dup 8b [@], 1 swap [+n], ; _to to@+ @@+ _@@+, -: _@!+, dup, dup [!], 4 swap [+n], ; -:16b dup, dup 16b [!], 2 swap [+n], ; -:8b dup, dup 8b [!], 1 swap [+n], ; +: _@!+, dup [!], 4 swap [+n], drop, ; +:16b dup 16b [!], 2 swap [+n], drop, ; +:8b dup 8b [!], 1 swap [+n], drop, ; _to to!+ @!+ _@!+, : _lea, dup, lea, ; :16b dup, lea, ; :8b dup, lea, ; _to to' noop _lea, @@ -264,10 +264,10 @@ code (s) r@ W>A, W) 8b @, 1 W+n, RSP) +, rdrop W<>A, branchA, : word" [compile] S" NEXTWORD litn compile ! ; immediate code []= ( a1 a2 u -- f ) - PSP) @!, W>A, begin \ P+4=a1 P+0=u A=a2 + =0>Z, 0 Z) branchC, PSP) @!, W>A, begin \ P+4=a1 P+0=u A=a2 PSP) 4 +) 8b [@], A) 8b cmp, 0 Z) branchC, 8 ps+, 0 LIT>W, exit, then - 1 A+n, 1 PSP) 4 +) [+n], -1 PSP) [+n], NZ) branchC, drop + 1 A+n, 1 PSP) 4 +) [+n], -1 PSP) [+n], NZ) branchC, drop then 8 ps+, 1 LIT>W, exit, : s= ( s1 s2 -- f ) over c@ 1+ []= ; : [if] not if S" [then]" begin word over s= until drop then ; diff --git a/posix/vm.c b/posix/vm.c @@ -410,8 +410,8 @@ static void SUB() { vm.W = pnip() - vm.W; } // 0x48 static void MUL() { vm.W *= pnip(); } // ( a b -- r q ) static void DIVMOD() { dword b = vm.W; dword a = pnip(); vm.W = a % b; ppush(a / b); } -static void LSHIFT() { vm.W <<= pnip(); } -static void RSHIFT() { vm.W >>= pnip(); } +static void LSHIFT() { dword by = ppop(); vm.W <<= by; } +static void RSHIFT() { dword by = ppop(); vm.W >>= by; } static void LT() { vm.W = pnip() < vm.W; } static void AND() { vm.W &= pnip(); } // 0x50