2b9d7edf9182

Add build instructions and clean up a bit
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 22 Dec 2016 22:18:41 -0500
parents 4a305535df61
children 7400e3b3fbba
branches/tags (none)
files .hgignore README.markdown src/emulator.lisp src/gui/screen.lisp

Changes

--- a/.hgignore	Wed Dec 21 15:29:11 2016 -0500
+++ b/.hgignore	Thu Dec 22 22:18:41 2016 -0500
@@ -3,4 +3,4 @@
 scratch.lisp
 roms
 lisp.prof
-plot.png
+*.png
--- a/README.markdown	Wed Dec 21 15:29:11 2016 -0500
+++ b/README.markdown	Thu Dec 22 22:18:41 2016 -0500
@@ -2,6 +2,29 @@
 
 * **License:** MIT/X11
 
+Building
+--------
+
+To build this project you'll need to do a few things.
+
+First, install [SBCL][].  You can use your package manager (homebrew, apt,
+whatever), or use [Roswell][], or just get some binaries.  This project uses
+a few SBCL-specific things, so it won't work with other implementations.
+
+Next, install [Quicklisp][].
+
+Finally you'll need to clone down this repo and [my utility library][losh] and
+symlink them into Quicklisp's [local-projects][] directory.
+
+Once you've done all that you should be able to run `sbcl` and use
+`(ql:quickload :cl-chip8)` to load the project and all of its dependencies.
+Then use `(chip8::run "path/to/a/chip8.rom")` to start it up.
+
+[SBCL]: http://www.sbcl.org/
+[Roswell]: https://github.com/roswell/roswell
+[Quicklisp]: https://www.quicklisp.org/beta/
+[losh]: https://github.com/sjl/cl-losh
+[local-projects]: https://www.quicklisp.org/beta/faq.html#local-project
 
 References
 ----------
--- a/src/emulator.lisp	Wed Dec 21 15:29:11 2016 -0500
+++ b/src/emulator.lisp	Thu Dec 22 22:18:41 2016 -0500
@@ -329,9 +329,9 @@
 ;;;; Sound --------------------------------------------------------------------
 (defconstant +pi+ (coerce pi 'single-float))
 (defconstant +tau+ (* 2 +pi+))
-(defconstant +1/4tau+ (* 1/4 tau))
-(defconstant +1/2tau+ (* 1/2 tau))
-(defconstant +3/4tau+ (* 3/4 tau))
+(defconstant +1/4tau+ (* 1/4 +tau+))
+(defconstant +1/2tau+ (* 1/2 +tau+))
+(defconstant +3/4tau+ (* 3/4 +tau+))
 
 (defconstant +sample-rate+ 44100d0)
 
@@ -359,15 +359,14 @@
 
 (defun tri (angle)
   (let ((a (mod angle +tau+)))
-    (cond ((< a +1/4tau+) (map-range 0   +1/4tau+
-                                     0.0 1.0
-                                     a))
-          ((< a 3/4tau) (map-range +1/4tau+ +3/4tau+
-                                   1.0      -1.0
-                                   a))
-          (t (map-range +3/4tau+ +tau+
-                        -1.0     0.0
-                        a)))))
+    (if (< a +1/2tau+)
+      (map-range 0    +1/2tau+
+                 -1.0 1.0
+                 a)
+      (map-range +1/2tau+ +tau+
+                 1.0      -1.0
+                 a))))
+
 
 
 (defun make-audio-buffer ()
--- a/src/gui/screen.lisp	Wed Dec 21 15:29:11 2016 -0500
+++ b/src/gui/screen.lisp	Thu Dec 22 22:18:41 2016 -0500
@@ -10,10 +10,6 @@
 (defparameter *fps* 60)
 
 
-;;;; Data ---------------------------------------------------------------------
-(defstruct gui chip screen)
-
-
 ;;;; OpenGL -------------------------------------------------------------------
 (defun initialize-texture (size)
   (let ((handle (gl:gen-texture)))