The Lambda Lab
/
projects
/
ez.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8455cb5
)
Added some more ops.
author
plugd
<plugd@thelambdalab.xyz>
Tue, 16 Nov 2021 10:26:20 +0000
(11:26 +0100)
committer
plugd
<plugd@thelambdalab.xyz>
Tue, 16 Nov 2021 10:26:20 +0000
(11:26 +0100)
ez.el
patch
|
blob
|
history
diff --git
a/ez.el
b/ez.el
index
181a37a
..
6e3b4bf
100644
(file)
--- 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)
((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)
((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 #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)))
(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)
(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)))
(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)
(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
;; Execution loop