assume cs:code
data segment
db 10 dup (0)
data ends
stack segment
dw 10 dup (0)
stack ends
code segment
start:mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,20
mov ax,12666
mov si,0
call dtoc
mov dh,8
mov dl,3
mov cl,2
call show-str
mov ax,4c00h
int 21h
dtoc:mov bx,0
s0:mov cx,10d
mov dx,0
div cx
mov cx,ax
jcxz s1
add dx,30h
push dx
inc bx
jmp short s0
s1:add dx,30h
push dx
inc bx
ret
showt-str:
mov [0],cl
mov cx,bx
call adr
s2:pop ax
mov es:[di+si],al
mov bl,[0]
mov es:[di+si+1],bl
add si,2
loop s2
ret
adr:mov ax,0b800h
mov es,ax
mov di,0
mov al,160
dec dh
mul dh
mov di,ax
mov al,2
dec dl
mul dl
add di,ax
ret
code ends
end start |