求一汇编程序
来源:百度知道 编辑:UC知道 时间:2024/07/02 07:35:27
要求用汇编实现输入两个十进制数比较大小并输出大数的二进制代码,程序执行时显示
please input the first number
please input the second number
the max number is
X86的PC
please input the first number
please input the second number
the max number is
X86的PC
data segment
a db 13,10,'please input first number:','$'
b db 13,10,'please input second number:','$'
c1 db 13,10,'the max number is:','$'
org 1000h
x db ?
y db ?
buff db 10,0,10 dup (0)
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov ah,09h
mov dx,offset a
int 21h
mov si,offset x
call inputnum
mov ah,09h
mov dx,offset b
int 21h
mov si,offset y
call inputnum
lea dx,c1
mov ah,09h
int 21h
mov dl,y
mov bl,x
cmp bl,dl
mov al,y ;暂设y 大
jb l1
mov al,x
l1:
MOV BL,AL
;以下输出bl
MOV AX,8
KK2:
PUSH AX
MOV CX,1
MOV DL,31H
RCL BL,CL
JC DISP
MOV DL,30H
DISP:
mov ah,02h
INT 21H
POP AX
DEC AX
JNZ KK2
int 3
MOV AH,4CH
INT 21H
i