Permalink
Fetching contributors…
Cannot retrieve contributors at this time
14 lines (11 sloc) 414 Bytes
(in-package :6502)
(defun execute (cpu)
"Step the CPU until a BRK instruction."
(loop for opcode of-type u8 = (get-byte (cpu-pc cpu))
do (handler-case (step-cpu cpu opcode)
(undefined-function ()
(error 'illegal-opcode :opcode opcode)))
until (zerop opcode)))
(defun step-cpu (cpu opcode)
"Step the CPU through the next OPCODE."
(funcall (aref *opcode-funs* opcode) cpu))