It is currently Mon Jun 24, 2019 6:53 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Mon Jan 28, 2019 11:31 am 
Offline

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

Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 11:35 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2529
Location: DIGDUG
Why are your variables commented out? (semicolon starts a comment)

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 12:08 pm 
Offline

Joined: Mon Jan 28, 2019 11:18 am
Posts: 5
Ah, sorry! It was a test, but it doesn't work anyway.


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 12:11 pm 
Offline
User avatar

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


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 12:13 pm 
Offline

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


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 12:21 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11371
Location: Rio de Janeiro - Brazil
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?


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 4:22 pm 
Offline

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


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 4:30 pm 
Offline
User avatar

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


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 4:49 pm 
Offline

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group