First page Back Continue Last page Overview Graphics
Data Transfer Instructions: LDAA
LDAA Load Accumulator A
- LDAA #$32 ;LDAA is the mnemonic for the
- ;machine code in computer memory, which is
- 86 ;opcode
- 32 ;operand
- After the execution of this instruction, what is the value in accumulator A in hex, binary and decimal?
- Answer 32 hex, 0011 0010 binary, 50 decimal
- Write the instruction to load a 2F hex into accumulator A. Answer LDAA #$2F
An op-code of 86 hex tells the computer that a data transfer instruction is to be executed, namely one that moves the contents of the next byte of memory to the A register. After this instruction executes, the A register contains the value 32 hex.
The “#” indicates immediate addressing and, accordingly, the assembler generates machine code for an immediate addressing instruction. With immediate mode addressing, data is moved directly from the operand of the instruction to the destination register (in this case register A). We'll introduce other addressing modes later in this lecture. The operand stored in code memory is loaded into register A when this instruction executes. It is very easy to forget the # sign when using this addressing mode. Failure to include the # sign when necessary will result in a program that does not perform as expected.
The “$” indicates that the 32 is a hexadecimal number. Decimal is the default base. LDAA #32 would load a 32 decimal (20 hex) into register A.
“LDAA” is a mnemonic (memory device) that is easier to remember than the hexadecimal opcode “86” for this instruction. A software program called an assembler converts the assembly code (mnemonics) to machine code.