source code for importing NES levels?

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

renegade74
Posts: 15
Joined: Fri Aug 05, 2016 11:10 pm

source code for importing NES levels?

Post by renegade74 »

Hello,

I've contacted a programmer who has agreed to code a game for me - which includes imported levels from an old NES title.
I've sent the .nes file.
However, they have stated to me that I need the "source code" to import the levels.
He asks, "How can I change things if I don't have code for it? It won't even let you extract graphics from that, not quality at least. To make modifications in the game there needs to be a backend for it...I get the front end game, but for modifications backend is required.

Could you help make sense of this? I also understand there may be some document(s) available here to help w/ debugging and if I send an emulator, this may solve the issue. I'm not sure if this is what they mean though.

Please understand, this is someone supposedly with knowledge of C++/ C#/ Python/ Java/ Linux/ Database/ VB/ Mobile Platforms and ECommerse plus more.

Thanks very much!

-Jared
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: source code for importing NES levels?

Post by Zepper »

Short and easy. He's not qualified for the duty.
renegade74
Posts: 15
Joined: Fri Aug 05, 2016 11:10 pm

Re: source code for importing NES levels?

Post by renegade74 »

you could be right there - I wondered so w/ all that experience....maybe just not a Nintendo programmer, huh?

I think what they want is the instruction map like how the original Super Mario was mapped out for all to see.

could I not send an emulator and some sort of doc on debugging you think?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: source code for importing NES levels?

Post by tepples »

Try playing through the level while logging all writes to nametables ($2000-$2FFF) that are near the screen edge. This should let you build the nametable data for that level. From there, your programmer should be able to build metatiles, Markov models, or whatever other map compression method he prefers.

That or he's using the correlation between "not having the source code" and "not having the rights" to politely decline what might be copyright infringement.
User avatar
dustmop
Posts: 136
Joined: Wed Oct 16, 2013 7:55 am

Re: source code for importing NES levels?

Post by dustmop »

That skill set you described isn't really applicable to the problem at hand. Your programmer is correct about needing source code, but no source code is available, in general, for classic nes games. You need someone who is skilled at reverse engineering, and 6502 assembly.
renegade74
Posts: 15
Joined: Fri Aug 05, 2016 11:10 pm

Re: source code for importing NES levels?

Post by renegade74 »

don't think its the latter....thanks for suggestions about nametable data....perhaps that will work.
renegade74
Posts: 15
Joined: Fri Aug 05, 2016 11:10 pm

Re: source code for importing NES levels?

Post by renegade74 »

thanks for your reply dustmop, can you get the source code from buying the original game on floppy disk how they have them for famicom/NES games? how else are NES games coded over?
User avatar
dustmop
Posts: 136
Joined: Wed Oct 16, 2013 7:55 am

Re: source code for importing NES levels?

Post by dustmop »

No, source code was never distributed, it would be a trade secret. Also, if the term "source code" means C or C++, it did not exist, most games were / are coded directly in assembly.
renegade74
Posts: 15
Joined: Fri Aug 05, 2016 11:10 pm

Re: source code for importing NES levels?

Post by renegade74 »

yeah, they mean to write it in C+...do you know someone with 6502 knowledge?

also, someone just responded on other forum...

"Unfortunately many high level programmers have no idea how things work on low level (although if he know C he should at least understand how pointers work).

But yeah, the way to go would be to use a debugger to understand how the levels are done. Using a debugger you can see the disassembled NES code (which as far as I know be close to the original uncommented source code anyway because I think they were programmed in assembly) and see the graphics on VRAM. It may be worth searching here or on Google to see if someone has documented the level format.

I can't suggest a specific debugging emulator because I've never used one for NES."
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: source code for importing NES levels?

Post by tepples »

renegade74 wrote:Using a debugger you can see the disassembled NES code (which as far as I know be close to the original uncommented source code anyway because I think they were programmed in assembly)
The assembly language source code of an NES game would have had subroutine names, array names, variable names, comments, and the like. See, for example, Home Alone 2 and Thwaite. If Data Crystal has a page about the game, you can get names out of that.
I can't suggest a specific debugging emulator because I've never used one for NES.
The usual suspects are FCEUX and Nintendulator. You might be able to write nametable logging as a Lua extension for FCEUX.
renegade74
Posts: 15
Joined: Fri Aug 05, 2016 11:10 pm

Re: source code for importing NES levels?

Post by renegade74 »

Thanks Tepples, getting a wide array of answers here...maybe one route will connect with the coder. Do you program games?
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: source code for importing NES levels?

Post by tokumaru »

It takes someone reasonably familiar with the NES architecture and 6502 assembly to be able to extract something from an .nes file. If your programmer doesn't already know how to do it, it's unlikely he'll want to learn it for this one project.

Using debugging tools in an emulator you can somewhat easily extract the graphics of a level while playing it. You can periodically dump the name tables to files as the screen scrolls, and then piece everything together to get a map describing which tiles go where, and this is something your programmer might be able to use. Unfortunately, that doesn't include any of the collision and object information.
renegade74
Posts: 15
Joined: Fri Aug 05, 2016 11:10 pm

Re: source code for importing NES levels?

Post by renegade74 »

I see...do you have interest in this project possibly?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: source code for importing NES levels?

Post by tepples »

renegade74 wrote:Do you program games?
Yes. Here are the NES game credits that I deem noteworthy:
  • Director, lead designer, and programmer for Concentration Room, Thwaite, Zap Ruder, RHDE: Furniture Fight, and the Action 53 menu
  • Lead programmer for Haunted: Halloween '85 and The Curse of Possum Hollow, for which I wrote every line of code except the music engine
  • Music engine programmer for Double Action Blaster Guys, Sliding Blaster, and Nova the Squirrel
renegade74
Posts: 15
Joined: Fri Aug 05, 2016 11:10 pm

Re: source code for importing NES levels?

Post by renegade74 »

nice, please see PM
Post Reply