Ubuntu 16.04
mkdir ~/other
cd ~/other
git clone https://github.com/cc65/cc65
cd cc65
make
PATH=$PATH:`pwd`/bin
If need to update:
make clean
git pull
make
sudo apt-get install fceux
or
sudo apt install subversion # I didn't have this installed, since git is so prevalent...
sudo apt install scons
svn checkout https://svn.code.sf.net/p/fceultra/code/fceu/trunk fceultra-code
cd fceultra-code
scons
...
xport PATH=$PATH:`pwd`/bin
Then get nes samples:
Don't bother with these
cd ~/other
mkdir nes
cd nes
wget https://shiru.untergrund.net/files/src/cc65_nes_examples.zip
unzip cc64_nes_examples.zip
cc65 crt0.s
crt0.s(1): Warning: Implicit `int' is an obsolete feature
crt0.s(1): Error: `;' expected
...
crt0.s(1): Fatal: Too many errors
Oops, try ca65 instead, that works
ca65 crt0.s # create crt0.o
cc65 -Oi example1.c --add-source # create example1.s
ca65 example1.s # creates example1.o
ld65 -C nrom_128_horz.cfg -o example1.nes crt0.o example1.o runtime.lib
ld65: Error: nrom_128_horz.cfg(53): Attribute expected, got '__STACKSIZE__'
replace line 53 with (looking at cc65/cfg/nes.cfg):
__STACKSIZE__: type = weak, value = $0500; # 5 pages stack
But then get
ld65: Error: nrom_128_horz.cfg(55): Attribute expected, got 'NES_MAPPER'
Try these instead? https://github.com/jmk/cc65-nes-examples.git
~/other/cc65-nes-examples$ make
ca65 crt0.s
cc65 -Oi example1.c --add-source
ca65 example1.s
rm example1.s
ld65 -C nes.cfg -o example1.nes crt0.o example1.o runtime.lib
ld65: Error: nes.cfg(82): Attribute expected, got '__STACKSIZE__'
Makefile:22: recipe for target 'example1.nes' failed
make: *** [example1.nes] Error 1
rm example1.o
These are 4 years old without an update.
https://github.com/RichardJohnn/cc65-nes-examples has a more recent fork
How about https://github.com/algofoogle/nes-gamedev-examples ?
nes-gamedev-examples/part01/ex01-c-example$ cl65 -t nes hello-nes.c -o hello.nes
That actually built a hello.nes
fceux hello.nes
Works!
NES Cartridge
What is the width of the pcb?
The width of the traces?
The spacing between the traces?
Is there a low cost off the shelf cartridge break-out?
https://wiki.nesdev.com/w/index.php/Cartridge_connector
http://www.raphnet.net/electronique/nes_cart/rom.txt
FPGA cartridge
Connect every pin to a low cost fpga dev board with a lot of gpio: https://www.amazon.com/RioRand-EP2C5T144-Altera-Cyclone-Development/dp/B00LEMKR92
Also need a usb blaster to program it.
Need a 69 bits of level shifting to go from 3.3V (or 1.8V?) to the 5.0V nes voltage.
Need to have an interface (Serial over usb?) to a computer.
It has 119,808 ram bits that could be configured over a dual port and a serial connection to a host computer (or through JTAG?).
This would amount to a 15 kB cartridge at a given moment, but the ability to change the memory would overcome that. (it couldn't be used as a generic device to play any nes game, just custom applications that can stream themselves to the dual port ram).