anchor.diff:    (mask      0 :type u8)
     (status    0 :type u8)
     (oam-addr  0 :type u8)
  +  (cycles    0 :type u8)
     (scroll    '(:x 0 :y 0 :next :x))
     (addr      '(:val 0 :next :hi))
  -  (meta      '(:scanline 0 :buffer 0 :x 0 :y 0 :cy 0)))
  +  (meta      '(:scanline 0 :buffer 0 :x 0 :y 0)))
   
   (defmethod initialize-instance :after ((ppu ppu) &key)
     ; TODO: handle variable size nametables in vram, stuff in oam, based on mapper.
  
positive.code: 
  ;;;; Sprites: How do they work?
  
  (defstruct sprite
    (x           0 :type u8)
    (y           0 :type u8)
  
negative.code: 
  ;;;; Misc Helpers
  
  (declaim (inline make-color get-color put-pixel))
  (defstruct color
    (r 0 :type u8)
    (g 0 :type u8)
    (b 0 :type u8))
  
  (defun get-color (index)
    (let ((base (* index 3)))
      (make-color :r (aref +color-palette+ (+ 2 base))
                  :g (aref +color-palette+ (+ 1 base))
                  :b (aref +color-palette+ (+ 0 base)))))
  
  (defun put-pixel (x y color)
    (let ((base (+ x (* y (getf *resolution* :width)))))
      (setf (aref *frame* (+ 0 (* 3 base))) (color-r color)
            (aref *frame* (+ 1 (* 3 base))) (color-g color)
            (aref *frame* (+ 2 (* 3 base))) (color-b color))))
  
  (defun get-pixel-color (ppu kind tile x y)
    (let ((offset (+ y (ash tile 4))))
      (case kind
        (:bg (incf offset (pattern-table-addr ppu)))
        (:sprite (incf offset (sprite-table-addr ppu))))
      (let* ((plane-0 (read-vram ppu offset))
             (plane-1 (read-vram ppu (+ offset 8)))
             (bit-0 (logand (ash plane-0 (- (mod x 8) 7)) 1))
             (bit-1 (logand (ash plane-1 (- (mod x 8) 7)) 1)))
        (logior (ash 1 bit-1) bit-0))))
  
  (defun nametable-addr (x y)
    ; TODO
    )
  
  (defun pixel-opaque-p (ppu x)
    (let* ((x (+ (getf (ppu-meta ppu) :x) x))
           (y (+ (getf (ppu-meta ppu) :y) (getf (ppu-meta ppu) :scanline)))
           )
      ; TODO
      ))
  
  (defun get-sprite-pixel (ppu sprites x opaque-p)
    ; TODO
    )
  
  (defun get-visible-sprites (ppu)
    (let ((count 0)
          (result (make-array 8 :initial-element nil)))
      (flet ((visible-p (sprite i)
               (when (on-scanline sprite ppu (getf (ppu-meta ppu) :scanline))
                 (if (< count 8)
                     (setf (aref result count) i
                           count (1+ count))
                     (progn
                       (set-sprite-overflow ppu 1)
                       (return-from get-visible-sprites result))))))
        (do-sprites ppu #'visible-p))))
  
  ;;;; Core
  
  