NESASM3 doesn't recognize .rs directive

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
WolfCorp
Posts: 5
Joined: Mon Jan 28, 2019 11:18 am

NESASM3 doesn't recognize .rs directive

Post by WolfCorp »

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.
Last edited by WolfCorp on Mon Jan 28, 2019 12:12 pm, edited 1 time in total.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: NESASM3 doesn't recognize .rs directive

Post by dougeff »

Why are your variables commented out? (semicolon starts a comment)
nesdoug.com -- blog/tutorial on programming for the NES
WolfCorp
Posts: 5
Joined: Mon Jan 28, 2019 11:18 am

Re: NESASM3 doesn't recognize .rs directive

Post by WolfCorp »

Ah, sorry! It was a test, but it doesn't work anyway.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NESASM3 doesn't recognize .rs directive

Post by tokumaru »

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.
WolfCorp
Posts: 5
Joined: Mon Jan 28, 2019 11:18 am

Re: NESASM3 doesn't recognize .rs directive

Post by WolfCorp »

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...
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NESASM3 doesn't recognize .rs directive

Post by tokumaru »

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?
WolfCorp
Posts: 5
Joined: Mon Jan 28, 2019 11:18 am

Re: NESASM3 doesn't recognize .rs directive

Post by WolfCorp »

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:
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: NESASM3 doesn't recognize .rs directive

Post by koitsu »

Syntax means the order of words, bytes, characters; think "grammar". What you have:

Code: Select all

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: Select all

; 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.
WolfCorp
Posts: 5
Joined: Mon Jan 28, 2019 11:18 am

Re: NESASM3 doesn't recognize .rs directive

Post by WolfCorp »

koitsu wrote:Syntax means the order of words, bytes, characters; think "grammar". What you have:

Code: Select all

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: Select all

; 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
Post Reply