home *** CD-ROM | disk | FTP | other *** search
-
- procedure getdate(var year:integer;
- var month,date,hour,min:byte);
-
- type
- mday = array[1..12] of byte;
- var
- i,ndays: integer;
- const
- nday : mday = (31,28,31,30,31,30,31,31,30,31,30,31);
- begin
- begin
- inline
- ( $b4/$2a/ { mov ah,2a }
- $cd/$21/ { int 21h dos interrupt 2a }
- $1e/ { push DS save ds}
- $85/$5e/$16/ { mov ds,[bp+16] load segment year}
- $8b/$5e/$14/ { mov bx,[bp+14] load offset year}
- $89/$0f/ { mov [bx],cx put cx into year}
- $85/$5e/$12/ { mov ds,[bp+12] load segment month}
- $8b/$5e/$10/ { mov bx,[bp+10] load offset month}
- $88/$37/ { mov [bx],dh put dh into month}
- $85/$5e/$0e/ { mov ds,[bp+0e] load segment date}
- $8b/$5e/$0c/ { mov bx,[bp+0c] load offset date}
- $88/$17/ { mov [bx],dl put al into date}
-
- $b4/$2c/ { mov ah,2c}
- $cd/$21/ { int 21h dos interrupt 2c }
- $85/$5e/$0a/ { mov ds,[bp+0a] load segment hour}
- $8b/$5e/$08/ { mov bx,[bp+08] load offset hour}
- $88/$2f/ { mov [bx],ch put dh into hour}
- $85/$5e/$06/ { mov ds,[bp+06] load segment min}
- $8b/$5e/$04/ { mov bx,[bp+04] load offset min}
- $88/$0f/ { mov [bx],cl put al into min}
- $1f { pop DS restore ds}
- )
- end;
-
- { get day of week }
-
- { ndays:=date;
- for i:=1 to month-1 do
- ndays:=ndays+nday[i];
- if (month >= 3) then if (year mod 4 = 0 ) then
- if ((year mod 100 <>0) or (year mod 400 =0)) then ndays := ndays+1;
- ndays:=ndays+trunc(365.25*(year-1901));
- day:=( (ndays+2) mod 7 ) + 1;
- }
- { writeln('Date is ',year,month:4,date:4,hour:5,':',min:2,day:7);}
- year:=year { -1900 } ;
- end;