diff --git a/.gitattributes b/.gitattributes index 9358b81e4c..c6a3f07808 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7783,6 +7783,9 @@ rtl/i386/setjumph.inc svneol=native#text/plain rtl/i386/strings.inc svneol=native#text/plain rtl/i386/stringss.inc svneol=native#text/plain rtl/i386/strpas.inc svneol=native#text/plain +rtl/i8086/i8086.inc svneol=native#text/plain +rtl/i8086/setjump.inc svneol=native#text/plain +rtl/i8086/setjumph.inc svneol=native#text/plain rtl/inc/aliases.inc svneol=native#text/plain rtl/inc/astrings.inc svneol=native#text/plain rtl/inc/cgeneric.inc svneol=native#text/plain @@ -8191,6 +8194,8 @@ rtl/morphos/varutils.pp svneol=native#text/plain rtl/morphos/video.pp svneol=native#text/plain rtl/morphos/videodata.inc svneol=native#text/plain rtl/msdos/prt0.asm svneol=native#text/plain +rtl/msdos/sysos.inc svneol=native#text/plain +rtl/msdos/sysosh.inc svneol=native#text/plain rtl/msdos/system.pp svneol=native#text/plain rtl/nativent/Makefile svneol=native#text/plain rtl/nativent/Makefile.fpc svneol=native#text/plain diff --git a/rtl/i8086/i8086.inc b/rtl/i8086/i8086.inc new file mode 100644 index 0000000000..4504fee200 --- /dev/null +++ b/rtl/i8086/i8086.inc @@ -0,0 +1,15 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2013 by the Free Pascal development team. + + Processor dependent implementation for the system unit for + intel i8086+ + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} diff --git a/rtl/i8086/setjump.inc b/rtl/i8086/setjump.inc new file mode 100644 index 0000000000..1e154d35da --- /dev/null +++ b/rtl/i8086/setjump.inc @@ -0,0 +1,23 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2013 by the Free Pascal development team + + SetJmp and LongJmp implementation for exception handling + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +Function fpc_SetJmp (Var S : Jmp_buf) : longint;assembler;nostackframe;[Public, alias : 'FPC_SETJMP']; compilerproc; +asm +end; + + +Procedure fpc_longJmp (Var S : Jmp_buf; value : longint); assembler;nostackframe;[Public, alias : 'FPC_LONGJMP']; compilerproc; +asm +end; diff --git a/rtl/i8086/setjumph.inc b/rtl/i8086/setjumph.inc new file mode 100644 index 0000000000..2aed1f58a5 --- /dev/null +++ b/rtl/i8086/setjumph.inc @@ -0,0 +1,22 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2013 the Free Pascal development team + + SetJmp/Longjmp declarations + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +Type + jmp_buf = packed record + end; + PJmp_buf = ^jmp_buf; + +Function Setjmp (Var S : Jmp_buf) : longint; [external name 'FPC_SETJMP']; +Procedure longjmp (Var S : Jmp_buf; value : longint); [external name 'FPC_LONGJMP']; diff --git a/rtl/inc/system.inc b/rtl/inc/system.inc index 8f0d018d4d..1d12240019 100644 --- a/rtl/inc/system.inc +++ b/rtl/inc/system.inc @@ -157,6 +157,14 @@ function do_isdevice(handle:thandle):boolean;forward; {$define SYSPROCDEFINED} {$endif cpui386} +{$ifdef cpui8086} + {$ifdef SYSPROCDEFINED} + {$Error Can't determine processor type !} + {$endif} + {$i i8086.inc} { Case dependent, don't change } + {$define SYSPROCDEFINED} +{$endif cpui8086} + {$ifdef cpum68k} {$ifdef SYSPROCDEFINED} {$Error Can't determine processor type !} diff --git a/rtl/inc/systemh.inc b/rtl/inc/systemh.inc index 9d779e917f..43a1008e6d 100644 --- a/rtl/inc/systemh.inc +++ b/rtl/inc/systemh.inc @@ -114,6 +114,21 @@ Type {$endif} {$endif CPUI386} +{$ifdef CPUI8086} + {$define CPU16} + + {$define DEFAULT_EXTENDED} + + {$define SUPPORT_SINGLE} + {$define SUPPORT_DOUBLE} + {$define SUPPORT_EXTENDED} + {$define SUPPORT_COMP} + + {$ifndef FPUNONE} + ValReal = Extended; + {$endif} +{$endif CPUI8086} + {$ifdef CPUX86_64} {$ifdef FPC_HAS_TYPE_EXTENDED} { win64 doesn't support the legacy fpu } diff --git a/rtl/msdos/sysos.inc b/rtl/msdos/sysos.inc new file mode 100644 index 0000000000..167080d3ac --- /dev/null +++ b/rtl/msdos/sysos.inc @@ -0,0 +1,16 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2013 by Free Pascal development team + + This file implements all the base types and limits required + for a minimal POSIX compliant subset required to port the compiler + to a new OS. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} diff --git a/rtl/msdos/sysosh.inc b/rtl/msdos/sysosh.inc new file mode 100644 index 0000000000..aedb41bcc4 --- /dev/null +++ b/rtl/msdos/sysosh.inc @@ -0,0 +1,26 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 2013 by Free Pascal development team + + This file implements all the base types and limits required + for a minimal POSIX compliant subset required to port the compiler + to a new OS. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +{Platform specific information} +type + THandle = Longint; + TThreadID = THandle; + + PRTLCriticalSection = ^TRTLCriticalSection; + TRTLCriticalSection = record + Locked: boolean + end; diff --git a/rtl/msdos/system.pp b/rtl/msdos/system.pp index 1827d57d25..5349bc1e63 100644 --- a/rtl/msdos/system.pp +++ b/rtl/msdos/system.pp @@ -4,14 +4,32 @@ unit system; interface +{$ifdef FULL_RTL} +{$I systemh.inc} +{$endif FULL_RTL} + +const + maxExitCode = 255; + +{$ifndef FULL_RTL} type + DWord = LongWord; + Cardinal = LongWord; + Integer = SmallInt; + UInt64 = QWord; + HRESULT = LongInt; +{$endif FULL_RTL} procedure DebugWrite(const S: string); procedure DebugWriteLn(const S: string); implementation +{$ifdef FULL_RTL} +{$I system.inc} +{$endif FULL_RTL} + procedure fpc_Initialize_Units;[public,alias:'FPC_INITIALIZEUNITS']; compilerproc; begin end; @@ -32,6 +50,7 @@ begin mov cl, al xor ch, ch mov ah, 2 + @@1: lodsb mov dl, al