Download Contents

Transcript
THE INSTRUCTION SET
Memory
M-1
M
M+1
[IXH] [IXL]
two cycles
M+2
M+3
M-1
Memory
M
M+1
M+3
two cycles
IX
IX
[M]
[M+1]
MPU
MPU
(a) stx
M+2
137
M
(b) ldx
M
Figure 6.3 16-bit Store and Load to/from memory operations.
example ldx 0030h seems to say “Load the byte datum in memory in
0030h into the 2-byte address register”. What really happens is shown in
Fig. 6.3(a) where the two bytes in memory at 0030h and 0031h are actually
copied although only the address 0030h was specified in the instruction.
As the Data bus is only eight bits wide it actually takes two Read cycles
to bring down down the full 16 bits (actually the high byte at 0030h is
read first followed immediately by the byte datum at 0031h — but this
is invisable to the programmer). Similarily when storing data from an
address register the lower address (that is for the most significant datum
byte) is specified. For example stx 0032h actually copies the contents of
the Index register IXH:IXL into 0032:3h, as shown in Fig. 6.3(b).
Flag instructions
Finally Table 6.8 shows a few instructions that can be used to directly set
or clear the C (sec and clc) and V (sev and clv) flags. It is also possible
to set and clear the I mask bit using sei and cli instructions to inhibit
and permit maskable interrupts (see page ??). All the flags/mask can be
simultaneously primed by copying the byte in Accumulator A into the
Code Condition register by using the (puzzling mnemoniced) tap (Transfer A to ??) instruction. In a similar manner the CCR can be transferred
to Accumulator A for futher examination using tpa.