Programming in C for NESThis is a featured page

How to compile and test a NES C program
===================================================================


First of all, you need to install some basic software, they are:
Jnes - NES emulator (download at http://jabosoft.com/?categoryid=3 )
C text editor - you can choose anyone
cc65 - C compiler for 6502 microcontroller that has extended NES support (download at www.cc65.org, but be carefull to download the NES version)

1) write your C code on the editor. The famous Hello World application code should be something like this:
#include <conio.h>
int main (void)
{
clrscr();
cprintf("hello world");
while(1)
{
}
}
Save this as test.c, for example.


2) Use de cc65 to compile your code by the following command line:
cc65 -t nes test.c (the -t parameter is mandatory to make the target system set to NES)


After that, an assembly file test.s would be generated on the same path. Run the following command:
ca65 -t nes test.s (this will generate the object file that will be needed for the linker)


Run the linker command:
ld65 -t nes test.o nes.o nes.lib atmos.lib -o test.nes


The linker will generate the .nes file that can be loaded on the Jnes emulator.


No user avatar
feriodice
Latest page update: made by feriodice , Sep 21 2008, 4:40 PM EDT (about this update About This Update feriodice Edited by feriodice


view changes

- complete history)
Keyword tags: NES programming
More Info: links to this page
Started By Thread Subject Replies Last Post
petruza atmos.lib not needed for NES development! 0 Feb 17 2009, 9:15 AM EST by petruza
Thread started: Feb 17 2009, 9:15 AM EST  Watch
This page is maybe the only one that gives a hint on how to compile with cc65 for NES. Thanks for that!
But in the example, the atmos library is not needed, indeed, it shouldn't be linked for NES development.
It does compile, but, the Atmos was a totally diferent computer:
http://en.wikipedia.org/wiki/Oric_Atmos
just that! good luck!
1  out of 1 found this valuable. Do you?    
Keyword tags: atmos atmos.lib cc65 needed nes not
BryantChou Awesome! 0 Sep 23 2008, 8:27 PM EDT by BryantChou
Thread started: Sep 23 2008, 8:27 PM EDT  Watch
Great! never knew there was a C compilers for NES. This can be very handy and definitely beats out NBasic...
will be playing around with it and see how much the cc65 lib provides. thanks for the info!
Do you find this valuable?    
Keyword tags: None
Showing 2 of 2 threads for this page

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)