Nicer instruction printing
This commit is contained in:
parent
41bd413b4c
commit
8dd78265b4
1 changed files with 22 additions and 5 deletions
|
@ -9,11 +9,28 @@
|
||||||
(%source :accessor source :initarg :source :initform nil)))
|
(%source :accessor source :initarg :source :initform nil)))
|
||||||
|
|
||||||
(defmethod print-object ((object instruction) stream)
|
(defmethod print-object ((object instruction) stream)
|
||||||
(format stream "#<~A~A>" (mnemonic object)
|
(cond ((some (lambda (type)
|
||||||
(if (or (typep object 'implied-mixin)
|
(typep object type))
|
||||||
(typep object 'accumulator-mixin))
|
'(immediate-mixin accumulator-mixin zero-page-mixin absolute-mixin))
|
||||||
""
|
(format stream "#<~A ~A~A~A>"
|
||||||
(format nil " ~S" (operand object)))))
|
(mnemonic object)
|
||||||
|
(typecase object
|
||||||
|
(immediate-mixin "#")
|
||||||
|
((member indirect-y-mixin indirect-x-mixin) "(")
|
||||||
|
(t ""))
|
||||||
|
(typecase object
|
||||||
|
(accumulator-mixin "A")
|
||||||
|
(t (operand object)))
|
||||||
|
(typecase object
|
||||||
|
(indirect-x-mixin ", X)")
|
||||||
|
(indirect-y-mixin "),Y")
|
||||||
|
(t ""))))
|
||||||
|
(t
|
||||||
|
(format stream "#<~A~A>" (mnemonic object)
|
||||||
|
(if (or (typep object 'implied-mixin)
|
||||||
|
(typep object 'accumulator-mixin))
|
||||||
|
""
|
||||||
|
(format nil " ~S" (operand object)))))))
|
||||||
|
|
||||||
(defclass complete-mixin ()
|
(defclass complete-mixin ()
|
||||||
((%opcode :allocation :class :reader opcode :initarg :opcode)))
|
((%opcode :allocation :class :reader opcode :initarg :opcode)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue