Code structure help (NES specifically)

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
Baka94
Posts: 12
Joined: 23 Feb 2014

Code structure help (NES specifically)

Post by Baka94 »

So, I think I now have all that I need to actually make some code, but I can't find a reference code (for NES) anywhere. I know some of the stuff I need to add to the code, but I don't know the overall code structure. Can someone make a short code that has everything that is needed (iNES header, Vectors, Banks, PPU Masking and some code for each used bank (if something is required to the end of the code, that too)).
User avatar
BigDumbDinosaur
Posts: 9428
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Code structure help (NES specifically)

Post by BigDumbDinosaur »

Baka94 wrote:
So, I think I now have all that I need to actually make some code, but I can't find a reference code (for NES) anywhere. I know some of the stuff I need to add to the code, but I don't know the overall code structure. Can someone make a short code that has everything that is needed (iNES header, Vectors, Banks, PPU Masking and some code for each used bank (if something is required to the end of the code, that too)).
Pardon me if I seem abrupt, but your request isn't making a whole lot of sense to me. Have you visited an website that caters to NES developers?
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Bregalad
Posts: 149
Joined: 27 Mar 2010
Location: Chexbres, VD, Switzerland
Contact:

Re: Code structure help (NES specifically)

Post by Bregalad »

I don't know which assembler/tools you are using, but as far as I can tell :

- iNES header in itself has nothing to do with coding, it's just an artifact when storing the ROM on a PC for the emulator to know which cartridge type to emulate. So consult your tutorial's doccumentation about how to add this at the begining of the ROM.
- Vectors (I assume you're talking about interrupt vectors) should be present at $fffa-$ffff, again just consult your tutorial. For a beginner you don't need to use IRQ and NMI yet to get an hello world-type of programm (set them to any value, like 0), just make sure RESET points to the start of your code.
- Banks : You won't need them for a while so don't bother yet, just know how to use a plain cartridge (ROM only) before dealing with mappers, etc...
- PPU Masking : I'm not even sure what you're refering to. Are you talking about the bits in $2001 that allows you to mask the left 8 pixels of the screen ?
In all cases you'll have to understand how the PPU works and play with it's registers for a while.

Also this site is more 6502 related, not really NES related so please come to NESdev if you want more NES related support. You'd come here if you need 6502 specific programming techniques or advice.
Post Reply