pier@ur-univax.UUCP (05/30/85)
The following is a set of 2 Pascal procedures written in Turbo Pascal that
get the date and time.
I hope you have Turbo Pascal though. If you don't have it you can always
figure out what these Pascal procedures do and write them in assembler.
The intr procedure is the interrupt procedure built in Turbo. It is used here
to call the DOS function (int 21H) with the function number in register AH.
Hope this is of use.
-------------------------------------------------------------------------------
type datetimetype = string[8];
regtype = record
ax,bx,cx,dx,bp,si,di,ds,es,flags: integer;
end;
function date :datetimetype;
var reg :regtype;
y,m,d,w :datetimetype;
i :integer;
begin
reg.ax:=$2A00;
intr($21,reg);
str(reg.cx,y);
delete(y,1,2);
str(hi(reg.dx):2,m);
str(lo(reg.dx):2,d);
w:=m+'/'+d+'/'+y;
for i:=1 to length(w) do if w[i] = ' ' then w[i]:='0';
date:=w;
end;
function time :datetimetype;
var reg :regtype;
h,m,s,w :datetimetype;
i :integer;
begin
reg.ax:=$2C00;
intr($21,reg);
str(hi(reg.cx):2,h);
str(lo(reg.cx):2,m);
str(hi(reg.dx):2,s);
w:=h+':'+m+':'+s;
for i:=1 to length(w) do if w[i] = ' ' then w[i]:='0';
time:=w;
end;
-------------------------------------------------------------------------------
Pierre Darmon
University of Rochester