B.2
Special Instructions
This section describes special instructions, other than addressing.
Special Instructions
JMP @A
This instruction moves the address contained in the accumulator (A) to the program counter
(PC) and branches to the new address. This instruction can be used to perform an N option
branch by placing N branch destination addresses in a table and moving the desired address to
the accumulator.
Figure B.2-1 shows an outline of the instruction operation.
MOVW A, PC
This instruction stores the PC contents in the accumulator A. This performs the opposite
operation to "JMP @A". By executing this instruction in the main routine and calling a particular
subroutine, the subroutine can determine whether the contents of A match a predetermined
value. The subroutine can check whether program runaway has occurred by checking whether
or not execution has branched from an expected location.
Figure B.2-2 shows an outline of the instruction operation.
The content of A after executing this instruction is the address of the next instruction (not the
address containing the operation code of this instruction). Accordingly, the value "1234
in A in the example shown in Figure B.2-2 is the address of the next operation code after
"MOVW A, PC".
Figure B.2-1 JMP @A
(Before execution)
1234
H
A
XXXX
H
Old PC
Figure B.2-2 MOVW A, PC
(Before execution)
XXXX
H
A
1234
H
Old PC
APPENDIX B Overview of Instructions
(After execution)
1234
H
A
1234
H
New PC
(After execution)
1234
H
A
1234
New PC
H
" stored
H
313