实验10.3
自己写的作业,还是有多余的代码,慢慢来吧。assume cs:code
data segment
db 10 dup(0)
data ends
code segment
start:
mov ax,12666
mov bx,data
mov ds,bx
mov si,0
call dtoc
mov dh,8
mov dl,3
mov cl,2
call show_str
mov ax,4c00h
int 21h
dtoc:
push cx
push ax
push bx
push si
push dx
s0: ;得到每位的值
mov cx,ax
jcxz input
mov dx,0
mov bx,10
div bx
mov bx,ax
add dx,30h
mov ax,dx
push ax
mov ax,bx
inc si
jmp s0
input:
mov cx,si
mov si,0
s1: ;将数值写入数据段
pop ax
mov ,al
inc si
loop s1
mov dl,0
mov ,dl
pop dx
pop si
pop bx
pop ax
pop cx
ret
show_str:
push cx
push si
push es
push dx
mov al,160
mul dh
mov bx,ax
mov al,2
mul dl
add bx,ax
mov ax,0b800h
mov es,ax
mov al,cl
mov cl,0
s:
mov ch,
jcxz ok
mov es:,
mov es:,cl
add bx,2
inc si
jmp s
ok: pop dx
pop es
pop si
pop cx
ret
code ends
end start
页:
[1]