Add relative addressing type for branches
This commit is contained in:
parent
37241a1fc3
commit
76f1fa0658
1 changed files with 10 additions and 1 deletions
|
@ -44,12 +44,21 @@
|
||||||
(:zero-page zero-page-mixin)
|
(:zero-page zero-page-mixin)
|
||||||
(:zero-page-x zero-page-x-mixin)
|
(:zero-page-x zero-page-x-mixin)
|
||||||
(:zero-page-y zero-page-y-mixin)
|
(:zero-page-y zero-page-y-mixin)
|
||||||
|
(:relative relative-mixin)
|
||||||
(:absolute absolute-mixin)
|
(:absolute absolute-mixin)
|
||||||
(:absolute-x absolute-x-mixin)
|
(:absolute-x absolute-x-mixin)
|
||||||
(:absolute-y absolute-y-mixin)
|
(:absolute-y absolute-y-mixin)
|
||||||
(:indirect-x indirect-x-mixin)
|
(:indirect-x indirect-x-mixin)
|
||||||
(:indirect-y indirect-y-mixin))))))
|
(:indirect-y indirect-y-mixin))))))
|
||||||
|
|
||||||
|
(defgeneric instruction-length (object)
|
||||||
|
(:method (immediate-mixin) 1)
|
||||||
|
(:method (implied-mixin) 1)
|
||||||
|
(:method (accumulator-mixin) 1)
|
||||||
|
(:method (zero-page-mixin) 2)
|
||||||
|
(:method (relative-mixin) 2)
|
||||||
|
(:method (absolute-mixin) 3))
|
||||||
|
|
||||||
(defclass branching-mixin ()
|
(defclass branching-mixin ()
|
||||||
((%branch-next :accessor branch-next :initarg :branch-next)))
|
((%branch-next :accessor branch-next :initarg :branch-next)))
|
||||||
|
|
||||||
|
@ -77,7 +86,7 @@
|
||||||
(define-instruction "PLA" nil (:implied 0))
|
(define-instruction "PLA" nil (:implied 0))
|
||||||
(define-instruction "TAX" nil (:implied 0))
|
(define-instruction "TAX" nil (:implied 0))
|
||||||
(define-instruction "DEX" nil (:implied 0))
|
(define-instruction "DEX" nil (:implied 0))
|
||||||
(define-instruction "BNE" t (:zero-page 0))
|
(define-instruction "BNE" t (:relative 0))
|
||||||
(define-instruction "LDA" nil
|
(define-instruction "LDA" nil
|
||||||
(:absolute 0)
|
(:absolute 0)
|
||||||
(:zero-page 0)
|
(:zero-page 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue