rsx: dispatch.lisp

RSX-METHOD: one method write, generated from the method table.

Other definitions

(defmacro rsx-small-array) source
(defmacro rsx-small-array () 32)
(defmacro define-rsx-dispatch) source
(defmacro define-rsx-dispatch ()
  (let ((clauses nil) (ranges nil))
    (dolist (m *rsx-methods*)
      (when (rmi-fn m)
        (if (<= (rmi-count m) (rsx-small-array))
            (dotimes (i (rmi-count m))
              (push `(,(+ (rmi-base m) (* i (rmi-stride m))) (,(rmi-fn m) rsx value ,i)) clauses))
            (let ((end (+ (rmi-base m) (* (rmi-count m) (rmi-stride m)))))
              (push `((and (>= method ,(rmi-base m)) (< method ,end))
                      (,(rmi-fn m) rsx value (ash (- method ,(rmi-base m)) ,(- 1 (integer-length (rmi-stride m))))))
                    ranges)))))
    `(defun rsx-method (rsx method value)
       "write VALUE to METHOD (a byte address, a multiple of 4 below #x10000)"
       (declare (type rsx rsx) (type u16 method) (type u32 value))
       (setf (aref (rsx-regs rsx) (ash method -2)) value)
       (case method
         ,@(nreverse clauses)
         (otherwise
          (cond ,@(nreverse ranges))))
       nil)))

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