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)))
|
||||
|
||||
(defmethod print-object ((object instruction) stream)
|
||||
(cond ((some (lambda (type)
|
||||
(typep object type))
|
||||
'(immediate-mixin accumulator-mixin zero-page-mixin absolute-mixin))
|
||||
(format stream "#<~A ~A~A~A>"
|
||||
(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)))))
|
||||
(format nil " ~S" (operand object)))))))
|
||||
|
||||
(defclass complete-mixin ()
|
||||
((%opcode :allocation :class :reader opcode :initarg :opcode)))
|
||||
|
|
Loading…
Add table
Reference in a new issue