summaryrefslogtreecommitdiff
path: root/6502.lisp
diff options
context:
space:
mode:
authoraleksei <aleksei@aj.org>2024-04-14 12:34:40 +1000
committeraleksei <aleksei@aj.org>2024-04-14 12:34:40 +1000
commit5fd0592e0bf449ec25392d2cb1b4c3b45b9cd718 (patch)
tree1d35eb657a2f67f9eae2dda1b236b83166d647f6 /6502.lisp
parent45045f2484f2eb88da587f98ec5c7fdeff672c94 (diff)
Some housekeeping
Diffstat (limited to '6502.lisp')
-rw-r--r--6502.lisp42
1 files changed, 18 insertions, 24 deletions
diff --git a/6502.lisp b/6502.lisp
index 32d67ba..1115a21 100644
--- a/6502.lisp
+++ b/6502.lisp
@@ -18,26 +18,26 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|#
-;;; List of addressing modes.
-(setf
+;;; List of addressing modes and their length.
+(defparameter
*addressing-modes*
- '(immediate
- absolute
- zero-page
- implied
- indirect-absolute
- absolute-indexed-x
- absolute-indexed-y
- zero-page-indexed-x
- zero-page-indexed-y
- indexed-indirect
- indirect-indexed
- relative
- accumulator))
+ '((immediate 2)
+ (absolute 3)
+ (zero-page 2)
+ (implied 1)
+ (indirect-absolute 3)
+ (absolute-indexed-x 3)
+ (absolute-indexed-y 3)
+ (zero-page-indexed-x 2)
+ (zero-page-indexed-y 2)
+ (indexed-indirect 2)
+ (indirect-indexed 2)
+ (relative 2)
+ (accumulator 1)))
;;; Instructions, with decimal opcode and
;;; addressing modes.
-(setf
+(defparameter
*instructions*
;; Load & Store
'((LDA 169 (immediate
@@ -214,9 +214,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(caddr (assoc instruction *instructions*))) t)
(t nil)))
-;; A list with with the respective rules of some
+;; A list with with the respective rules of
;; addressing mode syntax.
-(setf
+(defparameter
*addressing-modes-syntax*
'((immediate ; #?? ... more complex syntax rules for later
(lambda (s)
@@ -296,9 +296,3 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(and
(equal (length s) 1)
(equal "A" (subseq s 0 1)))))))
-
-;; Evaluate the second syntax rule on a string
-;; temporary
-(funcall
- (eval (cadr (assoc 'absolute *addressing-modes-syntax*)))
- "$A6AF")