用汇编语言怎么实现16位的乘除法,例如28H乘以FAH,然后再除以FFH,求大神啊
发布网友
发布时间:2022-04-24 20:56
我来回答
共2个回答
热心网友
时间:2023-10-10 22:10
MD:
MOV A,#28H
MOV B,#0FAH
MUL AB
MOV R2,B
MOV R1,A
MOV B,#0FFH
LCALL DIV16
MOV A,R1
MOV B,R2
RET
;R2:R1/B=R2:R1
DIV16:
MOV R0,#08H
DIV1:
CLR C
MOV A,R1
RLC A
MOV R1,A
MOV A,R2
RLC A
MOV R2,A
CLR C
SUBB A,B
JC DIV2
MOV R2,A
INC R1
DIV2:
DJNZ R0,DIV1
RET
热心网友
时间:2023-10-10 22:10
.com文件格式
code segment
main proc far
assume cs:code,ds:code
org 100h
start:
MOV CX,3
MOV AL,0
MOV BX,OFFSET ADR
NEXT:
MOV DX,[BX]
ROR DX,1
JC L1 ;奇数
INC AL ;偶数
L1:
ADD BX,2
LOOP NEXT
CMP AL,3
JE ALL_0
CMP AL,0
JE ALL_1
MOV AL,0FFh ;有偶有奇
JMP EXIT
ALL_0: ;全偶
MOV AL,1
JMP EXIT
ALL_1: ;全奇
MOV AL,0
EXIT:
MOV FLAG,AL
int 20h
ADR DW 3257H,5891H,0B24H
FLAG DB ?
main endp
code ends
end start