Commodore VIC-20 Programmer's Reference Manual page 146

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

I
YOUR
FIRST
MACHINE
LANGUAGE
INSTRUCTION
"LDA"—Load the Accumulator
In 6502 assembly language, mnemonics are always three
characters. LDA represents "load accumulator with. . .", and what
the
accumulator should
be loaded with
is decided
by the
parameter(s) associated with that instruction. The assembler
knows which token is represented by each mnemonic, and when it
"assembles" an instruction, it simply puts into memory (at whatever
address has been specified), the token and what parameters are
given. Some assemblers give error messages, or warnings when
the user has tried to assemble something that either the assembler
or the 6502 microprocessor cannot do.
If we put a "#" symbol in front of the parameter associated with
the instruction, this means that we wish the register specified in the
instruction to be loaded with the "value" after the "#". For
exam pie:—
LDA #$05
This instruction will put $05 (decimal 5) into the accumulator
register. The assembler will put into the specified address for this
instruction, SA9 (which is the token for this particular instruction, in
this mode), and it will put $05 into the next location after ihe location
containing the instruction (SA9).
If the parameter to be used by an instruction has "#" before it,
i.e., the parameter is a "value." rather than the contents of a
memory location, or another register, the instruction is said to be in
the "immediate" mode. To put this into perspective, le! us compare
this with another mode.
If we want to put the contents of memory location 5102E into the
accumulator, we are using the "absolute" mode of instruction:
LDA S102E
The assembler can distinguish between the two different modes
because the latter does not have a "#" before the parameter. The
6502 microprocessor can distinguish between the immediate
mode and the absolute mode of the LDA instruction because they
have slightly different tokens. LDA (immediate) has $A9 (as stated
previously), and LDA (absolute) has SAD.
The mnemonic representing an instruction usually implies what it
does. For instance, if we consider another instruction, "LDX," what
do you think this does?
Ifyou said "load theXregisterwith. . .".gotothetopoftheclass.
130
1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents