Reputation: 81
I'm new to 6502 assembly programming and I'm using cc65
suite (with C64 being the target). The official documentation indicates that "The assembler accepts the standard 6502/65816 assembler syntax"
however I have a hard time finding an authoritative reference. One thing I don't understand is the difference between the two assignment (?) operators in 6502 assembly "="
and ":="
.
For instance in the file "c64.inc" we find
BASIC_BUF := $200 ; Location of command-line
BASIC_BUF_LEN = 89 ; Maximum length of command-line
Upvotes: 4
Views: 245
Reputation: 81
As @JoachimPileborg points out the cc65
documentation does explain it. The first operator =
creates a symbol and assigns a given value to it. The second operator :=
also makes the symbol a label. The names and values of labels are exported as a part of debug information by the compiler (with the -g
option), which is not the case with regular symbols. Consequently, it makes sense to use :=
to define memory locations and =
for other purposes.
Upvotes: 4
Reputation: 6388
:=
declares and assigns,=
just assigns
:=
is a short form for declaration and initialization. wheres =
is an assignment operator, used in the same way as another programming language.
x := 12
y := "value"
x
is declared as int
and initialized with value 12
where y
is declared as string
and initialized with the value value
var x = 12
var y = "value"
Upvotes: 2