assume cs:code, ds:data
data segment
sun db 'Sunday, ', '$'
mon db 'Monday, ', '$'
tue db 'Tuesday, ', '$'
wed db 'Wednesday, ', '$'
thu db 'Thursday, ', '$'
fri db 'Friday, ', '$'
sat db 'Saturday, ', '$'
days dw sun, mon, tue, wed, thu, fri, sat
dom db ' -$'
month db ' -$'
year db ' $'
a db 10
data ends
code segment
start:
mov ax, data
mov ds, ax
mov es, ax
mov ah, 2Ah
int 21h
push dx
;print day of the week
mov bl, al
add bl, al
mov ah, 09h
mov dx, days[bx]
int 21h
pop dx
;print day of the month
mov al, dl
mov ah, 0
div a
lea di, dom
add al, '0'
stosb
xchg ah, al
add al, '0'
stosb
push dx
mov ah, 09h
mov dx, 0
mov dl, offset dom
int 21h
pop dx
;print month
mov al, dh
mov ah, 0
div a
lea di, month
add al, '0'
stosb
xchg al, ah
add al, '0'
stosb
mov ah, 09h
mov dx, 0
mov dl, offset month
int 21h
;print year
mov dx, cx
mov ax, dx
mov cx, 0
mov cx, 4
lea di, year
yearX:
div a
xchg al, ah
add al, '0'
stosb
xchg al, ah
mov ah, 0
loop yearX
mov ax, 4C00h
int 21h
code ends
end start