APPLICATION EXAMPLES
2 BYTE
PROCESSING SYSTEM
A suggested model
of
a processing routine
takes two single byte inputs from different
ports, compares them, and performs the
following, depending on the result of the
comparison:
(If Equal) Sets Flag and Exits
(If
Not
Equal) and Outputs the Larger
to
a
Third Port
INPUT FIRST OPERAND
INPUT SECOND OPERAND
PROCESS: CLR
IN
MOV
IN
MOV
CPL
INC
ADD
JZ
JNC
MOV
OUTL
JMP
SECOND: MOV
OUTL
JMP
EQUL: CPL
JMP
FO
A,P1
RO,A
A,P2
R1,A
A
A
A,RO
NOT EQUAL
;CLEAR
FO
BIT (INITIALIZE)
;READ FIRST INPUT, STORE IN
RO
;READ SECOND INPUT, STORE IN
R1
;SUBTRACT SECOND FROM FIRST
;(2's COMPLEMENT AND ADD)
EQUL ;BRANCH
IF THEY ARE EQUAL
SECOND ;IF NEGATIVE, SECOND WAS LARGER
A,RO
;ELSE,
OUTPUT
FIRST
BUS,A
DONE
A,R1
BUS,A
DONE
FO
DONE
;EXIT
;OUTPUT SECOND
;EXIT
;SET
FO
;EXIT
5·25