Minimal NES example using ca65
Moderator: Moderators
- rainwarrior
- Posts: 8758
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Minimal NES example using ca65
I thought this might be helpful for people trying to learn NES programming. This is a very minimal program written for the ca65 assembler.
The hope was to provide a starting example for learning to use the NES, something that accepts and responds to input, and demonstrates a straightforward PPU technique. It does not attempt do demonstrate the sound APU at all. Additionally, it is an example of how to set up and build a simple ca65 program.
This is now maintained at GitHub: https://github.com/bbbradsmith/NES-ca65-example
The original version is still attached to this post below.
There is also an FDS version available at the GitHub repository above, but it was originally available on the forum: post in thread requesting FDS example
The hope was to provide a starting example for learning to use the NES, something that accepts and responds to input, and demonstrates a straightforward PPU technique. It does not attempt do demonstrate the sound APU at all. Additionally, it is an example of how to set up and build a simple ca65 program.
This is now maintained at GitHub: https://github.com/bbbradsmith/NES-ca65-example
The original version is still attached to this post below.
There is also an FDS version available at the GitHub repository above, but it was originally available on the forum: post in thread requesting FDS example
- Attachments
-
- example1.zip
- Minimal NES example using ca65
- (9.43 KiB) Downloaded 1353 times
Last edited by rainwarrior on Thu Feb 07, 2019 7:15 pm, edited 17 times in total.
Re: Minimal NES example using ca65
I'm not the one to toot my own horn, but with a tiny change in the linker switches you could add source level debugging support for NintendulatorDX and NESICIDE:
I also moved the "-o" switch before "-C" in there, because the latest version of ld65 explicitly requires the switches in that order (unfortunately).
Code: Select all
cc65\bin\ld65 -o example.nes -C example.cfg example.o -m example.map.txt -Ln example.labels.txt --dbgfile example.nes.dbg
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
- cpow
- NESICIDE developer
- Posts: 1097
- Joined: Mon Oct 13, 2008 7:55 pm
- Location: Minneapolis, MN
- Contact:
Re: Minimal NES example using ca65
Thanks for tooting mine.thefox wrote:I'm not the one to toot my own horn...NESICIDE:
When did ld65's parameter ordering requirements change?
- rainwarrior
- Posts: 8758
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Minimal NES example using ca65
Okay, I made the suggested change.
As far as parameter order for ld65, I think the strict requirement has been removed, as I had tested this against the latest cc65 snapshot with no problems.
As far as parameter order for ld65, I think the strict requirement has been removed, as I had tested this against the latest cc65 snapshot with no problems.
Re: Minimal NES example using ca65
Did you get the warning? Or when was this change made? I have a fairly recent version from some weeks back (ld65 V2.14 - Git eaf4c8c), and it gave the warning and output the ROM in a.out, ignored the -o that came after -C.rainwarrior wrote:As far as parameter order for ld65, I think the strict requirement has been removed, as I had tested this against the latest cc65 snapshot with no problems.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
- rainwarrior
- Posts: 8758
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Minimal NES example using ca65
No warning. The files in the snapshot are stamped 4/04/2014. (It shouldn't be a warning or an error anyway, there was no good reason to have added such an arbitrary rule to the command line in the first place.)
Re: Minimal NES example using ca65
Yeah I completely agree about the arbitrariness (that's why the "unfortunately" in my original post). It seems like this got fixed about a week ago. Works with the latest snapshot.rainwarrior wrote:No warning. The files in the snapshot are stamped 4/04/2014. (It shouldn't be a warning or an error anyway, there was no good reason to have added such an arbitrary rule to the command line in the first place.)
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
- Jarhmander
- Formerly ~J-@D!~
- Posts: 570
- Joined: Sun Mar 12, 2006 12:36 am
- Location: Rive nord de Montréal
Re: Minimal NES example using ca65
Great example. I do believe however that the best would be to supply a NESICIDE project (either along or instead of compile_example) with your example because for a starter, using this IDE is much easier than using a shell "script", in the sense that NESICIDE will do a much better compile-time error reporting and simpler/faster testing of the resulting program, with the free added benefit that the example will be portable and much more scalable (NESICIDE can add files to a project with a few clicks, no script to modify). The downside is that it's possible that the package needs updating as NESICIDE evolves, but I don't think there will be much problems because a .nesproject is a xml file, so except if NESICIDE maintainer(s) change(s) the name of basic properties I don't see why it wouldn't work in the future.
Very minor fix btw: typo on line 9 (example.txt), "A Python 3 program to build debugging symbols forFCUEX is included."
Very minor fix btw: typo on line 9 (example.txt), "A Python 3 program to build debugging symbols for
((λ (x) (x x)) (λ (x) (x x)))
- rainwarrior
- Posts: 8758
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Minimal NES example using ca65
If you want to create an NESICIDE version of this please go right ahead. I don't use it, so I'm not interested or qualified to do so.
If it's minimal enough I'll add it to the attached zip.
If it's minimal enough I'll add it to the attached zip.
- cpow
- NESICIDE developer
- Posts: 1097
- Joined: Mon Oct 13, 2008 7:55 pm
- Location: Minneapolis, MN
- Contact:
Re: Minimal NES example using ca65
Compiles, runs. Had to RAR it though since .nesproject file extension is not allowed...rainwarrior wrote:If it's minimal enough I'll add it to the attached zip.
- Attachments
-
- example.rar
- (1.29 KiB) Downloaded 1167 times
Re: Minimal NES example using ca65
Why use WinRAR ($$$) instead of 7-Zip?
- cpow
- NESICIDE developer
- Posts: 1097
- Joined: Mon Oct 13, 2008 7:55 pm
- Location: Minneapolis, MN
- Contact:
Re: Minimal NES example using ca65
I dunno. Just what I have. Yeah it keeps asking me to buy it. But I don't. Actually I also have 7-zip but it's not in my context menu so I never use it.tepples wrote:Why use WinRAR ($$$) instead of 7-Zip?
- rainwarrior
- Posts: 8758
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Minimal NES example using ca65
WinRAR is still my preferred windows archiver after all these years. I still like its interface better than 7-Zip.
If 7-Zip is your preference, it will unpack RARs just fine, but I'm sure you know that already.
If 7-Zip is your preference, it will unpack RARs just fine, but I'm sure you know that already.
- cpow
- NESICIDE developer
- Posts: 1097
- Joined: Mon Oct 13, 2008 7:55 pm
- Location: Minneapolis, MN
- Contact:
Re: Minimal NES example using ca65
I lack the energy for a preference here. If you can use the file I attached, great. If not...maybe we could adjust the forum rules to allow .nesproject extensions? Not that I want to blast the forum with a bunch of NESICIDE project files...and maybe it would be best for me to set up my own forum [which tepples has offered to help with several times]. But I'm just too busy for such things.rainwarrior wrote:If 7-Zip is your preference, it will unpack RARs just fine, but I'm sure you know that already.
- rainwarrior
- Posts: 8758
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Minimal NES example using ca65
So, we can attach .nesproject files now, but then I realized I should probably just add it to the zip.