From 4b3278051629863cf71e9a20d3d972bf90a76866 Mon Sep 17 00:00:00 2001 From: nickysn Date: Sun, 19 Apr 2020 15:02:22 +0000 Subject: [PATCH] + set the program origin (i.e. the load address) and pass it to the linker for the ZX Spectrum target git-svn-id: branches/z80@44853 - --- compiler/systems/t_zxspectrum.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/systems/t_zxspectrum.pas b/compiler/systems/t_zxspectrum.pas index 3201a71246..493610b383 100644 --- a/compiler/systems/t_zxspectrum.pas +++ b/compiler/systems/t_zxspectrum.pas @@ -41,6 +41,7 @@ implementation TLinkerZXSpectrum_SdccSdld=class(texternallinker) private + FOrigin: Word; Function WriteResponseFile: Boolean; public { constructor Create; override;} @@ -215,9 +216,10 @@ procedure TLinkerZXSpectrum_SdccSdld.SetDefaultInfo; ExeName='sdcc-sdld'; {$endif} begin + FOrigin:=32768; with Info do begin - ExeCmd[1]:=ExeName+' -n $OPT -i $MAP $EXE -f $RES' + ExeCmd[1]:=ExeName+' -n -b _CODE=$ORIGIN $OPT -i $MAP $EXE -f $RES' //-g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES'; end; end; @@ -255,6 +257,7 @@ function TLinkerZXSpectrum_SdccSdld.MakeExecutable: boolean; { Call linker } SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr); Replace(cmdstr,'$OPT',Info.ExtraOptions); + Replace(cmdstr,'$ORIGIN',tostr(FOrigin)); if not(cs_link_on_target in current_settings.globalswitches) then begin Replace(cmdstr,'$EXE',FixedExeFileName);