6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon May 13, 2024 6:50 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: = vs. :=
PostPosted: Wed May 25, 2022 6:19 pm 
Offline

Joined: Sun Oct 03, 2021 2:17 am
Posts: 114
What is the motivation in ca65 behind having both = and := for numeric constants?
The documentation says := marks the symbol as a label "so it may be handled differently in a debugger"

https://cc65.github.io/doc/ca65.html#ss6.1

What does that mean; different how?


Top
 Profile  
Reply with quote  
 Post subject: Re: = vs. :=
PostPosted: Wed May 25, 2022 9:36 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1412
Location: Scotland
jeffythedragonslayer wrote:
What is the motivation in ca65 behind having both = and := for numeric constants?
The documentation says := marks the symbol as a label "so it may be handled differently in a debugger"

https://cc65.github.io/doc/ca65.html#ss6.1

What does that mean; different how?


My understanding is that labels are present in the output files (before linking) and so a debugger can find them and you can refer to them when linking with other files.

Using = just creates a name while that file is being assembled an doesn't create the label for any subsequent debugger to find.

The upshot is (AIUI), using = will produce smaller .o files which may assemble and/or link faster, but it's not something I've really cared about.

If you want symbols to be global over several files, then use := else use =

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
 Post subject: Re: = vs. :=
PostPosted: Wed May 25, 2022 11:59 pm 
Offline

Joined: Sat Dec 30, 2017 3:19 pm
Posts: 116
Location: Detroit, Michigan, USA
drogon wrote:
If you want symbols to be global over several files, then use := else use =

Hmm, except it seems you can still export symbols even with defined with "=". In my monitor code, I have this in one file:
Code:
.export IBUFFSZ

IBUFFSZ = 256

and I am able to import and use that just fine. Honestly when I wrote it that way I didn't expect it to work, but it does, so I just left it alone.

In general I just tend to declare constants with "=" and actual addresses/symbols with ":=", but I think that's mostly just a personal thing for me and I'm not sure it really makes a difference.


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

All times are UTC


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: