Page 1 of 1

Emulator files

Posted: Mon Jun 13, 2016 4:57 am
by xgamer
Hey guys,

I am new to programming for the NES (but not to programming).

After I write an ASM program and the assembler outputs an ASM file, or EEPROM file, or whatever, how do I get the file into a format that the emulator understands? I know an emulator does just that; it emulates the hardware. So if I feed it whatever the assembler spits out, does it think it's a NES ROM, or do I have to convert it into something else first?

I want to use Nestopia for my emulator if that helps.

Re: Emulator files

Posted: Mon Jun 13, 2016 5:41 am
by koitsu
1. The assembler will output a binary file of sorts, not an .asm file. The assembler reads an .asm file.

2. The answer depends on what assembler you're using. Several of the "simple" ones just require that you add the raw 16-byte .NES header either through .db statements in the .asm file, or by pre-creating it (say, in a hex editor) and prepending it to your binary file (ex. asm6 mygame.asm mygame.bin followed by copy /b header.bin + mygame.bin mygame.nes). You can read about the NES file format here. Don't worry about the "NES 2.0 header" crap, it's overkill for getting started. One may look something like this (see the code block in that post, not the attached files).

Re: Emulator files

Posted: Mon Jun 13, 2016 6:29 am
by tepples
Which assembler are you using? ca65, asm6, or NESASM? The subtleties differ among the three. But if you have correctly configured asm6 or NESASM, the assembler will output a .nes file for use in your emulator. Or if you have correctly configured ca65, the assembler will output .o files, and then ld65 links those into a .nes file for use in your emulator.