From 5e3baa70fbf74978ea0899a8c23fed9fe9d02cf4 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Sun, 7 Jul 2024 21:23:47 -0700 Subject: [PATCH] Add neg --- src/lisp/drawl.pla | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lisp/drawl.pla b/src/lisp/drawl.pla index 2dfb73c..7c1a0f1 100644 --- a/src/lisp/drawl.pla +++ b/src/lisp/drawl.pla @@ -721,6 +721,16 @@ def natv_rem(expr) return new_int(num[0], num[1]) end +def natv_neg(expr) + var num[2] + + num[0], num[1] = eval_num(expr) + load32(@num) + neg32 + store32(@num) + return new_int(num[0], num[1]) +end + def natv_gt(expr) var num[2] @@ -780,6 +790,7 @@ def install_defaults#0 new_sym("*")=>natv = @natv_mul) new_sym("/")=>natv = @natv_div) new_sym("REM")=>natv = @natv_rem) + new_sym("NEG")=>natv = @natv_neg) new_sym(">")=>natv = @natv_gt) new_sym("<")=>natv = @natv_lt) new_sym("PRINT")=>natv = @natv_print)