The Lambda Lab
/
projects
/
ez.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8ed7e62
)
Improved debug info output.
author
plugd
<plugd@thelambdalab.xyz>
Fri, 19 Nov 2021 09:43:29 +0000
(10:43 +0100)
committer
plugd
<plugd@thelambdalab.xyz>
Fri, 19 Nov 2021 09:43:37 +0000
(10:43 +0100)
ez.el
patch
|
blob
|
history
diff --git
a/ez.el
b/ez.el
index
1fb0f65
..
3948f4c
100644
(file)
--- a/
ez.el
+++ b/
ez.el
@@
-55,6
+55,14
@@
new-s
(binformat d new-s))))
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
;; Memory
(defvar ez-memory nil
@@
-371,10
+379,13
@@
(defun ez-set-var (var val)
(cond
((= var 0)
(defun ez-set-var (var val)
(cond
((= var 0)
+ (message "Pushed %x to stack" val)
(ez-routine-stack-push val))
((< var 16)
(ez-routine-stack-push val))
((< var 16)
+ (message "Saved %x to local variable %x" val var)
(ez-set-local-var var val))
(t
(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 ()
(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"
(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"
(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 ()
(funcall (elt table-row 2) operands operand-types))))
(defun ez-read-var-operands-and-inc ()