Figure B.2D Divu A; Figure B.2E Xchw A,Pc; Figure B.2F Example Using Xchw A,Pc - Fujitsu F2MC-8L MB89620 Series Hardware Manual

8-bit microcontroller
Table of Contents

Advertisement

l
DIVU A
This instruction divides the 16 bits of T by the 8 bits of AL, treating the data as unsigned. The
instruction stores the result in AL and the remainder in TL, both as 8 bit data. AH and TH are
both set to "zero". The arithmetic operation does not use the value of AH prior to instruction
execution. The result is not assured for data that produces a result that exceeds 8 bits. As there
is no indication that the result exceeded 8 bits, check the data before performing. Since the
flags remain unchanged, use care when branching is required based on the result of the
division.
Figure B.2d shows an outline of the instruction operation.
XCHW A, PC
l
This instruction exchanges the contents of A and PC, and as a result branches to the address
corresponding to contents of A before execution. The contents of A after execution assume the
address next to the address where the operation code of the "XCHW A,PC" is stored. The
instruction can be used to specify a table in the main routine which is used in a subroutine.
Figure B.2e 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 "1235
in A in the example shown in Figure B.2e is the address of the next operation code after "XCHW
A,PC". Therefore, the value of A is "1235
Figure B.2f shows an assembly language example.
(Main routine)
MOVW A,#PUTSUB
XCHW A,PC
DB
MOVW A,1234
278
APPENDIX
(Before execution)
5678
H
A
1862
T
H

Figure B.2d DIVU A

(Before execution)
5678
A
H
PC
1234
H

Figure B.2e XCHW A,PC

'PUT OUT DATA',EOL
H

Figure B.2f Example Using XCHW A,PC

(After execution)
0034
A
0002
T
(After execution)
1235
A
5678
PC
", not "1234
".
H
H
(Subroutine)
PUTSUB XCHW A,EP
PUSHW A
PTS1
MOV A,@EP
INCW EP
MOV IO,A
CMP A,#EOL
BNE PTS1
POPW A
XCHW A,EP
JMP @A
H
H
H
H
" stored
H
Table data
output here.
MB89620 series

Advertisement

Table of Contents
loading

Table of Contents