EuroAssembler Index Manual Download Source Macros

Sitemap Links Forum Tests Projects

Assembly Stub
Assembly €ASM
Global %variables

euroasm.htm is the nominal EuroAssembler source, linker and make script.
It is not a module, actual data and code are scattered in other source modules and included here.

EuroAssembler program itself can be rebuilt with command ..\euroasm euroasm.htm executed in subdirectory easource.
Rebuild uses the stable version located in EuroAssembler home directory .. or in system %PATH%.
Those output files are created during the rebuild:

  1. Tailored configuration file ..\easource\euroasm.ini used for initialization of all modules.
  2. MZ executable stub ..\objlib\coffstub.exe assembled from ..\easource\coffstub.htm.
  3. Object COFF modules ..\easource\*.obj assembled from their sources ..\easource\*.htm , from macrolibraries ..\maclib\*.htm and from factory-default configuration ..\objlib\euroasm.ini.
  4. Target executable ..\easource\euroasm.exe linked from
    1. COFF modules ..\easource\*.obj ,
    2. stub ..\objlib\coffstub.exe
    3. icon ..\objlib\euroasm.ico.
  5. Common listing ..\easource\euroasm.htm.lst

This file ..\easource\euroasm.htm in its HEAD..ENDHEAD block is also hosting common interface headers from all other source modules which are included to each module (except for its own).

↑ Initialization
Common default options required for the assembly of all EuroAssembler modules will be saved to a dynamically created local configuration file easource/euroasm.ini , so they need not to be explicitly specified in each module source file.
euroasm_ini PROGRAM FORMAT=BIN,OUTFILE="euroasm.ini"
DB "; This is a temporary configuration file created on the fly when EuroAssembler is built.",13,10
DB "; It tailors the appearance and format of assembly output and listing.",13,10
DB "[EUROASM]",13,10
DB "NOWARN=0563",13,10  ; I0563 Accepting link directive ''/!1S:!2S''.
DB "NOWARN=2101",13,10  ; W2101 Symbol "!1S" was defined but never used.
DB "NOWARN=2512",13,10  ; W2512 Overwriting macro "!1S" previously defined at !2@.
DB "MAXLINKS=64",13,10
DB "LIST=ON",13,10
DB "DUMP=ON",13,10
DB "DUMPWIDTH=28",13,10
DB "CPU=586",13,10
DB "DEBUG=OFF",13,10
DB "; Program options for all EuroAssembler modules:",13,10
DB "[PROGRAM]",13,10
DB "WIDTH=32",13,10
DB "MAXPASSES=48",13,10
 ENDPROGRAM euroasm_ini
↑ Assembly the stub file
Dos executable stub file in MZ format will be assembled separately, if it needs recompilation.

Target file ../objlist/coffstub.exe depends on its source ../easource/coffstub.htm.

    %IF FILETIME# "..\objlib\coffstub.exe" <= FILETIME# "coffstub.htm"
       INCLUDE "coffstub.htm"  ; Include and compile the stub for euroasm.exe.
↑ Headers
Block euroasm: HEAD .. ENDHEAD euroasm: in this file contains the common module header, which is included into every EuroAssembler source module. It refers interface of all other modules, thus each module knows about macros, structures and global symbols defined in other modules.
euroasm: HEAD ; Begin common interface block which is included to all modules.
↑ Global %variables
Parameters specified here are valid for all EuroAssembler sources.
%EuroasmOS specifies the operating system which EuroAssembler is compiled for. This version od €ASM supports only Win (32bit MS Windows) at this moment.
%EuroasmOS    %SET Win ; Identifier of EuroAssembler OS (1..4 characters).

    %eaos     %SET     ; Lowercase version of %EuroasmOS will be used in filenames to include.
    %eaossize %SETS %EuroasmOS        ; Get number of characters in this %variable.
  i %FOR 1..%eaossize
      %lc %SETC '%EuroasmOS[%i]' | 0x20 ; Convert i-th character to lowercase, set it to %lc
      %eaos %SET %eaos%lc             ;  and append it to %eaos.
    %ENDFOR i                         ; %eaos is now 'win'.

                                              ; %EaDefaultDllName is used in Win version only.
%EaDefaultDllName     %SET kernel32.dll       ; Used when IMPORT lacks the LIB= specification.
%EaDefaultDllNameSize %SETS %EaDefaultDllName ; Number of characters in Dll name.
↑ %ModuleList
Array %ModuleList enumerates €ASM source modules which will be assembled and linked to target PE program euroasm.exe.
%ModuleList %SET \
ea,       \
src,      \
pgm,      \
pass,     \
eaopt,    \
chunk,    \
ctx,      \
exp,      \
dict,     \
msg,      \
pgmopt,   \
stm,      \
sss,      \
sym,      \
member,   \
reloc,    \
var,      \
mac,      \
pseudo,   \
ii,       \
iia,      \
iib,      \
iic,      \
iid,      \
iif,      \
iig,      \
iik,      \
iim,      \
iip,      \
iis,      \
iit,      \
iiv,      \
iix,      \
iiy,      \
iiz,      \
lst,      \
pf,       \
pfbin,    \
pfcom,    \
pfmz,     \
pfomf,    \
pflibomf, \
pfcoff,   \
pflibcof, \
pfpe,     \
pfdll,    \
pfrsrc,   \
sys%eaos, \  Expanded to syswin, syslin, sysos2, sysbsd etc.
↑ %MaclibList
%MaclibList is an enumeration of macrolibrary names which are included to all module sources. Library files have file extension .htm, they are searched for in subdirectory ..\maclib\ and they contain definitions of those generally usable macros, which are hired by EuroAssembler.
%MaclibList %SET \
wins,     \
winscon,  \
winsfile, \
winapi,   \
winfile,  \
memory,   \
stdcal32, \
cpuext,   \
cpuext32, \
status32, \
string32, \
sort32,   \
is the list of runtime procedures declared as PROC1 in semiinlined macros.
Scope of those procedures will be declared as EXTERN in all modules except for module ea.htm where are the macros expanded.
This prevents the runtime code from being repeatedly emitted in each separately assembled module, which would unnecessarily blow up the final PE size.
%@RTprocedureList %SET     \
BufferCreate@RT,           \
BufferNew@RT,              \
BufferResize@RT,           \
BufferStore@RT,            \
BufferStoreByte@RT,        \
BufferStoreWord@RT,        \
BufferStoreDword@RT,       \
Clear32@RT,                \
Compare32@RT,              \
CopyTo32@RT,               \
DecodeUTF8@RT,             \
FileAssignA@RT,            \
FileClose@RT,              \
FileCreate@RT,             \
FileEach@RT,               \
FileMapOpen@RT,            \
FileMkDir@RT,              \
FileNameParseA@RT,         \
FileWrite@RT,              \
GetLength$A@RT,            \
SysGetFileSize@RT,         \
SysGetFileTime@RT,         \
IiAbort@RT,                \
IiAbortIfNotST0@RT,        \
IiAllowLocking@RT,         \
IiDataSize@RT,             \
IiStringDestination@RT,    \
IiStringSource@RT,         \
IiDispatchFormatFail@RT,   \
IiDispatchLocation@RT,     \
IiDispSize@RT,             \
IiEmitImm@RT,              \
IiEmitImm2@RT,             \
IiEmitOpcode@RT,           \
IiImmSize@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,            \
↑ Inclusion
Here are macrolibraries and interface headers from €ASM sources included to all source modules.
  EUROASM  NOWARN=0563, NOWARN=2101, NOWARN=2512, \ ; Common options valid for each source module.
;; Declare the list of macrolibrary file names.
%LibraryFiles %SET ; Initialize as empty array.
library %FOR %MaclibList
          %LibraryFiles %SET %LibraryFiles,"%library.htm"
        %ENDFOR library
   %IF "%^PROGRAM" !== "euroasm"
      INCLUDE %LibraryFiles ; Perform the actual inclusion of used macrolibraries to each module.
   %IF "%^PROGRAM" == "ea" ; Perform the actual scope declarations of runtime procedures.
     PUBLIC %@RTprocedureList
     %IF "%^PROGRAM" !== "euroasm"
       EXTERN %@RTprocedureList
;; Dynamically construct the list of interface headers from all other modules.
%ModulesToIncludehead %SET ; Initialize as empty array.
module %FOR %ModuleList
         %IF "%module" !== "%^PROGRAM" && "%^PROGRAM" !== "euroasm" ; Omit duplication of the own interface of current module.
            %ModulesToIncludehead %SET %ModulesToIncludehead,"%module.htm"
       %ENDFOR module
       INCLUDEHEAD1 %ModulesToIncludehead ; Perform the actual interface inclusion.
     ENDHEAD euroasm: ; End of common interface, which is included to all €ASM sources.
↑ Assembly
All modules enumerated in the array %ModuleList will be assembled to object files in COFF format.
In order to spare build time, object modules are assembled only if they are missing or if they are older than their source.
  module %FOR %ModuleList
           %IF FILETIME# "%module.obj" <= FILETIME# "%module.htm" ;> Reassembly only if the object file isn't fresh.
             %ModulesToAssemble %SET %ModulesToAssemble,"%module.htm"
         %ENDFOR module
         EUROASM LISTINCLUDE=ON ; Incorporate listing of each module to euroasm.htm.lst.
         INCLUDE %ModulesToAssemble ; Perform the actual assembly of each included PROGRAM..ENDPROGRAM block.
↑ Linking
All modules are assembled to their object files now. Here goes the declaration of final target executable program and LINK statement enumerating its modules.
         ; Define executable properties.
euroasm: PROGRAM Format=PE,Model=FLAT,Width=32,Subsystem=CON, \
                 StubFile="..\objlib\coffstub.exe", IconFile="euroasm.ico", \
                 SizeOfStackReserve=1M, SizeOfStackCommit=8K,  \
                 SizeOfHeapReserve=1M, SizeOfHeapCommit=4K, \
         ; Enumerate all assembled COFF modules which will be linked.
   module %FOR %ModuleList
             %ModulesToLink %SET %ModulesToLink,"%module.obj"
          %ENDFOR module
         ; Perform the actual linking.
          LINK %ModulesToLink ; Perform the linking of all modules to outfile.
         ENDPROGRAM euroasm:

▲Back to the top▲