m68k-amiga: prepare the startup code and system unit for legacy support

git-svn-id: trunk@44563 -
This commit is contained in:
Károly Balogh 2020-04-04 12:53:00 +00:00
parent 433e40fe71
commit 632353a808
2 changed files with 48 additions and 8 deletions

View File

@ -30,6 +30,20 @@ var
{$include execd.inc}
{$include execf.inc}
{$if defined(AMIGA_V1_0_ONLY) or defined(AMIGA_V1_2_ONLY)}
{$define AMIGA_LEGACY}
{$endif}
{$ifdef AMIGA_LEGACY}
var
args: pointer; public name '__fpc_args';
arglen: dword; public name '__fpc_arglen';
function AllocVec(byteSize : Cardinal; requirements: Cardinal): Pointer; external name '_fpc_amiga_allocvec';
procedure FreeVec(memoryBlock: Pointer); external name '_fpc_amiga_freevec';
procedure StackSwap(newStack: PStackSwapStruct); external name '_fpc_amiga_stackswap';
{$endif}
var
sst: TStackSwapStruct;
@ -42,6 +56,12 @@ var
newStack: Pointer;
task: PTask;
begin
{$IFDEF AMIGA_LEGACY}
asm
move.l d0, arglen
move.l a0, args
end;
{$ENDIF}
AOS_ExecBase:=realExecBase;
newStack:=nil;

View File

@ -21,9 +21,15 @@ unit System;
interface
{$define FPC_IS_SYSTEM}
{$define FPC_HAS_ANSI_TEXTFILEREC}
{$define FPC_ANSI_TEXTFILEREC}
{.$define FPC_AMIGA_USE_TINYHEAP}
{$if defined(AMIGA_V1_0_ONLY) or defined(AMIGA_V1_2_ONLY)}
{$define AMIGA_LEGACY}
{$endif}
{$ifdef AMIGA_LEGACY}
{$.define FPC_AMIGA_USE_TINYHEAP}
{$endif}
{$ifdef FPC_AMIGA_USE_TINYHEAP}
{$define HAS_MEMORYMANAGER}
@ -41,6 +47,17 @@ interface
{$undef fpc_softfpu_interface}
{$endif defined(cpum68k) and defined(fpusoft)}
const
{$if defined(AMIGA_V1_0_ONLY)}
OS_MINVERSION = 0;
{$else}
{$if defined(AMIGA_V1_2_ONLY)}
OS_MINVERSION = 33;
{$else}
OS_MINVERSION = 37;
{$endif}
{$endif}
const
LineEnding = #10;
LFNSupport = True;
@ -250,11 +267,13 @@ begin
AOS_wbMsg:=GetMsg(@self^.pr_MsgPort);
end;
AOS_DOSBase:=OpenLibrary('dos.library',37);
AOS_DOSBase:=OpenLibrary('dos.library',OS_MINVERSION);
if AOS_DOSBase=nil then Halt(1);
AOS_UtilityBase:=OpenLibrary('utility.library',37);
{$ifndef AMIGA_LEGACY}
AOS_UtilityBase:=OpenLibrary('utility.library',OS_MINVERSION);
if AOS_UtilityBase=nil then Halt(1);
AOS_IntuitionBase:=OpenLibrary('intuition.library',37); { amunits support kludge }
{$endif}
AOS_IntuitionBase:=OpenLibrary('intuition.library',OS_MINVERSION); { amunits support kludge }
if AOS_IntuitionBase=nil then Halt(1);
{$IFDEF AMIGAOS4}
@ -295,10 +314,11 @@ procedure SysInitStdIO;
begin
OpenStdIO(Input,fmInput,StdInputHandle);
OpenStdIO(Output,fmOutput,StdOutputHandle);
OpenStdIO(StdOut,fmOutput,StdOutputHandle);
OpenStdIO(StdErr,fmOutput,StdErrorHandle);
OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
{$ifndef FPC_STDOUT_TRUE_ALIAS}
OpenStdIO(StdOut,fmOutput,StdOutputHandle);
OpenStdIO(StdErr,fmOutput,StdErrorHandle);
{$endif FPC_STDOUT_TRUE_ALIAS}
end;
function GetProcessID: SizeUInt;