实验10.3
assume cs:codedata 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:mov ds:,ax
ret
show_str:mov al,160
mul dh
mov ds:,ax
mov al,2
mul dl
add ax,ds:
mov bx,ax
mov ds:,cl
mov ch,0
s:mov al,ds:
mov ah,0
mov byte ptr ds:,10
div byte ptr ds:
mov ds:,al ;商暂存ds:
mov al,ds:
div byte ptr ds:
mov cl,ah ;余数在cl中
jcxz ok
mov ah,ds: ;商在ax中
mov ds:,ax
push cx
inc byte ptr ds:
jmp short s
ok:mov ax,0b800h
mov es,ax
mov dl,ds:
s2:pop ax
add al,30h
mov es:,al
mov es:,dl
add bx,2
sub byte ptr ds:,1
mov cl,ds:
jcxz ook
jmp short s2
ook:ret
code ends
end star
页:
[1]