用汇编编写两数相乘

data segment
data1 db 32h,39h,30h,34h
data2 db 33h
result db 6 dup(00)
data ends


stack segment
sta db 20 dup(?)
top equ length sta
stack ends

code segment
assume cs:code,ds:data,ss:stack,es:data
start:
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov ax,top
mov sp,ax
mov si,offset data2
mov bl,[si]
and bl,00001111b
mov si,offset data1
mov di,offset result
mov cs,05
loop1:mov al,[si]
and al,00001111b
inc si
mul bl
aam
add al,[di]
aaa
mov [di],al
inc di
mov [di],ah
loop loop1
mov cx,06
mov si,offset result+5
displ:mov ah,02
mov dl,[si]
add dl,30h
int 21h
dec si
loop displ
mov ax,4c00h
int 21h
code ends
end start
 

你可能感兴趣的:(用汇编编写两数相乘)