HN Gopher Feed (2017-08-06) - page 1 of 10 ___________________________________________________________________
CHIP-8 in Common Lisp
68 points by tosh
http://stevelosh.com/blog/2016/12/chip8-graphics/?m=1
___________________________________________________________________
veddox - 1 hours ago
Very interesting read! But could somebody explain why the following
piece of code is needed? And why is it defined inline? (defun-
inline (setf vref) (new-value chip x y) (setf (aref (chip-
video chip) (+ (* +screen-width+ y) x)) new-value))
kbp - 2 minutes ago
Why is DEFUN-INLINE used over: (declaim (inline (setf vref)))
(defun (setf vref) (new-value chip x y) (setf (aref (chip-
video chip) (+ (* +screen-width+ y) x)) new-value))
Nokinside - 1 hours ago
vref and (setf vref) define getter and setter functions for
manipulating pixel arrays. Since these functions are used a lot,
it makes sense to allow compiler to inline them for maximum
speed.Normally function must be accessed trough the symbol and it
can be redefined on the fly.
sigjuice - 1 hours ago
It would be interesting to do a measurement of inline vs non-
inline to see how much of a speed difference it makes.
lispm - 16 minutes ago
Functions don't need to be accessed through them symbol. A file
compiler can assume that a function does not change inside a
file, etc. Inlining and being called via a symbol are slightly
different things...I would also think that lexical functions
are not called via symbols...
0xcde4c3db - 2 hours ago
> Also note that the program counter starts at address #x200,
because that?s where the ROM data eventually gets loaded into the
CHIP-8 memory.If I understand correctly, that's because 0-1FF was
ROM (including the interpreter itself) on the original machine, and
you typed CHIP-8 programs into RAM.
Retr0spectrum - 1 minutes ago
Yes, traditionally the interpreter was located there. However,
there is no "original machine". CHIP-8 was originally designed as
a virtual machine for portability, similar to
Java.https://en.wikipedia.org/wiki/CHIP-8