实验10遇到的问题
本帖最后由 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:,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:
mov byte ptr es:,ah
mov byte ptr es:,al
inc si
add di,2
mov ch,0
mov cl,ds:
jcxz OK
jmp short s0
OK:ret
code ends
end start
用栈 栈的储存方式是先进后出 先用栈PUSH在POP 还不懂 复习一下栈 将ascii码放在寄存器低位,将属性放在高位 压栈, 出栈后传送至显示存储区
页:
[1]