It is currently Sat Sep 23, 2017 10:07 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Sep 03, 2017 12:51 pm 
Offline
User avatar

Joined: Thu Aug 13, 2015 4:40 pm
Posts: 104
Location: Rio de Janeiro - Brazil
When I try to define a constant as simple number what I get is either an error or a memory address, no matter what I try. What am I doing wrong?

According to this page doing this: "two = 2" would define "two" as a numeric constant, but when I do that what I get is the address $2, not the number #2. If I try "two = #2" I get "trailing garbage characters" error.

ca65 is v2.16

edit: apparently this feature is only for cc65? Is that correct? Is there a way to do it on ca65?

_________________
http://nesrocks.com/blog/superpitfall30th/


Top
 Profile  
 
PostPosted: Sun Sep 03, 2017 1:06 pm 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2947
Location: Tampere, Finland
This is probably what you want:
Code:
two = 2
lda #two

This is possible, but NOT recommended:
Code:
.define two #2
lda two

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Sun Sep 03, 2017 1:16 pm 
Offline
User avatar

Joined: Thu Aug 13, 2015 4:40 pm
Posts: 104
Location: Rio de Janeiro - Brazil
Precisely, thanks! That works fine. :beer:

_________________
http://nesrocks.com/blog/superpitfall30th/


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 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