[comp.sys.ibm.pc] Turbo Pascal 3.0 Question

spectre@cisunx.UUCP (Robert Sillett) (07/01/88)

Hello Netland.

I am trying to read the date from DOS into Turbo Pascal 3.0.  
Turbo's manual gives me excellent instructions to read in the
time, but for other DOS calls it tells me to check the IBM
reference manual.  Well, I neither have an IBM or said manual.

Can anyone be of help?

Thanks in advance.


-- 
Robert L. Sillett, Jr.                      spectre@cisunx
University of Pittsburgh                    spectre@pittvms.BITNET
"Don't ask me -- I only work here."         ...!pitt!cisunx!spectre

swillett@violet.berkeley.edu (07/07/88)

DOS function 2AH (42 decimal) returns the system date.  This is
accessed through interrupt 21H (33 decimal) which Turbo Pascal
gives you access to.  Set up the registers with 2AH in the AH
register and execute interrupt 21H.  You will get back:

          Register     Contents
             AL        Day of the week (0=SUN, 6=SAT)
             CX        Year (1980-2099)
             DH        Month (1-12)
             DL        Day (1-31)

madd@bu-cs.BU.EDU (Jim Frost) (07/08/88)

In article <11757@agate.BERKELEY.EDU> swillett@violet.berkeley.edu writes:
[how to call the MS-DOS getdate function]

The Turbo Pascal 3.0 way to do it is:

type registers = record
  ax,bx,cx,dx,bp,si,di,ds,es,flags : integer
end;

procedure getdate(var year,month,day,weekday : integer);
var r : registers;
begin
  r.ax:= $2A00;
  msdos(r);
  year:= cx;
  month:= hi(dx);
  day:= lo(dx);
  weekday:= lo(ax);
end;

jim frost
madd@bu-it.bu.edu