NESASM3 doesn't recognize .rs directive

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
NESASM3 doesn't recognize .rs directive
by on (#233016)
Hello everyone.
I got into NES development a few days ago. I'm currently reading Nerdy Nights Week 7 (Nested loops and JSR stuff) and making a tiny game in the meanwhile. I'm using the NESASM3 compiler and the FCEUXSP emulator. I'm trying to allocate a few variables like score1 and score2, but all my compiler does is throwing an error.

I tried to compile Nerdy Nights Week 7's .asm but it doesn't give any error so I'm pretty sure that my code is wrong, but I can't tell what am I getting wrong, since I tried to get around the problem a few other ways but none of them worked. :roll:

Here is my full .asm code, by the way:
https://pastebin.com/wV7S9ef9

Thank you all in advance.

EDIT: I uncommented some lines.
Re: NESASM3 doesn't recognize .rs directive
by on (#233017)
Why are your variables commented out? (semicolon starts a comment)
Re: NESASM3 doesn't recognize .rs directive
by on (#233023)
Ah, sorry! It was a test, but it doesn't work anyway.
Re: NESASM3 doesn't recognize .rs directive
by on (#233024)
From what I can tell (from looking at NESASM's usage.txt), the syntax is score1 .rs 1, not .rs score1 1.

WolfCorp wrote:
I'm using the NESASM3 compiler and the FCEUXSP emulator.

Try not to rely on a single emulator for development. FCEUX and its derivatives, in particular, are somewhat lenient in certain areas compared to more accurate emulators.
Re: NESASM3 doesn't recognize .rs directive
by on (#233025)
tokumaru wrote:
From what I can tell (from looking at NESASM's usage.txt), the syntax is score1 .rs 1, not .rs score1 1.

WolfCorp wrote:
I'm using the NESASM3 compiler and the FCEUXSP emulator.

Try not to rely on a single emulator for development. FCEUX and its derivatives, in particular, are somewhat lenient in certain areas compared to more accurate emulators.


It's not FCEUX's fault. NESASM3 doesn't compile. The Nerdy Nights example works flawlessly...
Re: NESASM3 doesn't recognize .rs directive
by on (#233029)
WolfCorp wrote:
It's not FCEUX's fault. NESASM3 doesn't compile. The Nerdy Nights example works flawlessly...

My second comment was unrelated to the problem, it was just an advice. Did you read the part about the syntax, though?
Re: NESASM3 doesn't recognize .rs directive
by on (#233050)
Sorry for the very delayed reply :(
Also, I apprenciate your suggestion about the emulator.
In which sense "the syntax part"?
If you refer to the Nerdy Nights tutorial, I don't recall any part about syntax; well, it may be in the very first lessons I believe, but I still think I grasped them to an acceptable degree.
Maybe there's something I missed which was of pivotal importance for the .rs directives to be accepted? I have no idea... :roll:
Re: NESASM3 doesn't recognize .rs directive
by on (#233051)
Syntax means the order of words, bytes, characters; think "grammar". What you have:

Code:
variables:
 .rsset $0000       ;put starting location at 0000
 .rs score1 1       ;reserve 1 byte for var score1 at $0000
 .rs score2 1       ;reserve 1 byte for var score2 at $0001
 .rs marioflip 1    ;reserve 1 byte for var at $0002

This is not syntactically valid. nesasm3 documentation is here. What you SHOULD have:

Code:
; Variables
          .rsset $0000       ;put starting location at 0000
score1    .rs 1              ;reserve 1 byte for var score1 at $0000
score2    .rs 1              ;reserve 1 byte for var score2 at $0001
marioflip .rs 1              ;reserve 1 byte for var at $0002

Please look at the nesasm3 documentation for RS and you'll understand. It's up to you to get familiar with the syntax of the assembler you're using (nesasm3). That's why assembler documentation exists. :-)

Note also that your variables: line should have been preceded by a semicolon (;), indicating it's a comment. Otherwise, variables: by itself creates a label, which is not what you want.

The spacing/alignment is purely cosmetic in this case, which I cleaned up to make it more readable and easy to understand.
Re: NESASM3 doesn't recognize .rs directive
by on (#233055)
koitsu wrote:
Syntax means the order of words, bytes, characters; think "grammar". What you have:

Code:
variables:
 .rsset $0000       ;put starting location at 0000
 .rs score1 1       ;reserve 1 byte for var score1 at $0000
 .rs score2 1       ;reserve 1 byte for var score2 at $0001
 .rs marioflip 1    ;reserve 1 byte for var at $0002

This is not syntactically valid. nesasm3 documentation is here. What you SHOULD have:

Code:
; Variables
          .rsset $0000       ;put starting location at 0000
score1    .rs 1              ;reserve 1 byte for var score1 at $0000
score2    .rs 1              ;reserve 1 byte for var score2 at $0001
marioflip .rs 1              ;reserve 1 byte for var at $0002

Please look at the nesasm3 documentation for RS and you'll understand. It's up to you to get familiar with the syntax of the assembler you're using (nesasm3). That's why assembler documentation exists. :-)

Note also that your variables: line should have been preceded by a semicolon (;), indicating it's a comment. Otherwise, variables: by itself creates a label, which is not what you want.

The spacing/alignment is purely cosmetic in this case, which I cleaned up to make it more readable and easy to understand.


Thank you, I didn't understand he meant the assembler's syntax, so that's my bad.
Also, I'll check the NESASM3 documentation from now, it is pretty darn useful!
Now the assembler doesn't throw any errors and compiles flawlessly.
Thank you for your patience :D