Author Topic: Asmc Command-Line Reference  (Read 739 times)

nidud

  • Member
  • *****
  • Posts: 1651
    • https://github.com/nidud/asmc
Asmc Command-Line Reference
« on: June 20, 2018, 09:31:07 AM »
Asmc Command-Line Reference

Assembles and links one or more assembly-language source files. The command-line options are case sensitive.

ASMC [[options]] filename [[ [[options]] filename]]

options

         The options listed in the following table.

/[0|1|..|10][p]Set CPU: 0=8086 (default), 1=80186, 2=80286, 3=80386, 4=80486, 5=Pentium,6=PPro,7=P2,8=P3,9=P4,10=x86-64. [p] allows privileged instructions.
/assertGenerate .assert(code). Same as .assert:on.
/autostack[-auto] [[option win64:[NO]AUTO]] Calculate required stack space for arguments.
/binGenerate plain binary file.
/CsPush user registers before stack-frame is created in a proc.
/coffGenerate COFF format object file.
/CpPreserves case of all user identifiers.
/CuMaps all identifiers to upper case (default).
/cuiLink switch used with /pe -- subsystem:console (default).
/CxPreserves case in public and extern symbols.
/Dsymbol[[=value]]Defines a text macro with the given name. If value is missing, it is blank. Multiple tokens separated by spaces must be enclosed in quotation marks.
/enumberSet error limit number.
/elfGenerate 32-bit ELF object file.
/elf64Generate 64-bit ELF object file.
/EPGenerates a preprocessed source listing (sent to STDOUT). See /Sf.
/eqDon't display error messages.
/Fd[file]Write import definition file.
/FifileForce file to be included.
/Fl[[filename]]Generates an assembled code listing. See /Sf.
/FofilenameNames an object file.
/FwfilenameSet errors file name.
/FPiGenerates emulator fix-ups for floating-point arithmetic (mixed language only).
/FPi8780x87 instructions (default).
/fpcDisallow floating-point instructions.
/fpnSet FPU: 0=8087, 2=80287, 3=80387.
/GcSpecifies use of FORTRAN- or Pascal-style function calling and naming conventions. Same as OPTION LANGUAGE:PASCAL.
/GdSpecifies use of C-style function calling and naming conventions. Same as OPTION LANGUAGE:C.
/guiLink switch used with /pe -- subsystem:windows.
/GvSpecifies use of VECTORCALL-style function calling and naming conventions.
/GzSpecifies use of STDCALL-style function calling and naming conventions. Same as OPTION LANGUAGE:STDCALL.
/homeparams[-home] [[option win64:[NO]SAVE]] Forces parameters passed in registers to be written to their locations on the stack upon function entry.
/IpathnameSets path for include file.
/m[t|s|c|m|l|h|f]Set memory model.
/mzGenerate DOS MZ binary file.
/ncnameSet class name of code segment.
/ndnameSet name of data segment.
/nmnameSet name of module.
/ntnameSet name of text segment.
/nologoSuppresses messages for successful assembly.
/omfGenerates object module file format (OMF) type of object module.
/peGenerate PE binary file, 32/64-bit.
/pfPreserve Flags (Epilogue/Invoke).
/qSuppress copyright message.
/rRecurse subdirectories with use of wild args.
/SaTurns on listing of all available information.
/safesehMarks the object as either containing no exception handlers or containing exception handlers that are all declared with SAFESEH.
/SfAdds first-pass listing to listing file.
/SgTurns on listing of assembly-generated code.
/SnTurns off symbol table when producing a listing.
/Sp[n]Set segment alignment.
/stackalign[-stac] [[option win64:[NO]ALIGN]] Align stack variables to 16-byte.
/swcSpecifies use of C-style .SWITCH convention (default).
/swnNo jump-table creation in .SWITCH.
/swpSpecifies use of Pascal-style .SWITCH convention (auto break).
/swrAllows use of register [E]AX or R10/R11 in .SWITCH code.
/swtAllows use of jump-table creation in .SWITCH code (default).
/SxTurns on false conditionals in listing.
/wSame as /W0.
/WlevelSets the warning level, where level = 0, 1, 2, or 3.
/win64Generate 64-bit COFF object.
/ws[CodePage]Store quoted strings as Unicode. See OPTION WSTRING.
/WXReturns an error code if warnings are generated.
/XIgnore INCLUDE environment path.
/XcDisable Asmc extensions.
/zcwNo decoration for C symbols.
/ZdGenerates line-number information in object file.
/ZfMake all symbols public.
/zf[0|1][/color]Set FASTCALL type: MS/OW.
/ZgGenerate code to match Masm.
/Zi[0|1|2|3]Add symbolic debug info.
/zlcNo OMF records of data in code.
/zldNo OMF records of far call.
/zlfSuppress items in COFF: No file entry.
/zlpSuppress items in COFF: No static procs.
/zlsSuppress items in COFF: No section aux entry.
/ZmEnable MASM 5.10 compatibility.
/ZneDisable non Masm extensions.
/Zp[[alignment]]Packs structures on the specified byte boundary.
/ZsPerform syntax check only.
/zt<0|1|2>[/color]Set STDCALL decoration.
/Zv8Enable Masm v8+ PROC visibility.
/zzeNo export symbol decoration.
/zzsStore name of start address.

filename

         The name of the file.

Environment Variables

INCLUDESpecifies search path for include files.
ASMCSpecifies default command-line options.
TEMPSpecifies path for temporary files.

ASMC64

ASMC64 is similar to ML64 so it does not understand CPU or MODEL directives. The /win64 switch is silently ignored but the rest of the switches marked green will generate an error if used.
« Last Edit: March 15, 2019, 11:43:47 PM by nidud »

Vortex

  • Member
  • *****
  • Posts: 1921
Re: Asmc Command-Line Reference
« Reply #1 on: March 13, 2019, 06:20:03 AM »
Hi nidud,

Regarding the directive file linkw.lnk :

Code: [Select]
# Win32 console application
system begin con_32
    option  quiet
    libpath %ASMCDIR%\lib
    library libc,kernel32,user32
    symt    _cstart
    format  windows pe ^
    runtime console=4.0
end

If I am not wrong, symt is the directive informing the linker about the entry point of an executable.

I can link an object module like the following :

Code: [Select]
\asmc-master\bin\linkw format windows pe runtime console option NORelocs symt _cstart file Hello.obj
If I remove the directive symt, I get the following message :

Code: [Select]
Warning! W1023: no starting address found, using 00401000
Reading the manul JWlink.chm supplied with the source code of Asmc :

Quote
Formats:  All
The SYMTRACE directive instructs JWlink to print a list of all modules that reference the specified symbols.  The format of this directive ( short form SYMT ) is

         SYMTRACE  symbol_name{,symbol_name}

where <symbol_name> is the name of a symbol.

The information is displayed in the map file ( see the MAP option ).

Example:

     jwlink system my_os op map file test lib math symt sin, cos

JWlink will list, in the map file, all modules that reference the symbols "sin" and "cos".

Also see the MODTRACE directive.

linkw does not list any symbol in my test above. What's the correct usage of the directive symt? Could you confirm that it's used to specify the entry point? Thanks.

nidud

  • Member
  • *****
  • Posts: 1651
    • https://github.com/nidud/asmc
Re: Asmc Command-Line Reference
« Reply #2 on: March 13, 2019, 10:59:55 AM »
What it does is to flag a symbol to keep track of references to so it's more like a forced inclusion of a module. In this case _cstart is an actual entry point (and calls main) but symt _strtok will give the same error.

The help info is somewhat right in that the modules added will also end up in the map file, but the extended listing explanation seems a bit strange.

Vortex

  • Member
  • *****
  • Posts: 1921
Re: Asmc Command-Line Reference
« Reply #3 on: March 16, 2019, 06:07:01 AM »
Hi nidud,

Thanks. I found the run-time module defining the symbol _cstart.

nidud

  • Member
  • *****
  • Posts: 1651
    • https://github.com/nidud/asmc
Re: Asmc Command-Line Reference
« Reply #4 on: March 16, 2019, 10:11:00 PM »
There's currently 5 startup modules in lib32: Console and GUI (A/W) modules, and one for Watcom C. The names of the entry points differ based on compiler/linker used.
Code: [Select]
_mainCRTStartup:  - link    - main() - C
_cstart:   - linkw
_wmainCRTStartup: - link    - wmain() - C
_wcstart:         - linkw
_WinStart:   - link(w) - WinMain()  - stdcall
_wWinStart:       - link(w) - wWinMain() - stdcall
_cstart_:   - wlink   - main_() - watcall

Vortex

  • Member
  • *****
  • Posts: 1921
Re: Asmc Command-Line Reference
« Reply #5 on: March 17, 2019, 05:50:33 AM »
Linking an object module with linkw :

Code: [Select]
linkw format windows pe option NORelocs option start=_cstart file Hello.obj