diff --git a/wip-duuqnd/user-side-compiler/instruction.lisp b/wip-duuqnd/user-side-compiler/instruction.lisp index 1ad2488..1f51449 100644 --- a/wip-duuqnd/user-side-compiler/instruction.lisp +++ b/wip-duuqnd/user-side-compiler/instruction.lisp @@ -9,11 +9,28 @@ (%source :accessor source :initarg :source :initform nil))) (defmethod print-object ((object instruction) stream) - (format stream "#<~A~A>" (mnemonic object) - (if (or (typep object 'implied-mixin) - (typep object 'accumulator-mixin)) - "" - (format nil " ~S" (operand object))))) + (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))))))) (defclass complete-mixin () ((%opcode :allocation :class :reader opcode :initarg :opcode)))