Saturday, September 1, 2012

NESDEV beginning


There are a lot of smart people in the online NESDEV world, and most of them are very helpful. Despite this, I've found it is a bit difficult to get started in the world of NES development. This is no ones fault, it's due to the fact that there are many different tools and ideas about what assemblers to use and how to code different things.

I decided to blog a bit about what I've found that works, in an attempt to share how great my development is going, as well as to help others.

The tools I've decided to use, and the strategies I've used to code are the best I have tried at the time, and make me happy enough to stop looking, but I'm always open to something new or better if the change is worth it and it can improve upon what I am currently using.


Where to start?


Assembler

So, to start, I'll say I haven't even considered C, though it is possible using cc65, a cross compiler for 6502 based systems. What I have settled on, is ca65, the assembler that is a part of the cc65 package. Originally, I really liked the idea of NESHLA, but despite some really cool ideas, it's not really suitable for large projects. The macro functionality of ca65 is powerful enough to make things somewhat high level anyway. This assembler is often considered difficult to use, but once you have a suitable nes.cfg file, it's not really any harder then any other, and has many more advanced features waiting for you when you need them.


Editor

Notepad++ with NppExec is perfect for editing. I have colors setup the way I like, and NppExec allows quick execution of any commands I want, which is mainly make with a great generic makefile from here.  (Note, there will be some changes needed as mentioned in the post.) NppExec has a console capture window that can be easy setup to allow for double clicking the error to bring you to the offending line.





Debugging

Nintendulator is often considered one of the most accurate emulators. As such it's good for testing code and as well, thefox has added some features to a customized version (see link for image) that allows for much easier debugging. these three things combined allow for quick NES development. Of course there are always other options, and other opinions, but this is my suggestion at this time.

Other tools

For CHR (graphics) editing, I suggest NES Screen Tool (see link for image) as a great generic NES graphics tool. It's also good for learning about (and debugging) the screen addresses, as it shows the offsets of the nametable and attribute locations. You can also click the 1x grid to see pattern tile layout, 2x grid to see which tiles must use the same colors, and 4x grid too see the areas that use the same attribute table addresses. (It also shows which bits are applied to the 2x grid.)

That's it for a beginning, the intention of this blog is to track my progress from here, or anything I think is interesting and related to NESDEV.

But I'm a noob/newb and I don't quite...

If you don't quite feel like you are ready to start from this point, there are a few things I would suggest:

1. Learn binary and hexadecimal. You don't have to be good at it, just understand the basics and get better from there.
2. Learn the basic concepts of CPU and address and data bus. Along with this you should have some understanding of (all) the CPU registers, RAM/ROM and the PPU chip in the NES.
3. Learn about the 6502 instructions. As you'll no doubt find out, the NES CPU core is a MOS 6502 without decimal mode, so ignoring decimal mode, practically all 6502 (not 65c02) documentation applies to the NES CPU.
4. If you have the above more or less complete, the next step would be to start coding some simple code that does something and ideally synchronizes to the PPU framerate with the NMI signal.

That's it for the intro..





No comments:

Post a Comment