How would I make an iNES header?
Moderator: Moderators
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
How would I make an iNES header?
Yeah, my title pretty much says everything. Thanks!
Re: How would I make an iNES header?
The simplest way to make a header is to just use .db/.byte directives (depending of the assembler) to enter the bytes that forms the header at the start of the ROM.
Simple example of iNES header for NROM:
Using macros like Tepples' makes it easy to make any kind of header.
Simple example of iNES header for NROM:
Code: Select all
PRG_COUNT = $01 ;$01 = 16 kB ROM, $02 = 32 kB ROM
SCROLL = $01 ;$01 = Horizontal Nametable Arrangement, $00 = Vertical Nametable Arrangement, $08 = Four-Screen
TVSYSTEM = $00 ;$00 = NTSC, $01 = PAL
.db "NES", $1a ;identification of the iNES header
.db PRG_COUNT ;number of 16 kB PRG-ROM pages
.db $01 ;number of 8 kB CHR-ROM pages (0 = CHR-RAM)
.db $00|SCROLL ;mapper 0 and scroll setting
.db %00000000 ;mapper 0, iNES header, no arcade
.db $00 ;no PRG-RAM
.db TVSYSTEM ;NTSC or PAL
.dsb 6, $00 ;reserved bytes in the header
Re: How would I make an iNES header?
Ca65 doesn't have a .dsb directive. It does have .repeat and .res directives (either would do the same), but that's unnecessary. Just indicate fill = yes in the cfg definition of the header "segment", and it will pad up to the "size".
The size of the header needs to be exactly 16 bytes, and that is external to the PRG-ROM. It is metadata for the emulator, telling it how big the ROMs are and what map to use.
The size of the header needs to be exactly 16 bytes, and that is external to the PRG-ROM. It is metadata for the emulator, telling it how big the ROMs are and what map to use.
nesdoug.com -- blog/tutorial on programming for the NES
Re: How would I make an iNES header?
Ah yes sorry, I forgot to say my example is using Asm6 syntax.dougeff wrote:Ca65 doesn't have a .dsb directive.
Also Ca65 would use .byte instead of .db to define bytes. Nesasm uses .db, but it has special directives for defining the header. Manually defining the iNES header using .db in Nesasm might mess with its annoying banking system I guess.
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
So, if I were to have the iNES header in the text file, then have a hexdump file and write that to an EPROM to use it on a real NES, would it work? Even though I could probably use a simple JMP to get the the section that has all of the code. Also kind of unrelated but I find it funny how this websites spellcheck doesn't count NES as a real word as well as Nintendo.
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
* To the (Somehow spellcheck didn't notice that)DementedPurple wrote:So, if I were to have the iNES header in the text file, then have a hexdump file and write that to an EPROM to use it on a real NES, would it work? Even though I could probably use a simple JMP to get the the section that has all of the code. Also kind of unrelated but I find it funny how this websites spellcheck doesn't count NES as a real word as well as Nintendo.
Re: How would I make an iNES header?
Let's break this down line by line...So, if I were to have the iNES header in the text file, then have a hexdump file and write that to an EPROM to use it on a real NES, would it work? Even though I could probably use a simple JMP to get the the section that has all of the code. Also kind of unrelated but I find it funny how this websites spellcheck doesn't count NES as a real word as well as Nintendo.
The header, is the first 16 bytes of a .NES file. It is binary. You can assemble a header, from a text file, if that's what you mean.iNES header in the text file
A dump is a term refferring to...when there is a fatal crash of a program, a dump is the contents of RAM at the time of crash, saved to a file, for debugging purposes. I think you mean some other term.hexdump file
No. You will never write a header in any ROM. It is just for emulation purposes. You would strip the header off if you wanted to burn it to a file an play in on real hardware. (Unless you mean on a flash cartridge designed to play .NES files, then you would leave the original .NES file intact with the header).EPROM to use it on a real NES
Code: Select all
JMP to get the the section
EDIT: The last 6 bytes of the PRG ROM, has address for important things, the middle 2 bytes of that is the location of the start of the program. It's called the 'reset vector', and needs to be at address $FFFC-$FFFD. It points to the start address. When you press power or reset, the NES gets its program counter from here.
Finally. I still don't know what you are attempting to do.
nesdoug.com -- blog/tutorial on programming for the NES
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
So, if I can assemble a header, then how would I assemble with a CHR bank? Would I just make a simple .BIN file with the two files merged and change the extension or is it more complicated than that?
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
I'm attempting to make an NES ROM to test my game.dougeff wrote:
Finally. I still don't know what you are attempting to do.
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
And also, buy hexdump I meant a file with my codes OpCodes, not actually the hex values typed out, but the hex values characters.
Re: How would I make an iNES header?
This is not what hexdump means. If you say "an object file" (the .o extension) or "a binary file" (the general term), people will understand what you are referring to.DementedPurple wrote:And also, buy hexdump I meant a file with my codes OpCodes, not actually the hex values typed out, but the hex values characters.
Re: How would I make an iNES header?
That's your browser's spell check.DementedPurple wrote:this websites spellcheck doesn't count NES as a real word as well as Nintendo.
The cc65 toolchain is a bit more flexible than other toolchains, but this also makes it somewhat more complicated to set up. You need to make these:DementedPurple wrote:I'm attempting to make an NES ROM to test my game.
- An iNES header
- Code and data to put in PRG ROM
- Tile data to put in CHR ROM (optional, required if not using CHR RAM)
- Linker script to tell ld65 in what order to put all the above
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
So how would I tell it what TV System, would I just give the name, would I have to use some quotation marks, would I just give it the name with no quotation marks, or does a number stand for that.Pokun wrote:The simplest way to make a header is to just use .db/.byte directives (depending of the assembler) to enter the bytes that forms the header at the start of the ROM.
Simple example of iNES header for NROM:Using macros like Tepples' makes it easy to make any kind of header.Code: Select all
PRG_COUNT = $01 ;$01 = 16 kB ROM, $02 = 32 kB ROM SCROLL = $01 ;$01 = Horizontal Nametable Arrangement, $00 = Vertical Nametable Arrangement, $08 = Four-Screen TVSYSTEM = $00 ;$00 = NTSC, $01 = PAL .db "NES", $1a ;identification of the iNES header .db PRG_COUNT ;number of 16 kB PRG-ROM pages .db $01 ;number of 8 kB CHR-ROM pages (0 = CHR-RAM) .db $00|SCROLL ;mapper 0 and scroll setting .db %00000000 ;mapper 0, iNES header, no arcade .db $00 ;no PRG-RAM .db TVSYSTEM ;NTSC or PAL .dsb 6, $00 ;reserved bytes in the header
Re: How would I make an iNES header?
What tutorial have you been following? I know that at least the Nerdy Nights tutorial covers this topic, and should help you understand what to do.