A problem with NESASM
Moderator: Moderators
A problem with NESASM
Hello! I have a little problem with nesasm. When I try to run a .nes rom compiled without -raw nesasm option, it works perfectly, but when I don´t use that option I get an error. Is -raw option really necessary during compilation? I understand its purpose but anything works when is used.
Re: A problem with NESASM
This sentence is hard to understand: "When I try to run a .nes rom compiled without -raw nesasm option, it works perfectly, but when I don´t use that option I get an error." So... it works perfectly without -raw, but when you don't use -raw, it fails. How would it work perfectly then? :/
So let's just stick with the documentation. Assuming this is NESASM 3.0 or 3.1 (and not 2.x) -- because you didn't specify: the documentation is clear about what the -raw flag does:
"Header" in this case refers to the necessary 16-byte NES header (i.e. .nes file extension). This is necessary when used with emulators, for loading via the PowerPak, and so on.
If your code is generating the 16-byte header itself, then you need to use -raw (otherwise you will end up with two 16-byte headers and your code/game will probably crash upon load).
If your code is not generating the 16-byte header itself, then you should not use -raw (otherwise you will end up with a raw binary file that lacks the header; this would be used if you were to, say, be flashing your assembled code onto an EPROM/EEPROM).
So let's just stick with the documentation. Assuming this is NESASM 3.0 or 3.1 (and not 2.x) -- because you didn't specify: the documentation is clear about what the -raw flag does:
Code: Select all
-raw Control the header generation. By default the assembler
always adds an header to the ROM file; unless '-raw' is
specified, in this case no ROM header is generated.
If your code is generating the 16-byte header itself, then you need to use -raw (otherwise you will end up with two 16-byte headers and your code/game will probably crash upon load).
If your code is not generating the 16-byte header itself, then you should not use -raw (otherwise you will end up with a raw binary file that lacks the header; this would be used if you were to, say, be flashing your assembled code onto an EPROM/EEPROM).
Re: A problem with NESASM
Sorry for my horrible English, haha, I only speak Spanish. I'll better use Google translator. I understand what you say about -raw because I read the documentation. The problem I have is that a .nes file generated from a source code as simple as the following one, for example, gives me an error when I try to execute it in any emulator if during the compilation phase I use the -raw option:
.inesprg 1
.ineschr 0
.inesmir 1
.inesmap 0
.org $8000
.bank 0
Start:
jmp Start
.bank 1
.org $FFFA
.dw 0 ;(NMI_Routine)
.dw Start ;(Reset_Routine)
.dw 0 ;(IRQ_Routine)
However, if I do not use the -raw option everything works perfectly, which I find strange
.inesprg 1
.ineschr 0
.inesmir 1
.inesmap 0
.org $8000
.bank 0
Start:
jmp Start
.bank 1
.org $FFFA
.dw 0 ;(NMI_Routine)
.dw Start ;(Reset_Routine)
.dw 0 ;(IRQ_Routine)
However, if I do not use the -raw option everything works perfectly, which I find strange
Re: A problem with NESASM
What you describe is the expected behavior. The -raw option omits the iNES header, so emulators don't recognize the resulting file as an NES ROM. You absolutely need the header for playing the game on emulators. Why do you think you need to use the -raw option in the first place?
Here are a few examples of cases when omitting the header would make sense:
- You're making a game for a system other than the NES (e.g. the Atari 2600);
- You're supplying your own header some other way instead of using NESASM's directives (.inesprg, .ineschr, etc.);
- You're generating a binary file to burn to an EPROM that you'll put in an actual cartridge;
Here are a few examples of cases when omitting the header would make sense:
- You're making a game for a system other than the NES (e.g. the Atari 2600);
- You're supplying your own header some other way instead of using NESASM's directives (.inesprg, .ineschr, etc.);
- You're generating a binary file to burn to an EPROM that you'll put in an actual cartridge;
Re: A problem with NESASM
Ahhh, I understood! How silly I am! I thought that the -raw option automatically inserts a header into the source code before compiling. Maybe I should rest a bit, haha. Thanks for answering!
Re: A problem with NESASM
The assembler never modifies the source code files, but it does include the header in the output file by default. In the rare cases when you DON'T want the header, then you use the -raw option.Ignis wrote:I thought that the -raw option automatically inserts a header into the source code before compiling.
Re: A problem with NESASM
Some other cases where you might want to -raw:
- You're separately assembling one self-contained module with its own predefined entry point, such as a music bank or a game on a multicart, and then including that binary into your program
- You're building an NSF file instead of an NES ROM; those have a different 128-byte header, and you can get reasonable behavior by specifying $8080 as the load address
Re: A problem with NESASM
P.S., and off-topic, but I've heard fantastic things about https://www.deepl.com/TranslatorIgnis wrote:Sorry for my horrible English, haha, I only speak Spanish. I'll better use Google translator.
Re: A problem with NESASM
Thank you guys! I really appreciate your attention. This motivates me a lot! (I like the Deepl translator:)
Re: A problem with NESASM
English:
Spanish (not from Google Translate):
Code: Select all
-raw Control the header generation. By default the assembler
always adds an header to the ROM file; unless '-raw' is
specified, in this case no ROM header is generated.
Code: Select all
-raw El programa genera archivos con header por default;
si usas este parametro, creara un archivo sin header.