* fixes from OS/2 merged to EMX

This commit is contained in:
Tomas Hajny 2003-10-19 09:35:28 +00:00
parent c2a66502f0
commit fc7111ff4b
4 changed files with 134 additions and 239 deletions

View File

@ -131,7 +131,7 @@ function kbdcharin(var Akeyrec:Tkbdkeyinfo;wait,kbdhandle:longint):word; cdecl;
function kbdpeek(var Akeyrec:TkbdkeyInfo;kbdhandle:word):word; cdecl; function kbdpeek(var Akeyrec:TkbdkeyInfo;kbdhandle:word):word; cdecl;
external 'EMXWRAP' index 222; external 'EMXWRAP' index 222;
function dossleep(time:longint):word; cdecl; function dossleep(time:cardinal):cardinal; cdecl;
external 'DOSCALLS' index 229; external 'DOSCALLS' index 229;
function vioscrollup(top,left,bottom,right,lines:longint; function vioscrollup(top,left,bottom,right,lines:longint;
var screl:word;viohandle:longint):word; cdecl; var screl:word;viohandle:longint):word; cdecl;
@ -894,7 +894,10 @@ end.
{ {
$Log$ $Log$
Revision 1.1 2003-03-23 23:11:17 hajny Revision 1.2 2003-10-19 09:35:28 hajny
* fixes from OS/2 merged to EMX
Revision 1.1 2003/03/23 23:11:17 hajny
+ emx target added + emx target added

View File

@ -34,6 +34,7 @@ interface
{Platform specific information} {Platform specific information}
type type
THandle = Longint; THandle = Longint;
const const
LineEnding = #13#10; LineEnding = #13#10;
{ LFNSupport is defined separately below!!! } { LFNSupport is defined separately below!!! }
@ -131,29 +132,30 @@ procedure DosGetInfoBlocks (PATIB: PPThreadInfoBlock;
external 'DOSCALLS' index 312; external 'DOSCALLS' index 312;
function DosLoadModule (ObjName: PChar; ObjLen: cardinal; DLLName: PChar; function DosLoadModule (ObjName: PChar; ObjLen: cardinal; DLLName: PChar;
var Handle: cardinal): longint; cdecl; var Handle: cardinal): cardinal; cdecl;
external 'DOSCALLS' index 318; external 'DOSCALLS' index 318;
function DosQueryProcAddr (Handle, Ordinal: cardinal; ProcName: PChar; function DosQueryProcAddr (Handle, Ordinal: cardinal; ProcName: PChar;
var Address: pointer): longint; cdecl; var Address: pointer): cardinal; cdecl;
external 'DOSCALLS' index 321; external 'DOSCALLS' index 321;
function DosSetRelMaxFH (var ReqCount, CurMaxFH: longint): longint; cdecl; function DosSetRelMaxFH (var ReqCount: longint; var CurMaxFH: cardinal):
cardinal; cdecl;
external 'DOSCALLS' index 382; external 'DOSCALLS' index 382;
function DosSetCurrentDir (Name:PChar): longint; cdecl; function DosSetCurrentDir (Name:PChar): cardinal; cdecl;
external 'DOSCALLS' index 255; external 'DOSCALLS' index 255;
function DosSetDefaultDisk (DiskNum:longint): longint; cdecl; function DosSetDefaultDisk (DiskNum:cardinal): cardinal; cdecl;
external 'DOSCALLS' index 220; external 'DOSCALLS' index 220;
{ This is not real prototype, but is close enough } { This is not real prototype, but is close enough }
{ for us (the 2nd parameter is actually a pointer } { for us (the 2nd parameter is actually a pointer }
{ to a structure). } { to a structure). }
function DosCreateDir( Name : pchar; p : pointer): longint; cdecl; function DosCreateDir (Name: PChar; P: pointer): cardinal; cdecl;
external 'DOSCALLS' index 270; external 'DOSCALLS' index 270;
function DosDeleteDir( Name : pchar) : longint; cdecl; function DosDeleteDir (Name: PChar): cardinal; cdecl;
external 'DOSCALLS' index 226; external 'DOSCALLS' index 226;
{This is the correct way to call external assembler procedures.} {This is the correct way to call external assembler procedures.}
@ -212,13 +214,13 @@ function paramcount:longint;assembler;
asm asm
movl argc,%eax movl argc,%eax
decl %eax decl %eax
end ['EAX']; end {['EAX']};
function args:pointer;assembler; function args:pointer;assembler;
asm asm
movl argv,%eax movl argv,%eax
end ['EAX']; end {['EAX']};
function paramstr(l:longint):string; function paramstr(l:longint):string;
@ -267,7 +269,7 @@ asm
call syscall call syscall
mov word ptr [randseed], cx mov word ptr [randseed], cx
mov word ptr [randseed + 2], dx mov word ptr [randseed + 2], dx
end ['eax', 'ecx', 'edx']; end {['eax', 'ecx', 'edx']};
{$ASMMODE ATT} {$ASMMODE ATT}
@ -292,7 +294,7 @@ begin
{$ENDIF CONTHEAP} {$ENDIF CONTHEAP}
asm asm
movl size,%edx movl size,%edx
movw $0x7f00,%eax movw $0x7f00,%ax
call syscall { result directly in EAX } call syscall { result directly in EAX }
inc %eax { Result in EAX, -1 = error (has to be transformed to 0) } inc %eax { Result in EAX, -1 = error (has to be transformed to 0) }
jz .LSbrk_End jz .LSbrk_End
@ -307,25 +309,25 @@ end;
assembler; assembler;
asm asm
movl size,%edx movl size,%edx
movw $0x7f00,%eax movw $0x7f00,%ax
call syscall call syscall
inc %eax { Result in EAX, -1 = error (has to be transformed to 0) } inc %eax { Result in EAX, -1 = error (has to be transformed to 0) }
jz .LSbrk_End jz .LSbrk_End
dec %eax { No error - back to previous value } dec %eax { No error - back to previous value }
.LSbrk_End: .LSbrk_End:
end ['eax', 'edx']; end {['eax', 'edx']};
{$ENDIF DUMPGROW} {$ENDIF DUMPGROW}
function getheapstart:pointer;assembler; function getheapstart:pointer;assembler;
asm asm
movl heap_base,%eax movl heap_base,%eax
end ['EAX']; end {['EAX']};
function getheapsize:longint;assembler; function getheapsize:longint;assembler;
asm asm
movl heap_brk,%eax movl heap_brk,%eax
end ['EAX']; end {['EAX']};
{$i heap.inc} {$i heap.inc}
@ -398,6 +400,7 @@ end;
function do_read(h,addr,len:longint):longint; assembler; function do_read(h,addr,len:longint):longint; assembler;
asm asm
pushl %ebx
movl len,%ecx movl len,%ecx
movl addr,%edx movl addr,%edx
movl h,%ebx movl h,%ebx
@ -407,10 +410,12 @@ asm
movw %ax,inoutres; movw %ax,inoutres;
xorl %eax,%eax xorl %eax,%eax
.LDOSREAD1: .LDOSREAD1:
end ['eax', 'ebx', 'ecx', 'edx']; popl %ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function do_write(h,addr,len:longint) : longint; assembler; function do_write(h,addr,len:longint) : longint; assembler;
asm asm
pushl %ebx
xorl %eax,%eax xorl %eax,%eax
cmpl $0,len { 0 bytes to write is undefined behavior } cmpl $0,len { 0 bytes to write is undefined behavior }
jz .LDOSWRITE1 jz .LDOSWRITE1
@ -422,10 +427,12 @@ asm
jnc .LDOSWRITE1 jnc .LDOSWRITE1
movw %ax,inoutres; movw %ax,inoutres;
.LDOSWRITE1: .LDOSWRITE1:
end ['eax', 'ebx', 'ecx', 'edx']; popl %ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function do_filepos(handle:longint): longint; assembler; function do_filepos(handle:longint): longint; assembler;
asm asm
pushl %ebx
movw $0x4201,%ax movw $0x4201,%ax
movl handle,%ebx movl handle,%ebx
xorl %edx,%edx xorl %edx,%edx
@ -434,10 +441,12 @@ asm
movw %ax,inoutres; movw %ax,inoutres;
xorl %eax,%eax xorl %eax,%eax
.LDOSFILEPOS: .LDOSFILEPOS:
end ['eax', 'ebx', 'ecx', 'edx']; popl %ebx
end {['eax', 'ebx', 'ecx', 'edx']};
procedure do_seek(handle,pos:longint); assembler; procedure do_seek(handle,pos:longint); assembler;
asm asm
pushl %ebx
movw $0x4200,%ax movw $0x4200,%ax
movl handle,%ebx movl handle,%ebx
movl pos,%edx movl pos,%edx
@ -445,10 +454,12 @@ asm
jnc .LDOSSEEK1 jnc .LDOSSEEK1
movw %ax,inoutres; movw %ax,inoutres;
.LDOSSEEK1: .LDOSSEEK1:
end ['eax', 'ebx', 'ecx', 'edx']; popl %ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function do_seekend(handle:longint):longint; assembler; function do_seekend(handle:longint):longint; assembler;
asm asm
pushl %ebx
movw $0x4202,%ax movw $0x4202,%ax
movl handle,%ebx movl handle,%ebx
xorl %edx,%edx xorl %edx,%edx
@ -457,7 +468,8 @@ asm
movw %ax,inoutres; movw %ax,inoutres;
xorl %eax,%eax xorl %eax,%eax
.Lset_at_end1: .Lset_at_end1:
end ['eax', 'ebx', 'ecx', 'edx']; popl %ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function do_filesize(handle:longint):longint; function do_filesize(handle:longint):longint;
@ -491,12 +503,12 @@ asm
end ['eax', 'ebx', 'ecx', 'edx']; end ['eax', 'ebx', 'ecx', 'edx'];
const const
FileHandleCount: longint = 20; FileHandleCount: cardinal = 20;
function Increase_File_Handle_Count: boolean; function Increase_File_Handle_Count: boolean;
var Err: word; var Err: word;
L1, L2: longint; L1: longint;
begin L2: cardinal;
if os_mode = osOS2 then if os_mode = osOS2 then
begin begin
L1 := 10; L1 := 10;
@ -545,7 +557,7 @@ procedure do_open(var f;p:pchar;flags:longint);
when (flags and $10000) there is no check for close (needed for textfiles) when (flags and $10000) there is no check for close (needed for textfiles)
} }
var Action: longint; var Action: cardinal;
begin begin
allowslash(p); allowslash(p);
@ -603,15 +615,16 @@ begin
cmpl $0xffffffff, %eax cmpl $0xffffffff, %eax
jnz .LOPEN1 jnz .LOPEN1
movw %cx, InOutRes movw %cx, InOutRes
movw UnusedHandle, %ax movl UnusedHandle, %eax
.LOPEN1: .LOPEN1:
movl f,%edx { Warning : This assumes Handle is first } movl f,%edx { Warning : This assumes Handle is first }
movw %ax,(%edx) { field of FileRec } movl %eax,(%edx) { field of FileRec }
popl %ebx popl %ebx
end ['eax', 'ecx', 'edx']; end ['eax', 'ecx', 'edx'];
if (InOutRes = 4) and Increase_File_Handle_Count then if (InOutRes = 4) and Increase_File_Handle_Count then
(* Trying again after increasing amount of file handles *) (* Trying again after increasing amount of file handles *)
asm asm
pushl %ebx
movl $0x7f2b, %eax movl $0x7f2b, %eax
movl Action, %ecx movl Action, %ecx
movl p, %edx movl p, %edx
@ -619,10 +632,11 @@ begin
cmpl $0xffffffff, %eax cmpl $0xffffffff, %eax
jnz .LOPEN2 jnz .LOPEN2
movw %cx, InOutRes movw %cx, InOutRes
movw UnusedHandle, %ax movl UnusedHandle, %eax
.LOPEN2: .LOPEN2:
movl f,%edx movl f,%edx
movw %ax,(%edx) movl %eax,(%edx)
popl %ebx
end ['eax', 'ecx', 'edx']; end ['eax', 'ecx', 'edx'];
{ for systems that have more handles } { for systems that have more handles }
if FileRec (F).Handle > FileHandleCount then if FileRec (F).Handle > FileHandleCount then
@ -658,7 +672,7 @@ asm
dec eax { nope, so result is zero } dec eax { nope, so result is zero }
@IsDevEnd: @IsDevEnd:
pop ebx pop ebx
end ['eax', 'edx']; end {['eax', 'ebx', 'edx']};
{$ASMMODE ATT} {$ASMMODE ATT}
@ -775,7 +789,7 @@ end;
procedure ChDir (const S: string);[IOCheck]; procedure ChDir (const S: string);[IOCheck];
var RC: longint; var RC: cardinal;
Buffer: array [0..255] of char; Buffer: array [0..255] of char;
begin begin
@ -1115,7 +1129,8 @@ end;
function GetFileHandleCount: longint; function GetFileHandleCount: longint;
var L1, L2: longint; var L1: longint;
L2: cardinal;
begin begin
L1 := 0; (* Don't change the amount, just check. *) L1 := 0; (* Don't change the amount, just check. *)
if DosSetRelMaxFH (L1, L2) <> 0 then GetFileHandleCount := 50 if DosSetRelMaxFH (L1, L2) <> 0 then GetFileHandleCount := 50
@ -1248,7 +1263,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.15 2003-10-16 15:43:13 peter Revision 1.16 2003-10-19 09:35:28 hajny
* fixes from OS/2 merged to EMX
Revision 1.15 2003/10/16 15:43:13 peter
* THandle is platform dependent * THandle is platform dependent
Revision 1.14 2003/10/12 18:07:30 hajny Revision 1.14 2003/10/12 18:07:30 hajny

View File

@ -92,44 +92,44 @@ type
{ import the necessary stuff from the OS } { import the necessary stuff from the OS }
function DosAllocThreadLocalMemory (Count: cardinal; var P: pointer): longint; function DosAllocThreadLocalMemory (Count: cardinal; var P: pointer): cardinal;
cdecl; external 'DOSCALLS' index 454; cdecl; external 'DOSCALLS' index 454;
function DosFreeThreadLocalMemory (P: pointer): longint; cdecl; function DosFreeThreadLocalMemory (P: pointer): cardinal; cdecl;
external 'DOSCALLS' index 455; external 'DOSCALLS' index 455;
function DosCreateThread (var TID: longint; Address: pointer; function DosCreateThread (var TID: cardinal; Address: pointer;
(* TThreadFunc *) (* TThreadFunc *)
aParam: pointer; Flags: longint; StackSize: longint): longint; cdecl; aParam: pointer; Flags: cardinal; StackSize: cardinal): cardinal; cdecl;
external 'DOSCALLS' index 311; external 'DOSCALLS' index 311;
procedure DosExit (Action, Result: longint); cdecl; procedure DosExit (Action, Result: cardinal); cdecl;
external 'DOSCALLS' index 234; external 'DOSCALLS' index 234;
function DosCreateMutExSem (Name: PChar; var Handle: longint; Attr: longint; function DosCreateMutExSem (Name: PChar; var Handle: longint; Attr: cardinal;
State: boolean): longint; cdecl; external 'DOSCALLS' index 331; State: boolean): cardinal; cdecl; external 'DOSCALLS' index 331;
function DosCloseMutExSem (Handle: longint): longint; cdecl; function DosCloseMutExSem (Handle: longint): cardinal; cdecl;
external 'DOSCALLS' index 333; external 'DOSCALLS' index 333;
function DosQueryMutExSem (Handle: longint; var PID, TID, Count: longint): function DosQueryMutExSem (Handle: longint; var PID, TID, Count: cardinal):
longint; cdecl; external 'DOSCALLS' index 336; cardinal; cdecl; external 'DOSCALLS' index 336;
function DosRequestMutExSem (Handle, Timeout: longint): longint; cdecl; function DosRequestMutExSem (Handle:longint; Timeout: cardinal): cardinal; cdecl;
external 'DOSCALLS' index 334; external 'DOSCALLS' index 334;
function DosReleaseMutExSem (Handle: longint): longint; cdecl; function DosReleaseMutExSem (Handle: longint): cardinal; cdecl;
external 'DOSCALLS' index 335; external 'DOSCALLS' index 335;
function DosAllocMem (var P: pointer; Size, Flag: longint): longint; cdecl; function DosAllocMem (var P: pointer; Size, Flag: cardinal): cardinal; cdecl;
external 'DOSCALLS' index 299; external 'DOSCALLS' index 299;
function DosFreeMem (P: pointer): longint; cdecl; function DosFreeMem (P: pointer): cardinal; cdecl;
external 'DOSCALLS' index 304; external 'DOSCALLS' index 304;
function DosEnterCritSec:longint; cdecl; external 'DOSCALLS' index 232; function DosEnterCritSec:cardinal; cdecl; external 'DOSCALLS' index 232;
function DosExitCritSec:longint; cdecl; external 'DOSCALLS' index 233; function DosExitCritSec:cardinal; cdecl; external 'DOSCALLS' index 233;
procedure DosGetInfoBlocks (PATIB: PPThreadInfoBlock; procedure DosGetInfoBlocks (PATIB: PPThreadInfoBlock;
PAPIB: PPProcessInfoBlock); cdecl; PAPIB: PPProcessInfoBlock); cdecl;
@ -379,7 +379,10 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.3 2003-03-23 23:11:17 hajny Revision 1.4 2003-10-19 09:35:28 hajny
* fixes from OS/2 merged to EMX
Revision 1.3 2003/03/23 23:11:17 hajny
+ emx target added + emx target added
Revision 1.2 2002/11/17 22:32:05 hajny Revision 1.2 2002/11/17 22:32:05 hajny

View File

@ -25,9 +25,6 @@ interface
uses uses
Dos; Dos;
type
THandle = type Longint;
{ Include platform independent interface part } { Include platform independent interface part }
{$i sysutilh.inc} {$i sysutilh.inc}
@ -231,15 +228,9 @@ const
specification for DosFindFirst call.} specification for DosFindFirst call.}
{$ASMMODE INTEL} {$ASMMODE INTEL}
function FileOpen (const FileName: string; Mode: integer): longint; function FileOpen (const FileName: string; Mode: integer): longint; assembler;
{$IFOPT H+} asm
assembler; push ebx
{$ELSE}
var FN: string;
begin
FN := FileName + #0;
{$ENDIF}
asm
mov eax, Mode mov eax, Mode
(* DenyAll if sharing not specified. *) (* DenyAll if sharing not specified. *)
test eax, 112 test eax, 112
@ -248,50 +239,24 @@ begin
@FOpen1: @FOpen1:
mov ecx, eax mov ecx, eax
mov eax, 7F2Bh mov eax, 7F2Bh
{$IFOPT H+} mov edx, FileName
mov edx, FileName call syscall
{$ELSE} pop ebx
lea edx, FN end {['eax', 'ebx', 'ecx', 'edx']};
inc edx
{$ENDIF}
call syscall
{$IFOPT H-}
mov Result, eax
{$ENDIF}
end ['eax', 'ebx', 'ecx', 'edx'];
{$IFOPT H-}
end;
{$ENDIF}
function FileCreate (const FileName: string): longint; function FileCreate (const FileName: string): longint; assembler;
{$IFOPT H+} asm
assembler; push ebx
{$ELSE}
var FN: string;
begin
FN := FileName + #0;
{$ENDIF}
asm
mov eax, 7F2Bh mov eax, 7F2Bh
mov ecx, ofReadWrite or faCreate or doDenyRW (* Sharing to DenyAll *) mov ecx, ofReadWrite or faCreate or doDenyRW (* Sharing to DenyAll *)
{$IFOPT H+} mov edx, FileName
mov edx, FileName call syscall
{$ELSE} pop ebx
lea edx, FN end {['eax', 'ebx', 'ecx', 'edx']};
inc edx
{$ENDIF}
call syscall
{$IFOPT H-}
mov Result, eax
{$ENDIF}
end ['eax', 'ebx', 'ecx', 'edx'];
{$IFOPT H-}
end;
{$ENDIF}
Function FileCreate (Const FileName : String; Mode:longint) : Longint; function FileCreate (const FileName: string; Mode: longint): longint;
begin begin
FileCreate:=FileCreate(FileName); FileCreate:=FileCreate(FileName);
end; end;
@ -300,6 +265,7 @@ end;
function FileRead (Handle: longint; var Buffer; Count: longint): longint; function FileRead (Handle: longint; var Buffer; Count: longint): longint;
assembler; assembler;
asm asm
push ebx
mov eax, 3F00h mov eax, 3F00h
mov ebx, Handle mov ebx, Handle
mov ecx, Count mov ecx, Count
@ -308,12 +274,14 @@ asm
jnc @FReadEnd jnc @FReadEnd
mov eax, -1 mov eax, -1
@FReadEnd: @FReadEnd:
end ['eax', 'ebx', 'ecx', 'edx']; pop ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function FileWrite (Handle: longint; const Buffer; Count: longint): longint; function FileWrite (Handle: longint; const Buffer; Count: longint): longint;
assembler; assembler;
asm asm
push ebx
mov eax, 4000h mov eax, 4000h
mov ebx, Handle mov ebx, Handle
mov ecx, Count mov ecx, Count
@ -322,11 +290,13 @@ asm
jnc @FWriteEnd jnc @FWriteEnd
mov eax, -1 mov eax, -1
@FWriteEnd: @FWriteEnd:
end ['eax', 'ebx', 'ecx', 'edx']; pop ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function FileSeek (Handle, FOffset, Origin: longint): longint; assembler; function FileSeek (Handle, FOffset, Origin: longint): longint; assembler;
asm asm
push ebx
mov eax, Origin mov eax, Origin
mov ah, 42h mov ah, 42h
mov ebx, Handle mov ebx, Handle
@ -335,9 +305,10 @@ asm
jnc @FSeekEnd jnc @FSeekEnd
mov eax, -1 mov eax, -1
@FSeekEnd: @FSeekEnd:
end ['eax', 'ebx', 'edx']; pop ebx
end {['eax', 'ebx', 'edx']};
Function FileSeek (Handle : Longint; FOffset,Origin : Int64) : Int64; function FileSeek (Handle: longint; FOffset, Origin: Int64): Int64;
begin begin
{$warning need to add 64bit call } {$warning need to add 64bit call }
Result:=FileSeek(Handle,Longint(Foffset),Longint(Origin)); Result:=FileSeek(Handle,Longint(Foffset),Longint(Origin));
@ -358,6 +329,7 @@ end;
function FileTruncate (Handle, Size: longint): boolean; assembler; function FileTruncate (Handle, Size: longint): boolean; assembler;
asm asm
push ebx
mov eax, 7F25h mov eax, 7F25h
mov ebx, Handle mov ebx, Handle
mov edx, Size mov edx, Size
@ -371,7 +343,8 @@ asm
jnc @FTruncEnd jnc @FTruncEnd
dec eax dec eax
@FTruncEnd: @FTruncEnd:
end ['eax', 'ebx', 'ecx', 'edx']; pop ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function FileAge (const FileName: string): longint; function FileAge (const FileName: string): longint;
@ -388,22 +361,10 @@ begin
end; end;
function FileExists (const FileName: string): boolean; function FileExists (const FileName: string): boolean; assembler;
{$IFOPT H+}
assembler;
{$ELSE}
var FN: string;
begin
FN := FileName + #0;
{$ENDIF}
asm asm
mov ax, 4300h mov ax, 4300h
{$IFOPT H+} mov edx, FileName
mov edx, FileName
{$ELSE}
lea edx, FN
inc edx
{$ENDIF}
call syscall call syscall
mov eax, 0 mov eax, 0
jc @FExistsEnd jc @FExistsEnd
@ -411,13 +372,7 @@ asm
jnz @FExistsEnd jnz @FExistsEnd
inc eax inc eax
@FExistsEnd: @FExistsEnd:
{$IFOPT H-} end {['eax', 'ecx', 'edx']};
mov Result, eax
{$ENDIF}
end ['eax', 'ecx', 'edx'];
{$IFOPT H-}
end;
{$ENDIF}
type TRec = record type TRec = record
@ -542,6 +497,7 @@ end;
function FileGetDate (Handle: longint): longint; assembler; function FileGetDate (Handle: longint): longint; assembler;
asm asm
push ebx
mov ax, 5700h mov ax, 5700h
mov ebx, Handle mov ebx, Handle
call syscall call syscall
@ -550,7 +506,8 @@ asm
mov ax, dx mov ax, dx
shld eax, ecx, 16 shld eax, ecx, 16
@FGetDateEnd: @FGetDateEnd:
end ['eax', 'ebx', 'ecx', 'edx']; pop ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function FileSetDate (Handle, Age: longint): longint; function FileSetDate (Handle, Age: longint): longint;
@ -596,128 +553,55 @@ begin
end; end;
function FileGetAttr (const FileName: string): longint; function FileGetAttr (const FileName: string): longint; assembler;
{$IFOPT H+}
assembler;
{$ELSE}
var FN: string;
begin
FN := FileName + #0;
{$ENDIF}
asm asm
mov ax, 4300h mov ax, 4300h
{$IFOPT H+} mov edx, FileName
mov edx, FileName
{$ELSE}
lea edx, FN
inc edx
{$ENDIF}
call syscall call syscall
jnc @FGetAttrEnd jnc @FGetAttrEnd
mov eax, -1 mov eax, -1
@FGetAttrEnd: @FGetAttrEnd:
{$IFOPT H-} end {['eax', 'edx']};
mov Result, eax
{$ENDIF}
end ['eax', 'edx'];
{$IFOPT H-}
end;
{$ENDIF}
function FileSetAttr (const Filename: string; Attr: longint): longint; function FileSetAttr (const Filename: string; Attr: longint): longint; assembler;
{$IFOPT H+}
assembler;
{$ELSE}
var FN: string;
begin
FN := FileName + #0;
{$ENDIF}
asm asm
mov ax, 4301h mov ax, 4301h
mov ecx, Attr mov ecx, Attr
{$IFOPT H+} mov edx, FileName
mov edx, FileName
{$ELSE}
lea edx, FN
inc edx
{$ENDIF}
call syscall call syscall
mov eax, 0 mov eax, 0
jnc @FSetAttrEnd jnc @FSetAttrEnd
mov eax, -1 mov eax, -1
@FSetAttrEnd: @FSetAttrEnd:
{$IFOPT H-} end {['eax', 'ecx', 'edx']};
mov Result, eax
{$ENDIF}
end ['eax', 'ecx', 'edx'];
{$IFOPT H-}
end;
{$ENDIF}
function DeleteFile (const FileName: string): boolean; function DeleteFile (const FileName: string): boolean; assembler;
{$IFOPT H+}
assembler;
{$ELSE}
var FN: string;
begin
FN := FileName + #0;
{$ENDIF}
asm asm
mov ax, 4100h mov ax, 4100h
{$IFOPT H+} mov edx, FileName
mov edx, FileName
{$ELSE}
lea edx, FN
inc edx
{$ENDIF}
call syscall call syscall
mov eax, 0 mov eax, 0
jc @FDeleteEnd jc @FDeleteEnd
inc eax inc eax
@FDeleteEnd: @FDeleteEnd:
{$IFOPT H-} end {['eax', 'edx']};
mov Result, eax
{$ENDIF}
end ['eax', 'edx'];
{$IFOPT H-}
end;
{$ENDIF}
function RenameFile (const OldName, NewName: string): boolean; function RenameFile (const OldName, NewName: string): boolean; assembler;
{$IFOPT H+}
assembler;
{$ELSE}
var FN1, FN2: string;
begin
FN1 := OldName + #0;
FN2 := NewName + #0;
{$ENDIF}
asm asm
push edi
mov ax, 5600h mov ax, 5600h
{$IFOPT H+}
mov edx, OldName mov edx, OldName
mov edi, NewName mov edi, NewName
{$ELSE}
lea edx, FN1
inc edx
lea edi, FN2
inc edi
{$ENDIF}
call syscall call syscall
mov eax, 0 mov eax, 0
jc @FRenameEnd jc @FRenameEnd
inc eax inc eax
@FRenameEnd: @FRenameEnd:
{$IFOPT H-} pop edi
mov Result, eax end {['eax', 'edx', 'edi']};
{$ENDIF}
end ['eax', 'edx', 'edi'];
{$IFOPT H-}
end;
{$ENDIF}
{**************************************************************************** {****************************************************************************
@ -844,22 +728,10 @@ end;
{$ASMMODE INTEL} {$ASMMODE INTEL}
function DirectoryExists (const Directory: string): boolean; function DirectoryExists (const Directory: string): boolean; assembler;
{$IFOPT H+}
assembler;
{$ELSE}
var FN: string;
begin
FN := Directory + #0;
{$ENDIF}
asm asm
mov ax, 4300h mov ax, 4300h
{$IFOPT H+}
mov edx, Directory mov edx, Directory
{$ELSE}
lea edx, FN
inc edx
{$ENDIF}
call syscall call syscall
mov eax, 0 mov eax, 0
jc @FExistsEnd jc @FExistsEnd
@ -867,13 +739,7 @@ asm
jz @FExistsEnd jz @FExistsEnd
inc eax inc eax
@FExistsEnd: @FExistsEnd:
{$IFOPT H-} end {['eax', 'ecx', 'edx']};
mov Result, eax
{$ENDIF}
end ['eax', 'ecx', 'edx'];
{$IFOPT H-}
end;
{$ENDIF}
{**************************************************************************** {****************************************************************************
@ -883,6 +749,7 @@ end;
procedure GetLocalTime (var SystemTime: TSystemTime); assembler; procedure GetLocalTime (var SystemTime: TSystemTime); assembler;
asm asm
(* Expects the default record alignment (word)!!! *) (* Expects the default record alignment (word)!!! *)
push edi
mov ah, 2Ah mov ah, 2Ah
call syscall call syscall
mov edi, SystemTime mov edi, SystemTime
@ -907,7 +774,8 @@ asm
shl eax, 16 shl eax, 16
mov al, dh mov al, dh
stosd stosd
end ['eax', 'ecx', 'edx', 'edi']; pop edi
end {['eax', 'ecx', 'edx', 'edi']};
{$asmmode default} {$asmmode default}
@ -1013,7 +881,10 @@ end.
{ {
$Log$ $Log$
Revision 1.11 2003-10-14 21:15:20 hajny Revision 1.12 2003-10-19 09:35:28 hajny
* fixes from OS/2 merged to EMX
Revision 1.11 2003/10/14 21:15:20 hajny
* longint2cardinal fixes merged * longint2cardinal fixes merged
Revision 1.10 2003/10/07 21:33:24 hajny Revision 1.10 2003/10/07 21:33:24 hajny