EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

eaopt.htm
Class
EAOPT
Enumerations
%EaoptEasmList
%EaoptFeaList
%EaoptMiscList
%EaoptStatusList
Encodings
EaoptEnc
Procedures
EaoptAssemble
EaoptGetOnePath

EAOPT is a set of €ASM options controlled with

  1. built-in factory defaults,
  2. keywords specified at euroasm.exe command-line,
  3. keywords specified in [EUROASM] section of euroasm.ini,
  4. keywords specified as operands of pseudoinstruction EUROASM.

Instances of this class appear as a member of EA, SRC, PGM and Src.EaoptStack objects.
All EAOPT objects allocate memory from Ea.Pool.

Current Euroasm options in charge, which control the assembly, are always read from Ea.Eaopt.

Manipulation with EAOPT object
ActionSourceDestination
EaCreate Factory defaultsEa.Eaopt
EaMain Cmd line optionsEa.Eaopt
Global euroasm.iniEa.Eaopt
Cmd line options againEa.Eaopt
Ea.EaoptEa.EaoptIni
SrcCreate Ea.EaoptIniSrc.Eaopt
Local euroasm.iniSrc.Eaopt
Src.EaoptEa.Eaopt
PgmCreateProgram Ea.EaoptPgm.Eaopt
PassCreate Pgm.EaoptEa.Eaopt
EUROASM PUSH Ea.EaoptSrc.EaoptStack
EUROASM option= option=Ea.Eaopt
EUROASM POP Src.EaoptStackEa.Eaopt
In order to introduce a new EUROASM option, it must be inserted into
  1. %Eaopt*List enumeration,
  2. EAOPT structure,
  3. factory-default euroasm.ini file,
  4. EaoptAssemble configuration handler,
  5. VarExpand retrieve handler,
  6. Pseudoinstructions/EUROASM manual,
  7. Elements/EUROASM System %variables manual,
  8. test program.

      EUROASM NOWARN=3720,NOWARN=2101
eaopt PROGRAM FORMAT=COFF,MODEL=FLAT,WIDTH=32
INCLUDEHEAD "euroasm.htm" ; Interface (structures, symbols and macros) of other modules.
INCLUDEHEAD  \  ; Include headers of another modules used in this module.
dict.htm,    \
ea.htm,      \
exp.htm,     \
ii.htm,      \
msg.htm,     \
pf.htm,      \
pgm.htm,     \
pgmopt.htm,  \
sss.htm,     \
sym.htm,     \
syswin.htm,  \
var.htm,
;;
eaopt HEAD ; Start of module interface.
↑ EAOPT
This structure contains assembled options from configuration file euroasm.ini or from pseudoinstruction PseudoEUROASM. There are five kinds of options in EAOPT, specified in enumerations defined below:
  1. %EaoptStatusList enumerates boolean members defined in EAOPT.Status encoding and kept in EAOPT.Status,
  2. CPU generation options listed in DictEaoptCpu dictionary declare boolean members in CPU requirements encoding kept in EAOPT.Machine,
  3. SIMD generation options listed in DictEaoptSimd dictionary declare boolean members in SIMD requirements encoding kept in EAOPT.Machine,
  4. %EaoptFeaList enumerates boolean members defined in CPU features encoding and kept in EAOPT.Features,
  5. %EaoptMiscList enumerates miscellanous non-boolean members listed in DictEaoptMisc dictionary and kept in EAOPT members.
EAOPT STRUC
.ListFilePtr      D DWORD ; Option EUROASM LISTFILE=.
.ListFileSize     D DWORD ; Number of bytes in LISTFILE.
.MaxInclusions    D DWORD ; Option EUROASM MAXINCLUSIONS=.
.MaxLinks         D DWORD ; Option EUROASM MAXLINKS=.
                  ; +10h.
.Status           D DWORD ; Boolean EUROASM options in EaoptEnc below.
.Machine          D DWORD ; CPU and SIMD generation in CPU requirements encoding.
.Features         D DWORD ; Processor properties in CPU features  encoding.
.DumpWidth        D DWORD ; Option EUROASM DUMPWIDTH=.
                  ; +20h.
.IncludePathPtr   D DWORD ; Option EUROASM INCLUDEPATH=.
.IncludePathSize  D DWORD ; Number of bytes in INCLUDEPATH string.
.LinkPathPtr      D DWORD ; Option EUROASM LINKPATH=.
.LinkPathSize     D DWORD ; Number of bytes in LINKPATH string.
                  ; +30h.
.RunPathPtr       D DWORD ; Option EUROASM RUNPATH=.
.RunPathSize      D DWORD ; Number of bytes in RUNPATH string.
.InterpreterPtr   D DWORD ; Option EUROASM INTERPRETER=.
.InterpreterSize  D DWORD ; Number of bytes in INTERPRETER string.
                  ; +40h.
.CodePage         D DWORD ; Option EUROASM CODEPAGE=.
.TimeStamp        D DWORD ; Option EUROASM TIMESTAMP=. Initialized from Ea.TimeStart in EaCreate.
.NoWarn           D 500*B ; Options EUROASM NOWARN= and WARN=.
     ; Each .NoWarn bit will suppress one warning from I0000 to W3999.
     ; E.g. EUROASM NOWARN=0003..0006 will set the byte [EAOPT.NoWarn+0] to 0x79.
  ENDSTRUC EAOPT  ; Size=0x23C=572.
↑ EaoptEnc
Encoding of flags used in EAOPT.Status, set by pseudoinstruction EUROASM.
eaoptAUTOALIGN    EQU 0x0000_0001
eaoptAUTOSEGMENT  EQU 0x0000_0002
eaoptDUMP         EQU 0x0000_0010
eaoptDUMPALL      EQU 0x0000_0020
eaoptLIST         EQU 0x0000_0100
eaoptLISTINCLUDE  EQU 0x0000_1000
eaoptLISTMACRO    EQU 0x0000_2000
eaoptLISTREPEAT   EQU 0x0000_4000
eaoptLISTVAR      EQU 0x0000_8000
eaoptDISPLAYSTM   EQU 0x0001_0000
eaoptDISPLAYENC   EQU 0x0002_0000
eaoptUNICODE      EQU 0x0010_0000
eaoptDEBUG        EQU 0x0040_0000
eaoptPROFILE      EQU 0x0080_0000
eaoptNOWARN       EQU 0x8000_0000 ; Internal flag to distinguish WARN=/NOWARN= in EaoptAssemble.
↑ %EaoptMiscList
EUROASM nonboolean options and EUROASM system %^variables enumeration used in DictEaoptMisc, EaoptAssemble.
%EaoptMiscList    %SET CPU,SIMD,WARN,NOWARN,CODEPAGE,DUMPWIDTH,LISTFILE, TIMESTAMP, \
                       MAXINCLUSIONS,MAXLINKS,INCLUDEPATH,LINKPATH,RUNPATH,INTERPRETER
↑ %EaoptFeaList
EUROASM processor features and EUROASM system %^variables enumeration used in DictEaoptFea, EaoptAssemble.
%EaoptFeaList    %SET PROT,VMX,AES,SHA,LWP,XOP,MVEX,EVEX,FPU,TSX,MMX,SGX,ABM,SVM,MPX,  \
                      PRIV,UNDOC,AMD,CYRIX,VIA,D3NOW,FMA,SPEC,CET
↑ %EaoptStatusList
EUROASM boolean options and EUROASM system %^variables enumeration used in DictEaoptFea, EaoptAssemble.
%EaoptStatusList %SET AUTOALIGN,AUTOSEGMENT,DUMP,DUMPALL,LIST,LISTINCLUDE,LISTMACRO,LISTREPEAT,LISTVAR, \
                      DISPLAYSTM,DISPLAYENC,UNICODE,DEBUG,PROFILE
↑ %EaoptEasmList
€ASM system %^variables enumeration used in DictEaoptFea.
%EaoptEasmList %SET DATE, EUROASMOS, PASS, PROC, PROGRAM, SECTION, SEGMENT, \
                    SOURCEEXT, SOURCEFILE, SOURCELINE, SOURCENAME, TIME, VERSION
%EaoptEasmListLength %SETL %EaoptEasmList
  ENDHEAD eaopt  ; End of module interface.
[.text]
↑ EaoptAssemble EaoptPtr, KeyPtr, KeySize, ValPtr, ValSize
EaoptAssemble will process one EUROASM keyword option, e.g. LISTVAR=ON or NOWARN=3305..3307
Input
EaoptPtr Pointer to EAOPT structure, where the assembled option will be written to.
KeyPtr Pointer to key name, e.g. NOWARN.
KeySize Size of option key.
ValPtr Pointer to option value, e.g.3305..3307.
ValSize Size of the value.
Output
The object at EaoptPtr is modified.
Error
Errors W3712,W3713,W3715,W3720 are reported with macro Msg.
Invokes
DictLookup ExpCheckBounds ExpEvalBoolean ExpEvalNum ExpParseRange
Invoked by
EaIniAssemble PseudoEUROASM
Tested by
t2280
EaoptAssemble Procedure EaoptPtr, KeyPtr, KeySize, ValPtr, ValSize
EaoptKey       LocalVar ; Ptr to Msg !1S with option name.
EaoptVal       LocalVar ; Ptr to Msg !2S with unassembled option value.
EaoptRightPtr  LocalVar ; Right range expression.
EaoptRightSize LocalVar
EaoptLeftVal   LocalVar ; Value of lower (left side) range expression.
EaoptRightVal  LocalVar ; Value of greater (right side) range expression.
     MOV EDI,[%EaoptPtr]
     MOV ESI,[%ValPtr]
     MOV ECX,[%ValSize]
     LEA EBX,[%KeyPtr]
     LEA EAX,[%ValPtr]
     MOV [%EaoptKey],EBX
     MOV [%EaoptVal],EAX
     ; Parse option keyname.
     Invoke DictLookup::, DictEaoptMisc::,[%KeyPtr],[%KeySize]
     JNC .Misc:                                  ; If non-boolean option was used.
     Invoke DictLookup::, DictEaoptStatus::,[%KeyPtr],[%KeySize]
     JNC .Status:                                ; If boolean nonfeature key was used.
     Invoke DictLookup::, DictEaoptFea::,[%KeyPtr],[%KeySize]
     JNC .Fea:                                   ; If boolean feature key was used.
     Msg '3720',[%EaoptKey]                      ; "!1S" is unknown option in [EUROASM] section.
     JMP .99:
[.data] ; Assembled EAOPT values are stored in arrays of dwords, respectively to their order in enumeration.
     ALIGN DWORD
.FeaFlags:
  fea %FOR %EaoptFeaList
        DD iiFea_%fea
      %ENDFOR fea
.StatusFlags:
 status %FOR %EaoptStatusList
          DD eaopt%status
        %ENDFOR status
.MiscTable:
 misc %FOR %EaoptMiscList
        DD .%misc
      %ENDFOR misc
[.text]
.Fea: ; Feature flag recognized, e.g. MMX=. EAX=%ordinal<<16 + varTypeSysEaopt + varTypeSysEaoptF. ;>>
     AND EAX,varTypeSysEnum
     SHR EAX,16
     MOV EAX,[.FeaFlags-4+4*EAX]
     Invoke ExpEvalBoolean::, ESI,ECX
     JC .99:
     JZ .F0:
     OR [EDI+EAOPT.Features],EAX
     JMP .99:
.F0: NOT EAX
     AND [EDI+EAOPT.Features],EAX
     JMP .99:
.Status: ; Status flag was recognized, e.g. LISTMACRO=. EAX==%ordinal<<16 + varTypeSysEaopt + varTypeSysEaoptS. ; >>
     AND EAX,varTypeSysEnum
     SHR EAX,16
     MOV EAX,[.StatusFlags-4+4*EAX]
     Invoke ExpEvalBoolean::, ESI,ECX
     JC .99:
     JZ .S0:
     OR [EDI+EAOPT.Status],EAX
     JMP .99:
.S0: NOT EAX
     AND [EDI+EAOPT.Status],EAX
     JMP .99:
.Misc: ; Non-boolean EAOPT flag was recognized, e.g. DUMPWIDTH=. EAX=%ordinal<<16+varTypeSysEaopt+varTypeSysEaoptM. ; >>
     ; Input: EBX is !1S key name, ESI,ECX is key value.
     AND EAX,varTypeSysEnum
     SHR EAX,16
     MOV EAX,[.MiscTable-4+4*EAX]
     CALL EAX
     JMP .99:
.W3712:Msg '3712',[%EaoptKey],EAX,ECX,EBX        ; DB '3709 !1S=!2D is out of limit !3D..!4D. Ignored.
     RET
.W3713:Msg '3713',[%EaoptKey],ESI,ECX,EBX,EAX    ; DB '3709 !1S=!2D is out of limit !3D..!4D. Set to !5D.
     RET
.W3715:Msg '3715',[%EaoptKey],[%EaoptVal]        ; Invalid [EUROASM] option "!1S=!2S". Ignored.
     RET
.CODEPAGE::
     PUSH ECX,ESI
      StripSpaces ESI,ECX
      JECXZ .CP6:
      CMPB [ESI],'"'
      JE .CP2:
      CMPB [ESI],"'"
      JE .CP3:
.CP2: StripQuotes ESI,ECX
      JMP .CP5:
.CP3: StripApostrophes ESI,ECX
.CP5: StripSpaces ESI,ECX
.CP6: Invoke DictLookup::,DictCodePages::,ESI,ECX
     POP ESI,ECX 
     JNC .CP8:                                   ; If valid enumerated codepage token found.
     Invoke ExpEvalNum::,ESI,ECX                 ; Otherwise assume it is a numeric identifier.
     JC .W3715:
     Invoke ExpCheckBounds::,0,65535
     JNZ .W3715:
.CP8:MOV [EDI+EAOPT.CodePage],EAX
     RET
.DUMPWIDTH::
     Invoke ExpEvalNum::, ESI,ECX
     JC .W3715:
     MOV ECX,16                                  ; Min.
     MOV EBX,128                                 ; Max.
     Invoke ExpCheckBounds::, ECX,EBX
     JNL .D5:
     MOV ESI,EAX
     MOV EAX,ECX
     CALL .W3713:
     JMP .D9:
 .D5:JNG .D9:
     MOV ESI,EAX
     MOV EAX,EBX
     CALL .W3713:
 .D9:MOV [EDI+EAOPT.DumpWidth],EAX
     RET
.MAXINCLUSIONS::
     Invoke ExpEvalNum::, ESI,ECX
     JC .W3715:
     MOV [EDI+EAOPT.MaxInclusions],EAX
     RET
.MAXLINKS::
     Invoke ExpEvalNum::, ESI,ECX
     JC .W3715:
     MOV [EDI+EAOPT.MaxLinks],EAX
     RET
.TIMESTAMP::
     StripSpaces ESI,ECX
     JECXZ .TS9:                                 ; If TIMESTAMP= is empty or -1, do not change Ea.TimeStamp.
     Invoke ExpEvalNum::, ESI,ECX
     JC .W3715:
     CMP EAX,-1
     JE .TS9:                                    ; If TIMESTAMP= is empty or -1, do not change Ea.TimeStamp.
.TS8:MOV [EDI+EAOPT.TimeStamp],EAX
.TS9:RET
.INCLUDEPATH::
     StripQuotes ESI,ECX
     PoolStore [Ea.Pool::],ESI,ECX
     MOV [EDI+EAOPT.IncludePathSize],ECX
     MOV [EDI+EAOPT.IncludePathPtr],EAX
     RET
.LINKPATH::
     StripQuotes ESI,ECX
     PoolStore [Ea.Pool::],ESI,ECX
     MOV [EDI+EAOPT.LinkPathSize],ECX
     MOV [EDI+EAOPT.LinkPathPtr],EAX
     RET
.RUNPATH::
     StripQuotes ESI,ECX
     PoolStore [Ea.Pool::],ESI,ECX
     MOV [EDI+EAOPT.RunPathSize],ECX
     MOV [EDI+EAOPT.RunPathPtr],EAX
     RET
.INTERPRETER::
     StripQuotes ESI,ECX
     PoolStore [Ea.Pool::],ESI,ECX
     MOV [EDI+EAOPT.InterpreterSize],ECX
     MOV [EDI+EAOPT.InterpreterPtr],EAX
     RET
.LISTFILE::
     StripQuotes ESI,ECX
     PoolStore [Ea.Pool::],ESI,ECX
     MOV [EDI+EAOPT.ListFileSize],ECX
     MOV [EDI+EAOPT.ListFilePtr],EAX
     RET
.CPU::
     Invoke DictLookup::, DictEaoptCpu::,ESI,ECX
     JC .W3715:                                  ; Invalid [EUROASM] option "!1S=!2S". Ignored.
     RstSt [EDI+EAOPT.Machine],iiCPU_CpuMask
     SetSt [EDI+EAOPT.Machine],EAX
     RET
.SIMD::
     Invoke DictLookup::, DictEaoptSimd::,ESI,ECX
     JNC .S5:
     Invoke ExpEvalBoolean::, ESI,ECX
     JC .W3715:                                  ;  Invalid [EUROASM] option "!1S=!2S". Ignored.
     MOV EAX,iiCPU_SSE1 ; EUROASM SIMD=TRUE alias SIMD=SSE1 alias SIMD=SSE.
     JNZ .S5:
     XOR EAX,EAX ; SIMD=FALSE.
 .S5:RstSt [EDI+EAOPT.Machine],iiCPU_SimdMask    ; Erase all previous SIMD flags.
     SetSt [EDI+EAOPT.Machine],EAX
     RET
.NOWARN::
      SetSt [EDI+EAOPT.Status],eaoptNOWARN
      JMPS .W1:
.WARN::
      RstSt [EDI+EAOPT.Status],eaoptNOWARN
.W1:  ADD ECX,ESI                                ; Common handler for WARN= and NOWARN=,
      Invoke ExpParseRange::,ESI,ECX
      JC .W3:                                    ; When no range was provided, e.g. EUROASM NOWARN=3205.
      SUB ECX,EAX
      MOV [%EaoptRightPtr],EAX
      MOV [%EaoptRightSize],ECX
      LEA ECX,[EAX-2]
      SUB ECX,ESI
      Invoke ExpEvalNum::,ESI,ECX
      JC .W3715:
      SUB ECX,ECX
      MOV EBX,3999
      Invoke ExpCheckBounds::,ECX,EBX
      JNZ .W3712:
      MOV [%EaoptLeftVal],EAX
      MOV ESI,[%EaoptRightPtr]
      MOV ECX,[%EaoptRightSize]
      Invoke ExpEvalNum::,ESI,ECX
      JC .W3715:
      SUB ECX,ECX
      Invoke ExpCheckBounds::,ECX,EBX
      JNZ .W3712:
      CMP EAX,[%EaoptLeftVal]
      JGE .W4:
      XCHG EAX,[%EaoptLeftVal]                   ; If swapped range was provided, e.g.EUROASM NOWARN=3205..3200.
      JMPS .W4:
.W3:  SUB ECX,ESI                                ; No range was detected.
      Invoke ExpEvalNum::,ESI,ECX
      JC .W3715:
      SUB ECX,ECX
      MOV EBX,3999
      Invoke ExpCheckBounds::,ECX,EBX
      JNZ .W3712:
      MOV [%EaoptLeftVal],EAX
.W4:  MOV [%EaoptRightVal],EAX
      SUB ECX,ECX
      MOV EAX,[%EaoptLeftVal]                    ; Option number 0..3999.
.W5:  MOV CL,07h
      AND ECX,EAX
      SHR EAX,3
      JSt [EDI+EAOPT.Status],eaoptNOWARN,.W6:
      ; WARN=reset bit.
      BTR [EDI+EAOPT.NoWarn+EAX],ECX
      JMPS .W7:
.W6:  ; NOWARN=set bit.
      BTS [EDI+EAOPT.NoWarn+EAX],ECX
.W7:  MOV EAX,[%EaoptLeftVal]
      INC EAX
      MOV [%EaoptLeftVal],EAX
      CMP EAX,[%EaoptRightVal]
      JBE .W5:
      RET
.99:EndProcedure EaoptAssemble
↑ EaoptGetOnePath PathPtr, PathSize, PathNr
EaoptGetOnePath returns one of the many pathes which may be specified by Euroasm option INCLUDEPATH= or LINKPATH=.
They may be separated with comma , or semicolon ;.
Input
PathPtr is pointer to the pathstring INCLUDEPATH / LINKPATH, without quotes.
PathSize is number of bytes in this string.
PathNr (0,1,2...) specifies how many pathes to skip in INCLUDEPATH / LINKPATH contents.
Output
CF=0 ESI,ECX specify one path, unquoted, trimmed from white spaces. It may not be terminated with slash.
CF=1, ECX=0 if no path with requested ordinal number is found in INCLUDEPATH / LINKPATH.
Error
-
Invoked by
ChunkInclude PfLoad PfpeLoadStubFile PfrsrcLoadIconFile
EaoptGetOnePath Procedure PathPtr, PathSize, PathNr
    SUB EAX,EAX
    MOV ECX,[%PathSize]
    MOV ESI,[%PathPtr]
    MOVD [%ReturnECX],EAX
    LEA EDX,[ESI+ECX]                            ; End of pathes.
.10:CMP ESI,EDX 
    CMC
    JC .90:
    MOV EDI,ESI                                  ; Potential start of path.
.30:CMP ESI,EDX                                  ; Parse pathstring up to the separator or EDX.
    JNB .50:
    LODSB
    CMP AL,','
    JE .40;
    CMP AL,';'
    JNE .30:
.40:DEC ESI
.50:MOV ECX,ESI                                  ; EDI..ESI is parsed path.
    INC ESI
    SUB ECX,EDI
    StripSpaces EDI,ECX
    JECXZ .10:                                   ; Empty pathes do not count, e.g. path1;;path2.
    DECD [%PathNr]
    JNS .10:                                     ; If not the required path number yet.
    CLC
    MOV [%ReturnESI],EDI
    MOV [%ReturnECX],ECX
.90:EndProcedure EaoptGetOnePath
  ENDPROGRAM eaopt

▲Back to the top▲