ppc: exec.lisp

the PPU executor, decoder and step function.

Other definitions

(defun ppu-illegal) source
(defun ppu-illegal (cpu insn)
  (declare (type ppu cpu) (type (unsigned-byte 32) insn) (ignore insn))
  (raise +exc-illegal+))
(define-executor ppu-execute) source
(define-executor ppu-execute ppu :illegal ppu-illegal)
(define-decoder ppu-decode) source
(define-decoder ppu-decode ppu)
(defun ppu-step) source
(defun ppu-step (cpu)
  (declare (type ppu cpu))
  (let ((insn (mem-read 32 (ppu-pc cpu))))
    (setf (ppu-npc cpu) (wrap 64 (+ (ppu-pc cpu) 4)))
    (ppu-execute cpu insn)
    (when (= (ppu-exc cpu) 0)
      (setf (ppu-pc cpu) (ppu-npc cpu)))))
(defun ppu-run) source
(defun ppu-run (cpu stop max)
  (declare (type ppu cpu) (type (unsigned-byte 64) stop) (type (unsigned-byte 32) max))
  (let ((n 0))
    (loop
      (when (or (= (ppu-pc cpu) stop) (/= (ppu-exc cpu) 0) (>= n max)) (return n))
      (ppu-step cpu)
      (setq n (+ n 1)))))

Made from xspe at b2fac33349db by tools/gen-xspe.py. xspe is GPL-3.0-or-later.