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.
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.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.
> TODO: Write more idiomatic Lisp
Perhaps it's readable because it's not idiomatic :D
Author here: please don't look at this as a way to organize a lisp project.
I tried it but had some issues... first of all, on Mac, I had to run `brew install sdl2` as that's a native dependency required...
Now, I seem to need a ROM:
> Where path to rom is a string
I tried to use this one: https://www.emulatorgames.net/download/?rom=super-mario-bros
But just got lots of nonsense error messages no matter what I did.
;(nes:setup-and-emulate "1943.nes") #| The value NIL is not of type 6502-CPU::INSTRUCTION when binding 6502-CPU::INST |#
;(nes:setup-and-emulate "DKJU.nes") #| invalid number of arguments: 6 |#
I test both Rom using fcuex64.exe and both worked. Hence, I guess it is not usable. Sadly as the source code is very readable, unlike well python one.
and maybe read this first to understand where to begin with emulating an old CPU such as the 6502
NES or Gameboy are my two main ideas, but I'm curious if there are other suggestions.
New accounts sometimes get caught up in various filters.