|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 daya48 于 2012-1-8 16:18 编辑
运行结果显示'66621',想半天没想到怎样实现反过来.
assume cs:code,ds:data,ss:stack
data segment
db 16 dup(0)
data ends
stack segment
dw 8 dup(0)
stack ends
code segment
start: mov ax,data
mov ds,ax
mov ax,12666
mov dx,0
mov cx,10
mov bp,0
s1: push cx
call divdw
add cl,30h
mov ds:[bp],cl
mov cx,ax
jcxz s2
inc bp
pop cx
jmp near ptr s1
s2: mov dh,12
mov dl,64
mov cl,74h
call show_str
mov ax,4c00h
int 21h
divdw: mov si,ax
mov di,dx
mov ax,dx
mov dx,0
div cx
mov bx,ax
mov ax,si
div cx
mov cx,dx
mov dx,bx
ret
show_str: mov ax,0b800h
mov es,ax
mov al,dh
mov ah,160
mul ah
mov bx,ax
mov al,dl
mov ah,0
mov di,ax
mov al,cl
mov si,0
s0: mov ah,ds:[si]
mov byte ptr es:[bx+di],ah
mov byte ptr es:[bx+di+1],al
inc si
add di,2
mov ch,0
mov cl,ds:[si]
jcxz OK
jmp short s0
OK: ret
code ends
end start
|
|