Really Noob question

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
mattheweston
Posts: 25
Joined: Tue Feb 09, 2010 5:48 pm

Really Noob question

Post by mattheweston »

I understand that you code a game in assembler, but how do you get from that to the .Rom file that you can play on an emulator?
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Post by GradualGames »

You use one of several freely available tools called assemblers. They read your assembly language text file (you can create one in any text editor like notepad for example) and transform it into a file containing nothing but opcodes that an NES can understand (this is the ROM). I'm not sure from your post what your background is, but you should feel free to ask any and all questions you might have if you are interested in learning NES programming. There are tons of people here who are very knowledgeable and helpful.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Really Noob question

Post by tokumaru »

mattheweston wrote:I understand that you code a game in assembler
Just to clarify: The name of the language is "assembly", "assembler" is the program that converts assembly programs into machine language.
but how do you get from that to the .Rom file that you can play on an emulator?
Like Gradualore said, you use an assembler, which converts the source code into machine language. However, assemblers don't output valid NES ROMs by themselves (seeing as they can be used for various machines that use the same CPU, not only the NES), so it's your responsibility to make sure that the output file has a valid iNES header, all the PRG-ROM banks in order, followed by the CHR-ROM banks (if any). If you don't obey the structure, emulators will not recognize your file as a NES ROM.
mattheweston
Posts: 25
Joined: Tue Feb 09, 2010 5:48 pm

Post by mattheweston »

I hold a BA in comp sci having took a class in Assembly language programming. I guess I was a weirdo as I actually loved programming in Assembly. =)
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

mattheweston wrote:I guess I was a weirdo as I actually loved programming in Assembly. =)
We're all weirdos here, assembly is fun as hell! =D
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Post by GradualGames »

If you've got a solid programming background and know a bit of assembly I'd recommend Micahel Martin's NES 101 tutorial to get started (if that's what you're looking for). He has a complete program in there that shows you all the basics (well perhaps not all, but enough of), and even includes an assembler written in perl called P65.
mattheweston
Posts: 25
Joined: Tue Feb 09, 2010 5:48 pm

Post by mattheweston »

So any assembler that can "assemble" 6502 code will work?
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

mattheweston wrote:So any assembler that can "assemble" 6502 code will work?
Yes. You just have to make sure that they output a file that respects the structure of a NES ROM. NES ROMs contain a 16-byte header, followed by the PRG-ROM banks and then the CHR-ROM banks (if the game uses CHR-RAM there are no CHR-ROM banks in the ROM).
User avatar
ehguacho
Posts: 83
Joined: Tue Mar 09, 2010 11:12 pm
Location: Rosario, Argentina
Contact:

Post by ehguacho »

try NESASSEMBLER, it's the most common assembler used to get your .asm game program into a .rom file
sorry about my english, i'm from argentina...

http://nestate.uuuq.com
User avatar
Jeroen
Posts: 1048
Joined: Tue Jul 03, 2007 1:49 pm

Post by Jeroen »

^^i'm gonna have to disagree and say that "asm6" is probably the better program :-)
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Yeah, if you haven't picked an assembler yet, don't start out with NESASM, please. The only excuse for using NESASM is if you started learning from a tutorial that used it and are already spoiled by it, but if you have the choice, don't go with it, or you'll soon find yourself wanting to switch to something else.

Please pick anything but NESASM. ASM6 is probably at the same level of complexity (i.e. very low, you can get a ROM ready without hassle), but it's much less buggy and much more versatile.
Post Reply