How would I make an iNES header?
Moderator: Moderators
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
Okay, So I've compiled my iNES header, then copied the binary file and pasted it after the header in a HEX editor, then I created a .BIN with the CHR and PRG including the header, then tried running it in an emulator and it doesn't work. And yes, I've changed the file extension from .BIN to .NES.
Re: How would I make an iNES header?
I see you have perseverance. That is a good skill.
Communication skills, needs improvement.
Or perhaps you vastly overestimate our ability to understand your issue.
I don't know what your header looks like, nor what PRG ROM you are using, nor what CHR, nor which assembler, nor which emulator. It doesn't sound like you are using source code, but posting that would be useful, if you were.
And 'doesn't work', doesn't work in a forum. Error message? Blank screen? Screen full of gibberish tiles? What are isn't working?
Building a functional NES file takes a lot of technical knowledge. Working from a working source code is probably where you should start.
Communication skills, needs improvement.
Or perhaps you vastly overestimate our ability to understand your issue.
I don't know what your header looks like, nor what PRG ROM you are using, nor what CHR, nor which assembler, nor which emulator. It doesn't sound like you are using source code, but posting that would be useful, if you were.
And 'doesn't work', doesn't work in a forum. Error message? Blank screen? Screen full of gibberish tiles? What are isn't working?
Building a functional NES file takes a lot of technical knowledge. Working from a working source code is probably where you should start.
nesdoug.com -- blog/tutorial on programming for the NES
Re: How would I make an iNES header?
No need to paste anything in a hex editor, you assemble your source files into a complete binary .nes file, header and all. The iNES header is defined in the source of those example programs.
Re: How would I make an iNES header?
When NES homebrewing was in its infancy, it was somewhat common for programmers to create the header separately using an hex editor and join everything in the end. But we've come to realize that having the assembler spit out a complete NES file is more convenient, so nearly everyone does it like that now.
Seriously, if you want an example that "just works" for ASM6, get one of the templates I linked to in my previous post. Just provide the CHR file (if using a CHR-ROM template) and you should get a valid ROM after assembling. It won't do anything because there's no code, but the result will be a valid NES file emulators will accept. From there you can start writing the actual code so your program can do things.
Seriously, if you want an example that "just works" for ASM6, get one of the templates I linked to in my previous post. Just provide the CHR file (if using a CHR-ROM template) and you should get a valid ROM after assembling. It won't do anything because there's no code, but the result will be a valid NES file emulators will accept. From there you can start writing the actual code so your program can do things.
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
This is what my iNES header looked like: (The game was Super Mario Bros.)
Code: Select all
.db "NES",$1a
.db $02
.db $01
.db $00|$01
.db $00
.db $00
.db $00
.dsb 6,$00
Re: How would I make an iNES header?
And what did you do with it? How large was the resulting ROM file? What happened when you opened it in the emulator?
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
The resulting ROM file was 120 kilobytes, and when I load it in Nestopia, I get invalid file.
Re: How would I make an iNES header?
You need to be more precise with the file size, since every byte makes a difference. Please find the size in bytes (in Windows you can right click and ask for the file's properties to see the exact byte size).
120KB doesn't sound like a valid size for an NES ROM file though. The closest thing would be an UNROM program, with 16 + 131,072 = 131,088 bytes. UNROM has 8 16KB PRG-ROM banks and no CHR banks (it uses CHR-RAM).
120KB doesn't sound like a valid size for an NES ROM file though. The closest thing would be an UNROM program, with 16 + 131,072 = 131,088 bytes. UNROM has 8 16KB PRG-ROM banks and no CHR banks (it uses CHR-RAM).
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
It's exactly 119,952 bytes.tokumaru wrote:You need to be more precise with the file size, since every byte makes a difference. Please find the size in bytes (in Windows you can right click and ask for the file's properties to see the exact byte size).
120KB doesn't sound like a valid size for an NES ROM file though. The closest thing would be an UNROM program, with 16 + 131,072 = 131,088 bytes. UNROM has 8 16KB PRG-ROM banks and no CHR banks (it uses CHR-RAM).
Re: How would I make an iNES header?
That sounds to me like pasting ASCII instead of HEX, but that's just my random guess. Hard to know without more precise info.DementedPurple wrote:It's exactly 119,952 bytes.
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: How would I make an iNES header?
Well, I've copied and pasted the text in the binary file.
Re: How would I make an iNES header?
What kind of ROM are you trying to make? NROM? If so, anything beyond 40,976 bytes is wrong for sure. NROM needs to be either 24,592 or 40,976 bytes, depending on the size of the PRG-ROM.
It seems you're expecting the hex editor to do something it just doesn't do. Hex editors don't convert anything, if you copied text, you can only paste the exact same text, unmodified. File extensions also don't mean anything, they're just text meant to indicate what program should be used to open each file. Changing extensions doesn't modify the files in any way.
But really, you don't need hex editors or anything fancy, you just need an assembler. Write the correct stuff in it and you can generate a proper NES ROM file in one step.
It seems you're expecting the hex editor to do something it just doesn't do. Hex editors don't convert anything, if you copied text, you can only paste the exact same text, unmodified. File extensions also don't mean anything, they're just text meant to indicate what program should be used to open each file. Changing extensions doesn't modify the files in any way.
But really, you don't need hex editors or anything fancy, you just need an assembler. Write the correct stuff in it and you can generate a proper NES ROM file in one step.
Re: How would I make an iNES header?
I know that when I try to cut from FCEUX's hex editor, and paste into another hex editor, it doesn't paste as binary, but rather as a string of ASCII values.
Example...original binary = 0x95 cut pasted, becomes...
0x39,0x35. (The ascii values of '9' and '5'). That is of course wrong.
EDIT. The only way I can cut and paste from FCEUX, is, I can paste into a source code file (asm6) with the directive .hex (example .hex 95). I wouldn't recommend this.
Example...original binary = 0x95 cut pasted, becomes...
0x39,0x35. (The ascii values of '9' and '5'). That is of course wrong.
EDIT. The only way I can cut and paste from FCEUX, is, I can paste into a source code file (asm6) with the directive .hex (example .hex 95). I wouldn't recommend this.
nesdoug.com -- blog/tutorial on programming for the NES
Re: How would I make an iNES header?
Hex editors usually have options to copy as ASCII or as "hex string" and so on. The .hex directive is usefull if you have a very large table and you want to type it in a more compact manner.
DementedPurple whatever you are trying now doesn't seem to be working, so why don't you do what people have adviced you to for a long time now? Namely, instead of copying headers from existing games, start with a working example and work from there. I'd recommend to start as small as possible, so Tokumaru's NROM template is your best bet. It is already a minimal working ROM so just assemble it in asm6 and see if you can load it in an emulator without errors. Then you can enter some code to see if that works.
Here is some minimal working code that gives you feedback that it's working by making noise from the TV speakers:
Paste this under the "Reset" label in Tokumaru's NROM template.
Paste this line in the CHR-ROM bank (replace ".incbin "tiles.chr" with this line).
DementedPurple whatever you are trying now doesn't seem to be working, so why don't you do what people have adviced you to for a long time now? Namely, instead of copying headers from existing games, start with a working example and work from there. I'd recommend to start as small as possible, so Tokumaru's NROM template is your best bet. It is already a minimal working ROM so just assemble it in asm6 and see if you can load it in an emulator without errors. Then you can enter some code to see if that works.
Here is some minimal working code that gives you feedback that it's working by making noise from the TV speakers:
Code: Select all
;Basic init code:
sei
cld
ldx #$40
stx $4017
ldx #$FF
txs
inx
stx $2000
stx $2001
stx $4010
;Make some noise:
lda #%00001000
sta $4015 ;enable noise
lda #$3F
sta $400C ;volume F, disable internal length and volume
lda #$81
sta $400E ;make some noise
lda #$00
sta $400F ;set length
main:
jmp main
Code: Select all
.dsb 8192, $00 ;no graphics
Re: How would I make an iNES header?
If you uploaded some of your failed attempts to the forum as attachments, then we might be able to better-understand what's going wrong where.