nesdev.com
http://forums.nesdev.com/

Minimal NES example using ca65
http://forums.nesdev.com/viewtopic.php?f=10&t=11151
Page 1 of 3

Author:  rainwarrior [ Sun Apr 06, 2014 9:06 pm ]
Post subject:  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.


For an FDS build version, I made an alternative here: post in thread requesting FDS example

Attachments:
File comment: Minimal NES example using ca65
example1.zip [9.43 KiB]
Downloaded 89 times

Author:  thefox [ Mon Apr 07, 2014 3:56 am ]
Post subject:  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:
Code:
cc65\bin\ld65 -o example.nes -C example.cfg example.o -m example.map.txt -Ln example.labels.txt --dbgfile example.nes.dbg
I also moved the "-o" switch before "-C" in there, because the latest version of ld65 explicitly requires the switches in that order (unfortunately).

Author:  cpow [ Mon Apr 07, 2014 4:23 am ]
Post subject:  Re: Minimal NES example using ca65

thefox wrote:
I'm not the one to toot my own horn...NESICIDE:

Thanks for tooting mine. :lol:
When did ld65's parameter ordering requirements change?

Author:  rainwarrior [ Mon Apr 07, 2014 5:58 am ]
Post subject:  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.

Author:  thefox [ Mon Apr 07, 2014 6:17 am ]
Post subject:  Re: Minimal NES example using ca65

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.

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.

Author:  rainwarrior [ Mon Apr 07, 2014 6:26 am ]
Post subject:  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.)

Author:  thefox [ Mon Apr 07, 2014 6:41 am ]
Post subject:  Re: Minimal NES example using ca65

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.)

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.

Author:  Jarhmander [ Mon Apr 07, 2014 7:30 am ]
Post subject:  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 for FCUEX is included."

Author:  rainwarrior [ Mon Apr 07, 2014 7:38 am ]
Post subject:  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.

Author:  cpow [ Fri May 02, 2014 7:05 am ]
Post subject:  Re: Minimal NES example using ca65

rainwarrior wrote:
If it's minimal enough I'll add it to the attached zip.

Compiles, runs. Had to RAR it though since .nesproject file extension is not allowed...

Attachments:
example.rar [1.29 KiB]
Downloaded 282 times

Author:  tepples [ Fri May 02, 2014 7:05 am ]
Post subject:  Re: Minimal NES example using ca65

Why use WinRAR ($$$) instead of 7-Zip?

Author:  cpow [ Fri May 02, 2014 7:26 am ]
Post subject:  Re: Minimal NES example using ca65

tepples wrote:
Why use WinRAR ($$$) instead of 7-Zip?

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.

Author:  rainwarrior [ Fri May 02, 2014 8:18 am ]
Post subject:  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.

Author:  cpow [ Fri May 02, 2014 8:44 am ]
Post subject:  Re: Minimal NES example using ca65

rainwarrior wrote:
If 7-Zip is your preference, it will unpack RARs just fine, but I'm sure you know that already.

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.

Author:  rainwarrior [ Fri May 02, 2014 11:37 am ]
Post subject:  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. :P

Page 1 of 3 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/