UPI-41A/41AH/42/42AH USER’S MANUAL
CALL address
Subroutine Call
Opcode:
a
10
a
9
a
8
1
0 1 0 0
#
a
7
a
6
a
5
a
4
a
3
a
2
a
1
a
0
This is a 2-cycle instruction. The program counter and PSW bits 4 – 7 are saved in the stack.
The stack pointer (PSW bits 0 – 2) is updated. Program control is then passed to the location
specified by ‘address’.
Execution continues at the instruction following the CALL upon return from the subroutine.
((SP))
w
(PC), (PSW
4–7
)
(SP)
w
(SP)
a
1
(PC
8–9
)
w
(addr
8–9
)
(PC
0–7
)
w
(addr
0–7
)
Example:
Add three groups of two numbers. Put subtotals in locations 50, 51 and total in location 52.
MOV R0,
Ý
50
;MOVE ‘50’ DEC TO ADDRESS
;REG 0
BEGADD:
MOV A,R1
;MOVE CONTENTS OF REG 1
;TO ACC
ADD A,R2
;ADD REG 2 TO ACC
CALL SUBTOT
;CALL SUBROUTINE ‘SUBTOT’
ADD A,R3
;ADD REG 3 TO ACC
ADD A,R4
;ADD REG 4 TO ACC
CALL SUBTOT
;CALL SUBROUTINE ‘SUBTOT’
ADD A,R5
;ADD REG 5 TO ACC
ADD A,R6
;ADD REG 6 TO ACC
CALL SUBTOT
;CALL SUBROUTINE ‘SUBTOT’
#
#
#
SUBTOT:
MOV
@
R0,A
;MOVE CONTENTS OF ACC TO
;LOCATION ADDRESSED BY
;REG 0
INC R0
;INCREMENT REG 0
RET
;RETURN TO MAIN PROGRAM
CLR A
Clear Accumulator
Opcode:
0 0 1 0
0 1 1 1
The contents of the accumulator are cleared to zero.
(A)
w
00H
CLR C
Clear Carry Bit
Opcode:
1 0 0 1
0 1 1 1
During normal program execution, the carry bit can be set to one by the ADD, ADDC, RLC,
CPLC, RRC, and DAA instructions. This instruction resets the carry bit to zero.
(C)
w
0
CLR F1
Clear Flag 1
Opcode:
1 0 1 0
0 1 0 1
The F
1
flag is cleared to zero.
(F
1
)
w
0
33