From 984f78aa6ded9a174c6fa3dcff1241e2f4bc7033 Mon Sep 17 00:00:00 2001 From: plugd Date: Fri, 19 Nov 2021 10:43:29 +0100 Subject: [PATCH] Improved debug info output. --- ez.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 () -- 2.20.1