((1op #x05) inc ez-op-inc)
((1op #x06) dec ez-op-dec)
((1op #x0B) ret ez-op-ret)
+ ((0op #x08) ret_pulled ez-op-ret-pulled)
((1op #x0C) jump ez-op-jump)
((2op #x05) inc_jg ez-op-inc-jg)
((2op #x04) dec_jg ez-op-dec-jg)
((2op #x10) loadb ez-op-loadb)
((2op #x01) je ez-op-je)
((2op #x02) jl ez-op-jl)
+ ((2op #x03) jg ez-op-jg)
((2op #x06) jin ez-op-jin)
+ ((2op #x07) test ez-op-test)
((2op #x08) or ez-op-or)
((2op #x09) and ez-op-and)
((2op #x14) add ez-op-add)
(ez-set-var (ez-read-pc-byte-and-inc) retval))
t)
+(defun ez-op-ret-pulled (operands operand-types)
+ (let ((retval (ez-routine-stack-pop)))
+ (message "\tReturning value %x" retval)
+ (ez-op-ret (list retval)))
+ t)
+
(defun ez-op-rtrue (&optional operands operand-types)
(ez-op-ret (list 1))
t)
(= n (ez-get-obj-parent obj)))))
t)
+(defun ez-op-test (operands operand-types)
+ (let ((a (car operands))
+ (b (cadr operands)))
+ (ez-do-branch (= (logand a b) b)))
+ t)
+
(defun ez-op-jump (operands operand-types)
(let ((offset (if (eq (car operand-types) 'b)
(ez-decode-signed-byte (car operands))
;;; Buffer and I/O
;;
-(defun ez-render-prompt ()
- (with-current-buffer "*ez*"
- (let ((update-point (= ez-input-marker (point)))
- (update-window-points (mapcar (lambda (w)
- (list (= (window-point w) ez-input-marker)
- w))
- (get-buffer-window-list nil nil t))))
- (save-excursion
- (set-marker-insertion-type ez-prompt-marker nil)
- (set-marker-insertion-type ez-input-marker t)
- (let ((inhibit-read-only t))
- (delete-region ez-prompt-marker ez-input-marker)
- (goto-char ez-prompt-marker)
- (insert
- ">"
- (propertize " " ; Need this to be separate to mark it as rear-nonsticky
- 'read-only t
- 'rear-nonsticky t)))
- (set-marker-insertion-type ez-input-marker nil))
- (goto-char ez-input-marker))))
-
-(defvar ez-prompt-marker nil
- "Marker for prompt position in buffer.")
-
(defvar ez-input-marker nil
- "Marker for prompt position in buffer.")
+ "Marker for input position in buffer.")
(defun ez-setup-buffer ()
(with-current-buffer (get-buffer-create "*ez*")
(let ((inhibit-read-only t))
(delete-region (point-min) (point-max)))
(setq-local scroll-conservatively 1)
- (if (markerp ez-prompt-marker)
- (set-marker ez-prompt-marker (point-max))
- (setq ez-prompt-marker (point-max-marker)))
(if (markerp ez-input-marker)
(set-marker ez-input-marker (point-max))
(setq ez-input-marker (point-max-marker)))
- (goto-char (point-max))
- (ez-render-prompt)))
+ (goto-char (point-max))))
(defun ez-print (string)
(with-current-buffer "*ez*"
(save-excursion
- (goto-char ez-prompt-marker)
+ (goto-char ez-input-marker)
(insert-before-markers string))))
;; Mode