Browse Source

+ allow specifying the program load address for the ZX Spectrum target via the -WB option

git-svn-id: trunk@45581 -
nickysn 5 years ago
parent
commit
f5489b5678
5 changed files with 63 additions and 47 deletions
  1. 1 0
      compiler/msg/errore.msg
  2. 1 1
      compiler/msgidx.inc
  3. 45 42
      compiler/msgtxt.inc
  4. 1 1
      compiler/options.pas
  5. 15 3
      compiler/systems/t_zxspectrum.pas

+ 1 - 0
compiler/msg/errore.msg

@@ -4236,6 +4236,7 @@ A*2Wb_Create a bundle instead of a library (Darwin)
 4*2WB<x>_Set image base to <x> (Windows)
 4*2WB<x>_Set image base to <x> (Windows)
 A*2WB_Create a relocatable image (Windows, Symbian)
 A*2WB_Create a relocatable image (Windows, Symbian)
 A*2WB<x>_Set image base to <x> (Windows, Symbian)
 A*2WB<x>_Set image base to <x> (Windows, Symbian)
+Z*2WB<x>_Set image base to <x> (ZX Spectrum)
 3*2WC_Specify console type application (EMX, OS/2, Windows)
 3*2WC_Specify console type application (EMX, OS/2, Windows)
 4*2WC_Specify console type application (Windows)
 4*2WC_Specify console type application (Windows)
 A*2WC_Specify console type application (Windows)
 A*2WC_Specify console type application (Windows)

+ 1 - 1
compiler/msgidx.inc

@@ -1126,7 +1126,7 @@ const
   option_info=11024;
   option_info=11024;
   option_help_pages=11025;
   option_help_pages=11025;
 
 
-  MsgTxtSize = 85490;
+  MsgTxtSize = 85535;
 
 
   MsgIdxMax : array[1..20] of longint=(
   MsgIdxMax : array[1..20] of longint=(
     28,106,356,129,99,63,143,36,223,68,
     28,106,356,129,99,63,143,36,223,68,

+ 45 - 42
compiler/msgtxt.inc

@@ -1873,112 +1873,115 @@ const msgtxt : array[0..000356,1..240] of char=(
   '4*2WB<x>_Set image base to <x> (Windows)'#010+
   '4*2WB<x>_Set image base to <x> (Windows)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
   'A*2WB<x>_','Set image base to <x> (Windows, Symbian)'#010+
   'A*2WB<x>_','Set image base to <x> (Windows, Symbian)'#010+
+  'Z*2WB<x>_Set image base to <x> (ZX Spectrum)'#010+
   '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
   '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
   '4*2WC_Specify console type application (Windows)'#010+
   '4*2WC_Specify console type application (Windows)'#010+
-  'A*2WC_Specify console type application (Windows)'#010+
-  'P*2WC_Specify console type application (C','lassic Mac OS)'#010+
+  'A*2WC_Specify console type application (Windo','ws)'#010+
+  'P*2WC_Specify console type application (Classic Mac OS)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   '4*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   '4*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
-  'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
+  'A*2WD_Use DEFFILE to export functions of DLL or EXE (Win','dows)'#010+
   '3*2We_Use external resources (Darwin)'#010+
   '3*2We_Use external resources (Darwin)'#010+
-  '4','*2We_Use external resources (Darwin)'#010+
+  '4*2We_Use external resources (Darwin)'#010+
   'a*2We_Use external resources (Darwin)'#010+
   'a*2We_Use external resources (Darwin)'#010+
   'A*2We_Use external resources (Darwin)'#010+
   'A*2We_Use external resources (Darwin)'#010+
   'P*2We_Use external resources (Darwin)'#010+
   'P*2We_Use external resources (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
-  '3*2WF_Specify full-screen type application (EMX, OS','/2)'#010+
+  '3*2WF_','Specify full-screen type application (EMX, OS/2)'#010+
   '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
   '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
   '4*2WG_Specify graphic type application (Windows)'#010+
   '4*2WG_Specify graphic type application (Windows)'#010+
   'A*2WG_Specify graphic type application (Windows)'#010+
   'A*2WG_Specify graphic type application (Windows)'#010+
-  'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
-  '3*2Wi_Use internal res','ources (Darwin)'#010+
+  'P*2WG_Specify graphic type applic','ation (Classic Mac OS)'#010+
+  '3*2Wi_Use internal resources (Darwin)'#010+
   '4*2Wi_Use internal resources (Darwin)'#010+
   '4*2Wi_Use internal resources (Darwin)'#010+
   'a*2Wi_Use internal resources (Darwin)'#010+
   'a*2Wi_Use internal resources (Darwin)'#010+
   'A*2Wi_Use internal resources (Darwin)'#010+
   'A*2Wi_Use internal resources (Darwin)'#010+
   'P*2Wi_Use internal resources (Darwin)'#010+
   'P*2Wi_Use internal resources (Darwin)'#010+
-  'p*2Wi_Use internal resources (Darwin)'#010+
-  '3*2WI_Turn on/off the usage of imp','ort sections (Windows)'#010+
+  'p*2Wi_Use internal resource','s (Darwin)'#010+
+  '3*2WI_Turn on/off the usage of import sections (Windows)'#010+
   '4*2WI_Turn on/off the usage of import sections (Windows)'#010+
   '4*2WI_Turn on/off the usage of import sections (Windows)'#010+
   'A*2WI_Turn on/off the usage of import sections (Windows)'#010+
   'A*2WI_Turn on/off the usage of import sections (Windows)'#010+
-  '8*2Wh_Use huge code for units (ignored for models with CODE in a uniqu'+
-  'e segment)'#010+
-  '8*2Wm<x>_Set memory mo','del'#010+
+  '8*2Wh_Use huge code for units (ignored for models with COD','E in a uni'+
+  'que segment)'#010+
+  '8*2Wm<x>_Set memory model'#010+
   '8*3WmTiny_Tiny memory model'#010+
   '8*3WmTiny_Tiny memory model'#010+
   '8*3WmSmall_Small memory model (default)'#010+
   '8*3WmSmall_Small memory model (default)'#010+
   '8*3WmMedium_Medium memory model'#010+
   '8*3WmMedium_Medium memory model'#010+
   '8*3WmCompact_Compact memory model'#010+
   '8*3WmCompact_Compact memory model'#010+
   '8*3WmLarge_Large memory model'#010+
   '8*3WmLarge_Large memory model'#010+
-  '8*3WmHuge_Huge memory model'#010+
-  '3*2WM<x>_Minimum Mac OS X deployment version',': 10.4, 10.5.1, ... (Dar'+
-  'win)'#010+
+  '8*3WmHuge_Huge memory model',#010+
+  '3*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+
+  'n)'#010+
   '4*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+
   '4*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+
   'n)'#010+
   'n)'#010+
   'p*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+
   'p*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+
   'n)'#010+
   'n)'#010+
-  'P*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (','Dar'+
+  'P*2WM<x>_Minimum Mac',' OS X deployment version: 10.4, 10.5.1, ... (Dar'+
   'win)'#010+
   'win)'#010+
   '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '4*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '4*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
-  'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
-  'A*2Wp<x>_Specify the c','ontroller type; see fpc -i or fpc -iu for poss'+
-  'ible values'#010+
-  'm*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+
+  'A*2WN_Do not generate relocation code, needed f','or debugging (Windows'+
+  ')'#010+
+  'A*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+
   'le values'#010+
   'le values'#010+
-  'R*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+
+  'm*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+
   'le values'#010+
   'le values'#010+
-  'V*2Wp<x>_Specify the c','ontroller type; see fpc -i or fpc -iu for poss'+
+  'R*2Wp<x>_Specify the controller type; see fpc -i or fpc -','iu for poss'+
   'ible values'#010+
   'ible values'#010+
+  'V*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+
+  'le values'#010+
   'x*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+
   'x*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+
   'le values'#010+
   'le values'#010+
-  '3*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ... (iphonesim)'#010+
-  '4*2WP<x>_Minimum iOS deployment v','ersion: 8.0, 8.0.2, ... (iphonesim)'+
+  '3*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ... ','(iphonesim)'+
   #010+
   #010+
+  '4*2WP<x>_Minimum iOS deployment version: 8.0, 8.0.2, ... (iphonesim)'#010+
   'a*2WP<x>_Minimum iOS deployment version: 7.0, 7.1.2, ... (Darwin)'#010+
   'a*2WP<x>_Minimum iOS deployment version: 7.0, 7.1.2, ... (Darwin)'#010+
   'A*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ... (Darwin)'#010+
   'A*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ... (Darwin)'#010+
-  '3*2WR_Generate relocation code (Windows)'#010+
-  '4*2WR_Generate relocation code ','(Windows)'#010+
+  '3*2WR_Generate relocation c','ode (Windows)'#010+
+  '4*2WR_Generate relocation code (Windows)'#010+
   'A*2WR_Generate relocation code (Windows)'#010+
   'A*2WR_Generate relocation code (Windows)'#010+
   '8*2Wt<x>_Set the target executable format'#010+
   '8*2Wt<x>_Set the target executable format'#010+
   '8*3Wtexe_Create a DOS .EXE file (default)'#010+
   '8*3Wtexe_Create a DOS .EXE file (default)'#010+
-  '8*3Wtcom_Create a DOS .COM file (requires tiny memory model)'#010+
-  'P*2WT_Specify MPW tool type application (Cla','ssic Mac OS)'#010+
+  '8*3Wtcom_Create a DOS .COM file (requires tiny memory model)',#010+
+  'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
   '**2WX_Enable executable stack (Linux)'#010+
   '**2WX_Enable executable stack (Linux)'#010+
   '**1X_Executable options:'#010+
   '**1X_Executable options:'#010+
   '**2X9_Generate linkerscript for GNU Binutils ld older than version 2.1'+
   '**2X9_Generate linkerscript for GNU Binutils ld older than version 2.1'+
   '9.1 (Linux)'#010+
   '9.1 (Linux)'#010+
-  '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
-  'ux)'#010+
-  '**2Xd_Do',' not search default library path (sometimes required for cro'+
-  'ss-compiling when not using -XR)'#010+
+  '**2Xc_Pass --shared/-dynamic to the l','inker (BeOS, Darwin, FreeBSD, L'+
+  'inux)'#010+
+  '**2Xd_Do not search default library path (sometimes required for cross'+
+  '-compiling when not using -XR)'#010+
   '**2Xe_Use external linker'#010+
   '**2Xe_Use external linker'#010+
   '**2Xf_Substitute pthread library name for linking (BSD)'#010+
   '**2Xf_Substitute pthread library name for linking (BSD)'#010+
-  '**2Xg_Create debuginfo in a separate file and add a debuglink sec','tio'+
+  '**2Xg_Create debugin','fo in a separate file and add a debuglink sectio'+
   'n to executable'#010+
   'n to executable'#010+
   '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2Xi_Use internal linker'#010+
   '**2Xi_Use internal linker'#010+
   'L*2XlS<x>_LLVM utilties suffix (e.g. -7 in case clang is called clang-'+
   'L*2XlS<x>_LLVM utilties suffix (e.g. -7 in case clang is called clang-'+
   '7)'#010+
   '7)'#010+
-  '**2XLA_Define library substitutions for linking'#010+
-  '**2XLO','_Define order of library linking'#010+
+  '**2XLA_De','fine library substitutions for linking'#010+
+  '**2XLO_Define order of library linking'#010+
   '**2XLD_Exclude default order of standard libraries'#010+
   '**2XLD_Exclude default order of standard libraries'#010+
   '**2Xm_Generate link map'#010+
   '**2Xm_Generate link map'#010+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   's '#039'main'#039')'#010+
   's '#039'main'#039')'#010+
-  '**2Xn_Use target system native linker instead of GNU ld (Sol','aris, AI'+
+  '**2Xn_Use targe','t system native linker instead of GNU ld (Solaris, AI'+
   'X)'#010+
   'X)'#010+
   'F*2Xp<x>_First search for the compiler binary in the directory <x>'#010+
   'F*2Xp<x>_First search for the compiler binary in the directory <x>'#010+
   '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
   '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
-  '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
-  'ile, see the ld manual for more informat','ion) (BeOS, Linux)'#010+
+  '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross',' co'+
+  'mpile, see the ld manual for more information) (BeOS, Linux)'#010+
   '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
   '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
   ', Linux, Mac OS, Solaris)'#010+
   ', Linux, Mac OS, Solaris)'#010+
   '**2Xs_Strip all symbols from executable'#010+
   '**2Xs_Strip all symbols from executable'#010+
-  '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
-  '**2Xt_Link with',' static libraries (-static is passed to linker)'#010+
+  '**2XS_Try to link units statically (defa','ult, defines FPC_LINK_STATIC'+
+  ')'#010+
+  '**2Xt_Link with static libraries (-static is passed to linker)'#010+
   '**2Xv_Generate table for Virtual Entry calls'#010+
   '**2Xv_Generate table for Virtual Entry calls'#010+
   '**2XV_Use VLink as external linker       (default on Amiga, MorphOS)'#010+
   '**2XV_Use VLink as external linker       (default on Amiga, MorphOS)'#010+
-  '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
+  '**2XX_Try to smartlink units     ','        (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1*_'#010+
-  '**1?_S','how this help'#010+
+  '**1?_Show this help'#010+
   '**1h_Shows this help without waiting'
   '**1h_Shows this help without waiting'
 );
 );

+ 1 - 1
compiler/options.pas

@@ -2383,7 +2383,7 @@ begin
                       end;
                       end;
                     'B':
                     'B':
                       begin
                       begin
-                        if target_info.system in systems_all_windows+systems_symbian then
+                        if target_info.system in systems_all_windows+systems_symbian+[system_z80_zxspectrum] then
                           begin
                           begin
                             {  -WB200000 means set trefered base address
                             {  -WB200000 means set trefered base address
                               to $200000, but does not change relocsection boolean
                               to $200000, but does not change relocsection boolean

+ 15 - 3
compiler/systems/t_zxspectrum.pas

@@ -35,6 +35,9 @@ implementation
        globtype,globals,systems,verbose,comphook,cscript,fmodule,i_zxspectrum,link,
        globtype,globals,systems,verbose,comphook,cscript,fmodule,i_zxspectrum,link,
        cpuinfo,ogbase,ogrel,owar;
        cpuinfo,ogbase,ogrel,owar;
 
 
+    const
+       DefaultOrigin=23800;
+
     type
     type
 
 
        { sdld - the sdld linker from the SDCC project ( http://sdcc.sourceforge.net/ ) }
        { sdld - the sdld linker from the SDCC project ( http://sdcc.sourceforge.net/ ) }
@@ -186,7 +189,10 @@ procedure TLinkerZXSpectrum.SetDefaultInfo_Sdld;
   const
   const
     ExeName='sdldz80';
     ExeName='sdldz80';
   begin
   begin
-    FOrigin:={32768}23800;
+    if ImageBaseSetExplicity then
+      FOrigin:=ImageBase
+    else
+      FOrigin:=DefaultOrigin;
     with Info do
     with Info do
      begin
      begin
        ExeCmd[1]:=ExeName+' -n $OPT -i $MAP $EXE -f $RES'
        ExeCmd[1]:=ExeName+' -n $OPT -i $MAP $EXE -f $RES'
@@ -197,7 +203,10 @@ procedure TLinkerZXSpectrum.SetDefaultInfo_Vlink;
   const
   const
     ExeName='vlink';
     ExeName='vlink';
   begin
   begin
-    FOrigin:={32768}23800;
+    if ImageBaseSetExplicity then
+      FOrigin:=ImageBase
+    else
+      FOrigin:=DefaultOrigin;
     with Info do
     with Info do
      begin
      begin
        ExeCmd[1]:=ExeName+' -bihex $GCSECTIONS -e $STARTSYMBOL $STRIP $OPT -o $EXE -T $RES'
        ExeCmd[1]:=ExeName+' -bihex $GCSECTIONS -e $STARTSYMBOL $STRIP $OPT -o $EXE -T $RES'
@@ -384,7 +393,10 @@ constructor TInternalLinkerZXSpectrum.create;
     CArObjectReader:=TArObjectReader;
     CArObjectReader:=TArObjectReader;
     CExeOutput:=TIntelHexExeOutput;
     CExeOutput:=TIntelHexExeOutput;
     CObjInput:=TRelObjInput;
     CObjInput:=TRelObjInput;
-    FOrigin:={32768}23800;
+    if ImageBaseSetExplicity then
+      FOrigin:=ImageBase
+    else
+      FOrigin:=DefaultOrigin;
   end;
   end;
 
 
 procedure TInternalLinkerZXSpectrum.InitSysInitUnitName;
 procedure TInternalLinkerZXSpectrum.InitSysInitUnitName;