Hardware Reference
In-Depth Information
Load Instructions
Mnemonic
Function
Operation
A
[opr]
LDAA <opr>
Load A
B
[opr]
LDAB <opr>
Load B
A:B
[opr]:[opr+1]
LDD <opr>
Load D
SP
[opr]:[opr+1]
LDS <opr>
Load SP
LDX <opr>
Load index register X
X
[opr]:[opr+1]
LDY <opr>
Load index register Y
Y
[opr]:[opr+1]
LEAS <opr>
Load effective address into SP
SP
effective address
LEAX <opr>
Load effective address into X
X
effective address
LEAY <opr>
Load efective address into Y
Y effective address
Store Instructions
Mnemonic
Function
Operation
m[opr]
[A]
STAA <opr>
Store A in a memory location
m[opr]
[B]
STAB <opr>
Store B in a memory location
m[opr]:m[opr+1]
[A]:[B]
STD <opr>
Store D in a memory location
STS <opr>
Store SP in a memory location
m[opr]:m[opr+1]
[SP]
STX <opr>
Store X in a memory location
m[opr]:m[opr+1]
[X]
STY <opr>
Store Y in a memory location
m[opr]:m[opr+1]
[Y]
Table 1.5 Load and store instructions
The following instruction stores the contents of index register X in memory locations at $8000
and $8001:
stx $8000
When dealing with a complex data structure such as a record, we often use an index
register or the stack pointer to point to the beginning of the data structure and use the indexed
addressing mode to access the elements of the data structure. For example, a record contains
the following four fields:
ID number (unit none , size 4 bytes)
Height (unit inch , size 1 byte)
Weight (unit pound , size 2 bytes)
Age (unit year , size 1 byte)
Suppose this record is stored in memory starting at $6000. Then we can use the following in-
struction sequence to access the weight fi eld:
ldx
#$6000
; set X to point to the beginning of data structure
ldd
5, X
; copy weight into D
1.11.2 Transfer and Exchange Instructions
A summary of transfer and exchange instructions is displayed in Table 1.6. Transfer instructions
copy the contents of a register or accumulator into another register or accumulator. Source
content is not changed by the operation. TFR is a universal transfer instruction, but other
 
Search WWH ::




Custom Search