From: plugd Date: Fri, 19 Nov 2021 09:43:29 +0000 (+0100) Subject: Improved debug info output. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=984f78aa6ded9a174c6fa3dcff1241e2f4bc7033;p=ez.git Improved debug info output. --- diff --git a/ez.el b/ez.el index 1fb0f65..3948f4c 100644 --- a/ez.el +++ b/ez.el @@ -55,6 +55,14 @@ new-s (binformat d new-s)))) +(defun ez-list-to-string-hex (l) + (concat "(" + (when l + (concat + (format "%x" (car l)) + (apply 'concat (mapcar (lambda (n) (format " %x" n)) (cdr l))))) + ")")) + ;; Memory (defvar ez-memory nil @@ -371,10 +379,13 @@ (defun ez-set-var (var val) (cond ((= var 0) + (message "Pushed %x to stack" val) (ez-routine-stack-push val)) ((< var 16) + (message "Saved %x to local variable %x" val var) (ez-set-local-var var val)) (t + (message "Saved %x to global variable %x" val (- var 16)) (ez-set-global-var (- var 16) val)))) (defun ez-read-pc-var-and-inc () @@ -444,10 +455,11 @@ (let ((table-row (assoc (list optype opcode) ez-op-table))) (unless table-row (error "Unsupported op PC:%x Optype:%s Opcode:%x Operands:%s Operand-types:%s" - instr-pc optype opcode operands operand-types)) + instr-pc optype opcode (ez-list-to-string-hex operands) operand-types)) (let ((mnemonic (elt table-row 1))) (message "PC:%x Optype:%s Opcode:%x Mnemonic:%s Operands:%s Operand-types:%s" - instr-pc optype opcode mnemonic operands operand-types)) + instr-pc optype opcode mnemonic + (ez-list-to-string-hex operands) operand-types)) (funcall (elt table-row 2) operands operand-types)))) (defun ez-read-var-operands-and-inc ()