An interesting related and older project is this post showing a bit of using Lisp to write code for the NES: https://ahefner.livejournal.com/20528.html Making an assembler in Lisp is not a daunting project.
Another issue with several .asd files, no readme and not sure how to start. I am interested as this is simpler than the one here. At least the programmer has a test ROM sort of. Just not sure how to start.
As might be noticed, I have spent a few days here to try to sort out a way to start a simple (and possibly) interesting simple lisp project. NES as said in that web page is great. Just no good starting point (or may I say too complete as a starting point) for lisp project.
I think if you've never written any sort of lower level code before it's somewhat more daunting. I did spend a little time trying to get this emulator to run but ran into too many issues and gave up -- it's either a problem with some optimizations no longer being valid and raising type errors by default now (e.g. specifying a type as string does not, like other languages, implicitly mean it's either string or null¹) or something about the sdl2 bindings has changed (it's not the most stable of library binds unfortunately and has some misleading docs/examples out there, and the with- macros are not good and best avoided).
The assembler project I linked on the other hand works, though as you say having multiple asdf files is annoying, and the dollhouse.lisp demo makes an unfortunate choice of setting its *path* to #.*compile-file-pathname* Here's what I did to run it without changing that line (which would be better), translate to your flavor of editor+slime for convenience:
$ git clone https://github.com/ahefner/asm6502
$ cd asm6502/
$ sbcl
* (asdf-here)
; my own function I have in ~/.sbclrc, it is just:
;(defun asdf-here ()
; (push (uiop:getcwd) asdf:*central-registry*))
* (asdf:load-system "ichr")
T
* (defpackage :dollhouse-demo)
#<PACKAGE "DOLLHOUSE-DEMO">
* (defvar dollhouse-demo::*path* "hacks/")
DOLLHOUSE-DEMO::*PATH*
* (load "hacks/dollhouse.lisp")
; ...output
;
;(:NUM-UNIQUE 458)
;Empty space begins at F600
;Created "/tmp/dollhouse.nes"
T
* ^D
$ fceux /tmp/dollhouse.nes
¹Example of SBCL raising a type error:
(let ((x 3))
(declare (type integer x))
x)
; -> 3
(let ((x nil))
(declare (type integer x))
x)
; in: LET ((X NIL))
; (LET ((X NIL))
; (DECLARE (TYPE INTEGER X))
; X)
;
; caught WARNING:
; Constant NIL conflicts with its asserted type INTEGER.
; See also:
; The SBCL Manual, Node "Handling of Types"
;
; compilation unit finished
; caught 1 WARNING condition
debugger invoked on a SIMPLE-TYPE-ERROR in thread
#<THREAD tid=9761 "main thread" RUNNING {1001750003}>:
Value of NIL in
(LET ((X NIL))
(DECLARE (TYPE INTEGER X))
X)
is
NIL,
not a
INTEGER.
Very cool code. I bookmarked the author’s repo list to peruse later.
I don’t get to use Common Lisp as often now because almost everything dealing with LLMs, deep learning, etc. is now Python (soon to be Mojo, for me?). Still it simply makes me happy to see projects like this.
I tried more in-depth. MacOS hang there and not even sdl examples can run. I switch to windows wsl2 sample run and a windows also pop up. But as you exprience a lot of message which seems strange. Anyway at least I guess it is NOT the main-thread issue (e.g. one said bad op code.)
I've not tried to run this repo in "a long time" :tm: even back then, it had some fun and exciting sharp edges that I never got around to fixing. Apologies.
Yes the PPU is more complex than the CPU, but the audio emulation was more difficult than the PPU for me. Noticed the audio is a TODO for this emulator.
I don't mind stale repos when it comes to emulation, because nothing changes (except the host/build ecosystems) so there is less to keep updated. In the case of the NES, the last game released was in 1995.
NES is a little unusual in this respect because the vast majority of cartridges have "mapper" hardware that must be emulated, and there has been a more-or-less continuous trickle of unlicensed cartridges over the years, some of which have unique mappers. If memory serves you can get to something like 95% compatibility with the few dozen most common mappers, but then there's a pile of oddball mappers that are each used by 1 or 2 games (many of which are just pirate hacks of a licensed game).
Yeah a stale repo isn't bad as long as there aren't outstanding issues to be worked. It is still a bad sign in evolving tooling environments like java c++ or rust, but lisp is pretty stable at this point too...
I'm not really replying to this post per se, but the NES emulator is pretty cool. Just wondering if anyone who has posted here can help me. I posted my very first hacker news submission, but it only shows up on the "new" tab when I'm logged in (with an orange asterisk next to it). When I log out it's nowhere to be found. When I log back in, I see it. The FAQ says that "All Ask HNs appear on newest and asknew". Just a shot in the dark, but if anyone has any ideas what might be going on, it's appreciated. And sorry for spamming this submission.