(let ((addr (ez-get-obj-addr obj)))
(ez-mem-set-byte (+ addr 6) new-child)))
-(defun ez-get-obj-plist-addr (obj-id)
- (let ((addr (ez-get-obj-addr obj-id)))
+(defun ez-get-obj-plist-addr (obj)
+ (let ((addr (ez-get-obj-addr obj)))
(ez-mem-ref-word (+ addr 7))))
-(defun ez-get-obj-name (obj-id)
- (let ((plist-addr (ez-get-obj-plist-addr obj-id)))
+(defun ez-get-obj-name (obj)
+ (let ((plist-addr (ez-get-obj-plist-addr obj)))
(if (> (ez-mem-ref-byte plist-addr) 0)
- (ez-get-zstring (+ 1 (ez-get-obj-plist-addr obj-id)))
+ (ez-get-zstring (+ 1 (ez-get-obj-plist-addr obj)))
nil)))
(defun ez-get-prop-default (prop)
((var #x02) storeb ez-op-storeb)
((2op #x10) loadb ez-op-loadb)
((2op #x01) je ez-op-je)
+ ((2op #x02) jl ez-op-jl)
+ ((2op #x06) jin ez-op-jin)
((2op #x08) or ez-op-or)
((2op #x09) and ez-op-and)
((2op #x14) add ez-op-add)
((1op #x09) remove_obj ez-op-remove-obj)
((2op #x0E) insert_obj ez-op-insert-obj)
((var #x03) put_prop ez-op-put-prop)
+ ((2op #x11) get_prop ez-op-get-prop)
((0op #x02) print ez-op-print)
((0op #x0B) new_line ez-op-new-line)
((var #x06) print_num ez-op-print-num)
- ((var #x05) print_char ez-op-print-char)))
+ ((var #x05) print_char ez-op-print-char)
+ ((1op #x0A) print_obj ez-op-print-obj)))
(defun ez-op-ret (operands &optional operand-types)
(let ((retval (car operands)))
(ez-op-jl (cons (ez-get-var var) (cdr operands)) (cons 'w (cdr operand-types))))
t)
+(defun ez-op-jin (operands operand-types)
+ (let ((obj (car operands))
+ (n (cadr operands)))
+ (ez-do-branch (or (= n 0)
+ (= n (ez-get-obj-parent obj)))))
+ t)
(defun ez-op-jump (operands operand-types)
(let ((offset (if (eq (car operand-types) 'b)
(defun ez-op-get-sibling (operands operand-types)
(let ((sib (ez-get-obj-sibling (car operands))))
(ez-set-var (ez-read-pc-byte-and-inc) sib)
- (ez-do-branch (> sib 0))
- t))
+ (ez-do-branch (> sib 0)))
+ t)
(defun ez-op-get-child (operands operand-types)
(let ((child (ez-get-obj-child (car operands))))
(ez-set-var (ez-read-pc-byte-and-inc) child)
- (ez-do-branch (> child 0))
- t))
+ (ez-do-branch (> child 0)))
+ t)
(defun ez-op-get-parent (operands operand-types)
(let ((parent (ez-get-obj-parent (car operands))))
- (ez-set-var (ez-read-pc-byte-and-inc) parent)
- (ez-do-branch (> parent 0))
- t))
+ (ez-set-var (ez-read-pc-byte-and-inc) parent))
+ t)
(defun ez-op-remove-obj (operands operand-types)
(let ((obj (car operands)))
(let* ((obj (car operands))
(prop (cadr operands))
(a (caddr operands)))
- (ez-set-obj-prop obj prop a)
- t))
+ (ez-set-obj-prop obj prop a))
+ t)
+
+(defun ez-op-get-prop (operands operand-types)
+ (let* ((obj (car operands))
+ (prop (cadr operands)))
+ (ez-set-var (ez-read-pc-byte-and-inc)
+ (ez-get-obj-prop obj prop)))
+ t)
(defun ez-op-print (operands operand-types)
(let* ((word-count-and-string (ez-get-zstring-and-length (ez-get-pc)))
(ez-print (string c)))
t)
+(defun ez-op-print-obj (operands operand-types)
+ (let ((obj (car operands)))
+ (ez-print (ez-get-obj-name obj)))
+ t)
;; Execution loop