May need to brew install libsdl2-dev
brew install sbcl # or apt-get if you nasty playa
curl -O https://beta.quicklisp.org/quicklisp.lisp > quicklisp.lisp
sbcl --load quicklisp.lisp # and follow the prompts
git clone [email protected]:kingcons/clones.git ~/quicklisp/local-projects/clones.git
Start rlwrap sbcl
and ...
(ql:quickload :clones)
(in-package :clones)
(change-game "roms/commercial/dk.nes") ;; this path is relative to the clones installation folder/git checkout
(step-frames 4)
Make sure to do this on the mezzanine branch...
(ql:quickload :cl-json)
(defvar *nt* (clones.ppu::ppu-nametable (memory-ppu (cpu-memory *nes*))))
(cl-json:encode-json *nt*)
Make sure to brew install libpng
first and use my fork of cl-png...
git clone [email protected]:kingcons/cl-png.git ~/quicklisp/local-projects/cl-png
Then ...
(ql:quickload '(:zpng :clones))
(in-package :clones)
(change-game "roms/commercial/smb.nes")
(step-frames 30)
(defvar *image* (make-instance 'zpng:pixel-streamed-png :color-type :truecolor :width 256 :height 240))
(with-open-file (out "test.png" :element-type '(unsigned-byte 8) :direction :output
:if-does-not-exist :create :if-exists :supersede)
(zpng:start-png *image* out)
(dotimes (i (* 256 240))
(let ((pixel (list (aref clones.ppu:*framebuffer* (+ (* i 3) 0))
(aref clones.ppu:*framebuffer* (+ (* i 3) 1))
(aref clones.ppu:*framebuffer* (+ (* i 3) 2)))))
(zpng:write-pixel pixel *image*)))
(zpng:finish-png *image*))
Fixed a few bugs this morning. Mostly seems like stuff we would've caught sooner if we had good tests. We were picking the wrong high bits for background tiles, the switch statement was just mismatching cases. Then, we weren't switching on the right values for determining quadrant. We were testing whether
coarse_x
andcoarse_y
themselves were odd when we should've checked whethercoarse_x / 2
andcoarse_y / 2
were even or odd, since each "area" in a quad is a 2x2 tile square.i.e.