276
APPENDIX
●
XCHW A, PC
This instruction swaps the contents of A and PC, resulting in a branch to the address contained in A before
execution of the instruction. After the instruction is executed, A contains the address that follows the
address of the operation code of MOVW A, PC. This instruction is effective especially when it is used in
the main routine to specify a table for use in a subroutine.
Figure B.3-5 "XCHW A, PC" shows a summary of the instruction.
Figure B.3-5 XCHW A, PC
After the XCHW A, PC instruction is executed, A contains the address of the operation code of the next
instruction, rather than the address of the operation code of XCHW A, PC. Accordingly, Figure B.3-5
"XCHW A, PC" shows that A contains 1235
H
, which is the address of the operation code of the instruction
that follows XCHW A, PC. This is why 1235
H
is stored instead of 1234
H.
Figure B.3-6 "Example of using XCHW A, PC" shows an assembly language example.
Figure B.3-6 Example of using XCHW A, PC
1 2 3 4
H
A
PC
1 2 3 5
H
A
PC
(Before execution)
(After execution)
5 6 7 8
H
5 6 7 8
H
MOVW
XCHW
DB
MOVW
A, #PUTSUB
A, PC
'PUT OUT DATA', EOL
A, 1234
H
(Main routine)
XCHW A, EP
PUSHW A
MOV A, @EP
INCW EP
MOV IO, A
CMP A, #EOL
BNE PTS1
POPW A
XCHW A, EP
JMP @A
PUTSUB
PTS1
(Subroutine)
Output table
data here
Summary of Contents for MB89950 Series
Page 2: ......
Page 3: ...FUJITSU LIMITED F2MC 8L 8 BIT MICROCONTROLLER MB89950 950A Series HARDWARE MANUAL ...
Page 4: ......
Page 10: ...vi ...
Page 34: ...20 CHAPTER 2 HANDLING DEVICES ...
Page 134: ...120 CHAPTER 6 WATCHDOG TIMER ...
Page 236: ...222 CHAPTER 10 UART ...
Page 276: ...262 CHAPTER 12 LCD CONTROLLER DRIVER ...
Page 310: ...296 APPENDIX ...
Page 311: ...297 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Page 316: ...302 INDEX ...
Page 318: ......