MOV R6,R5
ADDC A, R3
MOV R7, A
RET
c. 双字节求补程序CPL1
CPL1: MOV A, R2
CPL A
ADD A, #01H
MOV A, R3
CPL A
ADDC A,#00H
MOV R3, A
RET
d. 带符号双字节乘法程序:
带符号双字节乘法流程图:
5.5 带符号双字节乘法流程图:
带符号乘法子程序MULT1:
MOV SIGN1 ,C ;被乘数符号送SIGN1
JNC POS1 ;若被乘数为正,则POS1
MOV A ,R6 ;对R7求补
CPL A
ADD A, #01H
MOV R6, A
MOV A,R7 ;对R4求补
CPL A
ADDC A , #00H
MOV R7, A
POS1: MOV A ,R5
RLC A
MOV SIGN2,C ; 乘数符号送SIGN2
JNC POS2
MOV A ,R4 ;对R4求补
CPL A
ADD A , # 01H
MOV R4, A
MOV A, R5 ;对R5求补
CPL A
ADDC A, #00H
MOV R5, A
POS2: ACALL MULT ;调用无符号程序
MOV C , SIGN1
ANL C , SIGN2
JC TPL ;若是,则TPL
MOV C , SIGN1 ;否则,判两乘数
ORL C, SIGN2
JNC TPL ;若是,则TPL
DEC R0 ;否则,对成绩的高16为求补
MOV A , @R0
CPL A
ADD A , #01H
MOV @R0 , A
INC R0
MOV A , @R0
CPL A
ADDC A , #00H
MOV @R0, A
TPL: RET
SCAN: MOV DPTR,#7FF8H
MOV A,#01H
MOVX @DPTR,A
KEY: ACALL KST
CJNE A,#0FH,KEY1
ACALL DELAY
ANL A,#0FH
CJNE A,#0FH,KEY4
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>