duskos

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

commit e30d4b11b6f0e92aca1120b6cdf62cc566755d97
parent 72a30850cbf1f59f0fa5f473a411e1f48e041212
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sun, 19 Mar 2023 07:47:58 -0400

hal: add "neg,"

Diffstat:
Mfs/xcomp/bootlo.fs | 2+-
Mfs/xcomp/i386/kernel.fs | 3+++
Mposix/vm.c | 4+++-
3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/xcomp/bootlo.fs b/fs/xcomp/bootlo.fs @@ -107,7 +107,7 @@ code ?dup W=0>Z, 0 Z) branchC, dup, then exit, : min ?swap drop ; : max ?swap nip ; : max0 ( n -- n ) dup 0< if drop 0 then ; : =><= ( n l h -- f ) over - rot> ( h n l ) - >= ; -: neg 0 -^ ; +code neg neg, exit, code ^ -1 xorn, exit, : and? bool swap bool and ; : or? or bool ; diff --git a/fs/xcomp/i386/kernel.fs b/fs/xcomp/i386/kernel.fs @@ -313,6 +313,9 @@ xcode orn, ( n -- ) \ ax XX i) or, xcode xorn, ( n -- ) \ ax XX i) xor, $35 i) cwrite, ax dwrite, xdrop, ret, +xcode neg, ( -- ) \ ax neg, + $d8f7 i) wwrite, ret, + xcode W=0>Z, $c085 i) wwrite, ret, \ ax ax test, xcode A=0>Z, $ff85 i) wwrite, ret, \ di di test, pc 8 nc, $b8 0 0 0 0 $0f $94 $c0 \ ax 0 i) mov, al setz, diff --git a/posix/vm.c b/posix/vm.c @@ -454,6 +454,7 @@ static void DIVMOD() { dword b = vm.W; dword a = pnip(); vm.W = a % b; ppush(a / 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 NEG() { vm.W = -vm.W; } static void AND() { vm.W &= pnip(); } // 0x50 static void OR() { vm.W |= pnip(); } @@ -782,7 +783,7 @@ static void (*ops[OPCNT])() = { MAYBEWORD, WORD, PARSE, FIND, WNF, FINDMOD, NULL, NULL, STACKCHK, COMPWORD, RUNWORD, COMPILING, STARTCOMP, STOPCOMP, RSADDWR, COMPOP, ALIGN4, ENTRY, CODE, CODE16, CODE8, NULL, NULL, NULL, - SWAPSUB, MUL, DIVMOD, LSHIFT, RSHIFT, LT, NULL, NULL, + SWAPSUB, MUL, DIVMOD, LSHIFT, RSHIFT, LT, NEG, NULL, AND, OR, XOR, NULL, NULL, NULL, NULL, NULL, BYE, BYEFAIL, QUIT, ABORT_, DBG, USLEEP, NULL, NULL, SHLN, SHRN, ANDN, ORN, XORN, WCHECKZ, STOREZ, ACHECKZ, @@ -882,6 +883,7 @@ static void buildsysdict() { entry("+,"); compopwr(0x17); retwr(); entry("lea,"); compopwr(0x28); retwr(); entry("cmpn,"); compileop(0x2f); writewr(); retwr(); + entry("neg,"); compileop(0x4e); retwr(); entry("<<n,"); compileop(0x60); cwritewr(); retwr(); entry(">>n,"); compileop(0x61); cwritewr(); retwr(); entry("andn,"); compileop(0x62); writewr(); retwr();