EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

euroasm.htm
Headers
Scope selection
OS selection
Link €ASM

euroasm.htm is the EuroAssembler linker script which will be invoked by the make-script eamake.sh or eamake.cmd.
It is not a module; actual data and code are scattered in other source modules and they will be linked here by the same executable EuroAssembler file which was used for assembly.

This linker script is common for Linux and Windows versions of EuroAssembler. It expects that the downloaded executable file, whose name is euroasm.x for Linux and euroasm.exe for Windows, remains in the main €ASM directory, the same where euroasm.css, search.php etc are located, see the installation instructions.

EuroAssembler is shipped as executable file but it can also be rebuild in the subdirectory easource with script ./eamake.sh (in Linux) or eamake.cmd (in Windows). If the rebuild is successfull, it creates the listing file easource/euroasm.htm.lst and output file easource/euroasm.x (in Linux) or easource\euroasm.exe (in Windows).

You cannot rebuild EuroAssembler with the same euroasm executable which is being created, that means you cannot execute euroasm euroasm.htm in the subdirectory easource. Use the executable from PATH or from the directory one level higher than easource.

Presence of environment variable OS specifies the operating system for which will be EuroAssembler linked. In MS Windows is something like OS=Windows_NT, in Linux it is undefined.

Changing the variable manually, e. g. SET OS=Linux before invokation of eamake.cmd will link Linux version easource\euroasm.x on MS Windows (and vice versa).

The just rebuilt executable can be tested in subdirectory eatests using more than eight hundred test files with command ./testman.x "t*.htm" (in Linux) or testman.exe "t*.htm" (in Windows).

Executable test managers eatests/testman.x and eatests\testman.exe are not shipped in euroasm.zip, you should create them first from their source file.
In Linux change to subdirectory prolin32 and run ../euroasm.x testman.htm.
In Windows change to subdirectory prowin32 and run ..\euroasm.exe testman.htm.

↑ Headers
Instructions between HEAD and ENDHEAD in this file represent the common module header, which is included into every EuroAssembler source module (using the pseudoinstruction INCLUDEHEAD euroasm.htm ).
     HEAD                 ; Begin common interface block which is included to all modules.
     EUROASM NOWARN=0563, NOWARN=2101, NOWARN=2512, \  ; Common options valid for each source module.
             LIST=ON, LISTINCLUDE=OFF, LISTMACRO=OFF, LISTREPEAT=OFF, LISTVAR=OFF,  \
             CODEPAGE=UTF-8, UNICODE=OFF, PROFILE=OFF, DEBUG=OFF
↑ Scope selection
Many macroinstruction used in EuroAssembler are semi-inline, they push arguments and then they call their run-time procedure declared in PROC1/ENDPROC1 block.
The following %variable %@RTprocedureList keeps names of those run-time procedures. The list will be used to declare their scope in other modules:
run-time procedures will be PUBLIC in the main module ea.htm and EXTERN in all other modules.
This prevents the run-time procedures to be repeatedly included in each module, where is their semi-inline macro expanded, as this would unnecessarily blow up the executable size.
%@RTprocedureList %SET BufferCreate@RT,BufferNew@RT,BufferResize@RT,BufferStore@RT,BufferStoreByte@RT,BufferStoreDword@RT, \
   BufferStorePascalString@RT,BufferStoreQword@RT,BufferStoreWord@RT,Clear32@RT,Compare32@RT,CopyTo32@RT,FileClose@RT,     \
   FileCreate@RT,FileEach@RT,FileMapOpen@RT,FileMkDir@RT,FileWrite@RT,GetLength$A@RT,IiAbort@RT,IiAbortIfNotST0@RT,        \
   IiAllowLocking@RT,IiDataSize@RT,IiDispatchFormatFail@RT,IiDispatchLocation@RT,IiDispSize@RT,IiEmitImm@RT,IiEmitImm2@RT, \
   IiEmitOpcode@RT,IiImmSize@RT,IiStringDestination@RT,IiStringSource@RT,ListCreate@RT,ListInsert@RT,ListNew@RT,           \
   ListRemove@RT,ListStore@RT,LodD32@RT,PoolCreate@RT,PoolDestroy@RT,PoolNew@RT,ShellSort32@RT,StackCreate@RT,StackPush@RT,\
   StoD32@RT,StoH32@RT,StoQD32@RT,StreamCreate@RT,StreamDump@RT,StreamGetSize@RT,StreamStore$size@RT,StreamStore@RT,SysGetEnvironment@RT
   %IF "%^PROGRAM" == "ea" ; Perform the actual scope declarations of runtime procedures.
     PUBLIC %@RTprocedureList   ; Scope is PUBLIC in the module ea.htm
   %ELSE
       EXTERN %@RTprocedureList ;   and EXTERN in all other modules.
   %ENDIF
↑ Operating System selection

This linker script uses environment variable OS to recognize whether it runs on Linux or MS Windows. According to the detected OS it selects macrolibraries for this system, for instance linapi.htm or winapi.htm etc., which will be included to all modules. The source code of modules is the same for both Linux and Windows.

%OS %SETE OS                   ; Try to load environment variable OS at runtime.
   %IF "%OS[1]" == "W"         ; Environment %OS% in MS Windows is something like "Windows_NT". Test its first character.
     %eaos    %SET win         ; User-defined variable %eaos is used to include macrolibrary files.
     %format  %SET PE          ; Output executable file format.
     %outfile %SET euroasm.exe ; Output executable file name.
   %ELSE                       ; When the environment %OS% is not set, we must be in Linux.
     %eaos    %SET lin         ; User-defined variable %eaos is used to include macrolibraries.
     %format  %SET ELFX        ; Output executable file format.
     %outfile %SET euroasm.x   ; Output executable file name.
   %ENDIF
   INCLUDE cpuext.htm, cpuext32.htm, stdcal32.htm, status32.htm, string32.htm, sort32.htm
   INCLUDE %eaos[]api.htm, %eaos[]sfile.htm, %eaos[]f32.htm, %eaos[]s.htm, memory32.htm, sys%eaos.htm
  ENDHEAD                      ; End of common interface, which is included to all €ASM sources.
↑ Link EuroAssembler
All modules were assembled to their object files by the script eamake.sh or eamake.cmd.
Here follows the declaration of final target executable program and the LINK statement enumerating its assembled modules.
euroasm: PROGRAM Format=%format, Model=FLAT, Width=32, Entry=EaMain:,          \
                 Subsystem=CON, ListLiterals=OFF, ListGlobals=OFF, ListMap=ON, \ Options below this line
                 StubFile="..\objlib\coffstub.exe", IconFile="euroasm.ico",    \   are irrelevant
                 SizeOfStackReserve=1M, SizeOfStackCommit=8K,                  \   in Linux version.
                 SizeOfHeapReserve=1M, SizeOfHeapCommit=4K
           LINK ea.obj, chunk.obj, ctx.obj, dict.obj, eaopt.obj, exp.obj, lst.obj, mac.obj, member.obj, msg.obj
           LINK pass.obj, pgm.obj, pgmopt.obj, pseudo.obj, reloc.obj, src.obj, sss.obj, stm.obj, sym.obj, var.obj
           LINK ii.obj, iia.obj, iib.obj, iic.obj, iid.obj, iif.obj, iig.obj, iik.obj, iim.obj, iip.obj
           LINK iis.obj, iit.obj, iiv.obj, iix.obj, iiy.obj, iiz.obj
           LINK pf.obj, pfbin.obj, pfboot.obj, pfcoff.obj, pfcom.obj, pfdll.obj, pfelf.obj, pfelfso.obj, pfelfx.obj
           LINK pflibcof.obj, pflibomf.obj, pfmz.obj, pfomf.obj, pfpe.obj, pfrsrc.obj
         ENDPROGRAM euroasm:

▲Back to the top▲