Chapter
1
I
System
Calls
GetDate
Get Date Function Call
2AH
Returns the current date set in the operating system. The
date is returned as binary numbers.
En try Conditions:
AH
=
2AH
Exit Conditions:
CX
=
year (1980-2099)
DH
=
month
(1
=
January,
2
=
February, etc.)
DL
=
day
of
the month (1-31)
AL
=day
of
the week
(0
=
Sunday,
1
=
Monday,
etc.)
Macro
Definition:
get-date macro
mov ah,2AH
int
21
H
endm
Example:
The following program gets the date, increments the day,
increments the month or year, if necessary, and sets the
new date.
month db
31
,28,31 ,38,31 ,38,31 ,31 ,30,31 ,30,31
func-2AH: get-date
inc
xor
mov
dec
CmP
1'e
mov
inc
CmP
mov
inc
J'e
month-ok: set-date
dl
bx, bx
bl
.dh
bx
dl,month[bxl
mont h-o
k
dl,l
dh
dh,l2
mon
t
h-o
k
dh,
1
cx,dh,dl
cx
;see above
;increment day
;so
EL
can be used
as
;index
;move month
to
index
:register
;month
table
5tarts
with
0
;past
end
of
month?
;no, set the new date
;ye5, 5et day
to
1
;and increment month
;pa5t
end
of
year?
;no, 5et the new date
;yes, set the month to
1
;increment year
;see Function 2BH
85