From: Tim Vaughan Date: Fri, 15 Oct 2021 07:17:28 +0000 (+0200) Subject: Fixed local variable numbering bug. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=b524e883ec1b6df18f37738f9f63504e70fa0554;p=ez.git Fixed local variable numbering bug. --- diff --git a/ez.el b/ez.el index 4cea075..b766b70 100644 --- a/ez.el +++ b/ez.el @@ -236,7 +236,7 @@ ((= var 0) (ez-routine-stack-pop)) ((< var 16) - (ez-get-local-var (- var 1))) + (ez-get-local-var var)) (t (ez-get-global-var (- var 16))))) @@ -245,7 +245,7 @@ ((= var 0) (ez-routine-stack-push val)) ((< var 16) - (ez-set-local-var (- var 1) val)) + (ez-set-local-var var val)) (t (ez-set-global-var (- var 16) val)))) @@ -303,9 +303,8 @@ (unless table-row (error "Unsupported op" optype opcode)) (let ((mnemonic (elt table-row 1))) - (message "Optype:%s Opcode:%x Operands:%s" - (symbol-name optype) - opcode operands)) + (message "Optype:%s Opcode:%x Mnemonic:%s Operands:%s" + optype opcode mnemonic operands)) (apply (elt table-row 2) operands)))) (defun ez-read-var-operands-and-inc () @@ -348,7 +347,7 @@ (dotimes (i L) (if (< i n) (ez-set-local-var (+ i 1) (elt operands i)) - (ez-set-local-var (+ i 1) (ez-mem-ref-byte (+ r 1 (* 2 i))))))) + (ez-set-local-var (+ i 1) (ez-mem-ref-word (+ r 1 (* 2 i))))))) t) ;; Main @@ -366,26 +365,8 @@ (ez-parse-header) (setq ez-call-stack (list (ez-make-call-stack-frame ez-start-pc))) (ez-execute-instr) - -(binformat #x9b) -"10 01 10 11" - -(* 2 #x2b07) - -"10011011" - -#b00101111 -(lsh #x2f) - ez-call-stack -(binformat #x2f) -"10 11 11" -(* 2 #x2b07) - - -(ez-get-obj 1) - (defun binformat (n &optional s) (unless s (setq s ""))