From: plugd Date: Tue, 16 Nov 2021 10:26:20 +0000 (+0100) Subject: Added some more ops. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=52862ec1d857dc5591dcbda8715d60fecefee1b2;p=ez.git Added some more ops. --- diff --git a/ez.el b/ez.el index 181a37a..6e3b4bf 100644 --- a/ez.el +++ b/ez.el @@ -504,6 +504,8 @@ ((1op #x0E) load ez-op-load) ((var #x01) storew ez-op-storew) ((2op #x0F) loadw ez-op-loadw) + ((var #x02) storeb ez-op-storeb) + ((2op #x10) loadb ez-op-loadb) ((2op #x01) je ez-op-je) ((2op #x08) or ez-op-or) ((2op #x09) and ez-op-and) @@ -520,7 +522,8 @@ ((var #x03) put_prop ez-op-put-prop) ((0op #x02) print ez-op-print) ((0op #x0B) new_line ez-op-new-line) - ((var #x06) print_num ez-op-print-num))) + ((var #x06) print_num ez-op-print-num) + ((var #x05) print_char ez-op-print-char))) (defun ez-op-ret (operands &optional operand-types) (let ((retval (car operands))) @@ -610,6 +613,19 @@ (ez-set-var (ez-read-pc-byte-and-inc) (ez-mem-ref-word (+ baddr (* 2 n))))) t) +(defun ez-op-storeb (operands operand-types) + (let ((baddr (car operands)) + (n (cadr operands)) + (a (caddr operands))) + (ez-mem-set-byte (+ baddr n) a)) + t) + +(defun ez-op-loadb (operands operand-types) + (let ((baddr (car operands)) + (n (cadr operands))) + (ez-set-var (ez-read-pc-byte-and-inc) (ez-mem-ref-byte (+ baddr n)))) + t) + (defun ez-op-and (operands operand-types) (let ((a (car operands)) (b (cadr operands))) @@ -708,6 +724,11 @@ (ez-print (number-to-string s))) t) +(defun ez-op-print-char (operands operand-types) + (let ((c (car operands))) + (ez-print (string c))) + t) + ;; Execution loop