* SetDate, SetTime corrected

This commit is contained in:
Tomas Hajny 2000-06-05 18:50:55 +00:00
parent 72c8dbfa43
commit 0baf0745bc

View File

@ -279,7 +279,7 @@ procedure setftime(var f;time : longint);
begin begin
if os_mode = osOS2 then if os_mode = osOS2 then
begin begin
{!!! Must be done differently for OS/2 !!!} {TODO!!! Must be done differently for OS/2 !!!}
end end
else else
asm asm
@ -545,19 +545,23 @@ begin
end; end;
end; end;
procedure setdate(year,month,day : word); procedure SetDate (Year, Month, Day: word);
var DT: TDateTime;
begin begin
if os_mode = osOS2 then if os_mode = osOS2 then
begin begin
{TODO: !!! Must be done differently for OS/2 !!!} DosGetDateTime (DT);
DT.Year := Year;
DT.Month := Month;
DT.Day := Day;
DosSetDateTime (DT);
end end
else else
asm asm
movw 8(%ebp),%cx movw Year, %cx
movb 10(%ebp),%dh movb Month, %dh
movb 12(%ebp),%dl movb Day, %dl
movb $0x2b,%ah movb $0x2b, %ah
call syscall call syscall
(* SetDate isn't supposed to change DosError!!! (* SetDate isn't supposed to change DosError!!!
xorb %ah,%ah xorb %ah,%ah
@ -566,43 +570,50 @@ begin
end; end;
end; end;
procedure gettime(var hour,minute,second,sec100:word); procedure GetTime (var Hour, Minute, Second, Sec100: word); assembler;
asm
begin movb $0x2c, %ah
asm call syscall
movb $0x2c,%ah xorb %ah, %ah
call syscall movl Sec100, %edi
xorb %ah,%ah movb %dl, %al
movl 20(%ebp),%edi stosw
movb %dl,%al movl Second, %edi
stosw movb %dh,%al
movl 16(%ebp),%edi stosw
movb %dh,%al movl Minute, %edi
stosw movb %cl,%al
movl 12(%ebp),%edi stosw
movb %cl,%al movl Hour, %edi
stosw movb %ch,%al
movl 8(%ebp),%edi stosw
movb %ch,%al
stosw
end;
end; end;
procedure settime(hour,minute,second,sec100:word); procedure SetTime (Hour, Minute, Second, Sec100: word);
(* TODO: Syscall 58h (__settime) should be used instead!!! *) var DT: TDateTime;
begin begin
asm if os_mode = osOS2 then
movb 8(%ebp),%ch begin
movb 10(%ebp),%cl DosGetDateTime (DT);
movb 12(%ebp),%dh DT.Hour := Hour;
movb 14(%ebp),%dl DT.Minute := Minute;
movb $0x2d,%ah DT.Second := Second;
call syscall DT.Sec100 := Sec100;
DosSetDateTime (DT);
end
else
asm
movb Hour, %ch
movb Minute ,%cl
movb Second, %dh
movb Sec100, %dl
movb $0x2d, %ah
call syscall
(* SetTime isn't supposed to change DosError!!! (* SetTime isn't supposed to change DosError!!!
xorb %ah,%ah xorb %ah, %ah
movw %ax,doserror movw %ax, DosError
*) *)
end; end;
end; end;
procedure getcbreak(var breakvalue:boolean); procedure getcbreak(var breakvalue:boolean);
@ -1183,7 +1194,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.26 2000-06-01 18:38:46 hajny Revision 1.27 2000-06-05 18:50:55 hajny
* SetDate, SetTime corrected
Revision 1.26 2000/06/01 18:38:46 hajny
* warning about SetDate added (TODO) * warning about SetDate added (TODO)
Revision 1.25 2000/05/28 18:20:16 hajny Revision 1.25 2000/05/28 18:20:16 hajny