diff --git a/compiler/systems/i_zxspectrum.pas b/compiler/systems/i_zxspectrum.pas index d7f29a7d53..01e62c1f8b 100644 --- a/compiler/systems/i_zxspectrum.pas +++ b/compiler/systems/i_zxspectrum.pas @@ -44,7 +44,7 @@ unit i_zxspectrum; cpu : cpu_z80; unit_env : ''; extradefines : ''; - exeext : ''; + exeext : '.tzx'; defext : '.def'; scriptext : '.sh'; smartext : '.sl'; diff --git a/compiler/systems/t_zxspectrum.pas b/compiler/systems/t_zxspectrum.pas index 28dddd50b0..2085f632a8 100644 --- a/compiler/systems/t_zxspectrum.pas +++ b/compiler/systems/t_zxspectrum.pas @@ -68,6 +68,8 @@ implementation public constructor create;override; procedure InitSysInitUnitName;override; + function MakeExecutable: boolean; override; + function postprocessexecutable(const fn : string): boolean; end; @@ -390,6 +392,38 @@ procedure TInternalLinkerZXSpectrum.InitSysInitUnitName; sysinitunit:='si_prc'; end; +function TInternalLinkerZXSpectrum.MakeExecutable: boolean; + begin + result:=inherited; + { Post process } + if result and not(cs_link_nolink in current_settings.globalswitches) then + result:=PostProcessExecutable(current_module.exefilename); + end; + +function TInternalLinkerZXSpectrum.postprocessexecutable(const fn: string): boolean; + var + exitcode: longint; + FoundBin: ansistring; + Found: Boolean; + utilexe: TCmdStr; + begin + result:=false; + + utilexe:=utilsprefix+'ihx2tzx'; + FoundBin:=''; + Found:=false; + if utilsdirectory<>'' then + Found:=FindFile(utilexe,utilsdirectory,false,Foundbin); + if (not Found) then + Found:=FindExe(utilexe,false,Foundbin); + + if Found then + begin + exitcode:=RequotedExecuteProcess(foundbin,' '+fn); + result:=exitcode<>0; + end; + end; + {***************************************************************************** Initialize *****************************************************************************}