Skip to content

Instantly share code, notes, and snippets.

@flambard
Last active August 29, 2015 13:57
Show Gist options
  • Save flambard/9763015 to your computer and use it in GitHub Desktop.
Save flambard/9763015 to your computer and use it in GitHub Desktop.
Macro for recompiled chip-8 code.
(defmacro chip-8-program (subroutines &body code)
`(let ((v0 0) (v1 0) (v2 0) (v3 0) (v4 0) (v5 0) (v6 0) (v7 0)
(v8 0) (v9 0) (vA 0) (vB 0) (vC 0) (vD 0) (vE 0) (vF 0)
(I 0) (DT 0)
(memory (make-ram)))
(declare (type (unsigned-byte 16) I))
(declare (type (unsigned-byte 8) DT
v0 v1 v2 v3 v4 v5 v6 v7
v8 v9 vA vB vC vD vE vF))
(labels ,subroutines
(tagbody ,@code))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment