[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

You should really try to learn to "think" in hexadecimal. It's not too difficult, because you don't have to think about converting it back into decimal. For example, if you said that a particular value is stored at $14ED instead of 5357, it shouldn't make any difference.

YOUR FIRST MACHINE LANGUAGE INSTRUCTION

LDA - LOAD THE ACCUMULATOR

In 6510 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 you try to assemble something that either the assembler, or the 6510 microprocessor, cannot do.

If you put a "#" symbol in front of the parameter associated with the instruction, this means that you want the register specified in the instruction to be loaded with the "value" after the "#". For example:

   LDA #$05  <----[ $=HEX ]

This instruction will put $05 (decimal 5) into the accumulator register. The assembler will put into the specified address for this instruction, $A9 (which is the token for this particular instruction, in this mode), and it will put $05 into the next location after the location containing the instruction ($A9).

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, let's compare this with another mode:

If you want to put the contents of memory location $102E into the accumulator, you're using the "absolute" mode of instruction:

   LDA $102E

The assembler can distinguish between the two different modes because the latter does not have a "#" before the parameter. The 6510 microprocessor


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated July 10, 2002.