编写程序计算(A+B*10-D)/C,其中A、B、C、D均为已定义的有符号双字变量,要求商和余数分别存入变量X和Y中用汇编语言编写
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/07 16:55:45
编写程序计算(A+B*10-D)/C,其中A、B、C、D均为已定义的有符号双字变量,要求商和余数分别存入变量X和Y中用汇编语言编写
编写程序计算(A+B*10-D)/C,其中A、B、C、D均为已定义的有符号双字变量,要求商和余数分别存入变量X和Y中
用汇编语言编写
编写程序计算(A+B*10-D)/C,其中A、B、C、D均为已定义的有符号双字变量,要求商和余数分别存入变量X和Y中用汇编语言编写
DATA SEGMENT
A1\x05DW\x0510\x05;双字变量A的低16位
A2\x05DW\x050\x05;双字变量A的高16位
B1\x05DW\x0510\x05;双字变量B的低16位
B2\x05DW\x050\x05;双字变量B的高16位
C\x05DW\x053
D1\x05DW\x0510\x05;双字变量D的低16位
D2\x05DW\x050\x05;双字变量D的高16位
X\x05DW\x050
Y\x05DW\x050
Z\x05DW\x0510
M\x05DB\x051 DUP('X')
N\x05DB\x051 DUP('Y')
K\x05DB\x051 DUP('=')
STR\x05DB 16 DUP(?)
DATA\x05ENDS
STACK\x05SEGMENT\x05STACK
\x05DB\x05200\x05DUP(0)
STACK\x05ENDS
CODE\x05SEGMENT
\x05ASSUME DS:DATA,SS:STACK,CS:CODE
START:\x05MOV\x05AX,DATA
\x05MOV\x05DS,AX
\x05MOV\x05AX,B1
\x05IMUL\x05Z
\x05MOV\x05CX,AX
\x05MOV\x05BX,DX
\x05MOV\x05AX,B2
\x05IMUL\x05Z
\x05ADD\x05BX,AX
\x05MOV\x05AX,A1
\x05MOV\x05DX,A2
\x05ADD\x05CX,AX
\x05ADC\x05BX,DX
\x05MOV\x05AX,D1
\x05MOV\x05DX,D2
\x05SUB\x05CX,AX
\x05SBB\x05BX,DX
\x05MOV\x05AX,CX
\x05MOV\x05DX,BX
\x05IDIV\x05C
\x05MOV\x05X,AX
\x05MOV\x05Y,DX
\x05LEA\x05DI,STR
\x05MOV\x05BYTE\x05PTR [DI],'X'
\x05INC\x05DI
\x05MOV\x05BYTE\x05PTR [DI],'='
\x05INC \x05DI
\x05MOV\x05AX,X
\x05MOV\x05CL,4
\x05SHR\x05AH,CL
\x05OR\x05AH,30H
\x05
\x05CMP\x05AH,3Ah\x05
\x05JB\x05BELOW1\x05
\x05ADD\x05AH,07H
BELOW1:\x05ADD\x05AH,00H
\x05
\x05MOV\x05[DI],AH
\x05INC\x05DI
\x05MOV\x05AX,X
\x05AND\x05AH,0FH
\x05OR\x05AH,30H
\x05CMP\x05AH,3Ah\x05
\x05JB\x05BELOW2\x05
\x05ADD\x05AH,07H
BELOW2:\x05ADD\x05AH,00H
\x05
\x05MOV\x05[DI],AH
\x05INC\x05DI
\x05
\x05
\x05MOV\x05AX,X
\x05MOV\x05CL,4
\x05SHR\x05AL,CL
\x05OR\x05AL,30H
\x05
\x05CMP\x05AL,3Ah\x05
\x05JB\x05BELOW3\x05
\x05ADD\x05AL,07H
BELOW3:\x05ADD\x05AL,00H
\x05
\x05MOV\x05[DI],AL
\x05INC\x05DI
\x05MOV\x05AX,X
\x05AND\x05AL,0FH
\x05OR\x05AL,30H
\x05CMP\x05AL,3Ah\x05
\x05JB\x05BELOW4\x05
\x05ADD\x05AL,07H
BELOW4:\x05ADD\x05AL,00H
\x05
\x05MOV\x05[DI],AL
\x05INC\x05DI
\x05MOV\x05BYTE\x05PTR [DI],'H'
\x05INC\x05DI
\x05MOV\x05BYTE\x05PTR [DI],','
\x05INC\x05DI
\x05MOV\x05BYTE\x05PTR [DI],'Y'
\x05INC\x05DI
\x05MOV\x05BYTE\x05PTR [DI],'='
\x05INC \x05DI
\x05MOV\x05AX,Y
\x05MOV\x05CL,4
\x05SHR\x05AH,CL
\x05OR\x05AH,30H
\x05
\x05CMP\x05AH,3Ah\x05
\x05JB\x05BELOW5\x05
\x05ADD\x05AH,07H
BELOW5:\x05ADD\x05AH,00H
\x05
\x05MOV\x05[DI],AH
\x05INC\x05DI
\x05MOV\x05AX,Y
\x05AND\x05AH,0FH
\x05OR\x05AH,30H
\x05CMP\x05AH,3Ah\x05
\x05JB\x05BELOW6\x05
\x05ADD\x05AH,07H
BELOW6:\x05ADD\x05AH,00H
\x05
\x05MOV\x05[DI],AH
\x05INC\x05DI
\x05MOV\x05AX,Y
\x05MOV\x05CL,4
\x05SHR\x05AL,CL
\x05OR\x05AL,30H
\x05
\x05CMP\x05AL,3Ah\x05
\x05JB\x05BELOW7\x05
\x05ADD\x05AL,07H
BELOW7:\x05ADD\x05AL,00H
\x05
\x05MOV\x05[DI],AL
\x05INC\x05DI
\x05MOV\x05AX,Y
\x05AND\x05AL,0FH
\x05OR\x05AL,30H
\x05CMP\x05AL,3Ah\x05
\x05JB\x05BELOW8\x05
\x05ADD\x05AL,07H
BELOW8:\x05ADD\x05AL,00H
\x05
\x05MOV\x05[DI],AL
\x05
\x05
\x05INC\x05DI
\x05MOV\x05BYTE\x05PTR [DI],'H'
\x05INC\x05DI
\x05MOV\x05BYTE\x05PTR [DI],'$'
\x05LEA\x05DX,STR
\x05MOV\x05AH,9
\x05INT\x0521H
\x05MOV\x05AH,4CH
\x05INT\x0521H
CODE\x05ENDS
\x05END START