It is currently Wed Jun 28, 2017 12:16 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Sun Mar 05, 2017 10:09 am 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 262
Location: Colorado USA
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.


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 11:48 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1601
Location: DIGDUG
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.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 12:15 pm 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 593
Location: Sweden
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.


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 12:51 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9758
Location: Rio de Janeiro - Brazil
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.


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 1:11 pm 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 262
Location: Colorado USA
This is what my iNES header looked like: (The game was Super Mario Bros.)
Code:
.db "NES",$1a
.db $02
.db $01
.db $00|$01
.db $00
.db $00
.db $00
.dsb 6,$00


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 1:18 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9758
Location: Rio de Janeiro - Brazil
And what did you do with it? How large was the resulting ROM file? What happened when you opened it in the emulator?


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 1:43 pm 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 262
Location: Colorado USA
The resulting ROM file was 120 kilobytes, and when I load it in Nestopia, I get invalid file.


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 2:54 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9758
Location: Rio de Janeiro - Brazil
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).


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 2:56 pm 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 262
Location: Colorado USA
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).

It's exactly 119,952 bytes.


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 3:12 pm 
Offline
User avatar

Joined: Wed Oct 16, 2013 7:55 am
Posts: 115
DementedPurple wrote:
It's exactly 119,952 bytes.


That sounds to me like pasting ASCII instead of HEX, but that's just my random guess. Hard to know without more precise info.


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 3:19 pm 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 262
Location: Colorado USA
Well, I've copied and pasted the text in the binary file.


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 3:37 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9758
Location: Rio de Janeiro - Brazil
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.


Top
 Profile  
 
PostPosted: Sun Mar 05, 2017 4:08 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1601
Location: DIGDUG
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.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Mon Mar 06, 2017 3:56 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 593
Location: Sweden
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:
Code:
;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

Paste this under the "Reset" label in Tokumaru's NROM template.



Code:
  .dsb 8192, $00 ;no graphics

Paste this line in the CHR-ROM bank (replace ".incbin "tiles.chr" with this line).


Top
 Profile  
 
PostPosted: Mon Mar 06, 2017 3:18 pm 
Offline
User avatar

Joined: Sat Jul 12, 2014 3:04 pm
Posts: 848
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group