System time to take a simple applet


code segment
assume cs: code
start:
mov ah, 2ch; 2ch No. function calls, access the system time: ch, cl, dh minutes and seconds, respectively, when stored
int 21h
call disptime; call disptime subroutine display time
exit:
mov ax, 4c00h; end of the program, return to DOS
int 21h

disptime proc
mov al, ch; hour value assigned to al
cbw; al extended to ax, used as a division of the dividend
call bindec
mov dl ,'':''; Show ":"
mov ah, 02h
int 21h
mov al, cl; points
cbw
call bindec
mov dl ,'':''; Show ":"
mov ah, 02h
int 21h
mov al, dh; seconds
cbw
call bindec
ret
disptime endp

bindec proc
push ax; save register values (must be a)
push cx
push dx
mov dx, 0; dividend high position 0 16
mov cx, 10d; divisor for the 10d
div cx
mov bx, dx; first save the remainder
mov dl, al; show business (ie decimal digit of 10)
add dl, 30h; converted into Ascii code
mov ah, 02h; 2 Feature will call to show character (10)
int 21h
mov dx, bx; to restore the balance of the value (decimal 2-digit digit)
add dl, 30h; converted into ASCII code
mov ah, 02h; 2 Feature will call to show character (a bit)
int 21h
pop dx; to restore the value of register
pop cx
pop ax
ret; subroutine return
bindec endp
code ends
end start