just to get some facts across:
When you are working with a symbolic (cross-)assembler, those symbols being assigned to a value are only relevant at assemble time (i.e., when the assembler builds your program), not at run time (i.e. when your assembled program actually runs on the computer).bkumanchik wrote:Isn't that how you declare a constant, not a variable?
During assembly, the symbols get replaced by their actual values they have at that exact point and instruction they are referenced. The instruction then derives its operand from that value. If you change the value of a symbol by a re-assignment, all assembled instructions above will reference the value before that change, and all instructions below will reference the updated value. The re-assignment itself does not result in any code - as said above, this is an assemble time only thing.
Finally, the CPU itself knows nothing about symbols. It only sees a stream of instruction operation codes either:
- with implicit addressing - i.e. the operand is implicit from the opcode already -, or
- with 1 following byte - either a 1 byte immediate value, a zero page (base) address, or the offset of a branch instruction -, or
- with 2 following bytes - a 16 bit (base) address.
Greetings,
Michael