print macro msg
lea dx,msg
mov ah,09h
int 21h
endm
.model small
.stack 100h
.data
msg1 db 10,13,'DATE(DD/MM/YYYY): $'
msg2 db '/$'
msg3 db 10,13,'TIME: $'
msg4 db ':$'
day db 0
month db 0
year dw 0
sec db 0
min db 0
hour db 0
.code
main proc
mov ax,@data
mov ds,ax
mov ah,2ah
int 21h
mov day,dl
mov month,dh
mov year,cx
; AL = day of week(00h=Sunday)
print msg1
xor ax,ax
mov al,day
call printmul
print msg2
xor ax,ax
mov al,month
call printmul
print msg2
mov ax,year
call printmul
mov ah,2ch
int 21h
mov sec,dh
mov min,cl
mov hour,ch
;DL = 1/100 seconds
print msg3
xor ax,ax
mov al,hour
call printmul
print msg4
xor ax,ax
mov al,min
call printmul
print msg4
xor ax,ax
mov al,sec
call printmul
mov ah,4ch
int 21h
main endp
printmul proc
mov bx,000ah
xor cx,cx
;push into stack
l2:xor dx,dx
div bx
push dx
inc cx
cmp ax,0000h
jne l2
;pop from stack
l3:pop dx
add dl,30h
mov ah,02h
int 21h
loop l3
ret
printmul endp
end
No comments:
Post a Comment