* Some bug fixes.

* ___SYSCALL changed to uppercase.
This commit is contained in:
daniel 1998-05-20 08:11:25 +00:00
parent b7f23a6e8c
commit a21b12c9e4

View File

@ -165,7 +165,7 @@ begin
asm asm
movb $0x4c,%ah movb $0x4c,%ah
movb errnum,%al movb errnum,%al
call ___syscall call ___SYSCALL
end; end;
end; end;
@ -210,7 +210,7 @@ var hl:longint;
begin begin
asm asm
movb $0x2c,%ah movb $0x2c,%ah
call ___syscall call ___SYSCALL
movw %cx,-4(%ebp) movw %cx,-4(%ebp)
movw %dx,-2(%ebp) movw %dx,-2(%ebp)
end; end;
@ -232,8 +232,8 @@ function sbrk(size:longint):longint;
begin begin
asm asm
movl size,%edx movl size,%edx
movl $0x7f00,%ax movw $0x7f00,%ax
int $0x21 call ___SYSCALL
movl %eax,__RESULT movl %eax,__RESULT
end; end;
end; end;
@ -273,7 +273,7 @@ begin
asm asm
movb $0x3e,%ah movb $0x3e,%ah
mov h,%ebx mov h,%ebx
call ___syscall call ___SYSCALL
end; end;
end; end;
@ -284,7 +284,7 @@ begin
asm asm
movl 8(%ebp),%edx movl 8(%ebp),%edx
movb $0x41,%ah movb $0x41,%ah
call ___syscall call ___SYSCALL
jnc LERASE1 jnc LERASE1
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
LERASE1: LERASE1:
@ -300,7 +300,7 @@ begin
movl 8(%ebp),%edx movl 8(%ebp),%edx
movl 12(%ebp),%edi movl 12(%ebp),%edi
movb $0x56,%ah movb $0x56,%ah
call ___syscall call ___SYSCALL
jnc LRENAME1 jnc LRENAME1
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
LRENAME1: LRENAME1:
@ -315,7 +315,7 @@ begin
movl 12(%ebp),%edx movl 12(%ebp),%edx
movl 8(%ebp),%ebx movl 8(%ebp),%ebx
movb $0x3f,%ah movb $0x3f,%ah
call ___syscall call ___SYSCALL
jnc LDOSREAD1 jnc LDOSREAD1
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
xorl %eax,%eax xorl %eax,%eax
@ -333,7 +333,7 @@ begin
movl 12(%ebp),%edx movl 12(%ebp),%edx
movl 8(%ebp),%ebx movl 8(%ebp),%ebx
movb $0x40,%ah movb $0x40,%ah
call ___syscall call ___SYSCALL
jnc LDOSWRITE1 jnc LDOSWRITE1
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
LDOSWRITE1: LDOSWRITE1:
@ -345,11 +345,10 @@ function do_filepos(handle:longint):longint;
begin begin
asm asm
movb $0x42,%ah movw $0x4201,%ax
movb $0x1,%al
movl 8(%ebp),%ebx movl 8(%ebp),%ebx
xorl %edx,%edx xorl %edx,%edx
call ___syscall call ___SYSCALL
jnc LDOSFILEPOS jnc LDOSFILEPOS
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
xorl %eax,%eax xorl %eax,%eax
@ -363,12 +362,10 @@ procedure do_seek(handle,pos:longint);
begin begin
asm asm
movl $0x4200,%eax movw $0x4200,%ax
movl 8(%ebp),%ebx movl 8(%ebp),%ebx
movl 12(%ebp),%edx movl 12(%ebp),%edx
movl %edx,%ecx call ___SYSCALL
shrl $16,%ecx
call ___syscall
jnc .LDOSSEEK1 jnc .LDOSSEEK1
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
.LDOSSEEK1: .LDOSSEEK1:
@ -381,20 +378,14 @@ function do_seekend(handle:longint):longint;
begin begin
asm asm
movl $0x4202,%eax movw $0x4202,%ax
movl 8(%ebp),%ebx movl 8(%ebp),%ebx
xorl %ecx,%ecx
xorl %edx,%edx xorl %edx,%edx
call ___syscall call ___SYSCALL
jnc .Lset_at_end1 jnc .Lset_at_end1
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
xorl %eax,%eax xorl %eax,%eax
jmp .Lset_at_end2
.Lset_at_end1: .Lset_at_end1:
shll $16,%edx
movzwl %ax,%eax
orl %edx,%eax
.Lset_at_end2:
leave leave
ret $4 ret $4
end; end;
@ -417,16 +408,14 @@ begin
movl $0x4200,%eax movl $0x4200,%eax
movl 8(%ebp),%ebx movl 8(%ebp),%ebx
movl 12(%ebp),%edx movl 12(%ebp),%edx
movl %edx,%ecx call ___SYSCALL
shrl $16,%ecx
call ___syscall
jc .LTruncate1 jc .LTruncate1
movl 8(%ebp),%ebx movl 8(%ebp),%ebx
movl 12(%ebp),%edx movl 12(%ebp),%edx
movl %ebp,%edx movl %ebp,%edx
xorl %ecx,%ecx xorl %ecx,%ecx
movb $0x40,%ah movb $0x40,%ah
call ___syscall call ___SYSCALL
jnc .LTruncate2 jnc .LTruncate2
.LTruncate1: .LTruncate1:
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
@ -446,7 +435,7 @@ procedure do_open(var f;p:pchar;flags:longint);
when (flags and $1000) there is no check for close (needed for textfiles) when (flags and $1000) there is no check for close (needed for textfiles)
} }
var oflags:longint; var oflags:byte;
begin begin
allowslash(p); allowslash(p);
@ -465,12 +454,12 @@ begin
end; end;
{ reset file handle } { reset file handle }
filerec(f).handle:=high(word); filerec(f).handle:=high(word);
oflags:=$8404; oflags:=2;
{ convert filemode to filerec modes } { convert filemode to filerec modes }
case (flags and 3) of case (flags and 3) of
0 : begin 0 : begin
filerec(f).mode:=fminput; filerec(f).mode:=fminput;
oflags:=$8001; oflags:=0;
end; end;
1 : filerec(f).mode:=fmoutput; 1 : filerec(f).mode:=fmoutput;
2 : filerec(f).mode:=fminout; 2 : filerec(f).mode:=fminout;
@ -478,13 +467,13 @@ begin
if (flags and $100)<>0 then if (flags and $100)<>0 then
begin begin
filerec(f).mode:=fmoutput; filerec(f).mode:=fmoutput;
oflags:=$8302; oflags:=2;
end end
else else
if (flags and $10)<>0 then if (flags and $10)<>0 then
begin begin
filerec(f).mode:=fmoutput; filerec(f).mode:=fmoutput;
oflags:=$8404; oflags:=2;
end; end;
{ empty name is special } { empty name is special }
if p[0]=#0 then if p[0]=#0 then
@ -498,18 +487,34 @@ begin
end; end;
exit; exit;
end; end;
asm if (flags and $100)<>0 then
movl $0xff02,%ax {Use create function.}
movl -4(%ebp),%ecx asm
movl 12(%ebp),%ebx movb $0x3c,%ah
call ___syscall movl p,%edx
jnc .LOPEN1 xorw %cx,%cx
movw %ax,U_SYSOS2_INOUTRES; call ___SYSCALL
movw $0xffff,%ax jnc LOPEN1
.LOPEN1: movw %ax,U_SYSOS2_INOUTRES;
movl 8(%ebp),%edx movw $0xffff,%ax
movw %ax,(%edx) LOPEN1:
end; movl f,%edx
movw %ax,(%edx)
end
else
{Use open function.}
asm
movb $0x3d,%ah
movb oflags,%al
movl p,%edx
call ___SYSCALL
jnc LOPEN2
movw %ax,U_SYSOS2_INOUTRES;
movw $0xffff,%ax
LOPEN2:
movl f,%edx
movw %ax,(%edx)
end;
if (flags and $10)<>0 then if (flags and $10)<>0 then
do_seekend(filerec(f).handle); do_seekend(filerec(f).handle);
end; end;
@ -555,7 +560,7 @@ begin
asm asm
leal buffer,%edx leal buffer,%edx
movb 8(%ebp),%ah movb 8(%ebp),%ah
call ___syscall call ___SYSCALL
jnc .LDOS_DIRS1 jnc .LDOS_DIRS1
movw %ax,U_SYSOS2_INOUTRES; movw %ax,U_SYSOS2_INOUTRES;
.LDOS_DIRS1: .LDOS_DIRS1:
@ -600,7 +605,7 @@ begin
movb drivenr,%dl movb drivenr,%dl
movl sof,%esi movl sof,%esi
mov $0x47,%ah mov $0x47,%ah
call ___syscall call ___SYSCALL
end; end;
{ Now Dir should be filled with directory in ASCIIZ, } { Now Dir should be filled with directory in ASCIIZ, }
{ starting from dir[4] } { starting from dir[4] }
@ -627,7 +632,7 @@ begin
{ because the drive was the default, which can be unknown } { because the drive was the default, which can be unknown }
asm asm
movb $0x19,%ah movb $0x19,%ah
call ___syscall call ___SYSCALL
addb $65,%al addb $65,%al
movb %al,i movb %al,i
end; end;
@ -661,7 +666,7 @@ begin
{Determine the operating system we are running on.} {Determine the operating system we are running on.}
asm asm
movw $0x7f0a,%ax movw $0x7f0a,%ax
call ___syscall call ___SYSCALL
test $512,%bx {Bit 9 is OS/2 flag.} test $512,%bx {Bit 9 is OS/2 flag.}
setnzb U_SYSOS2_OS_MODE setnzb U_SYSOS2_OS_MODE
test $4096,%bx test $4096,%bx
@ -674,7 +679,13 @@ begin
asm asm
mov $0x7f01,%ax mov $0x7f01,%ax
movl HEAPSIZE,%edx movl HEAPSIZE,%edx
call ___syscall addl __heap_base,%edx
call ___SYSCALL
cmpl $-1,%eax
jnz _heapok
pushl $204
call _SYSOS2$$_RUNERROR$WORD
_heapok:
end; end;
{Now request, if we are running under DOS, {Now request, if we are running under DOS,
@ -685,7 +696,7 @@ begin
xor %ebx,%ebx xor %ebx,%ebx
mov $0xfff,%ecx mov $0xfff,%ecx
xor %edx,%edx xor %edx,%edx
call ___syscall call ___SYSCALL
mov %eax,U_SYSOS2_FIRST_MEG mov %eax,U_SYSOS2_FIRST_MEG
end end
else else