Upload
others
View
197
Download
4
Embed Size (px)
Citation preview
AsmcMacroAssemblerReference
ThisdocumentlistssomeofthedifferencesbetweenAsmc,JWasm,andMasm.
InThisSection
AsmcCommand-LineOptionDescribestheAsmccommand-lineoption.
AsmcErrorMessagesDescribesAsmcfatalandnonfatalerrormessagesandwarnings.
AsmcExtensionsProvideslinkstotopicsdiscussingMasmversusAsmc.
DirectivesReferenceProvideslinkstotopicsdiscussingtheuseofdirectivesinAsmc.
SymbolsReferenceProvideslinkstotopicsdiscussingtheuseofsymbolsinAsmc.
ChangeLog|Forum
AsmcCommand-LineReference
Assemblesandlinksoneormoreassembly-languagesourcefiles.Thecommand-lineoptionsarecasesensitive.
ASMC[[options]]filename[[[[options]]filename]]
options
Theoptionslistedinthefollowingtable.
/[0|1|..|10][p]
SetCPU: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]allowsprivilegedinstructions.
/assert Generate.assert(code).Sameas.assert:on./bin Generateplainbinaryfile.
/Cs Pushuserregistersbeforestack-frameiscreatedinaproc.
/coff GenerateCOFFformatobjectfile./Cp Preservescaseofalluseridentifiers./Cu Mapsallidentifierstouppercase(default).
/cui Linkswitchusedwith/pe--subsystem:console(default).
/Cx Preservescaseinpublicandexternsymbols.
/Dsymbol[[=value]]Definesatextmacrowiththegivenname.Ifvalueismissing,itisblank.Multipletokensseparatedbyspacesmustbeenclosedinquotationmarks.
/enumber Seterrorlimitnumber./elf Generate32-bitELFobjectfile./elf64 Generate64-bitELFobjectfile.
/EP Generatesapreprocessedsourcelisting(senttoSTDOUT).See/Sf.
/eq Don'tdisplayerrormessages./Fd[file] Writeimportdefinitionfile.
/Fifile Forcefiletobeincluded./Fl[[filename]] Generatesanassembledcodelisting.See/Sf./Fofilename Namesanobjectfile./Fwfilename Seterrorsfilename.
/FPi Generatesemulatorfix-upsforfloating-pointarithmetic(mixedlanguageonly).
/FPi87 80x87instructions(default)./fpc Disallowfloating-pointinstructions./fpn SetFPU:0=8087,2=80287,3=80387.
/GcSpecifiesuseofFORTRAN-orPascal-stylefunctioncallingandnamingconventions.SameasOPTIONLANGUAGE:PASCAL.
/Gd SpecifiesuseofC-stylefunctioncallingandnamingconventions.SameasOPTIONLANGUAGE:C.
/gui Linkswitchusedwith/pe--subsystem:windows.
/Gv SpecifiesuseofVECTORCALL-stylefunctioncallingandnamingconventions.
/GzSpecifiesuseofSTDCALL-stylefunctioncallingandnamingconventions.SameasOPTIONLANGUAGE:STDCALL.
/homeparamsCopyRegisterParameterstoStack.Forcesparameterspassedinregisterstobewrittentotheirlocationsonthestackuponfunctionentry.
/Ipathname Setspathforincludefile./m[t|s|c|m|l|h|f] Setmemorymodel./mz GenerateDOSMZbinaryfile./ncname Setclassnameofcodesegment./ndname Setnameofdatasegment./nmname Setnameofmodule./ntname Setnameoftextsegment./nologo Suppressesmessagesforsuccessfulassembly.
/omf Generatesobjectmodulefileformat(OMF)typeofobjectmodule.
/pe GeneratePEbinaryfile,32/64-bit.
/pf PreserveFlags(Epilogue/Invoke)./q Suppresscopyrightmessage./r Recursesubdirectorieswithuseofwildargs./Sa Turnsonlistingofallavailableinformation.
/safesehMarkstheobjectaseithercontainingnoexceptionhandlersorcontainingexceptionhandlersthatarealldeclaredwithSAFESEH.
/Sf Addsfirst-passlistingtolistingfile./Sg Turnsonlistingofassembly-generatedcode./Sn Turnsoffsymboltablewhenproducingalisting./Sp[n] Setsegmentalignment.
/swc SpecifiesuseofC-style.SWITCHconvention(default).
/swn Nojump-tablecreationin.SWITCH.
/swp SpecifiesuseofPascal-style.SWITCHconvention(autobreak).
/swr Allowsuseofregister[R|E]AXin.SWITCHcode.
/swt Allowsuseofjump-tablecreationin.SWITCHcode(default).
/Sx Turnsonfalseconditionalsinlisting./w Sameas/W0./Wlevel Setsthewarninglevel,wherelevel=0,1,2,or3./win64 Generate64-bitCOFFobject.
/ws[CodePage] StorequotedstringsasUnicode.SeeOPTIONWSTRING.
/WX Returnsanerrorcodeifwarningsaregenerated./X IgnoreINCLUDEenvironmentpath./Xc DisableAsmcextensions/zcw NodecorationforCsymbols./Zd Generatesline-numberinformationinobjectfile./Zf Makeallsymbolspublic./zf[0|1] SetFASTCALLtype:MS/OW./Zg GeneratecodetomatchMasm./Zi[0|1|2|3] Addsymbolicdebuginfo.
/zlc NoOMFrecordsofdataincode./zld NoOMFrecordsoffarcall.
/zlf SuppressitemsinCOFF:Nofileentry./zlp SuppressitemsinCOFF:Nostaticprocs./zls SuppressitemsinCOFF:Nosectionauxentry./Zm EnableMASM5.10compatibility./Zne DisablenonMasmextensions./Zp[[alignment]] Packsstructuresonthespecifiedbyteboundary./Zs Performsyntaxcheckonly./zt<0|1|2> SetSTDCALLdecoration./Zv8 EnableMasmv8+PROCvisibility./zze Noexportsymboldecoration./zzs Storenameofstartaddress.
filename
Thenameofthefile.
EnvironmentVariables
INCLUDE Specifiessearchpathforincludefiles.
ASMC Specifiesdefaultcommand-lineoptions.
TEMP Specifiespathfortemporaryfiles.
SeeAlso
ASMCErrorMessages
AsmcErrorMessages
TheerrormessagesgeneratedbyAsmccomponentsfallintothreecategories:
Fatalerrors(A1000-A1901):Theseindicateasevereproblemthatpreventstheutilityfromcompletingitsnormalprocess.Nonfatalerrors(A2000-A3021):Theutilitymaycompleteitsprocess.Ifitdoes,itsresultisnotlikelytobetheoneyouwant.Warnings(A4000-A8020):Thesemessagesindicateconditionsthatmaypreventyoufromgettingtheresultsyouwant.
Allerrormessagestakethefollowingform:
Utility:Filename(Line):[Error_type}(Code):Message_text
UtilityTheprogramthatsenttheerrormessage.
FilenameThefilethatcontainstheerror-generatingcondition.
LineTheapproximatelinewheretheerrorconditionexists.
Error_typeFatalError,Error,orWarning.
CodeTheunique5-or6-digiterrorcode.
Message_textAshortandgeneraldescriptionoftheerrorcondition.
SeeAlso
AsmcMacroAssemblerReference
AsmcMacroAssemblerReference
AsmcExtensions
ThemaingoalwithAsmcisanattempttoprovidemorereadabilitytotheassemblylanguagebasedonMasmsyntaxbutatthesametimekeepcompatibilitywithexistingsourcecode.InordertoachievethissomeofthemaincoreoftheassemblerhastoberewrittenandtheHLLsectionenhancedasdiscussedbelow.
InThisSection
ParsingoflabelsProvideslinkstotopicsdiscussingparsingoflabels.
ExpansionofmacrosProvideslinkstotopicsdiscussingexpansionofmacros.
TheinvokedirectiveProvideslinkstotopicsdiscussingtheinvokedirective.
TheHLLsectionProvideslinkstotopicsdiscussingtheHLLsection.
HandlingofstringsProvideslinkstotopicsdiscussinghandlingofstrings.
EnhancedvectorextensionProvideslinkstotopicsdiscussingEnhancedvectorextension.
SeeAlso
AsmcMacroAssemblerReference
DirectivesReference
OPTIONoptionlist
Enablesanddisablesfeaturesoftheassembler.AddedoptionsbyASMCinclude:
OPTIONASMCOPTIONCSTACKOPTIONSWITCHOPTIONLOOPALIGNOPTIONCASEALIGNOPTIONWSTRING
ConditionalControlFlow
.IF
.WHILE
.REPEAT
.UNTILCXZ
.BREAK
.CONTINUE
.FOR
.SWITCH
.CASE
.ENDC
.GOTOSW
.DEFAULT
.ENDSW
.COMDEF
.CLASSDEF
.ENDS
.ASSERTFlagconditionsSignedcompareReturncode
SeeAlso
0.Contents1.About2.CommandlineOptionsOptions-0,-1,-2,...,-10Option-binOption-coffOption-djgppOption-eOption-elfOption-elf64Option-eqOption-FdOption-FPiOption-FwOptions-Gc,-Gd,-Gr,-GzOption-mOption-mzOption-ncOptions-nd,-ntOption-nmOption-peOption-win64Option-zcOption-ZdOption-zfOption-ZgOption-ZiOptions-zlcand-zldOptions-zlf,-zlpandzlsOption-ZmOption-ZneOption-ztOption-Zv8Option-zzeOption-zzs
3.SyntaxExtensions3.1DirectiveINCBIN3.2FASTCALLRegisterCallingConvention3.3IDsenclosedinBackQuotes3.4Floating-PointImmediatesinInstructions3.5DirectiveOPTIONFIELDALIGN3.6DirectiveOPTIONPROCALIGN3.7DirectiveOPTIONMZ3.8DirectiveOPTIONELF3.9DirectiveOPTIONWIN643.10DirectiveOPTIONFRAME3.11DirectiveOPTIONRENAMEKEYWORD3.12DirectiveOPTIONDLLIMPORT3.13DirectiveOPTIONCODEVIEW3.14DirectiveOPTIONSTACKBASE3.15DirectivesPUSHCONTEXT/POPCONTEXTALIGNMENT3.16Directives.X64and.X64p3.17AttributeLABELforfirstMacroParameter3.18MemberArgumentforIF[N]DEFand.ERR[N]DEF3.19InitializationofDataItemsofTypeMMWORD/XMMWORD3.20OptionalArraySizeforLABELDirective3.21OptionalNameArgumentforSimplifiedSegmentDirectives3.22SegmentAttributeCOMDAT3.23AttributeVARARGMLforlastMacroParameter3.24Miscellaneous3.24.1Numericconstant__JWASM__3.24.2OperatingSystemArgumentfor.MODEL3.24.3AcceptedParametersforIF[N]DEFDirective3.24.4VisibilityofProcedures3.24.5Non-RIP-RelativeAddressingin64-Bit4.InstructionSets5.CodeGenerationDifferences5.1ForwardReferencesinMacroExpressions6.OutputFormats6.1OMFOutputFormat6.2COFFOutputFormat6.3Win64OutputFormat6.4BinaryOutputFormat6.5PEOutputFormat
7.MasmBugsfixedinJWasm8.OptionalFeatures9.KnownBugsandmissingFeatures10.LicenseAppendixA.ReservedWordsAppendixB.SourceSamplesAppendixC.ErrorsandWarningsAppendixD.DifferencesbetweenMasm6andMasm8AppendixE.Restrictionsofprecommpiled16-bitBinaryJWASMR.EXEAppendixF.AdditionalFeaturesofJWasm'sDebugVersion
1.AboutThisdocumentliststhedifferencesbetweenJWasmandMasm,asfarastheuserinterfaceisconcerned.
WhenMasmismentioned,thenusuallyMasmv8.00ismeant,unlessstatedotherwise.Masmv8.00alsowasthefirstMasmversionsupporting64-bit(ML64.EXE).
TheMasmdocumentationitselfcanbefoundonnumerousplacesintheweb,inplaintext,HTML,PDFandWindowsHelpformat.However,it'susuallyjustthedocumentationthatcamewhithMasmv6.1-henceabitoutdatednowadays(thechangesfromMasmv6toMasmv8arelistedinAppendixD).
2.CommandlineOptionsEntering'JWasm-?'or'JWasm-h'willmakeJWasmdisplaytheoptionsitunderstands.AlotofthemexistinbothMasmandJWasm,butsomearevalidforJWasmonly;OTOH,afewoptionsaremissinginJWasm.
Optionsareusuallyenteredviathecommandline.Additionally,whenstarting,JWasmwillsearchforenvironmentvariableJWASMandhandleitsimilartothewayMasmhandlesvariableML.Henceitisalsopossibletoenteroptionsviathismethod.
TheoptionsspecifictoJWasm-andalsotheoptionswhicharehandledsomewhatdifferentlybyJWasmcomparedtoMasm-willbehandledinthefollowingchapters.
Onemajordifferenceshouldbementionedhere:JWasmdoesneverlaunchalinkeronitsown(whichMasmdoesunlessoption-cisgiven).ThismakesafewMasmoptionsuselessforJWasm,andhencetheyarenotimplemented;seeChapterKnownBugsandmissingFeaturesfordetails.
Options-0,-1,-2,...,-10:SelectCpuOption[0|1|..|10]selectscpu/instructionset.Mostvaluescorrespondtocpudirectives:
0 .80861 .1862 .2863 .3864 .4865 .5866 .6867 .686and.MMX(P2)8 .686,.MMXandSSEinstructions(P3)9 .686,.MMX,SSEandSSE2instructions(P4)10 .x64(x86-64cpu)
Option-bin:SelectOutputFormatBinaryOption-binselectsoutputformatBINary.Theoutputmodule'sdefaultfileextensionwillbechangedfrom.OBJto.BIN.
Formoreinformation,seeBinaryOutputFormat.
ChapterOutputFormatslistsallavailableoutputformats.
Option-coff:SelectOutputFormatCOFFOption-coffselectsoutputformatCOFF.Themostcommonusefor-coffistoproducemodulesfor32-bitWindows.However,it'snotmandatorythattheoutputwillbe32-bitwith-coff;dependingonwhatcpuisselectedwhenthe.MODELdirectivewillbeparsed,theoutputmaybe32-or64-bit.
FormoreinformationaboutCOFF,seeCOFFOutputFormat.
ChapterOutputFormatslistsallavailableoutputformats.
Option-djgpp:SelectOutputFormatforDJGPP(optional)Option-djgppselectsDjgpp'svariantofCOFFasoutputformat.Sinceitisrarelyusednowadays,thisoptionisn'tactivatedintheprecompiledbinaries.SeeOptionalFeatureshowtoenableit.
ChapterOutputFormatslistsallavailableoutputformats.
Option-e:SeterrorlimitAllowstosetthenumberoferrorsafterwhichtheassemblyprocessisaborted.Thedefaultvalueis50.
Option-elf:Select32-bitOutputFormatELFOption-elfselectsoutputformatELF.JWasmwillproduceanobjectmodulein32-bitElfformat.
UseOPTIONELFtosetvaluesintheELFheader.
ChapterOutputFormatslistsallavailableoutputformats.
Option-elf64:Select64-bitOutputFormatELFOption-elf64selectsoutputformatELF64.JWasmwillproduceanobjectmodulein64-bitElfformat.Additionally,thisoptionwillsetcputox86-64andmodeltoFLAT.
UseOPTIONELFtosetvaluesintheELFheader.
ChapterOutputFormatslistsallavailableoutputformats.
Option-eq:SuppressErrorMessagesonScreenOption-eqwillsuppressdisplayingerrormessagesonthescreen.Theyarestillwrittenintoanerrorfile.
Option-Fd:WriteImportDefinitionsOption-FdmakesJWasmwriteimportdefinitionsinaformatunderstoodbyOpenWatcom'sWlinkandJWlink.Suchdefinitionswilltellthelinkerhowtoresolvetheexternalreference;noimportlibraryisneeded.ThisoptionisonlyusefulinconjunctionwithOPTIONDLLIMPORT(chapter3.12).Syntaxis:
-Fd[=file_name]
Iftheoptional<file_name>argumentisgiven,theimportdefinitionswillbewrittenintoafileofthisname.ThisistheonlywayforOpenWatcom'sWlinktopasstheinformation.
IfJWlinkisused,the<file_name>argumentmaybeomitted.ThenJWasmwillwritetheimportdefinitionsdirectlyintotheobjectmodule'slinkerdirectivesection(section".drectve").ThisworksforoutputformatsCOFFandELFonly.SeesampleWin32_7howtouseJWasmandJWlinktocreateaWindowsbinarywithoutimportlibs.
Option-FPi:ActivateFloating-PointEmulationOption-FPiactivates"inlineFPinstructionswithemulation".ThiswillmakeJWasmcreatefixupsforfloating-pointinstructionsifcodeis16bit.IfsupportedbythelinkerortheOS,theFPinstructionscanthenbereplacedbycallstoanFPemulatorifnocoprocessorexists.
Option-Fw:SetErrorFileNameOption-Fwwillsetthefilenameforwarninganderrormessages.Asdefault,thesemessagesarewrittentoafilewithanameequaltotheassemblysource,butwithextension.ERR.Syntaxis:
-Fwfile_name
Options-Gc,-Gd,-Gr,-Gz:SetDefaultCallingConventionThedefaultcallingconventionsetbytheseoptionsare:
-Gc Pascal-Gd C(decl)-Gr Fastcall-Gz Stdcall
Option-m:SelectMemoryModelOption-mgeneratesalinecontaininga.MODELdirectivetoselectamemorymodel.Syntaxis:
-m[t|s|m|c|l|h|f]
wherethevaluebehind'm'means:
t=tinys=smallm=mediumc=compactl=largeh=hugef=flat
Thisoptionisignoredifa64-bitoutputformat(-win64or-elf64)isactive.
Option-mz:SelectOutputFormatMZOption-mzselectsoutputformatMZ.ThiswillwriteabinaryinDOSMZformat.Themodule'sdefaultfileextensionwillbechangedfrom.OBJto.EXE.Allsymbolsinthemodulemustresolveinternally,noexternalsareallowed.Somevaluesinthe"MZ"headercanbeadjustedbydirectiveOPTIONMZ(seebelow).
Asinallbinaryformats,thelistingwillcontainabinarymap;seeBinaryOutputFormatformoredetails.
ChapterOutputFormatslistsallavailableoutputformats.
Option-nc:SetCodeClassNameOption-ncsetsthecodesegment'sclassnameifsimplifiedsegmentdirectivesareused(default:CODE).Syntaxis:
-nc=name
where<name>willbethecodesegment'sclassname.
Options-ndand-nt:SetDATAandCODESegmentNamesOptions-ndand-ntwillsetthenameofthedata/codesegmentsifsimplifiedsegmentdirectivesareused.Syntaxis:
-nt=name_of_code-nd=name_of_data
Thedefaultnamesare_TEXTforcodeand_DATAfordata.
Option-nm:SetModuleNameOption-nmsetsthemodulename.Syntaxis:
-nm=module_name
Thedefaultvaluefor<module_name>isthenameofthesourcefilewithoutextension.
Option-pe:CreateaPEBinaryOption-pewillmakeJWasmcreateabinaryinWindowsPEformat(32-and64-bit).Theoutputmodule'sdefaultfileextensionwillbechangedfrom.OBJto.EXE.
FormoredetailsaboutthePEformatseePEOutputFormat.
ChapterOutputFormatslistsallavailableoutputformats.
Option-win64:SelectOutputFormatWin64Option-win64makesJWasmproduceanobjectmoduleinPE32+format,the64-bitformatusedforWin64binaries.
Option-win64willalsosetcputox86-64,modeltoFLATanddefaultcallingconventiontoFASTCALL.ThisistomakeJWasmcompatiblewithMasm64(ML64.EXE).
WithOPTIONWIN64,parametersspecifictoWin64maybeset.
FormoreinformationaboutWin64,seeWin64OutputFormat.
ChapterOutputFormatslistsallavailableoutputformats.
Option-zc:SetNameDecorationforCThisoptionsetsthenamedecorationfortheC(akaCDECL)callingconvention.Therearetwovariants:
-zc[m|w]
-zcmisthedefault,Cnamesaredecoratedwithanunderscoreprefix.ThisisalsothewayMasmdoesit.Theothervariant,-zcw,omitstheprefixaltogether.Thisistheusual"decoration"inUnix/Linux.
Option-Zd:EmitLineNumberDebuggingInfoOption-ZdgenerateslinenumberdebuginformationforOMFandCOFFoutputformat.Forotherformats,thisoptionisignored.Linenumberinformationallowsadebuggertotracethebinaryonthesourcecodelevel.Debuggersthathavebeenverifiedtoworkwiththisoption:
MSCodeView OMF 16-bit,WindowsandDOSCDB,NTSD COFF 32-and64-bit,WindowsWinDbg COFF 32-and64-bit,WindowsMSVisualStudio2008 COFF 32-bit[1],WindowsMSVisualStudio2010 COFF 32-bit[1],WindowsOWWD/WDW OMF/COFF 16-and32-bit,WindowsandDOSPellesCIDE COFF 32-bit[1],WindowsBorlandTD/TDW/TD32 OMF 16-and32-bit,WindowsandDOS[1]:the64-bitversionofthissoftwareshouldalsobeabletodebug64-bitdebuggees.
Option-zf:SelectFASTCALLTypeOption-zfselectstheFASTCALLcallingconventiontypefor16-and32-bitcode.Syntaxis:
-zf[0|1]
Thedefaultvalue0isMSVCstyle,whilevalue1activatestheOpenWatcomfastcalltype.
Option-Zg:Masm-compatibleCodeGenerationOption-ZgmakesJWasmtryanexactcopyofMasm'scodegeneration,whichresultsinthefollowingchanges:
thedefaultprologueforprocedureswilluseadd[e]sp,-localsizeinsteadofsub[e]sp,localsize.thedefaultepilogueforprocedureswillalmostalwaysprefertogenerateopcodeLEAVEifpossible.expressions<reg>==0and<reg>!=0willgeneratecodeor<reg>,<reg>insteadofcmp<reg>,0.ifinvokemustextendanargument'ssizefromwordtodword,registereaxremainsunchanged.thesegmentvalueofFARexternalswillalwaysbeassumedunknown,nomatterwhethertheexternalisdefinedinsideoroutsideofasegmentblock.Thusthoselabelsareexcludedfrom"farcalloptimization".ifindirectaddressinguses2(32-or64-bit)registersandnoscalingfactorisusedandthesecondregisterisn'tESP/RSP,thentheregistersareswapped:thesecondbecomesbaseandthefirstbecomesindex(theregistersinanexpressionarecountedfromlefttoright).[sincev2.10,thisisstandardbehavior].
Option-Zi:EmitSymbolicDebuggingInfoOption-ZigeneratessymbolicdebugginginfoinCodeViewV4styleforOMFandCOFFoutputformat.Forotherformats,thisoptionisaccepted,butignored.Notethat-Ziwillalwaysenable-Zd(linenumberinformation).Debuggerswhichhavebeenverifiedtoworkwiththisoption:
MSCodeView 16-bit,WindowsandDOSMSCDBorNTSD 32-and64-bit,WindowsMSWinDbg 32-and64-bit,WindowsMSVisualStudio2008 32-bit[1],WindowsMSVisualStudio2010 32-bit[1],WindowsOpenWatcomWD/WDW 16-and32-bit,WindowsandDOSPellesCIDE 32-bit[1],Windows[1]:the64-bitversionofthissoftwareshouldalsobeabletodebug64-bitdebuggees.
Usuallyboththeassemblerandthelinkermustbetoldthatsymbolicdebugginginformationistobegenerated(withMSlink,thelinkeroptionis/DEBUG).
The-Zioptionacceptsanoptionalnumericargumenttocontrolthevolumeofinformationthatisemitted.Thevaluescurrentlyacceptedare:
0 Justglobalsymbolswillbewritten.
1Global&localsymbolswillbewritten.Nouser-definedtypesareincluded.Usuallythisreductiondoesnoharm,butmaydecreaselinkingtime-iflotsofmodulesaretobelinked,theeffectmaybequitesignificant.
2 Thisisthedefault.Global&localsymbolsanduser-definedtypesarewritten.3 Additionallyto2,symbolicconstants(equates)willbewritten.
AlsoseeOPTIONCODEVIEWforadditionalswitchestocontrolsymbolicdebuggingoutput.
Options-zlcand-zld:ControlContentofOMFOutputModuleOptions-zlcand-zlddoreducesizeoftheOMFoutputmodule.Theymightbeusefuliflotsof-small-modulesaretobeassembledandputintoastaticlibrary.Also,theOMFcomentrecordswrittenif-zlcor-zldisNOTsetmaynotbeacceptedbyalllinkers.
Option-zlc:suppresseswritingOMFcomentrecordsaboutdatainCodesegments.Theserecordsmayhelpadisassemblertoproducenicerlistings.
Option-zld:suppresseswritinganOMFcomentrecordforeachCodesegmenttellingthelinkerthatfarcallstotargetsinthesamesegmentsshouldbeoptimized.Thisismoreorlessafeaturefor16-bitcodeonly.
Options-zlf,-zlpand-zls:ControlContentofCOFFOutputModuleOptions-zlf,-zlpand-zlsdoreducesizeoftheCOFFoutputmodule.Theymightbeusefuliflotsof-small-modulesaretobeassembledandputintoastaticlibrary.
Option Meaning
-zlfsuppressesthe@fileentryintheCOFFsymboltable.Thisentryisusuallyusedfordebuggingpurposesonlyandhencea-prettysmall-amountofspacecanbesaved.
-zlp
suppressesstatic(=private)procedurestobeincludedintotheCOFFsymboltable-aslongastheyaren'treferencedabsolutely.Suchproceduresaren'tneededforthelinkingprocess.However,sincethelinkerhasnoknowledgeofthemthen,theywillalsodisappearfromthelinker-generatedmap-file.
-zlssuppressestheauxiliaryentriesforsectionsintheCOFFsymboltable.Theseentriesmaynotbeneededinallcasesandthusalittlespaceissaved.
Option-Zm:EnableMasmv5CompatibilityOption-Zm(orsettingOPTIONM510)willdo:
-setOPTIONOLDSTRUCTS-setOPTIONDOTNAME-setOPTIONSETIF2:TRUE-setOPTIONOFFSET:SEGMENT(ifnomodelisset)-setOPTIONNOSCOPED(ifnomodelwithlanguagespecifierisset)-allowtodefinedataitemsbehindcodelabels-allow"invalid"useofREP/REPE/REPNEinstructionprefixes-changeprecedenceof[]and()operatorfrom1to9.Henceexpression-5[bx]isparsedas(-5)[bx],whilewithout-Zmitisparsedas-(5[bx]),whichgeneratesanerror.
OtherMasmv5.1compatibilityoptionsaren'timplementedyet.
Option-Zne:DisableJWasmSyntaxExtensionsOption-Znewilldisablesyntaxextensionswhicharen'tsupportedbyMasm.Currentlytheseare:
-directiveINCBIN-callingconventionFASTCALL-IDsenclosedinbackquotes-floating-pointimmediateoperandsininstructions-directiveOPTIONFIELDALIGN-directiveOPTIONPROCALIGN-directiveOPTIONMZ-directiveOPTIONELF-directiveOPTIONWIN64-directiveOPTIONFRAME-directiveOPTIONRENAMEKEYWORD-directiveOPTIONDLLIMPORT-directiveOPTIONCODEVIEW-directiveOPTIONSTACKBASE-directivesPUSHCONTEXT/POPCONTEXTALIGNMENT-attributeLABELforfirstmacroparameter-memberargumentforIF[N]DEFand.ERR[N]DEFdirectives-integerinitializervaluesforitemsoftype[X]MMWORD-optionalnameargumentfor.DATA,.DATA?and.CONSTdirectives-forwardreferencesinargumentsforINVOKEdprocedures-overridesinsidesquarebracketsforbase/indexregisters-OptionalArraySizeforLABELDirective
Somedirectivesaren'ttouchedbythisoption,althoughMasmwon'tacceptthem:
.X64and.X64pINVOKEin64-bitmoderuntimeconditionaldirectives.IF,.REPEAT,.WHILEin64-bitmode
Option-zt:SetNameDecorationforSTDCALLOption-ztwillfine-tunenamedecorationforSTDCALLsymbols.Syntaxis:
-zt[0|1|2]
wherevalue0willdisablenamedecoration,value1willjustaddanunderscoreprefixandvalue2-whichisthedefault-willemitfullSTDCALLnamedecorationasexpectedbymostlinkers.
Option-zt0willmakeobjectmodulescompatibletoALINK+Win32.lib.ItmayalsoeaseaddingassemblymodulestoBorland'sC++BuilderorDelphiprojects.
Option-Zv8:EnableMasmv8ProcedureVisibilityOption-Zv8changeshandlingofprocedurevisibilitytothewaydonebyMasmv8+.SeeVisibilityofProceduresfordetails.
Option-zze:DisableExportNameDecorationOption-zzesuppressesnamedecorationforprocedureswiththeEXPORTattribute(exportednameonly).
Option-zzs:AvoidWlinkCOFFIncompatibilityOption-zzsiskindofaworkaroundforaWlinkincompatibility.It'susefultobesetif1)thesourcemodulehasastartingaddress,2)outputformatisCOFFAND3)Wlinkistobeusedaslinker.
3.1DirectiveINCBINThisdirectiveallowstoincludethecontentsofafileintotheobjectmodule.Syntaxis
INCBINfilename[,startingoffset[,maxsize]]
<filename>shouldbeenclosedin<>ordoublequotes.
3.2FASTCALLRegisterCallingConventionIn16-and32-bitmode,onemayuseeithertheMicrosoftortheWatcomregistercallingconvention.It'sselectedbyoption-zf.
TheMicrosoftFASTCALLconventionusesregistersAX,DXandBXin16-bitforthefirst3parameters,andregistersECXandEDXin32-bitforthefirst2parameterswhicharesmallenoughtofitintoaregister.
TheOpenWatcomfastcallconventionusesuptofourregisters(E/AX,E/DX,E/BX,E/CX).
In64-bitmode,FASTCALLmeansthestandardWindows64ABIifoutputformatisnotELF.For-elf64,thereisnoFASTCALLsupportimplementedyet.
TomakeFASTCALLthedefaultcallingconvention,thereare3ways:
Commandlineoptions-Gr(or-win64)Secondargumentofthe.MODELdirective:.MODELFLAT,FASTCALLDirectiveOPTIONLANGUAGE:FASTCALL
3.3IDsenclosedinBackQuotesIDscanbeenclosedinbackquotes(`)andthustheycancontaincharactersnotallowedin"normal"IDs.However,thereisatleastonecasewhereIDsinbackquoteswon'tberecognized:iftheexpansionoperator(%)islocatedatposition0inaline.
Exampleusingbackquotes:
Module1:
`functionname.with.dots`PROCCPUBLICa1:dword
Module2:
`functionname.with.dots`PROTOC:dword
.code
INVOKE`functionname.with.dots`,1
SinceIDsinbackquotesarenot100%compatiblewith"normal"IDs,itmightbeconsideredtousetheALIASdirectiveinstead.Beawarethat,sincethealiashandlingisalinkertask,itisnecessarytodefinebothnames,thealiasnameandthetargetname,aspublic.
3.4Floating-PointImmediatesinInstructionsFloating-pointimmediatevaluesareacceptedasinstructionoperands.Asdefault,thetypeisaREAL4,whichhasamagnitudeof32bits:
moveax,1.0
Withtypecoercion,it'salsopossibletodefinea64-bit"double",althoughit'sprobablyusefulin64-bitcodeonly:
movrax,real8ptr1.0
Additionally,operatorsLOW32andHIGH32acceptafloating-pointconstantasargument.Inthiscase,theconstantisassumedtohaveformatREAL8.Thusit'spossibletopassadoubleconstantdirectlyasaprocedureargumentin32-bitcode:
pushHIGH321.0
pushLOW321.0
callWorkWithReal8Value
3.5DirectiveOPTIONFIELDALIGNOPTIONFIELDALIGNsetsthedefaultvalueforstructurealignment.Thedefaultvalueis1orthevaluesetbycmdlineswitch-Zp.Syntaxis:
OPTIONFIELDALIGN:[1|2|4|8|16|32]
Thecurrentdefaultvaluecanbesaved/restoredwithdirectivesPUSHCONTEXT/POPCONTEXTALIGNMENT,
3.6DirectiveOPTIONPROCALIGNWithOPTIONPROCALIGNparameterit'spossibletoautomaticallyalignprocedures.Syntaxis:
OPTIONPROCALIGN:[1|2|4|8|16|32]
Thedefaultvalueis1.Thecurrentvaluecanbesaved/restoredwithdirectivesPUSHCONTEXT/POPCONTEXTALIGNMENT,
Example:
.386
.modelflat,stdcall
optionPROCALIGN:16
.code
proc1PROC
ret
proc1endp
proc2PROC
ret
proc2endp
end
Thelistingshowsthatstartaddressofproc2isalignedto16(=10h):
00000000proc1PROC
00000000ret
00000000C3*retn
00000001proc1endp
00000010proc2PROC
00000010ret
00000010C3*retn
00000011proc2endp
Note:toensurethattheproceduresarealignedinthefinalbinaryasitissupposedbytheOPTIONPROCALIGNvalue,thealignmentofthecurrentcode
3.7DirectiveOPTIONMZDirectiveOPTIONMZallowstofine-tunethevalueswrittentotheMZheaderifoutputformatMZ(see-mzcmdlineoption)isselected.Forotheroutputformats,thisoptionhasnoeffect.Thesyntaxforthedirectiveis:
OPTIONMZ:[start_fixups][:header_align][:heap_min][:heap_max]
Theparametersare:
start_fixups offsetwithintheheaderwheresegmentfixupswillstart.Thesizeoftheheaderwillalwaysbeatleastthisvalue,eveniftherearenofixupsatall.Default-andminimum-valueis1Eh.
header_align alignmentoftheheader(includingsegmentfixups).Valuemustbeapowerof2,10histhedefaultandminimum.
heap_min theadditionalspace(inparagraphs)whichisneededbythebinarytorun.DefaultisthetotalofthesizesoftheuninitializedBSSandSTACKsegments.
heap_max space(inparagraphs)whichthebinarywouldliketohave.DefaultisFFFFh.
3.8DirectiveOPTIONELFDirectiveOPTIONELFallowstofine-tunethevalueswrittentotheELFheaderifoutputformatELF(see-elfor-elf64)isselected.Forotheroutputformats,thisoptionhasnoeffect.Thesyntaxforthedirectiveis:
OPTIONELF:osabi
Theonlyargument<osabi>willbecopiedtotheELFheaderfieldEI_OSABI.It'sanumericconstant,andaccordingtotheelfspecssomevalidvaluesare:
0 ELFOSABI_NONE unspecified1 ELFOSABI_HPUX HP-UX2 ELFOSABI_NETBSD NetBSD3 ELFOSABI_LINUX Linux,default6 ELFOSABI_SOLARIS SunSolaris7 ELFOSABI_AIX IBMAIX9 ELFOSABI_FREEBSD FreeBSD12 ELFOSABI_OPENBSD OpenBSD
3.9DirectiveOPTIONWIN64DirectiveOPTIONWIN64allowstosetparametersfortheWin64outputformatifthisformat(see-win64cmdlineoption)isselected.Forotheroutputformats,thisoptionhasnoeffect.Thesyntaxforthedirectiveis:
OPTIONWIN64:switches
acceptedvaluesforswitchesare:
StoreRegisterArguments[bit0]:-0:the"homelocations"(alsosometimescalled"shadowspace")ofthefirst4registerparametersareuninitialized.Thisisthedefaultsetting.-1:registercontentsofthePROC'sfirst4parameters(RCX,RDX,R8andR9)willbecopiedtothe"homelocations"withinaPROC'sprologue.
INVOKEStackSpaceReservation[bit1]:-0:foreachINVOKEthestackisadjustedtoreservespacefortheparametersrequiredforthecall.Afterthecall,thespaceisreleasedagain.Thisisthedefaultsetting.-1:themaximumstackspacerequiredbyallINVOKEsinsideaprocedureiscomputedbytheassemblerandreservedonceontheprocedure'sentry.It'sreleasedwhentheprocedureisexited.IfINVOKEsaretobeusedoutsideofprocedures,thestackspacehastobereservedmanually!Note:anassemblytimevariable,@ReservedStack,iscreatedinternallywhenthisoptionisset.Itwillreflectthevaluecomputedbytheassembler.Itshouldalsobementionedthatwhenthisoptionison,andaprocedurecontainsnoINVOKEsatall,thenneverthelesstheminimalamountof4*8bytesisreservedonthestack.Warning:YoushouldhaveunderstoodexactlywhatthisoptiondoesBEFOREyou'reusingit.UsingPUSH/POPinstructionpairsto"save"valuesacrossanINVOKEisVERBOTENifthisoptionison.
16-byteAlignmentforLocalStackVariables[bit2]:0:standard8-bytealignmentforlocalvariables.1:16-bytealignmentforlocalvariables.ThissettingisusefulifyouwanttoloadorstoreXMMregisterswithinstructionsthatexpectalignedmemory
3.10DirectiveOPTIONFRAMEThisoptionaffects64-bitonly.ItallowstomakeJWasmautomaticallygenerateprologuesandepiloguesforprocedureswiththeFRAMEattribute.ThusthecodecompliestotherulesofWin64SEH(StructuredExceptionHandling).Syntaxis
OPTIONFRAME:<AUTO|NOAUTO>
AUTOwillenablethisfeature,NOAUTO(whichisdefault)disablesit.
Theunwindinformationwhichisgeneratedis"complete",thatis,itcontainsthe".endprologue"pseudo-opalready.Toallowtosaveallnon-volatileregistersintheprologue,the"USES"phraseismorecapableinthismodeandwillacceptXMMregisterstobesavedandrestored.
3.11DirectiveOPTIONRENAMEKEYWORDThisoptionallowstorenameakeyword,soitcanbeusedunderadifferentname.Syntax:
OPTIONRENAMEKEYWORD:<current_name>=new_name
current_nameisthecurrentnameofthekeywordandmustbeenclosedinanglebrackets.new_namemustbeavalididentifier.Ifakeywordistoberenamed,itshouldbedoneatthebeginningofthesource,andakeywordshouldn'tberenamedmultipletimes.Sincev2.11,akeywordmayberenamedtemporarilyandmultipletimes.
3.12DirectiveOPTIONDLLIMPORTa)UsingOPTIONDLLIMPORT
ThisoptionmakestheassemblerassumethatallPROTOsthatfollowthisdirectiverepresentfunctionslocatedinadll.Syntax:
OPTIONDLLIMPORT:<dll_name>|NONE
<dll_name>mustbeenclosedinanglebrackets.ArgumentNONEwillswitchbacktothedefaultmode.
b)CodeGenerationEffects
TheeffectsofsettingthisoptionsaresubtleandusefulonlyforMSWindowsapplications:ifthefunctiondescribedbytheprototypeiscalledviaINVOKE,slightlymoreefficientcodethannormalisgenerated,becausethefunction'saddressintheIATisused.Example:
INVOKEGetModuleHandle,NULL
codegenerationwithOPTIONDLLIMPORT:
pushNULL
callDWORDPTR[_imp__GetModuleHandle@4]
codegenerationwithoutOPTIONDLLIMPORT:
pushNULL
call_GetModuleHandle@4
...
_GetModuleHandle@4:
jmpDWORDPTR[_imp__GetModuleHandle@4];stubaddedbythelinker
c)OPTIONDLLIMPORTinConjunctionwith-FdSwitch
Optionally,byusingcmdlineoption-Fd,JWasmwillwritetheimportinformationreceivedthroughOPTIONDLLIMPORTlinestoeitherafileordirectlyintotheobjectmodule(COFFandELFonly).Example:
.386
.modelflat,stdcall
optiondllimport:<kernel32>
GetModuleHandleAproto:dword
ExitProcessproto:dword
optiondllimport:none
.code
invokeGetModuleHandleA,0
invokeExitProcess,0
end
JWasm-coff-Fd=lnk.rspsample.asm
Aftertheassemblystep,filelnk.rspwillcontain:
import'_ExitProcess@4'kernel32.ExitProcessimport'_GetModuleHandleA@4'kernel32.GetModuleHandleA
BothOpenWatcom'sWlinkandJWlinkwillbeabletodirectlyusethisinformationandhence,asaresult,nofurtherWindowsimportlibrariesareneededinthelinkstep:
JWlinkmayevengoonestepfurther-it'sabletoreadimportdefinitionscontainedinaCOFForELFmodule'slinkerdirectivesection(named".drectve").Thereforeonecanomitthefilenameargumentfor-Fd.SampleWin32_7demonstratestheusage.
d)OPTIONDLLIMPORTinConjunctionwith-peSwitch
IfoutputformatPEisselected,usingOPTIONDLLIMPORTistheonlywaytoresolveexternalreferences;seePEOutputFormatformoreinformation.
3.13DirectiveOPTIONCODEVIEWTheOPTIONCODEVIEWdirectiveallowstofine-tunethegenerationofsymbolicdebugginginformation.Ithasnoeffectatallifcommandlineoption-Ziisn'tset.Syntax:
OPTIONCODEVIEW:switches
Thereiscurrentlyonlyoneswitch:
[bit0]:If1,createsymbolswithindicesS_[L|G]THREAD32insteadofS_[L|G]DATA32fordataitemsthatarestoredinsegmentswithclass'TLS'.ThisallowsthedebuggertodisplaythecorrectvalueofstaticTLS(ThreadLocalStorage)variables.Example:
optioncodeview:1
_TLSsegmentdwordalias(".tls")public'TLS'
tvarDD-1;codeviewsymboltvarwillbeS_LTHREAD32
_TLSends
3.13DirectiveOPTIONSTACKBASETheOPTIONSTACKBASEdirectiveallowstochangethewayhowstackvariables-definedbythePROCandLOCALdirectives-areaccessed.Syntaxis:
OPTIONSTACKBASE:register
registerwillbetheindexregisterthatisusedforaccessingthestackvariables.The"natural"registerforaccessingthesevariablesisthe[E|R]BPregister(the"framepointer").WithOPTIONSTACKBASEonemightsetanyindexregisterasframepointer.
OPTIONSTACKBASEwilladditionallydefineassembly-timevariable@StackBase.Theassemblerwilladdthevalueofthisvariabletotheeffectiveaddressofstackvariables.@StackBasecanbemodifiedjustlikeanyuserdefinedvariable-however,itisinitializedtozerobythePROCdirective.Thepurposefortheintroductionof@StackBaseistomakeitfeasibletousethe"volatile"stack-pointer(ESP/RSP)registerasbaseforaccessingstackvariables.
Finally,OPTIONSTACKBASEwilldefineanotherassembly-timevariable:@ProcStatus.Thisvariableisread-onlyandwillallowtoqueryinformationaboutthecurrentprocedure'sstatus.Theinformationthatisreturnedby@ProcStatusis:
Bit Meaningifbitis10 insideprologueofcurrentprocedure.1 insideepilogueofcurrentprocedure.2 "frame-pointeromission"isonforprocedure7 prologueofcurrentprocedureisn'tcreatedyet
3.15DirectivesPUSHCONTEXT/POPCONTEXTALIGNMENTThePUSHCONTEXT/POPCONTEXTdirectivesunderstandnewqualifierALIGNMENT,whichsaves/restorescurrentvaluesofFIELDALIGNandPROCALIGNoptions.
Note:inJWasmv2.00-2.09,PUSHCONTEXT/POPCONTEXTALLdidincludethesealignmentvalues.SinceJWasmv2.10,thisisnolongertrue;thisbehaviorismoreMasm-compatible.
3.16Directives.X64and.X64pThesedirectivesselecta64-bit(x86-64)cpu.Incontrastto.X64,.X64pwillallowtouseprivilegedinstructions.
The.X64directiveisn'tneededusually,becauseforoutputformatsWIN64(see-win64)andELF64(see-elf64),.X64isthedefault.
The.X64pdirectiveisusefulformixed-modelbinariesorsystemsoftware(seeexampleDOS64).
Whenthecpuissetto64-bit,theSEGMENTdirectiveacceptsanew'size'value:USE64.Ittellstheassemblerthatthissegment'soffsetis64-bitwideanduses64-bitinstructions.
TheSYSCALLcallingconventionisrenamedtoSYSCALL_when64-bitison,becausethereexistsaSYSCALLinstructionmnemonicinthismode.
3.17AttributeLABELforfirstMacroParameterTheLABELattributeforthefirstmacroparameterallowsaccesstoalabelwhichisassignedtothemacro.Syntaxis:
<macro_name>MACRO<param_name>:LABEL[,<param_name>[,...]]
TheLABELattributeisacceptedforthefirstparameteronly.Amacrowithsuchaparametercanbeinvokedinthefollowingway:
<label><macro_name>[<argument>,...]
Example:
foomacrolbl:LABEL,first,second
lbldbfirst
dwsecond
endm
.data
data1foo1,1000
data2foo2,2000
Notethatacodelabel(thatis,alabelfollowedbyacolonordouble-colon)isparsedBEFOREthemacroisevaluated,hencesuchalabelwillhavebeendefinedalreadywhenthemacro"runs".
3.18MemberArgumentforIF[N]DEFand.ERR[N]DEFDirectivesSincev2.07,JWasm'simplementationofIF[N]DEF-and.ERR[N]DEF-willadditionallyacceptastructmemberasargument.Thissyntaxrequiresafullyqualifiedname:
IFDEF<struct_name>.<member_name>
3.19InitializationofDataItemswithTypeMMWORD/XMMWORDFordataitemsoftypesMMWORDorXMMWORD,JWasmwillacceptintegervaluesforinitialization:
vmm1MMWORD1122334455667788h
vxmm1XMMWORD112233445566778899AABBCCDDEEFFh
Masmwillacceptjustfloating-pointinitializersfordataitemsoftype[X]MMWORD.It'sevenworse,sincefloating-pointinitializersaresilentlyignoredfordataitemswithsizes!=4,8and10;sinceXMMWORDhassize16,it'simpossibletoinitializesuchanitemdirectly.JWasmcopiesthisMasmbehavior,buttoallowtoinitializeaXMMWORDwithafloating-pointvalue,onemayusetypecoercion:
vxmm1XMMWORDreal4ptr1.0;bytes4-15willbe0
vxmm2XMMWORDreal8ptr1.0;bytes8-15willbe0
VariantsthatworkinbothJWasmandMasm,andalsoallowtoinitializethefullXMMWORDare:
vxmm1LABELXMMWORD
real41.0,2.0,3.0,4.0
vxmm2LABELXMMWORD
real81.0,2.0
3.20OptionalArraySizeforLABELDirectiveTheLABELdirectiveacceptsanoptionalarraysizeargument:
myarrayLABELword:10;myarrayisassumedtobeanarrayof10words
dw1,2,3,4,5,6,7,8,9,10
Pleasenotethatthearraysizeargumentdefinesthearray'snumberofelements,notthearray'ssizeinbytes.
Thisextensionallowstodefinelargeinitializedarrays,notrestrictedbylinesizelimits.TheSIZEOFandLENGTHOFoperatorswillreturnthesamevaluesasifthearrayhadbeendefinedviatheDUPoperator.
Thearraysizeargumentmaybeaforwardreference:
myarrayLABELword:size_myarray/sizeofword
dw1,2,3,4,5,6,7,8,9,10
size_myarrayequ$-myarray
3.21OptionalNameArgumentforSimplifiedSegmentDirectivesMasmallowsanoptionalargumentforsimplifiedsegmentdirectives.CODE,.FARDATAand.FARDATA?.Thisistosetthenameofthesegmentthatistobeopened.JWasmwillalsoacceptthenameargumentforthosedirectives;additionally,it'sacceptedfor.DATA,.DATA?and.CONSTdirectives.
3.22SegmentAttributeCOMDATWithsegmentattributeCOMDATonemaydefineCOMDATsections.ACOMDATsectionisasectionthatcanbedefinedbymorethanoneobjectfile.ACOMDATsectionmustcontainatleastonesymbol,theCOMDATsymbol.Thesyntaxtodefinethesectionis:
segnameSEGMENTCOMDAT(selection[,assoc_segment])...
TheselectionargumenttellsthelinkerwhattodoifmultipledefinitionsofaCOMDATsymbolarefound;theacceptedvaluesare:Value Description
1 noduplicates
Ifthesymbolisalreadydefined,thelinkerissuesa"multiplydefinedsymbol"error.
2 any AnysectionthatdefinesthesameCOMDATsymbolcanbelinked;therestareremoved.
3 samesizeThelinkerchoosesanarbitrarysectionamongthedefinitionsforthissymbol.Ifalldefinitionsarenotthesamesize,a"multiplydefinedsymbol"errorisissued.
4 exactmatch
Thelinkerchoosesanarbitrarysectionamongthedefinitionsforthissymbol.Ifalldefinitionsdonotmatchexactly,a"multiplydefinedsymbol"errorisissued.
5 associative ThesectionislinkedifacertainotherCOMDATsection(seetheassoc_segmentinthesyntaxdescription)islinked.
6 largestThelinkerchoosesthelargestdefinitionfromamongallofthedefinitionsforthissymbol.Ifmultipledefinitionshavethissize,thechoicebetweenthemisarbitrary.
CurrentlysupportforCOMDATisrestrictedtoCOFF.
JWasmwon'tdoanythingspecialwithCOMDATsections;infuturereleasesthismaychange:cmdlineoptionssimilartotheMicrosoftVCcompileroptions-Gfor-Gymaybeadded.
TocreateanobjectmodulethatplaceseachfunctioninitsownCOMDAT
section(asitisdonebyMSVCifthe-Gyoptionisgiven),itisrecommendedtouseCOMDATinconjunctionwithALIAS:
_TEXT_proc1segmentflatcomdat(1)alias(".text")
proc1procc
...
proc1endp
_TEXT1_proc1ends
_TEXT_proc2segmentflatcomdat(1)alias(".text")
proc2proccprivate
...
proc2endp
_TEXT2_proc2ends
_TEXT_proc3segmentflatcomdat(1)alias(".text")
proc3procc
...
proc3endp
_TEXT_proc3ends
3.23AttributeVARARGMLforlastMacroParameterVARARGMLhasmostlythesameeffectsasattributeVARARG;thedifferenceisthatVARARGMLwillmaketheassemblerconcatlinesifthelastcharacteronthelineisacomma.
3.24Miscellaneous3.24.1Numericconstant__JWASM__3.24.2OperatingSystemArgumentfor.MODEL3.24.3AcceptedParametersforIF[N]DEFDirective3.24.4VisibilityofProcedures3.24.5Non-RIP-RelativeAddressingin64-Bit
3.24.1Numericconstant__JWASM____JWASM__isapredefinedsymbol,itsvalueisthecurrentJWasmversion*100,thatis,forv1.9thevalueis190.Thepredefinedtextequate@Versionwon'tcontainJWasm'sversion,forcompatibilityreasonsithasvalue<800>(sincev2.06,previouslythevaluewas<615>).
3.24.2OperatingSystemArgumentfor.MODELThe.MODELdirectivehasanoptional"operatingsystem"argument.MasmacceptsvalueOS_DOSonly,JWasmacceptsvaluesOS_DOSandOS_OS2.Thissettingwillaffectthegeneratedcodeofdirectives.STARTUPand.EXITfor16-bitmemorymodels.
3.24.3AcceptedParametersforIF[N]DEFDirectiveMasm'sIF[N]DEFdirectiveacceptsuser-definedsymbolsandregisters,butfailsforinstructions,directivesandotherreservedwords.JWasm'sIF[N}DEFimplementationacceptsthosesymbolsaswell.OTOH,JWasmisabitmorepickyandwilldisplayawarningifmorethanoneitemisfoundbehindthedirective-Masmjusttakesthefirstandsilentlyskipstherest.
AlsoseeMemberArgumentforIF[N]DEFand.ERR[N]DEFDirectives.
3.24.4VisibilityofProceduresWhenaPROTOorEXTERNDEFdirectiveforasymbolislocatedinamodulebeforeamatchingPROCdirective,thevisibilityofthisProcedure("public"vs"private",or"external"vs."static")ishandleddifferentlyinMasmv6or7andMasmv8ornewer:
SinceMasmv8,aPROTOorEXTERNDEFforasymbolwhichislaterdefinedasaPROCwillmaketheprocedurepublic,nomatterwhatapossiblevisibilityattributeofthePROCitself-orthedefaultonesetwithOPTIONPROC-istelling.
OTOH,withMasmv6/7,boththevisibilityattributeofthePROCdirectiveandthecurrentdefaultsettingofOPTIONPROCwillaffectthesymbol'svisibility.
Masm6Masm8JWasmJWasm+Zv8
-------------------------------------
On,E,Pxx
On,E,Pnxx
On,E,Ppxxxx
Op,E,Pxxxx
Op,E,Pnxxx
Op,E,Ppxxxx
On=OPTIONPROC:PRIVATE
Op=OPTIONPROC:PUBLIC
E=PROTOorEXTERNDEFbeforePROC
P=PROCwithoutvisibilityattribute
Pn=PROCwithPRIVATEvisibilityattribute
Pp=PROCwithPUBLICvisibilityattribute
x=procedurewillbepublic
Asdefault,JWasmmoreorlesscopiestheMasmv6/7behavior.ThedifferenceisthatanexplicitevisibilityattributebehindPROChasthehighestpriorityforJWasm.However,sincev2.04,there'sanadditionalcmdlineoption-Zv8whichwillmakeJWasmbehavelikeMasmv8+.
ItshouldbenotedthatwithoutaPROTO/EXTERNDEFbeforePROC,therearenodifferencesbetweenMasmv6,v8andJWasm,andthe-Zv8switchalsohasnoeffectthen.
3.24.5Non-RIP-RelativeAddressingin64-BitIn64-bitaRIP-relativeaddressingmodewasintroduced.Thismodeisusedasdefaultfordirectaddressing,becauseitallowstoaccessallcodeordatalabelswitha32-bitdisplacement.However,forconstantaddresslocationsthismodeisnotappropriateandwon'tbeused:
moval,gs:[1000h]
moval,gs:[100000000h]
Ifaconstantaddressistobeaccessedwithoutsegmentprefixes-notethatin64-bit,onlysegmentregistersFSandGScanbeusedassegmentprefixes-onehastousetheFLATkeywordinJWasm:
moval,FLAT:[1000h];invalidforMasm
moval,FLAT:[100000000h];invalidforMasm
ThissyntaxdiffersfromMasm's,becauseMasmwon'tacceptFLAT.In64-bitMasm,thesyntaxforaccessingconstantaddressesisinstead:
moval,[1000h];invalidforJWasm
moval,[100000000h];invalidforJWasm
Thecodethatwillbegeneratedwon'tshowanydifferences:
0000000000000000:658A042510000000moval,byteptrgs:[00000010h]
0000000000000008:65A00000000001000000moval,byteptrgs:[0000000100000000h]
0000000000000012:8A042510000000moval,byteptrds:[00000010h]
0000000000000019:A00000000001000000moval,byteptrds:[0000000100000000h]
4.InstructionSetsJWasmsupportsallinstructionssetssupportedbyMasmv8.Theseare
-theinstructionsimplementedby8086,80186,80286,80386,80486.-thePentiumandPentiumProinstructions.-theMMXandK3Dinstructionsetextensions.-theSSE,SSE2,SSE3andSSSE3instructionsetextensions.-theIntelVMXinstructionsetextension(sinceJWasmv2.09).-thex86-6464-bitinstructionset(implementedbyML64).
Additionallysupportedare
-SSE4.1andSSE4.2instructionsets(sinceJWasmv2.01).-AVXinstructionset(sinceJWasmv2.06).
WithMasm,SSE4.1andSSE4.2requireMasmv9;AVXrequiresMasmv10.
5.CodeGenerationDifferencesJWasmmightgenerateslightlydifferentcodethanMasmonsomeoccasions.Commandlineoption-Zgshouldeliminatemostofthesedifferences.However,somedifferencesareduetofixedMasmbugs(seebelow),inwhichcaseoption-Zgwon'thaveanyeffect.
Forafewinstructions,theencodingdiffersbetweenMasmversions.
Example:
cmpal,dl
isencoded38D0inMasmv6,but3AC2inMasmv8.Insuchcases,JWasmwillprefertocopytheencodingofMasmv8.
5.1ForwardReferencesinMacroExpressionsLikeMasm,JWasmusuallyevaluatesexpressionsinpreprocessordirectivesduringthefirstpassonly.However,duetodifferentjumpoptimizationstrategiesofMasmandJWasm,theresultsmaydiffer.Thisisveryunlikelytoimposeaproblem,butitismentionedhereforcompleteness.Anexample(foundinREADME.TXTofMasmv6.14):
Label1:
JMPLabel2
Label2:
REPEATLabel2-Label1
INCAX
ENDM
Masmwill-incorrectly-repeattheloop10times,althoughtheresultofexpressionLabel2-Label1is2only.OTOH,JWasmwillrepeattheloop2timesonly,becauseit'susingan"optimistic"strategyconcerningforwardreferences.
6.OutputFormatsTheformatoftheassembler'soutputisselectedbycommandlineoptions.Theseare:
-omfIntel's"relocatableObjectModuleFormat",including32-bitMSextensions.It'sthedefault.
-coff (MS)COFFobjectmoduleformat,supportsflatmemorymodelsonly.It'susuallyusedfor32-bitWindowsmodules.
-elf 32-BitELF("ExecutableandLinkableFormat")objectmodules.-elf64 64-bitELFobjectmodules.-win64
64-bitformatforWin64objectmodules.COFFvariantwith64-bitextensions.
-djgpp COFFvariantusedbyDJGPP.Notactiveinprecompiledbinaries.-bin rawbinaryformat.-mz DOSMZbinaryformat.-pe 32-and64-bitPEbinaries.Theformatsselectedby-bin,-mzand-pearebinaryformats,hencetheoutputisnotsupposedtobefedtoalinker.
6.1OMFOutputFormatTheOMFformatfullysupportsthesegmentedarchitectureofthex86cpu.Thespecificationhasbeenextendedaround1990tosupport32-bit,includingtheFLATmemorymodel.However,sinceit'sabitoldnow,there'snosupportofsomeofthenewrelocationsintroducedfor64-bit.
OMFwon'tsupporttheIMAGERELandSECTIONRELoperators.JWasmcurrentlywon'temitOMFLIDATArecords(unlikeMasm).ThismeansthatiftheassemblysourcecontainslotsofarraysdefinedwithDUP,theobjectmodulemightbecomesignificantlylargerthanasimiliarobjectmodulewrittenbyMasm.JWasmemitsafewCOMENTrecordsthatMasmwon't.TheseareremnantsofOpenWatcom'sWASM;theymaybesuppressedwithcommandlineoptions-zlcand-zld.Theyshouldn'tdoanyharm,though.
TheOMFobjectmoduleconsistsofrecordsofcertaintypes.JWasmwritesthoserecordsinthefollowingorder:
Type Description
THEADR 1Marksthestartofanobjectmodule,containsthenameofthesourcefile.
COMENT,classA1h 1MSextension;tellslinkertheCodeViewversionnumber.Emitted
if-Zioptionisactive.COMENT,classE9h n Borland-styleauto-dependencyrecord(s).Emittedif-Zdor-Zioptionsareactive.COMENT,class9Eh 1MSextension;directsthelinkertousea"standardized"segment
ordering.Emittedifthe.DOSSEGdirectiveisfoundinthesource.COMENT,class9Fh n Defaultlibrarysearchname(s).EmittedifINCLUDELIBdirectivesareused.
LNAMES n Definesnamesforsegmentsandgroups(optionallyalsoforexternals,communalsandpublics).SEGDEF n Definessegment(s).COMENT,classFEh n TellsWLinktodoFARCALLoptimizationforaspecificsegment.
Suppressedwith-zld.GRPDEF n Definesgroup(s).
EXTDEF n Definesexternal(s).COMENT,classA8h n Definesweakexternal(s).EmittedifEXTERNdirectiveisusedwith"altname".COMDEF n Definescommunal(s).ALIAS n Definesalias(es).PUBDEF n Definespublic(s).COMENT,classA0h n Definesexport(s).EmittediftheEXPORTattributeisusedinaPROCdirective.COMENT,classA2h 1 LinkPassSeparator.Emittedifnoentrypointisdefinedinthisobjectmodule.LEDATA n Datarecord;definessegmentcontent(s).
FIXUPP n Containsinformationtomakethelinkerresolvereferencesbetweenobjectmodules.LINNUM n Linenumberinformation.Emittedif-Zdor-Zioptionisactive.COMENT,classFDh n Tellsdisassemblerthatacodesegmentcontainsdata.Suppressedwith-zlc.
MODEND 1Markstheendoftheobjectmodule;optionallydefinestheentrypoint.
LEDATA,FIXUPPandLINNUMrecordsusuallyareintermixed;aFIXUPPand/oraLINNUMrecordappearsimmediatelyaftertheLEDATArecordtowhichitrefers.Sincev2.11,multipleTHEADRrecordsarewrittenifcmdlineoptions-Zdor-Ziaresetandlinenumberinformationiswrittenformorethanonesourcefile;thisconformstoMASMbehavior.
6.2COFFOutputFormatTheCOFFobjectmoduleformatissuitableforflat,non-segmentedmemorymodels.InmostcasestheCOFFformatisusedfor32-bitcode.However,it'spossibletocreatea64-bitCOFFmoduleifthecurrentcpuis.x64whenthe.MODELdirectiveisparsed(notethat-win64istheusualwaytocreatemodulesfor64-bitWindows).Tosomeextent16-bitcodeisalsosupportedwithCOFF,althoughOMFwillalwaysbethebetterchoicethen.
The-safesehcmdlineoptionandthe.SAFESEHdirectivearesupportedbyCOFFonly.NotsupportedbyCOFFare:
theGROUPdirectivethedirectivestocontrolsegmentorder:.ALPHA,.DOSSEG,.SEQcodethatwillgenerate"far"fixups(i.e.directFARcallsorjumps).
Afew,commonsegmentnamesaretranslatedintheoutputmodulewhenCOFFisselected:
name_TEXTistranslatedto.textname_DATAistranslatedto.datanameCONSTistranslatedto.rdataname_BSSistranslatedto.bss
Thisalsoaffectssimplifiedsegmentdirectives,since_TEXT,_DATA,CONSTand_BSSsegmentsareinternallygeneratedwhendirectives.CODE,.DATA,.CONSTor.DATA?aredetected.IfCOFFisselected,MasmwillignoresegmentcombinetypeSTACKandtreatstacksegmentsjustlikenormaldatasegments(theMSlinkerandcompatibleswillsetthestack'ssizewithcommandlineoptions).JWasmDOESNOTignorecombinetypeSTACKfortheCOFFoutputformat;additionally,unlessthesegmentcontainsinitializeddata,JWasmwillresetthesizeofstacksegmentsto0.DirectiveEXTERNname(altname):<type>willdefineaweakexternalwithcharacteristicsIMAGE_WEAK_EXTERN_SEARCH_LIBRARY(seeMSPEandCOFFspecification).DirectiveALIAS<aliasname>=<actualname>willdefineaweakexternalwithcharacteristicsIMAGE_WEAK_EXTERN_SEARCH_ALIAS(seeMSPEandCOFF
specification).TherearesomecmdlineoptionstocontroltheextentofsymbolsthatarewrittentotheCOFFoutputmodule:-zlf,-zlpand-zls.
6.3Win64OutputFormat6.3.1Win64Basics
Thisoutputformat,thatisselectedwiththe-win64commandlineoption,isavariantoftheCOFFoutputformat.It'scommonlyusedtocreateobjectmodulesfor64-bitWindows.ThedefaultcallingconventionistheWin64FASTCALLimplementation.
6.3.2DirectiveINVOKEinWin64
Unlikethe64-bitversionofMasm,whichdoesn'tsupportINVOKEanymore,JWasmstilldoes;however,pleasebeawareofsomepeculiarities:
intheory,usingINVOKErequirestheFRAMEattributeforPROC.ItwillworkwithoutFRAME,butWin64SEHwon'tbehappywithitthen.thedefaultimplementationin64-bitisverysimple:foreachINVOKEregisterRSPisreducedbythespacerequiredforthearguments,thenthecallisissuedandfinallyregisterRSPisrestored.ToenableamoreefficientcodegenerationseeOPTIONWIN64,INVOKEStackSpaceReservation-thisoptionisnotactiveasdefaultbecauseitvirtuallyrequiresacertainprogrammingstyle.thereisnoadditionalcheckthatthestackisalignedto16byte.ThePROC'sFRAMEattributeensuresthatthestackiscorrectlyalignedaftertheprologueisdone.However,it'stheprogrammersresponsibilitythatthestackisstillalignedwhenthecodegeneratedbyINVOKEstarts.parameternameslistedbehindthePROCdirectivewillalwaysrefertotheparameter'sshadowspaceonthestack.However,onaprocedure'sentrytheactualvaluesofthefirstfourparametersareholdinregisters,andthevalueoftheassociatedshadowspacesareundefined.SeeOPTIONWIN64,StoreRegisterArguments,howtomakeJWasmautomaticallysavetheregisterargumentsandthusinitializetheshadowspaceonaprocedure'sentry.
6.3.3Win64StructuredExceptionHandling(SEH)
SEHinWin64differssignificantlyfromtheimplementationinWin32.It'svery
wellpossibletoignoreWin64SEHforassembly.However,ifanassemblyroutinewantstocomplytotheserules,athoroughunderstandingoftheWin64ABIisnecessary.Masm(the64-bitversion)suppliessome"primitives"forSEHsupport(.ALLOCSTACK,.PUSHREG,.SAVEREG,...),alongwithanewFRAMEattributeforthePROCdirective.ThesefeaturesarealsosupportedbyJWasm.SeesampleWin64_3howthe"primitives"aretobeusedforSEHsupport.
ThebigdisadvantageisthatusingtheFRAMEkeywordinMasm"disables"mostoftheotherhighlevelfeaturescombinedwithPROC(functionparameters,localsandregisterssavedwithUSES)becausenofunctionprologuesandepiloguesaregeneratedanymore.Additionally,theimplementationatleastinMasmv8seemstobeabitbuggy,atleastinMasmv8.BecauseofthisandtoeasetheusageofSEHinWin64thereisanewdirectiveimplementedinJWasm:
OPTIONFRAME:AUTO
Ifthisoptionisset,JWasmwillcreateWin64SEH-compatibleprologuesandepilogues.Iftheoptionisoff,JWasmwillbehaveMasm-compatible,thatis,FRAMEfoundinaPROCdirectivewilldisableautomaticprologue/epiloguegeneration.SeesampleWin64_3ehowthisoptionissupposedtobeused.
AsforthePROCsyntax:TheMasmdocumentationstatesthatFRAMEcanbeusedincombinationwithUSESandprocedureparametersandmustbelocatedbehindallparameters.However,thissyntaxisn'tacceptedbyanyMasmversion.TheonlysyntaxwhichMasmwillacceptwithoutbeingconfusedisFRAMEastheoneandonlyparameterforPROC.ThereforeJWasmdoesn'tfollowtheMasmdocumentationinthispoint:theoptionalFRAMEkeywordisexpected*before*theprocedureparameters.ThesyntaxinJWasmis:
procnamePROC[public]FRAME[:exc_handler][USES<reglist>][parameters]
TheSEH"primitives"willgeneratesomeadditionaldatainsegments.pdataand.xdata.Thisdataissomewhathidden,butJWasmwilldisplaythecorrespondingdatadefinitionsinthelistingifoption-Sgisset.
Finally,JWasm'sdefaultbehaviorofINVOKEisn'tfullySEH-compatible,becausethestackpointeristemporarilychangedtomakeroomforarguments.
6.4BinaryOutputFormatIfthebinaryoutputformathasbeenselected,thecontentsofthefilearejusttherawdatabytesemittedbytheassembler,noheader,relocationsorsymboltablesaregenerated.Allreferenceshavetoberesolvedinternally.
ThebinaryformatismostusefulforbootloadersorDOSCOMfiles,butmaybeusedtocreateanybinaryformat.SeesampleWin32_5,thatdemonstrateshowthebinaryformatisusedtocreateaWin32application.
Ifalistingfileisproduced,abinarymapwillbeadded,whichshowsthefileandmemorylayoutoftheimage:
.modeltiny
.data
000000000D0A48656C6C6F2C20str1db13,10,"Hello,world!",13,10,'$'
00000000.code
org100h
00000100start:
00000100B409movah,09h
00000102BA0000movdx,offsetstr1
00000105CD21int21h
00000107B8004Cmovax,4c00h
0000010ACD21int21h
endstart
BinaryMap:
SegmentPos(file)VASize(fil)Size(mem)
---------------------------------------------------------------
_TEXT0100CC
_DATAC10C1212
---------------------------------------------------------------
1E1E
Notethatbyteswith"undefinedcontents"atthestartandtheendoftheoutputfileareskippedandwon'tbecomepartofthebinary.
6.5PEOutputFormatThe(Windows)PEoutputformat(both32-and64-bit)isabinaryformat-there'snolinkstepsupposedtofollowtheassemblystep.Henceallreferencesmustberesolvedinternally,noexternalreferencesarepossible.SincetheWindowsABIisimplementedasasetofdllsthatexportfunctionnames,it'snecessarytoprovideamechanismtocallsuchexternalfunctions-inthePEformatthisisachievedwiththehelpofdirectiveOPTIONDLLIMPORT;itallowstoattachamodulenametofunctionprototypesusedbytheassemblysourceandconsequentlygivetheassemblerthemeanstoresolveallreferenceswithoutthehelpofalinker.
ThePEformatrequiresa.MODELFLATdirectiveinthesourcecode.ThisdirectivewilltriggerthecreationoftheinternalPE-headersection,thevalueofthecpuatthistimewilldeterminewhethera32-or64-bitPEbinaryistobewritten.
Asinallbinaryformats,thelistingwillcontainabinarymap;seeBinaryOutputFormatformoredetails.
If-peisset,afewsectionswillbecreatedinternally:
-.hdr$1:sectionwillcontaintheDOSMZ-stub.-.hdr$2:sectionwillcontainthePEheader-.hdr$3:sectionwillcontainthePEobjecttable
ThedefaultvaluesinthePEheaderareField 32-bitValue 64-bitValue(ifdifferent)
Signature "PE"Machine 14Ch 8664hTimestamp date&timeSizeOptionalHeader 0E0h 0F0hCharacteristics 10Fh 12FhMagic 10Bh 20BhLinkerVersion 5.1
ImageBase 400000hSectionAlignment 1000hFileAlignment 200hOSVersion 4.0ImageVersion 0.0SubsystemVersion 4.0Win32Version 0Checksum 0Subsystem 2(=Console)DllCharacteristics 0SizeOfStack 100000h,1000hSizeOfHeap 100000h,1000hLoaderFlags 0
TochangethedefaultvaluesinthePEheadertherearetwooptions.First,apredefinedassembly-timevariable@pe_file_flagswillmapthevalueoffieldCharacteristics-changingthevalueof@pe_file_flagswillalsochangethevalueintheheaderfield.TheotherfieldsinthePEheaderareonlyaccessiblebysettingtheappropriatevaluesinsection.hdr$2.Fieldsnotlistedinthetableabovearesetinternallybytheassemblertoensuredataintegrityandcannotbemodifiedfromwithintheassemblysource.
IfthePEbinaryistouseresources,a.rsrcsectionhastobecreatedwhichistocontainthem.Definingtheresourcesmanuallyworksandisdoable,butitmightbecometediousifalotofresourceitemsaretobedefined.Thereforetoolres2incissupplied,whichallowstoconvertacompiledresourcefile(.RES)toanassemblyincludefile.
Ifadlliscreatedwith-pe,onehastomarkallproceduresthataretobeexportedwiththeEXPORTattribute.Iftheexportednamesaretobeundecorated,usethe-zzecmdlineoption.
SampleWin64_8showshowa64-bitWindowsbinaryiscreatedwith-pe.Italsoshowshowtodefineresourcesin.rsrcmanuallyandhowtomodifydefaultvaluesofPEheaderfields.
7.MasmbugsfixedinJWasm
# DescriptionFixedMasmVersion
1theinfamous"invoke"bug:ifanargumentforinvokehastobeexpanded(fromBYTEorWORDtoDWORD,forexample),badcodewasgenerated.
9
2 PROTOscontainedtwiceinthesourcecausedanEXTDEFentrytobegeneratedintheobjectmodule. -
3 "TYPExmm0"willreturn10inMasmv6andv7-thecorrectvalueis16. 8
4 anestedstructuremightcauseaGPFinMasmiftheembeddedSTRUCT'sstartingoffsethastobeadjustedduetoalignment. -
5 defininghugearraysinMasmisveryslowandmightevencauseadeadlockifCOFFhasbeenselectedasoutputformat. -
6 forMasmv6andv7,ifanarray>64kBisdefinedandoutputformatOMFisselected,thearray'ssizewillbemod0x10000only. 8
7 Masmdoesn'tflaginvalidnumbersinstruct/arrayinitializerstrings. -
8ifanALIASisdefinedsomewhereinthesourceandthesymboltableislisted,a'GeneralFailure'erroroccursinMasmifoutputformatisOMF.
-
9Type"coerces"forDWORDdataitemsdefinedina32bitsegmentareignoredbyMasm,i.e.,"ddfar16ptr<symbol>"willgenerateanear32fixupinsteadofafar16one.
-
10iftheALIGNdirectivehastoadd5bytesin32bitcodesegments,Masmincludesan"addeax,0"opcode,whichisn'tano-opbecauseflagsaremodified.
-
11 silenttruncationofimmediateconstants:Masmv6andv7willacceptline"mov[word_variable],12345h"withouterror. 8
12preprocessedoutputwithoption-EPmayerroneouslycontaintextmacrosandmacrofunctioncallsifthemacrosarelocatedintheinitializationstringofastructuredvariable.
-
Masmgenerateswrongcodeifaconditionaljumpiscoupledwitha
13 typecoercionwhichmodifiesoffsetmagnitude.Examples:"jznear32ptr..."in16bitcodeor"jznear16ptr..."in32bitcode).
-
14 iftheargumentsgiventoMasmendwithanoptionwhichexpectsaparameter(i.e."ml-c-Fo"),a'GeneralFailure'mayoccur. -
15 floating-pointdataitemsinMasmcanbefollowedbyanysuffix(example:REAL41.0foo,2.0bar).JWasmwon'tacceptthis. -
16
Ifalocalisdefinedinsideamacro,Masmwillcreateauniquenameforit.Thenameisconstructedbyusing'??'asprefix,followedbyahexadecimalnumberwith4digits.Thereisnocheckforoverflow,however,soifthetotaloflocalsinallmacrosexceeds65536,strangeerrorswilloccur.
-
17Ifaweakexternalisdefinedfor-coffwiththeALIASdirective,aninvalidfixup-andalsoastrangeentryinthemodule'ssymboltable-iscreated.
-
18Ifasectioncontainsmorethan0xffffrelocationsinCOFF,thenumberofrelocationsthatisstoredintheobjectmoduleisjustthevalueofthelower16-bithalfoftherelocationcount.
8
19
Ifasymbolicconstant(=equate)ismadepublicinOMFformat,Masmwillstorethesymbol'svalueina16-bitrecordifitisintherange-32768...65535.Ifthesymbolisreferencedinanothermoduleasa32-bitnumber,itisalwayszero-extended,neversign-extended;hencevalues-1...-32768willbecome65535...32768.
-
20
ifdatalabelsbecomepublicbythe-Zfoption(andnotbythePUBLICdirective),theirnamesarenotdecorated.Also,ifformatisCOFF,theywon'tbecometruepublics,they'rejustincludedinthesymboltablewithclass"static",
-
It'sslightlydangeroustofixoldMasmbugs,sincesomecodemightworkonlyifthebugsexists.Sono,JWasmwon'tachieve100%Masmcompatibility.
8.OptionalFeaturesThereexistsomefeaturesthatarenotactivatedintheprecompiledbinaries.Toenabletheseoptions,theJWasmsourcemustberecompiledwithoneormoreswitchessetinthecommandline:
SupportforDjgpp'svariantofCOFF
Thisoptionisenabledwithswitch-DDJGPP_SUPPORT.ThegeneratedJWasmbinarywillacceptanadditionaloutputformat(-djgpp)tobesetinthecommandline,thatmakestheassemblergenerateCOFFmodulescompatiblewithDJGPP.
SupportforAssemblySourcegeneratedbyIntelC++compiler
Thisoptionisenabledwithswitch-DDOTNAMEX.Itwillmaketheassembleracceptnamesthatcontaindotsifthenamestartswithadotoranunderscore.NotethatthisbehaviorisnotcompatiblewithstandardMasmsyntax.
b)Featureswhicharen'timplementedyet:
-directivesPAGE,TITLE,SUBTITLE,SUBTTL.thedirectivesareignoredandawarning(level4)isdisplayed.-thefollowingparametersoftheOPTIONdirective:
-OLDMACROS-EXPR16-READONLY
-optionalparameterNONUNIQUEforstructuresisignored.-commandlineoption-AT(Enabletinymodel).-commandlineoptions-Sp,-Ssand-St(setpagelength,subtitleandtitle).-commandlineoption-H(setmaxexternalnamelength).-commandlineoption-Ta(Assemblenon-.ASMfile).-commandlineoption-ZdforELFoutputformat.-commandlineoption-ZiforELFoutputformat.
Ifthere'severaproblemwithoneofthemissingfeatures,it'sverylikelythatit'srelatedtoOPTIONOLDMACROS.ThisoptionmakesMasm6emulatetwoMasm5.1peculiarities:
-macroargumentsmaybeseparatedbyspaces-ampersands(&)insidethemacromustmatchthecurrentlevelofmacronesting.
c)Missingfeatureswhichmostlikelywon'tbeimplemented:
-syntax"mm(n)"and"xmm(n)"(supportedbyMasmv6andv7only)-commandlineoption-Bl,-F,-Fe,-Fmand-link:sinceJWasmdoesn'tlaunchalinker,thoseoptionsareuseless.-commandlineoptions-Frand-FR(generatebrowserinfo).-commandlineoption-Sc(generatetimingsinlisting).-commandlineoption-errorReport(ReportinternalassemblererrorstoMicrosoft).
10.LicenseThismanualwaswrittenbyAndreasGrech(akaJapheth).
Itmayberedistributedaslongasitisfreeofcharge.
AppendixA.JWasmReservedWordsReservedWordsarecase-insensitive.BesidestheitemslistedbelowallinstructionmnemonicsarealsoReservedWords.
Registers16-and32-bitModes
8-bitregisters AL CL DL BL AH CH DH BH16-bitregisters AX CX DX BX SP BP SI DI32-bitregisters EAX ECX EDX EBX ESP EBP ESI EDISegmentregisters ES CS SS DS FS GS
Floating-pointregisters ST ST(1) ST(2) ST(3) ST(4) ST(5) ST(6) ST(7)
MMXregisters MM0 MM1 MM2 MM3 MM4 MM5 MM6 MM7SSEregisters XMM0XMM1XMM2XMM3XMM4XMM5XMM6XMM7AVXregisters YMM0YMM1YMM2YMM3YMM4YMM5YMM6YMM7Controlregisters CR0 CR2 CR3 CR4
Debugregisters DR0 DR1 DR2 DR3 DR6 DR7
Testregisters[1] TR3 TR4 TR5 TR6 TR7[1]:invalidin64-bitmode.
AdditionalRegistersin64-bitMode
8-bitregisters SPL BPL SIL DIL
R8B R9B R10B R11B R12B R13B R14B R15B16-bitregisters R8W R9W R10W R11W R12W R13W R14W R15W
32-bitregisters R8D R9D R10D R11D R12D R13D R14D R15D
64-bitregisters RAX RCX RDX RBX RSP RBP RSI RDI
R8 R9 R10 R11 R12 R13 R14 R15SSEregisters XMM8XMM9XMM10 XMM11 XMM12 XMM13 XMM14 XMM15
AVXregisters YMM8YMM9YMM10 YMM11 YMM12 YMM13 YMM14 YMM15
Controlregisters CR8
Types
BYTESBYTEWORDSWORDDWORDSDWORDREAL4FWORDQWORDSQWORDREAL8TBYTEREAL10OWORDYMMWORDNEARFARNEAR16NEAR32FAR16FAR32MMWORDXMMWORD
UnaryOperators
.TYPEHIGHHIGH32HIGHWORDIMAGEREL[1]
LENGTHLENGTHOFLOWLOW32LOWWORDLROFFSETMASKOFFSETOPATTRSECTIONREL[1]
SEGSHORTSIZESIZEOFTHISTYPEWIDTH[1]:notforOMFoutputformat.
BinaryOperators
EQNEGEGTLELTMODPTRDUPSHL[1]
SHR[1]
AND[1]
OR[1]
XOR[1]
[1]:thesekeywordsarealsoinstructions.
Directives
.8086
.186
.286
.286C
.286P
.386
.386C
.386P
.486
.486P
.586
.586P
.686
.686P
.K3D
.MMX
.XMM
.X64
.X64P
.8087
.287
.387
.NO87
.CREF
.LIST
.LISTALL
.LISTIF,.LFCOND
.NOCREF,.XCREF
.NOLIST,.XLIST
.NOLISTIF,.SFCOND
.TFCONDPAGESUBTITLE,SUBTTLTITLE.LISTMACRO,.XALL.LISTMACROALL,.LALL.NOLISTMACRO,.SALL.ALPHA.DOSSEG,DOSSEG.SEQ.CODE.STACK.DATA.DATA?.FARDATA.FARDATA?.CONST.IF.REPEAT.WHILE.BREAK.CONTINUE.ELSE.ELSEIF.ENDIF.ENDW.UNTIL.UNTILCXZ.EXIT.STARTUP.MODEL.RADIX.SAFESEH
.ERR
.ERR1
.ERR2
.ERRE
.ERRNZ
.ERRDIF
.ERRDIFI
.ERRIDN
.ERRIDNI
.ERRB
.ERRNB
.ERRDEF
.ERRNDEFCOMMENTIFIFEIF1IF2IFDIFIFDIFIIFIDNIFIDNIIFBIFNBIFDEFIFNDEFELSEELSEIFELSEIFEELSEIF1ELSEIF2ELSEIFDIFELSEIFDIFI
ELSEIFIDNELSEIFIDNIELSEIFBELSEIFNBELSEIFDEFELSEIFNDEFENDIFFOR,IRPFORC,IRPCREPEAT,REPTWHILEMACROEXITMENDMGOTOPURGEINCLUDETEXTEQUCATSTRSUBSTRINSTRSIZESTRDBDWDDDFDQDTSTRUCT,STRUCUNIONTYPEDEFRECORDCOMM
EXTERN,EXTRNEXTERNDEFPUBLICPROTOPROCENDPLOCALLABELINVOKEORGALIGNEVENSEGMENTENDSGROUPASSUMEALIASECHO,%OUTENDEQUINCBININCLUDELIBNAMEOPTIONPOPCONTEXTPUSHCONTEXT
AdditionalDirectivesin64-bitMode
.ALLOCSTACK
.ENDPROLOG
.PUSHFRAME
.PUSHREG
.SAVEREG
.SAVEXMM128
.SETFRAME
OtherReservedWords
ADDRFLATVARARGFRAME[1]
CSYSCALL[2]
STDCALLPASCALFORTRANBASICFASTCALL[1]:in64-bitmodeonly.[2]:in64-bit,callingconventionSYSCALLisrenamedtoSYSCALL_,sinceinthismodethereexistsaSYSCALLinstruction.
AppendixB.SourceSamplesWin64_3-SEHSupportinWin64Win64_3e-SEHSupportinWin64(JWasmspecific)DOS64-SwitchtoLongModeandBackWin32_5-CreateaWin32Binarywith-binWin32_7-UsageofOPTIONDLLIMPORTand-FdSwitchWin64_8-CreateaWin64Binarywith-pe
Win64_3-SEHSupportinWin64
;---ThissampleshowshowtouseSEHprimitives.Itdoesn'tusehll
;---directives.ThusthissourcecanbeassembledbybothJWasm
;---andMasm64.
;---
;---toassembleenter:
;---JWasm-win64Win64_3.asm
;---or:
;---ml64-cWin64_3.asm
;---
;---tolinkthebinaryenter:
;---LinkWin64_3.obj
optioncasemap:none
includelibkernel32.lib
includelibuser32.lib
HINSTANCEtypedefQWORD
HWNDtypedefQWORD
HMENUtypedefQWORD
HICONtypedefQWORD
HBRUSHtypedefQWORD
HCURSORtypedefQWORD
WPARAMtypedefQWORD
LPARAMtypedefQWORD
LPSTRtypedefQWORD
LPVOIDtypedefQWORD
UINTtypedefDWORD
NULLequ0
WS_OVERLAPPEDWINDOWequ0CF0000h
CW_USEDEFAULTequ80000000h
SW_SHOWDEFAULTequ10
SW_SHOWNORMALequ1
IDC_ARROWequ32512
IDI_APPLICATIONequ32512
WM_DESTROYequ2
CS_VREDRAWequ1
CS_HREDRAWequ2
COLOR_WINDOWequ5
proto_WNDPROCtypedefproto:HWND,:QWORD,:WPARAM,:LPARAM
WNDPROCtypedefptrproto_WNDPROC
WNDCLASSEXAstruct8
cbSizeDWORD?
styleDWORD?
lpfnWndProcWNDPROC?
cbClsExtraDWORD?
cbWndExtraDWORD?
hInstanceHINSTANCE?
hIconHICON?
hCursorHCURSOR?
hbrBackgroundHBRUSH?
lpszMenuNameLPSTR?
lpszClassNameLPSTR?
hIconSmHICON?
WNDCLASSEXAends
POINTstruct
xSDWORD?
ySDWORD?
POINTends
MSGstruct8
hwndHWND?
messageDWORD?
wParamWPARAM?
lParamLPARAM?
timeDWORD?
ptPOINT<>
MSGends
GetModuleHandleAproto:LPSTR
GetCommandLineAproto
ExitProcessproto:UINT
LoadIconAproto:HINSTANCE,:LPSTR
LoadCursorAproto:HINSTANCE,:LPSTR
RegisterClassExAproto:ptrWNDCLASSEXA
CreateWindowExAproto:DWORD,:LPSTR,:LPSTR,:DWORD,:SDWORD,:SDWORD,:SDWORD,:SDWORD,:HWND,:HMENU,:HINSTANCE,:LPVOID
ShowWindowproto:HWND,:SDWORD
UpdateWindowproto:HWND
GetMessageAproto:ptrMSG,:HWND,:SDWORD,:SDWORD
TranslateMessageproto:ptrMSG
DispatchMessageAproto:ptrMSG
PostQuitMessageproto:SDWORD
DefWindowProcAproto:HWND,:UINT,:WPARAM,:LPARAM
;WinMainproto:HINSTANCE,:HINSTANCE,:LPSTR,:UINT
.data
ClassNamedb"SimpleWinClass",0
AppNamedb"OurFirstWindow",0
.data?
hInstanceHINSTANCE?
CommandLineLPSTR?
.code
WinMainCRTStartupprocFRAME
pushrbp
.pushregrbp
movrbp,rsp
.setframerbp,0
.endprolog
subrsp,32
movecx,NULL
callGetModuleHandleA
movhInstance,rax
callGetCommandLineA
movCommandLine,rax
movrcx,hInstance
movrdx,NULL
movr8,CommandLine
movr9d,SW_SHOWDEFAULT
callWinMain
movecx,eax
callExitProcess
align4
WinMainCRTStartupendp
WinMainprocFRAME
pushrbp
.pushregrbp
movrbp,rsp
.setframerbp,0
.endprolog
subrsp,sizeofWNDCLASSEXA+sizeofMSG+sizeofHWND+12*8
hInstequ<[rbp+10h]>
hPrevInstequ<[rbp+18h]>
CmdLineequ<[rbp+20h]>
CmdShowequ<[rbp+28h]>
wcequ<[rbp-sizeofWNDCLASSEXA].WNDCLASSEXA>
msgequ<[rbp-sizeofWNDCLASSEXA-sizeofMSG].MSG>
hwndequ<[rbp-sizeofWNDCLASSEXA-sizeofMSG-sizeofHWND]>
movhInst,rcx;storeparam1inshadowspace
movwc.cbSize,SIZEOFWNDCLASSEXA
movwc.style,CS_HREDRAWorCS_VREDRAW
;movrax,OFFSETWndProc;usingLEAispreferable
learax,[WndProc]
movwc.lpfnWndProc,rax
movwc.cbClsExtra,NULL
movwc.cbWndExtra,NULL
movwc.hInstance,rcx
movwc.hbrBackground,COLOR_WINDOW+1
movwc.lpszMenuName,NULL
;movrax,OFFSETClassName;usingLEAispreferable
learax,[ClassName]
movwc.lpszClassName,rax
movecx,NULL
movedx,IDI_APPLICATION
callLoadIconA
movwc.hIcon,rax
movwc.hIconSm,rax
movecx,NULL
movedx,IDC_ARROW
callLoadCursorA
movwc.hCursor,rax
learcx,wc
callRegisterClassExA
movecx,NULL
leardx,[ClassName]
lear8,[AppName]
movr9d,WS_OVERLAPPEDWINDOW
movdwordptr[rsp+4*8],CW_USEDEFAULT
movdwordptr[rsp+5*8],CW_USEDEFAULT
movdwordptr[rsp+6*8],CW_USEDEFAULT
movdwordptr[rsp+7*8],CW_USEDEFAULT
movqwordptr[rsp+8*8],NULL
movqwordptr[rsp+9*8],NULL
movrax,hInst
mov[rsp+10*8],rax
movqwordptr[rsp+11*8],NULL
callCreateWindowExA
movhwnd,rax
movrcx,hwnd
movedx,SW_SHOWNORMAL
callShowWindow
movrcx,hwnd
callUpdateWindow
;---messageloop
@@:
learcx,msg
movrdx,NULL
movr8,0
movr9,0
callGetMessageA
andrax,rax
jz@F
learcx,msg
callTranslateMessage
learcx,msg
callDispatchMessageA
jmp@B
@@:
movrax,msg.wParam
addrsp,sizeofWNDCLASSEXA+sizeofMSG+sizeofHWND+12*8
poprbp
ret
align4
WinMainendp
WndProcprocFRAME
subrsp,4*8
.allocstack4*8
.endprolog
cmpedx,WM_DESTROY
jnz@F
movecx,NULL
callPostQuitMessage
xorrax,rax
jmpexit
@@:
callDefWindowProcA
exit:
addrsp,4*8
ret
align4
Win64_3e-SEHSupportinWin64(JWasmspecific)
;---SEHsupportinWin64.UnlikeWin64_3,
;---thisversionuseshlldirectives,soitcannotbeassembled
;---withMasm64.Also,OPTIONFRAME:AUTOisused.
;---
;---tocreatethebinaryenter:
;---JWasm-win64Win64_3e.asm
;---LinkWin64_3e.obj
optioncasemap:none
optionframe:auto;generateSEH-compatibleprologuesandepilogues
includelibkernel32.lib
includelibuser32.lib
HINSTANCEtypedefQWORD
HWNDtypedefQWORD
HMENUtypedefQWORD
HICONtypedefQWORD
HBRUSHtypedefQWORD
HCURSORtypedefQWORD
WPARAMtypedefQWORD
LPARAMtypedefQWORD
LPSTRtypedefQWORD
LPVOIDtypedefQWORD
UINTtypedefDWORD
NULLequ0
WS_OVERLAPPEDWINDOWequ0CF0000h
CW_USEDEFAULTequ80000000h
SW_SHOWDEFAULTequ10
SW_SHOWNORMALequ1
IDC_ARROWequ32512
IDI_APPLICATIONequ32512
WM_DESTROYequ2
CS_VREDRAWequ1
CS_HREDRAWequ2
COLOR_WINDOWequ5
proto_WNDPROCtypedefproto:HWND,:QWORD,:WPARAM,:LPARAM
WNDPROCtypedefptrproto_WNDPROC
WNDCLASSEXAstruct8
cbSizeDWORD?
styleDWORD?
lpfnWndProcWNDPROC?
cbClsExtraDWORD?
cbWndExtraDWORD?
hInstanceHINSTANCE?
hIconHICON?
hCursorHCURSOR?
hbrBackgroundHBRUSH?
lpszMenuNameLPSTR?
lpszClassNameLPSTR?
hIconSmHICON?
WNDCLASSEXAends
POINTstruct
xSDWORD?
ySDWORD?
POINTends
MSGstruct8
hwndHWND?
messageDWORD?
wParamWPARAM?
lParamLPARAM?
timeDWORD?
ptPOINT<>
MSGends
GetModuleHandleAproto:LPSTR
GetCommandLineAproto
ExitProcessproto:UINT
LoadIconAproto:HINSTANCE,:LPSTR
LoadCursorAproto:HINSTANCE,:LPSTR
RegisterClassExAproto:ptrWNDCLASSEXA
CreateWindowExAproto:DWORD,:LPSTR,:LPSTR,:DWORD,:SDWORD,:SDWORD,:SDWORD,:SDWORD,:HWND,:HMENU,:HINSTANCE,:LPVOID
ShowWindowproto:HWND,:SDWORD
UpdateWindowproto:HWND
GetMessageAproto:ptrMSG,:HWND,:SDWORD,:SDWORD
TranslateMessageproto:ptrMSG
DispatchMessageAproto:ptrMSG
PostQuitMessageproto:SDWORD
DefWindowProcAproto:HWND,:UINT,:WPARAM,:LPARAM
WinMainproto:HINSTANCE,:HINSTANCE,:LPSTR,:UINT
.data
ClassNamedb"SimpleWinClass",0
AppNamedb"OurFirstWindow",0
.data?
hInstanceHINSTANCE?
CommandLineLPSTR?
.code
WinMainCRTStartupprocFRAME
invokeGetModuleHandleA,NULL
movhInstance,rax
invokeGetCommandLineA
movCommandLine,rax
invokeWinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invokeExitProcess,eax
WinMainCRTStartupendp
WinMainprocFRAMEhInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:UINT
localwc:WNDCLASSEXA
localmsg:MSG
localhwnd:HWND
movhInst,rcx
movwc.cbSize,SIZEOFWNDCLASSEXA
movwc.style,CS_HREDRAWorCS_VREDRAW
learax,[WndProc]
movwc.lpfnWndProc,rax
movwc.cbClsExtra,NULL
movwc.cbWndExtra,NULL
movwc.hInstance,rcx
movwc.hbrBackground,COLOR_WINDOW+1
movwc.lpszMenuName,NULL
learax,[ClassName]
movwc.lpszClassName,rax
invokeLoadIconA,NULL,IDI_APPLICATION
movwc.hIcon,rax
movwc.hIconSm,rax
invokeLoadCursorA,NULL,IDC_ARROW
movwc.hCursor,rax
invokeRegisterClassExA,addrwc
invokeCreateWindowExA,NULL,ADDRClassName,ADDRAppName,\
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,\
hInst,NULL
movhwnd,rax
invokeShowWindow,hwnd,SW_SHOWNORMAL
invokeUpdateWindow,hwnd
.while(1)
invokeGetMessageA,ADDRmsg,NULL,0,0
.break.if(!rax)
invokeTranslateMessage,ADDRmsg
invokeDispatchMessageA,ADDRmsg
.endw
movrax,msg.wParam
ret
WinMainendp
WndProcprocFRAMEhWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.if(edx==WM_DESTROY)
invokePostQuitMessage,NULL
xorrax,rax
.else
invokeDefWindowProcA,rcx,edx,r8,r9
.endif
ret
WndProcendp
endWinMainCRTStartup
DOS64-SwitchtoLongModeandBack
;---DOSprogramwhichswitchestolong-modeandback.
;---Note:requiresatleastJWasmv2.
;---Also:needsa64bitcpuinreal-modetorun.
;---Partsofthesourcearebasedonsamplessuppliedby
;---sinsiandTomaszGrysztarintheFASMforum.
;---Tocreatethebinaryenter:
;---JWasm-mzDOS64.asm
.x64p
;---16bitstart/exitcode
_TEXT16segmentuse16parapublic'CODE'
assumeds:_TEXT16
assumees:_TEXT16
GDTRlabelfword;GlobalDescriptorsTableRegister
dw4*8-1;limitofGDT(sizeminusone)
ddoffsetGDT;linearaddressofGDT
IDTRlabelfword;InterruptDescriptorTableRegister
dw256*16-1;limitofIDT(sizeminusone)
dd0;linearaddressofIDT
nullidtlabelfword
dw3FFh
dd0
align8
GDTdq0;nulldescriptor
dw0FFFFh,0,9A00h,0AFh;64-bitcodedescriptor
dw0FFFFh,0,9A00h,000h;compatibilitymodecodedescriptor
dw0FFFFh,0,9200h,000h;compatibilitymodedatadescriptor
wPICMaskdw0;variabletosave/restorePICmasks
start16:
pushcs
popds
movax,cs
movzxeax,ax
shleax,4
adddwordptr[GDTR+2],eax;convertoffsettolinearaddress
movwordptr[GDT+2*8+2],ax
movwordptr[GDT+3*8+2],ax
shreax,16
movbyteptr[GDT+2*8+4],al
movbyteptr[GDT+3*8+4],al
movax,ss
movdx,es
subax,dx
movbx,sp
shrbx,4
addbx,ax
movah,4Ah
int21h;freeunusedmemory
pushcs
popes
movax,ss
movdx,cs
subax,dx
shlax,4
addax,sp
pushds
popss
movsp,ax;makeaTINYmodel,CS=SS=DS=ES
smswax
testal,1
jz@F
movdx,offseterr1
movah,9
int21h
movah,4Ch
int21h
err1db"ModeisV86.NeedREALmodetoswitchtoLONGmode!",13,10,'$'
@@:
xoredx,edx
moveax,80000001h;testiflong-modeissupported
cpuid
testedx,20000000h
jnz@F
movdx,offseterr2
movah,9
int21h
movah,4Ch
int21h
err2db"No64bitcpudetected.",13,10,'$'
@@:
movbx,1000h
movah,48h
int21h
jnc@F
movdx,offseterr3
movah,9
int21h
movah,4Ch
int21h
err3db"Outofmemory",13,10,'$'
@@:
addax,100h-1;aligntopageboundary
moval,0
moves,ax
;---setuppagedirectoriesandtables
subdi,di
movcx,4096
subeax,eax
repstosd;clear4pages
subdi,di
movax,es
movzxeax,ax
shleax,4
movcr3,eax;loadpage-maplevel-4base
leaedx,[eax+5000h]
movdwordptr[IDTR+2],edx
oreax,111b
addeax,1000h
moves:[di+0000h],eax;firstPDPtable
addeax,1000h
moves:[di+1000h],eax;firstpagedirectory
addeax,1000h
moves:[di+2000h],eax;firstpagetable
movdi,3000h;addressoffirstpagetable
moveax,0+111b
movcx,256;numberofpagestomap(1MB)
@@:
stosd
adddi,4
addeax,1000h
loop@B
;---setupebx/rbxwithlinearaddressof_TEXT
movbx,_TEXT
movzxebx,bx
shlebx,4
add[llg],ebx
;---createIDT
movdi,5000h
movcx,32
movedx,offsetexception
addedx,ebx
make_exc_gates:
moveax,edx
stosw
movax,8
stosw
movax,8E00h
stosd
xoreax,eax
stosd
stosd
addedx,4
loopmake_exc_gates
movcx,256-32
make_int_gates:
moveax,offsetinterrupt
addeax,ebx
stosw
movax,8
stosw
movax,8E00h
stosd
xoreax,eax
stosd
stosd
loopmake_int_gates
movdi,5000h
moveax,ebx
addeax,offsetclock
moves:[di+80h*16+0],ax;setIRQ0handler
shreax,16
moves:[di+80h*16+6],ax
moveax,ebx
addeax,offsetkeyboard
moves:[di+81h*16+0],ax;setIRQ1handler
shreax,16
moves:[di+81h*16+6],ax
;---clearNTflag
pushf
popax
andah,0BFh
pushax
popf
;---reprogramPIC:changeIRQ0-7toINT80h-87h,IRQ8-15toINT88h-8Fh
cli
inal,0A1h
movah,al
inal,21h
mov[wPICMask],ax
moval,10001b;beginPIC1initialization
out20h,al
moval,10001b;beginPIC2initialization
out0A0h,al
moval,80h;IRQ0-7:interrupts80h-87h
out21h,al
moval,88h;IRQ8-15:interrupts88h-8Fh
out0A1h,al
moval,100b;slaveconnectedtoIRQ2
out21h,al
moval,2
out0A1h,al
moval,1;Intelenvironment,manualEOI
out21h,al
out0A1h,al
inal,21h
moval,11111100b;enableonlyclockandkeyboardIRQ
out21h,al
inal,0A1h
moval,11111111b
out0A1h,al
moveax,cr4
oreax,1shl5
movcr4,eax;enablephysical-addressextensions(PAE)
movecx,0C0000080h;EFERMSR
rdmsr
oreax,1shl8;enablelongmode
wrmsr
lgdt[GDTR]
lidt[IDTR]
movcx,ss
movzxecx,cx;getbaseofSS
shlecx,4
movzxesp,sp
addecx,esp;ECX=linearaddressofcurrentSS:ESP
moveax,cr0
oreax,80000001h
movcr0,eax;enablepaging+pmode
db66h,0EAh;jmp0008:oooooooo
llgddoffsetlong_start
dw8
;---switchbacktoreal-modeandexit
backtoreal:
cli
moveax,cr0
andeax,7FFFFFFFh;disablepaging
movcr0,eax
movecx,0C0000080h;EFERMSR
rdmsr
andah,not1h;disablelongmode(EFER.LME=0)
wrmsr
movax,24;setSS,DSandESto64kdata
movss,ax
movds,ax
moves,ax
moveax,cr0;switchtorealmode
andal,0FEh
movcr0,eax
db0eah;clearinstructioncache,CS=real-modeseg
dw$+4
dw_TEXT16
movax,STACK;SS=real-modeseg
movss,ax
movsp,4096
pushcs;DS=real-mode_TEXT16seg
popds
lidt[nullidt];IDTR=real-modecompatiblevalues
moveax,cr4
andal,not20h;disablephysical-addressextensions(PAE)
movcr4,eax
;---reprogramPIC:changeIRQ0-7toINT08h-0Fh,IRQ8-15toINT70h-77h
moval,10001b;beginPIC1initialization
out20h,al
moval,10001b;beginPIC2initialization
out0A0h,al
moval,08h;IRQ0-7:backtoints8h-Fh
out21h,al
moval,70h;IRQ8-15:backtoints70h-77h
out0A1h,al
moval,100b;slaveconnectedtoIRQ2
out21h,al
moval,2
out0A1h,al
moval,1;Intelenvironment,manualEOI
out21h,al
out0A1h,al
inal,21h
movax,[wPICMask];restorePICmasks
out21h,al
moval,ah
out0A1h,al
sti
movax,4c00h
int21h
_TEXT16ends
;---here'sthe64bitcodesegment.
;---since64bitcodeisalwaysflatbuttheDOSmzformatissegmented,
;---therearerestrictions,becausetheassemblerdoesn'tknowthe
;---linearaddresswherethe64bitsegmentwillbeloaded:
;---+directaddressingwithconstantsisn'tpossible(mov[0B8000h],rax)
;---sincetherip-relativeaddresswillbecalculatedwrong.
;---+64bitoffsets(movrax,offset<var>)mustbeadjustedbythelinear
;---addresswherethe64bitsegmentwasloaded(isinrbx).
;---
;---rbxmustpreservelinearaddressof_TEXT
_TEXTsegmentparause64public'CODE'
assumeds:FLAT,es:FLAT
long_start:
xoreax,eax
movss,eax
movesp,ecx
sti;nowinterruptscanbeused
callWriteStrX
db"Hello64bit",10,0
nextcmd:
movr8b,0;r8bwillbefilledbythekeyboardirqroutine
nocmd:
cmpr8b,0
jznocmd
cmpr8b,1;ESC?
jzesc_pressed
cmpr8b,13h;'r'?
jzr_pressed
callWriteStrX
db"unknownkey",0
moval,r8b
callWriteB
callWriteStrX
db10,0
jmpnextcmd
;---'r'key:displaysomeregistercontents
r_pressed:
callWriteStrX
db10,"cr0=",0
movrax,cr0
callWriteQW
callWriteStrX
db10,"cr2=",0
movrax,cr2
callWriteQW
callWriteStrX
db10,"cr3=",0
movrax,cr3
callWriteQW
callWriteStrX
db10,"cr4=",0
movrax,cr4
callWriteQW
callWriteStrX
db10,"cr8=",0
movrax,cr8
callWriteQW
callWriteStrX
db10,0
jmpnextcmd
;---ESC:backtoreal-mode
esc_pressed:
jmp[bv]
bvlabelfword
ddoffsetbacktoreal
dw16
;---screenoutputhelpers
;---scrollscreenuponeline
;---rsi=linearaddressstartoflastline
;---rbp=linearaddressofBIOSarea(0x400)
scroll_screen:
cld
movedi,esi
movzxeax,wordptr[rbp+4Ah]
pushrax
learsi,[rsi+2*rax]
movcl,[rbp+84h]
mulcl
movecx,eax
repmovsw
poprcx
movax,0720h
repstosw
ret
WriteChr:
pushrbp
pushrdi
pushrsi
pushrbx
pushrcx
pushrdx
pushrax
movedi,0B8000h
movebp,400h
cmpbyteptr[rbp+63h],0B4h
jnz@F
xordi,di
@@:
movzxebx,wordptr[rbp+4Eh]
addedi,ebx
movzxebx,byteptr[rbp+62h]
movesi,edi
movzxecx,byteptr[rbx*2+rbp+50h+1];ROW
movzxeax,wordptr[rbp+4Ah]
mulecx
movzxedx,byteptr[rbx*2+rbp+50h];COL
addeax,edx
movdh,cl
leaedi,[rdi+rax*2]
moval,[rsp]
cmpal,10
jznewline
mov[rdi],al
movbyteptr[rdi+1],07
incdl
cmpdl,byteptr[rbp+4Ah]
jb@F
newline:
movdl,00
incdh
cmpdh,byteptr[rbp+84h]
jbe@F
decdh
callscroll_screen
@@:
mov[rbx*2+rbp+50h],dx
poprax
poprdx
poprcx
poprbx
poprsi
poprdi
poprbp
ret
WriteStr:;writestringinrdx
pushrsi
movrsi,rdx
cld
@@:
lodsb
andal,al
jz@F
callWriteChr
jmp@B
@@:
poprsi
ret
WriteStrX:;writestringatrip
pushrsi
movrsi,[rsp+8]
cld
@@:
lodsb
andal,al
jz@F
callWriteChr
jmp@B
@@:
mov[rsp+8],rsi
poprsi
ret
WriteQW:;writeQWordinrax
pushrax
shrrax,32
callWriteDW
poprax
WriteDW:
pushrax
shrrax,16
callWriteW
poprax
WriteW:
pushrax
shrrax,8
callWriteB
poprax
WriteB:;writeByteinal
pushrax
shrrax,4
callWriteNb
poprax
WriteNb:
andal,0Fh
addal,'0'
cmpal,'9'
jbe@F
addal,7
@@:
jmpWriteChr
;---exceptionhandler
exception:
excno=0
repeat32
pushexcno
jmp@F
excno=excno+1
endm
@@:
callWriteStrX
db10,"Exception",0
poprax
callWriteB
callWriteStrX
db"errcode=",0
movrax,[rsp+0]
callWriteQW
callWriteStrX
db"rip=",0
movrax,[rsp+8]
callWriteQW
callWriteStrX
db10,0
@@:
jmp$
;---clockandkeyboardinterrupts
clock:
pushrbp
movebp,400h
incdwordptr[rbp+6Ch]
poprbp
interrupt:;handlerforallotherinterrupts
pushrax
moval,20h
out20h,al
poprax
iretq
keyboard:
pushrax
inal,60h
testal,80h
jnz@F
movr8b,al
@@:
inal,61h;givefinishinginformation
out61h,al;tokeyboard...
moval,20h
out20h,al;...andinterruptcontroller
poprax
iretq
_TEXTends
;---4kstack,usedinbothmodes
STACKsegmentuse16parastack'STACK'
db4096dup(?)
STACKends
endstart16
Win32_5-CreateaWin32Binarywith-bin
;---Win32"helloworld"consoleapplication.
;---UsesJWasm'sbinoutputformat,sonolinkerneeded.
;---assemble:JWasm-bin-FoWin32_5.exeWin32_5.ASM
.386
optioncasemap:none
.nolist
includewinnt.inc;includePEimagedefinitions
.list
STD_OUTPUT_HANDLEequ-11
IMAGEBASEequ400000h
PEHDRsegmentdwordFLAT
;---definetheDOS"MZ"header
orgIMAGEBASE
IMAGE_DOS_HEADER<"ZM",80h,1,0,4,0,-1,0,200h,0,0,0,0,0,<0>,0,0,<0>,IMAGERELPEHdr>
db0Eh;pushcs
db1Fh;popds
db0BAh,0Eh,0;movdx,text
db0B4h,09h;movah,9
db0CDh,21h;int21h
db0B8h,01h,4Ch;movax,4c01h
db0CDh,21h;int21h
db"ThisprogramcannotberuninDOSmode",13,10,'$'
orgIMAGEBASE+80h
;---definetheWin32"PE"header
PEHdrlabelbyte
db"PE",0,0
IMAGE_FILE_HEADER<IMAGE_FILE_MACHINE_I386,num_sections,0,0,0,sizeofIMAGE_OPTIONAL_HEADER32,
IMAGE_FILE_RELOCS_STRIPPEDorIMAGE_FILE_EXECUTABLE_IMAGEorIMAGE_FILE_32BIT_MACHINEorIMAGE_FILE_LOCAL_SYMS_STRIPPED>
IMAGE_OPTIONAL_HEADER32{10Bh,;magic
6,0,;linkermajor,minor
1000h,1000h,0,;sizeofcode,initializeddata,uninitializeddata
IMAGERELmainCRTStartup,;entrypoint
IMAGERELstart_text,IMAGERELstart_rdata,;baseofcode,data
IMAGEBASE,;imagebase
1000h,200h,;sectionalignment,filealignment
4,0,;OSmajor,minor
0,0,;Imagemajor,minor
4,0,;Subsysmajor,minor
0,;win32version
3000h,;sizeofimage
1000h,;sizeofheader
0,;checksum
IMAGE_SUBSYSTEM_WINDOWS_CUI,
0,;dllcharacteristics
100000h,1000h,;stackres,com
100000h,1000h,;heapres,com
0,;loaderflags
16,;numberofdirectories
<<0,0>,;exports
<IMAGERELstart_idata,SECTIONRELendof_idata>,;imports
<0,0>,<0,0>,;resource,exception
<>,<>,<>,<>,;security,baserelocs,debug,architecture
<>,<>,<>,<>,;globalptr,tls,load_config,bound_import
<>,<>,<>,<>>};iat,delay_import,comdescriptor,reserved
;---definethesectiontable
sectiontablelabelbyte
IMAGE_SECTION_HEADER<".text",<sizeof_text>,IMAGERELstart_text,sizeof_text,
200h,0,0,0,0,060000020h>
IMAGE_SECTION_HEADER<".rdata",<SECTIONRELendof_idata+sizeof_const>,IMAGERELstart_rdata,SECTIONRELendof_idata+sizeof_const,
400h,0,0,0,0,040000040h>
num_sectionsequ($-sectiontable)/sizeofIMAGE_SECTION_HEADER
orgIMAGEBASE+200h;forcesphysicalsizeofheaderto200handsetsVAto400200h
PEHDRends
;---theALIGNxsegmentsareneededbecause
;---sectionalignmentandfilealignmentaredifferent
ALIGN1segmentdwordpublicFLAT'DATA'
org0E00h;changepctoRVA1000h
ALIGN1ends
_TEXTsegmentdwordpublicFLAT'CODE'
_TEXTends
ALIGN2segmentdwordpublicFLAT'DATA'
org0E00h;changepctoRVA2000h
ALIGN2ends
_IDATAsegmentdwordpublicFLAT'DATA'
start_rdatalabelbyte
start_idatalabelbyte
;---importdescriptorsgohere
_IDATAends
_IDATA$1segmentdwordpublicFLAT'DATA'
IMAGE_IMPORT_DESCRIPTOR<<0>,0,0,0,0>
;---ILTentriesgohere
_IDATA$1ends
_IDATA$2segmentdwordpublicFLAT'DATA'
dd0;---endoflastILT
;---IATentriesgohere
_IDATA$2ends
_IDATA$3segmentdwordpublicFLAT'DATA'
dd0;---endoflastIAT
;---importnamestringsgohere
_IDATA$3ends
_IDATA$4segmentdwordpublicFLAT'DATA'
endof_idataequ$
_IDATA$4ends
CONSTsegmentdwordpublicFLAT'DATA'
start_constlabelbyte
CONSTends
DefineImpDllmacroname
_IDATAsegment
IMAGE_IMPORT_DESCRIPTOR<<IMAGERELname&ILT>,0,0,IMAGERELname,IMAGERELname&IAT>
_IDATAends
_IDATA$1segment
ifdefImportDefined
dd0;terminatepreviousILT
endif
name&ILTlabeldword
_IDATA$1ends
_IDATA$2segment
ifdefImportDefined
dd0;terminatepreviousIAT
endif
name&IATlabeldword
_IDATA$2ends
_IDATA$3segment
namedb@CatStr(!",name,!"),0
align4
_IDATA$3ends
ImportDefinedequ1
endm
DefineImportmacroname
_IDATA$1segment
ddIMAGERELn&name
_IDATA$1ends
_IDATA$2segment
lp&nametypedefptrpr&name
namelp&nameIMAGERELn&name
_IDATA$2ends
_IDATA$3segment
n&namedw0
db@CatStr(!",name,!"),0
align4
_IDATA$3ends
endm
prWriteConsoleAtypedefprotostdcall:dword,:dword,:dword,:dword,:dword
prGetStdHandletypedefprotostdcall:dword
prExitProcesstypedefprotostdcall:dword
DefineImpDllkernel32
DefineImportExitProcess
DefineImportWriteConsoleA
DefineImportGetStdHandle
if0;iffurtherdllsaretobeimported
prMessageBoxAtypedefprotostdcall:dword,:dword,:dword,:dword
DefineImpDlluser32
DefineImportMessageBoxA
endif
CONSTsegment
stringdb13,10,"hello,world.",13,10
sizeof_constequ$-start_const
CONSTends
_TEXTsegment
assumeds:FLAT,es:FLAT
start_textlabelnear
;---startofprogram
mainproc
localdwWritten:dword
localhConsole:dword
invokeGetStdHandle,STD_OUTPUT_HANDLE
movhConsole,eax
invokeWriteConsoleA,hConsole,addrstring,sizeofstring,addrdwWritten,0
xoreax,eax
ret
mainendp
;---entry
mainCRTStartupprocc
invokemain
invokeExitProcess,eax
mainCRTStartupendp
sizeof_textequ$-start_text
org200h;alignsizeof_TEXTtonext512byteboundary
_TEXTends
end
Win32_7-UsageofOPTIONDLLIMPORTand-FdSwitch
;---Win32_7-ShowshowtouseOPTIONDLLIMPORTandswitch-Fd.
;---Noimportlibrariesareneededinthelinkstep.
;---
;---assemble:JWasm-coff-FdWin32_7.ASM
;---link:JWlinkformatwindowspefWin32_7.OBJ
.386
.modelFLAT,stdcall
optioncasemap:none
STD_OUTPUT_HANDLEequ-11
optiondllimport:<kernel32>
WriteConsoleAproto:dword,:dword,:dword,:dword,:dword
GetStdHandleproto:dword
ExitProcessproto:dword
optiondllimport:<user32>
MessageBoxAproto:dword,:dword,:dword,:dword
optiondllimport:<none>
.const
msgdb13,10,"hello,world.",13,10
db0
.code
mainproc
localwritten:dword
invokeGetStdHandle,STD_OUTPUT_HANDLE
movebx,eax
invokeWriteConsoleA,ebx,addrmsg,sizeofmsg,
addrwritten,0
invokeMessageBoxA,0,addrmsg,0,0
ret
Win64_8-CreateaWin64Binarywith-pe
;---createa64-bitbinarywith-pecmdlineoption
;---
;---JWasm-peWin64_8.asm
.x64;-perequirestosetcpu,model&language
.modelflat,fastcall
optioncasemap:none
optionframe:auto;generateSEH-compatibleprologuesandepilogues
optionwin64:3;initshadowspace,reservestackatPROClevel
;---resourceIDs
IDR_MENU1equ100
IDR_BITMAP1equ101
IDM_EXITequ1000
NULLequ0
LPSTRtypedefptr
LPVOIDtypedefptr
UINTtypedefdword
BOOLtypedefdword
;---winbasedefinitions
HINSTANCEtypedefptr
;---winuserdefinitions
HWNDtypedefptr
HMENUtypedefptr
HICONtypedefptr
HBRUSHtypedefptr
HCURSORtypedefptr
HDCtypedefptr
HBITMAPtypedefptr
WPARAMtypedefptr
LPARAMtypedefqword
WS_OVERLAPPEDWINDOWequ0CF0000h
CW_USEDEFAULTequ80000000h
SW_SHOWDEFAULTequ10
SW_SHOWNORMALequ1
IDC_ARROWequ32512
IDI_APPLICATIONequ32512
CS_VREDRAWequ1
CS_HREDRAWequ2
COLOR_WINDOWequ5
WM_DESTROYequ2
WM_PAINTequ000Fh
WM_COMMANDequ0111h
proto_WNDPROCtypedefproto:HWND,:qword,:WPARAM,:LPARAM
WNDPROCtypedefptrproto_WNDPROC
WNDCLASSEXAstruct8
cbSizedword?
styledword?
lpfnWndProcWNDPROC?
cbClsExtradword?
cbWndExtradword?
hInstanceHINSTANCE?
hIconHICON?
hCursorHCURSOR?
hbrBackgroundHBRUSH?
lpszMenuNameLPSTR?
lpszClassNameLPSTR?
hIconSmHICON?
WNDCLASSEXAends
POINTstruct
xsdword?
ysdword?
POINTends
MSGstruct8
hwndHWND?
messagedword?
wParamWPARAM?
lParamLPARAM?
timedword?
ptPOINT<>
MSGends
RECTstruct
leftsdword?
topsdword?
rightsdword?
bottomsdword?
RECTends
PAINTSTRUCTstruct8
hdcHDC?
fEraseBOOL?
rcPaintRECT<>
fRestoreBOOL?
fIncUpdateBOOL?
rgbReservedbyte32dup(?)
PAINTSTRUCTends
;---wingdidefinitions
DIB_RGB_COLORSequ0
SRCCOPYequ00CC0020h
HGDIOBJtypedefptr
BITMAPINFOHEADERstruct
biSizedword?
biWidthsdword?
biHeightsdword?
biPlanesword?
biBitCountword?
biCompressiondword?
biSizeImagedword?
biXPelsPerMetersdword?
biYPelsPerMetersdword?
biClrUseddword?
biClrImportantdword?
BITMAPINFOHEADERends
optiondllimport:<kernel32>
GetModuleHandleAproto:LPSTR
GetCommandLineAproto
ExitProcessproto:UINT
optiondllimport:<user32>
BeginPaintproto:HWND,:ptrPAINTSTRUCT
CreateWindowExAproto:dword,:LPSTR,:LPSTR,:dword,:sdword,:sdword
DefWindowProcAproto:HWND,:UINT,:WPARAM,:LPARAM
DestroyWindowproto:HWND
DispatchMessageAproto:ptrMSG
EndPaintproto:HWND,:ptrPAINTSTRUCT
GetClientRectproto:HWND,:ptrRECT
GetMessageAproto:ptrMSG,:HWND,:sdword,:sdword
LoadBitmapAproto:HINSTANCE,:LPSTR
LoadCursorAproto:HINSTANCE,:LPSTR
LoadIconAproto:HINSTANCE,:LPSTR
PostQuitMessageproto:sdword
RegisterClassExAproto:ptrWNDCLASSEXA
ShowWindowproto:HWND,:sdword
TranslateMessageproto:ptrMSG
UpdateWindowproto:HWND
optionDLLIMPORT:<gdi32>
BitBltproto:HDC,:dword,:dword,:dword,:dword,:HDC,:
CreateCompatibleDCproto:HDC
DeleteDCproto:HDC
GetDIBitsproto:HDC,:HBITMAP,:dword,:dword,:ptr,:ptrBITMAPINFO,:
SelectObjectproto:HDC,:HGDIOBJ
optiondllimport:none
WinMainproto:HINSTANCE,:HINSTANCE,:LPSTR,:UINT
.data
ClassNamedb"SimpleWinClass",0
AppNamedb"Bitmaprendering",0
.data?
hInstanceHINSTANCE?
hBitmapHBITMAP?
CommandLineLPSTR?
.code
WinMainCRTStartupprocFRAME
invokeGetModuleHandleA,NULL
movhInstance,rax
invokeGetCommandLineA
movCommandLine,rax
invokeWinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invokeExitProcess,eax
WinMainCRTStartupendp
WinMainprocFRAMEhInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:UINT
localwc:WNDCLASSEXA
localmsg:MSG
localhwnd:HWND
invokeLoadBitmapA,hInst,IDR_BITMAP1
movhBitmap,rax
movwc.cbSize,sizeofWNDCLASSEXA
movwc.style,CS_HREDRAWorCS_VREDRAW
learax,[WndProc]
movwc.lpfnWndProc,rax
movwc.cbClsExtra,NULL
movwc.cbWndExtra,NULL
movrcx,hInst
movwc.hInstance,rcx
movwc.hbrBackground,COLOR_WINDOW+1
movwc.lpszMenuName,IDR_MENU1
learax,[ClassName]
movwc.lpszClassName,rax
invokeLoadIconA,NULL,IDI_APPLICATION
movwc.hIcon,rax
movwc.hIconSm,rax
invokeLoadCursorA,NULL,IDC_ARROW
movwc.hCursor,rax
invokeRegisterClassExA,addrwc
invokeCreateWindowExA,NULL,ADDRClassName,ADDRAppName,
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,
hInst,NULL
movhwnd,rax
invokeShowWindow,hwnd,SW_SHOWNORMAL
invokeUpdateWindow,hwnd
.while(1)
invokeGetMessageA,ADDRmsg,NULL,0,0
.break.if(!eax)
invokeTranslateMessage,ADDRmsg
invokeDispatchMessageA,ADDRmsg
.endw
movrax,msg.wParam
ret
WinMainendp
WndProcprocFRAMEhWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
localhdc2:HDC
localps:PAINTSTRUCT
localrect:RECT
localbmi:BITMAPINFOHEADER
.ifedx==WM_DESTROY
invokePostQuitMessage,NULL
xorrax,rax
.elseifedx==WM_COMMAND
.ifwParam==IDM_EXIT
invokeDestroyWindow,hWnd
.endif
xoreax,eax
.elseifedx==WM_PAINT
invokeBeginPaint,hWnd,addrps
invokeCreateCompatibleDC,ps.hdc
movhdc2,rax
invokeSelectObject,hdc2,hBitmap
movbmi.biSize,sizeofBITMAPINFOHEADER
movbmi.biBitCount,0
invokeGetDIBits,hdc2,hBitmap,0,0,0,addrbmi,DIB_RGB_COLORS
invokeGetClientRect,hWnd,addrrect
movr8d,rect.right
subr8d,bmi.biWidth
jnc@F
xorr8d,r8d
@@:
shrr8d,1
movr9d,rect.bottom
subr9d,bmi.biHeight
jnc@F
xorr9d,r9d
@@:
shrr9d,1
invokeBitBlt,ps.hdc,r8d,r9d,bmi.biWidth,bmi.biHeight,hdc2,0,0,SRCCOPY
invokeDeleteDC,hdc2
invokeEndPaint,hWnd,addrps
xoreax,eax
.else
invokeDefWindowProcA,rcx,edx,r8,r9
.endif
ret
WndProcendp
if1;for-pe
RT_BITMAPequ2
RT_MENUequ4
;---menuresourceflags
MF_POPUPequ10h
MF_ENDequ80h
IMAGE_RESOURCE_DIRECTORYstruct
Characteristicsdword?
TimeDateStampdword?
MajorVersionword?
MinorVersionword?
NumberOfNamedEntriesword?
NumberOfIdEntriesword?
IMAGE_RESOURCE_DIRECTORYends
IMAGE_RESOURCE_DIRECTORY_ENTRYstruct
union
r0recordNameIsString:1,NameOffset:31
Name_dword?
Idword?
ends
union
OffsetToDatadword?
r1record DataIsDirectory:1,OffsetToDirectory:31
ends
IMAGE_RESOURCE_DIRECTORY_ENTRYends
IMAGE_RESOURCE_DATA_ENTRYstruct
OffsetToDatadword?
Size_dword?
CodePagedword?
Reserveddword?
IMAGE_RESOURCE_DATA_ENTRYends
optiondotname
.rsrcsegmentdwordFLATpublicread'RSRC'
;---definemenuIDR_MENU1andbitmapIDR_BITMAP1
;---rootlevel:enumtheresourcetypes
IMAGE_RESOURCE_DIRECTORY<0,0,0,0,0,2>
IMAGE_RESOURCE_DIRECTORY_ENTRY<<RT_BITMAP>,<SECTIONRELbms+80000000h>>
IMAGE_RESOURCE_DIRECTORY_ENTRY<<RT_MENU>,<SECTIONRELmenus+80000000h>>
;---secondlevel:enumtheIDsofresourcetypeX
bmsIMAGE_RESOURCE_DIRECTORY<0,0,0,0,0,1>
IMAGE_RESOURCE_DIRECTORY_ENTRY<<IDR_BITMAP1>,<SECTIONRELbm1+80000000h>>
menusIMAGE_RESOURCE_DIRECTORY<0,0,0,0,0,1>
IMAGE_RESOURCE_DIRECTORY_ENTRY<<IDR_MENU1>,<SECTIONRELmenu1+80000000h>>
;---thirdlevel:enumthelanguagesofIDX
bm1IMAGE_RESOURCE_DIRECTORY<0,0,0,0,0,1>
IMAGE_RESOURCE_DIRECTORY_ENTRY<<409h>,<SECTIONRELbm1_l1>>
menu1IMAGE_RESOURCE_DIRECTORY<0,0,0,0,0,1>
IMAGE_RESOURCE_DIRECTORY_ENTRY<<409h>,<SECTIONRELm1_l1>>
;---lastlevel:definetheresourcedata
;---dataformenuIDR_MENU1,language409h
m1_l1IMAGE_RESOURCE_DATA_ENTRY<IMAGERELm1_l1_data,size_m1_l1,0,0>
m1_l1_datadw0,0 ;menuheader
dwMF_POPUPorMF_END,'&','F','i','l','e',0
dwMF_END,IDM_EXIT,'E','&','x','i','t',0
size_m1_l1equ$-m1_l1_data
align4
;---dataforbitmapIDR_BITMAP1
bm1_l1IMAGE_RESOURCE_DATA_ENTRY<IMAGERELbm1_l1_data,size_bm1_l1,0,0>
bm1_l1_datalabelword
incbin<Win32_8.bmp>,14 ;skipbitmapfileheader
size_bm1_l1equ$-(bm1_l1_data)
.rsrcends
;---set/subsystem:windows
;---thePEheaderisstoredinsection.hdr$2
optiondotname
.hdr$2segmentdwordFLATpublic'HDR'
org5Ch;positiontoIMAGE_NT_HEADER64.OptionalHeader.Subsystem
dw2;2=subsystemwindows
.hdr$2ends
endif
endWinMainCRTStartup
AppendixC.ErrorsandWarningsThewarninganderrornumbersemittedbyJWasmdifferfromMasm's.However,thetextsofthemessagesareprettymuchidentical.AsinMasm,thefirstdigitshowstheseverityoftheissue:range1xxxreportsafatalerror(assemblyprocessisstopped),range2xxxindicatesanerror(assemblyprocesscontinues,butnoobjectmodulewillbecreated)and4xxxarewarnings.
x029Multiplebaseregistersnotallowed
In16-bitcode,onecannotusebothBXandBPinindirectaddressing;in32/64-bitcode,ESP/RSPcanonlyappearonceinindirectaddressing.
x030
InstructionorregisternotacceptedincurrentCPUmode
x031InvalidaddressingmodewithcurrentCPUsetting
x032CannotuseTRn-TRnwithcurrentCPUsetting
TheTRxspecialregisterswererestrictedto80386and80486cpus.
x033Mustbeindexorbaseregister
x034Multipleindexregistersnotallowed
x035
x036 Scalefactormustbe1,2,4or8
x037Cannotbeusedasindexregister:<register>
Indexregistersarerestricted.In16-bitmode,onlySIandDIcanbeindexregisters.In32-bitmode,allgeneral-purposeregistersexceptESPcanbeindexregisters.
Baseandindex
x038 registerdifferinsize
x039 Expectingcomma
x040ORGneedsaconstantorlocaloffset
x041 POPCSisnotallowed
x042OnlyMOVcanusespecialregister
ThespecialregistersCRx,DRxandTRxcanonlybemovedto/fromgeneralpurposeregisters.
x043CannotuseSHORTwithCALL
DistanceofCALLoperandsmustbeNEARorFAR.
x044OnlySHORTjumpdistanceisallowed
Somejumpinstructionsacceptshortdistancesonly(JCXZ,JECXZ,LOOPx).
x045 Syntaxerror
x046Prefixmustbefollowedbyaninstruction
x047 Syntaxerror:Unexpectedcolon
x048
Operandsmustbethesamesize:<sizeop1>-<sizeop2>
x049 Invalidinstructionoperands
x050JumpdistancenotpossibleincurrentCPUmode
Jccinstructionswon'taccepttypecoercionsthatincreasethejumpdistance(i.e."jzNEARPTRlabel")ifcurrentcpuis<80386.
x051 ImmediatedataoutofrangeCannotuseshortornearmodifiers
x052withthisinstruction
x053 Jumpoutofrangeby<num>byte(s) Ashortdistancemustbeintherange-128to+127.
x054Displacementoutofrange:<displacement>
x055 Initializervaluetoolarge
x056Symbolalreadydefined:<symbol>
x057Offsetmagnitudetoolargeforspecifiedsize
x058Magnitudeofoffsetexceeds16bit
x059Operand2toobig
x060Operand1toosmallx061 Linetoolong Sizeofaline(afterconcatenation)isrestrictedto600.
x062 Toomanytokensinaline Thenumberoftokensinalineisrestrictedto150.
x063
x064Operandisexpected
x065Constantexpected
Aconstant(numeric)valueisexpectedinthecurrentcontext.Notethatalabel-moreexactly:theoffsetpartofalabel'saddress-isnotaconstantvalue,sincethefinalvalueiscalculatedbythelinker(ortheOSloader)only.
x066ConstantoperandisexpectedTheexpressionevaluatoracceptsaconstantonlyinthecurrentcontext.
.ELSEclause An.IFblockmaycontain0or1.ELSEclausesandit
x067 alreadyoccuredinthis.IFblock
mustbethelastclausebefore.ENDIF.
x068Multipleoverrides
x069Segment,grouporsegmentregisterexpected
Theoperandbeforethecolonoperator(:)mustbeasegment,grouporsegmentregister.
x070 Identifiertoolong
Identifernamesarerestrictedto247.ThisisahardlimitforOMFoutputformat.Forotherformats,thelimitmaybeextendedbyadjustingandrecompilingthesourcecode.
x071Invalidoperandsizeforinstruction
x072Notsupported:<directive>
Messageisdisplayedifoneofthefollwingoptionsisspecified:OPTIONREADONLY,OPTIONEXPR16,OPTIONOLDMACROS.Thosearecurrentlynotsupported.
x073 Sizenotspecified,assuming:<type>
thisisawarning.<type>maybeBYTE,WORDorDWORD.Themessagemayoccurifanimmediatevalueiswrittentoanuntypedmemoryreference:
mov[ebx],1
JWasmmakesaguessanddisplaysthewarning,whileMasmwilldisplayanerrorinsuchcases.
x074 Floating-pointinitializerignored
x075
OnlySHORTandNEARjumpdistanceisallowed
Conditionaljump(Jcc)instructiondestinationcannotbefar.
x076
InitializermagnitudetoolargeforspecifiedsizeSegmentattribute
x077 isdefinedalready:<attribute>
x078Segmentdefinitionchanged:%s,%s
x079Classnametoolong Segmentclassnamesarerestrictedto255insize.
x080Blocknestingerror:%s
x081 Segmentattributeisunknown:%s
x082Mustbeinsegmentblock
Instructionsanddirectivesthatgeneratecodeordatamustbeinsideasegmentblock.
x083Segmentnotdefined:<segment>
x084Colonisexpected
x085 Invalidqualifiedtype:%s
x086Qualifiedtypeisexpectedx087
x088 Librarynameismissing
x089
Cannotaccesslabelthroughsegmentregisters:<label>
x090Linetoolongafterexpansion:<line>
x091 Languagetypemustbespecified
x092
PROC,MACROormacroloopdirectivemust
precedeLOCAL
x093Cannotnestprocedures
x094VARARGrequiresCcallingconvention
x095
Multiple.MODELdirectives,.MODELignored
x096Modelisnotdeclared
Withoutamodel,simplifiedsegmentdirectives(.CODE,.DATA,.CONST,.DATA?,.STACK,.FARDATAand.FARDATA?)anddirectives.STARTUP,.EXITcannotbeused.
x097Backquotemissing:`<identifier>
x098COMMENTdelimiterexpected
x099ENDdirectiverequiredatendoffile
x100Nestingleveltoodeep
x101Macronestingleveltoodeep
x102Symbolnotdefined:<symbol>
x103
x104Nofilenamespecified.
x105OutofMemory
Thisisafatalerror.Withthe8086-versionofjwasm,JWASMR,you'llseethiserrorifyoutrytoassemblesomethingthatcontainsafewthousandsymbols.The32-or64-bitversionsofjwasmshouldalwayshave
enoughmemoryonmodernmachines.
x106Cannotopenfile:"<file>"[<errorcode>]
ErrorcodeENOENTmeans"filenotfound".Othererrorcodesaredisplayedasnumbers
x107Cannotclosefile:<file>[<errorcode>]
x108Filewriteerror:<file>[<errorcode>]
Usuallyhappensifoutputmediaisread-onlyorfull.
x109Invalidcommand-lineoption:<option>
x110Internalerrorin<sourcefile>(<line>)
Thiserrorshouldn'tbeseeninthereleaseversion.It'sdisplayediftheinternalassert()functioniscalled,whichusuallyisdonewhena"virtuallyimpossible"errorconditionhasoccurred.
x111 Expectingclosingsquarebracket
x112 Expectingfilename
x113 Toomanyerrors Usecommandlineoption-etosetthemax.numberoferrorsthataredisplayed
x114 forcederror<message> Generic"forcederror"message
x115forcederror:Valuenotequalto0:<value><text>
Erroremittedbythe.ERRNZdirective.
x116forcederror:Valueequalto0:<value><text>
Erroremittedbythe.ERREdirective.
x117forcederror:symboldefined:<symbol>
Erroremittedbythe.ERRDEFdirective.
forcederror:symbolnot
x118 defined:<symbol>
Erroremittedbythe.ERRNDEFdirective.
x119forcederror:stringblank:<string>
Erroremittedbythe.ERRBdirective.
x120forcederror:stringnotblank:<string>
Erroremittedbythe.ERRNBdirective.
x121
forcederror:stringsnotequal:<string>:<string>
Erroremittedbythe.ERRDIFand.ERRDIFIdirectives.
x122
forcederror:stringsequal:<string>:<string>
Erroremittedbythe.ERRIDNand.ERRIDNIdirectives.
x123 <file>(<line>):IncludedbyAdditionalerrorinformationiferroroccuredinanincludefile.
x124<file>(<line>)[<macro>]:Macrocalledfrom
Additionalerrorinformationiferroroccuredinsideamacro.
x125
<file>(<line>):iteration<iteration>:Macrocalledfrom
Additionalerrorinformationiferroroccuredinsidealoopmacro(FOR,FORC,REPEAT,...).
x126 <file>(<line>):MainlinecodeAdditionalerrorinformationiferroroccuredinsideanincludefileoramacro.
x127 Extendingjump
x128Directiveignored:%s
x129 numbermustbeapowerof2
x130Incompatiblewithsegmentalignment:%s
x131 Segmentexpected:%s
x132IncompatibleCPUmodefor32-bitsegment
x133Farcallisconvertedtonearcall.
x134CPUoption%sisnotvalidforselectedCPU.
x135Segment'%s'isinanothergroupalready
x136 Symboltypeconflict:%s
x137Conflictingparameterdefinition:%s
x138
PROCandPROTOcallingconventionconflict
x139Non-benign%sredefinition:%s
x140 ToomanybitsinRECORD:%s
x141
Statementnotallowedinsidestructuredefinition
x142Unmatchedblocknesting:%s
x143 Symbolredefinition:%sx144 Textitemrequired
x145INVOKEargumenttypemismatch:argument%u
x146ToofewargumentstoINVOKE:%s
x147VARARGparametermustbelast
x148 LABELparametermustbefirst
x149Toomanyargumentsinmacrocall:%s
Thisisawarning.Macroisinvokedwithmoreargumentsthanexpected.
x150Missingoperatorinexpression
x151Unexpectedliteralfoundinexpression:%s
Literalsenclosedin<>or{}areitemsprocessedbythepreprocessorortoinitialize"structured"dataitems.Ifthey'reusedotherwise,thiserrorwilloccur.
x152Initializermustbeastringorsingleitem:%s
x153Toomanyinitialvaluesforstructure:%s
x154Toomanyinitialvaluesforarray:%s
x155 Stringortextliteraltoolong
x156PROLOGUEmustbemacrofunction
Theuser-definedprologuemacromustbeamacrofunction,thatis,theremustbeanEXITMsomewhereinsidethatreturnsaliteral.
x157EPILOGUEmustbemacroprocedure:%s
Theuser-definedepiloguemacromustbeamacroprocedure,thatis,theremustNOTbeanEXITMsomewhereinsidethatreturnsaliteral.
x158Reservedwordexpected
x159INVOKErequiresprototypeforprocedure
x160Invalidtypefordatadeclaration:%s
x161OperandmustbeRECORDtypeorfield
x162Unmatchedmacronesting
x163 Empty(null)string
x164Nosegmentinformationtocreatefixup:%s
x165RegistervalueoverwrittenbyINVOKE
x166Missingquotationmarkinstring
x167Dividebyzeroinexpressionx168GeneralFailure
x169
Cannothaveimplicitfarjumporcalltonearlabel
x170 Invaliduseofregister
x171Distanceinvalidforcurrentsegment
x172 Initializermagnitudetoolarge:%s
x173Cannotaddtworelocatablelabels
x174Cannotdefineaspublicorexternal:<symbol_name>
Textmacros,macros,stackvariables,structurefieldsorsegment/groupscannotbepublicorexternal.
x175 Positivevalueexpected
x176FARnotallowedinFLATmodelCOMMvariables
x177ToomanyargumentstoINVOKE
x178Directivemustappearinsideamacro
x179 Invalidtypeexpression
x180
CannotdeclarescopedcodelabelasPUBLIC:<label>
x181 Invalidradixtag
x182Instructionoperandmusthavesize
Theinstructionallowsoperandswithmorethanjustonesize,andthewantedsizecannotbeguessedfromthecurrentoperands.
x183UseofregisterassumedtoERROR
x184
Instructionsandinitializeddatanotsupportedin<seg_type>
<seg_type>maybeBSSorAT.Suchsegmentsdon'thavedata.
segments
x185 Literalexpectedafter'='
x186No4kPage-alignedsegmentsinMS386OMF
A4Kpage-alignedsegmentisn'tcompatiblewithMSOMFformat,it'saPharLabextension.Thiswarningwon'tappearinthestandardversion.
x187x188Operandmustbe
relocatable
x189Constantorrelocatablelabelexpected
x190
[ELSE]IF2/.ERR2notallowed,single-passassembler
x191ExpressiontoocomplexforUNTILCXZ
x192Operandsmustbeinsamesegment
x193Invaliduseofexternalsymbol:<symbol_name>
x194
For-coffleadingunderscorerequiredforstartlabel:<start_label>
x195Invalidcommand-linevalue,defaultisused:%s
x196
Unknownfixuptype:%uat<segment>.<offset>
x197Unsupportedfixuptypefor<format>:<type>
x198
Invalidfixuptypefor<format><type>atlocation<segment>.<offset>
x199Syntaxerrorincontrol-flowdirective
x200Invalid.modelparameterforflatmodel
x201
Outputformatdoesn'tsupportexternals:<symbol>
InformatsBINandMZallreferencesmustbelocaltothemodule.
x202 Invalidstartlabelfor-bin
x203Nostartlabeldefined
Warning,formatMZonly:MZ-binariesusuallyhaveastartlabel.Insomecases(i.e.overlays)amissingstartlabelmaybeok.
x204NostackdefinedWarning,formatMZonly:MZ-binariesusuallyhaveastack.Insomecases(i.e.overlays)amissingstackmaybeok.
x205Invalidalignment-valuemustbe2^n(n=4..15)
x206Indexvaluepastendofstring:<value>
TheindexargumentofSUBSTRorINSTRisbeyondthestringargumentlength
x207Countvaluetoolarge
x208Countmustbepositiveorzero
x209 Syntaxerror:<item>
Theparserfoundanitemthathasnomeaninginthecurrentcontext
x210x211
x212Mustusefloating-pointinitializer
x213ORGdirectivenotallowedinunions
x214Structalignmentmustbe1,2,4,8,16or32
x215 StructurecannotbeinstancedAstructurethathassize0orthatcontainsanORGdirectivecannotbeinstanced.
x216Missinganglebracketorbraceinliteral
x217Nondigitinnumber:<number>
x218 16bitfixupfor32bitlabel:%s
x219 ToomanymacroplaceholdersThenumberofparametersandlocalsforamacromustnotexceed256
x220Missingmacroargument:%s,parameter%u
x221Doesn'tworkwith32-bitsegments:<directive>
Directives.STARTUPand.EXITworkfor16-bitonly.
x222 Segmentexceeds64klimit:%s InMZformat,16-bitsegmentsarerestrictedto64k.
x223NotsupportedwithOMFformat:%s
Notsupported Thedirectiveorfeatureisn'tsupportedbyallformats.
x224withcurrentoutputformat:%s
Forexample,segment-relateddirectivesorattributeswon'tmakemuchsenseforflatformatslikeCOFForELF.
x225Unknowndefaultprologueargument:%s
x226 LOADDSignoredinflatmodel
x227Missingrightparenthesisinexpression
x228Invalidoperandfor<operator>:<operand>
x229Structureimproperlyinitialized:%s
x230 Expected:%s
x231 Invaliddatainitializer
x232 ExpecteddatalabelSomeoperators(LENGTH,SIZE)workwithdatalabelsonly.
x233 Expressionmustbeacodeaddress
x234-nOptionneedsavalidnameparameter
x235Constantvaluetoolarge:<value>thevalueoftheconstantdoesn'tfitin64or-ifitisanumbertobeassignedtoasymbolicconstant-32bits.
x236Textmacrowasusedbeforedefinition
thisisawarningonly.However,usingtextmacrosbeforetheyhavebeendefinedwillforceJWasmtodoafullsecondpass,whichincreasesassemblytime.
x237OffsetsizeincompatiblewithcurrentsegmentInstructionform
x238 requires80386
x239
Group/Segmentoffsetsizeconflict:<groupoffset>-<segmentoffset>
Segmentswithinagroupmustallhavethesameoffsetsize.
x240Assemblypassesreached:<passes>
Althoughthisisawarningonlyitusuallyindicatesasevereproblem.Theassemblerisveryprobablyunabletocalculate"final"valuesofalllabelsandhastobeterminatedbypressingCtrl-C.
x241
Filenameparametermustbeenclosedin<>orquotes
TheINCBINdirectiverequiresdelimitersforitsfilename.
x242
StartaddressonENDdirectiveignoredwith.STARTUP
x243
Invalidsymboltypeinexpression:<symbol>
Theexpressionevaluatorhasencounteredasymbolthatismeaninglessinexpressions,forexamplea(text)macro.
x244Missingrightparenthesis
x245Directivemustbeincontrolblock
.ELSE,.ELSEIFand.ENDIFarevalidinside.IF-blocks,.BREAK,.CONTINUEmayoccurinside.WHILE-or.REPEAT-blocks,.ENDWneedsapreceding.WHILEand.UNTILneedsapreceding.REPEAT.
x246 Expected:memorymodelthe.MODELdirectiveneedsatleastoneparameter,thememorymodel.
x247 Typeiswrongsizeforregister
x248IF[n]DEFexpectsaplainsymbolasargument
thisisawarning.Masmacceptsanyexpressionasargumentfordirectives[ELSE]IF[N]DEF,buttheresultprobablyisn'talwayswhathasbeenexpected.
x249Jumpdestinationmustspecifyalabel
x250 Ignored:<attribute>
Anattributeorparameterofadirectivewasfound,butnothandled.SeeKnownBugsandmissingFeaturesfordetailsaboutwhatfeaturesaren'timplementedyet.
x251Missingargumentforcmdlineoption
x252Invalidcoprocessorregister
x253
RegistersAH-DHmaynotbeusedwithSPL-DILorR8-R15
64-bitonly.
x254.ENDPROLOGfoundbeforeEHdirectives
64-bitonly.
x255
MissingFRAMEinPROC,nounwindcodewillbegenerated
64-bitonly.
x256Badalignmentforoffsetinunwindcode
64-bitonly.
x257Nonzerovalueexpected
x258Sizeofprologtoobig,mustbe<256bytes
64-bitonly.
x259Missing.ENDPROLOG:%s
64-bitonly.
x260.SAFESEHargumentmustbeaPROC
x261Directiveignoredwithout-%sswitch
x262
ELFGNUextensions(8/16-bitrelocations)used
Thisisawarningonly.Theextensionsarenot"official",buttheGNUlinkerLDwillunderstandthem.
x263 Syntaxerrorinexpression
x264Macrolabelnotdefined:%s
ThetargetofaGOTOmustbewithintheverysamemacro.
x265
Procedureargumentorlocalnotreferenced:%s
Thiswarningisdisplayedonlyifatleast-W3isspecified.
x266
Groupdefinitiontoolarge,truncated:<group_name>
ThesizeoftheOMFrecordthatistodefineagroupwouldexceed4kB.However,toseethiserroryou'llhavetodefineagroupthatistocomprisemorethan1000segments,
x267COMMvariableexceeds64K:<variable>
in16-bit,thesizeofaCOMMvariableisrestrictedto64kB.
x268Mustbepublicorexternal:%s
Namesthataretobeknownbythelinkermustbepublicorexternal.
x269parameter/localnameisreservedword:%s
Thisisawarning.Thenamesofmacroparametersorlocalshavehighestpriorityandhencethereservedwordwillbecomeinaccessiblewithinthemacro.
x270realorBCDnumbernotallowed
x271 structurefieldexpected
x272Constantvaluetoolarge:<value>thevalueoftheconstantdoesn'tfitin64or-ifitisanumbertobeassignedtoasymbolicconstant-32bits.
x273ELSEclausealreadyoccuredin AnIFblockmaycontain0or1ELSEclausesanditmustbethelastclausebeforeENDIF.
thisIFblock
x274 Illegaluseofsegmentregister
x275Groupexceeds64K:<group>
MZformatonly:agroupthatcontains16-bitsegmentscannotbelargerthan64kB,becausethegroupmustfitintoaphysicalsegment.
x276 EXPORTmustbeFAR:<symbol>A16-bitprocedurethatistobeexportedmustbedeclaredwiththeFARdistanceattribute.
AppendixD.DifferencesbetweenMasm6andMasm8ThisisnotstrictlyJWasm-related,butsincealotofdocumentationthatcanbefoundaboutMasmstillreferstoMasmv6orMasmv6.1only,it'susefultolistthedifferences.
defaultoutputformathasbeenchangedfromOMFtoCOFFinMasm8.expressionevaluatorcalculationsaredonein64-bitinsteadof32-bit.Thisisnotalwaysreflectedinthelistingfile,wherethevaluesmaybetruncatedto32-bit.somesegmentattributeshavebeenaddedinMasm8tocovertheCOFFsectionattributebits.Theseare:
INFODISCARDNOCACHENOPAGESHAREDEXECUTEREADWRITEALIASALIGN
the-safesehcommandlineoptionandthe.SAFESEHdirectivehavebeenaddedinMasm8.Masm8understandsafewnewdatatypes:
OWORD-128-bitintegerMMWORD-64-bitdatatypeforMMXXMMWORD-128-bitdatatypeforSSE
severalunaryoperatorsarenewforMasm8:LOW32-returnsthelower32-bitofanexpressionHIGH32-returnstheupper32-bitofanexpressionIMAGEREL-returnstheimagerelativeoffsetofanexpression(akaRVA).COFFformatonly.SECTIONREL-returnsthesectionrelativeoffsetofanexpression.
COFFformatonly.Pleasenote:LOW32andHIGH32operatorswon'tacceptplainnumberswithvaluesthatexceed32-bits.Masm8understandsinstructionsetsuptoSSE3.ThelastversionofMasm6,version6.15,supportsSSE2only.Masm8alsounderstandsIntel'sVMXandAMD'sSVMextensions(x86virtualization).Masm8needsatleastWindows2000,itwon'trunonWindows9x(withouthacks).Masm8needsaMSVCruntimedll-MSVCR80.DLL-torun,whileMasm6wasastand-alonebinary.Finally,Masm8fixessomebugsandintroducesafewnewones.OneofthenewbugsisthatMasm8hasproblemswithwildcardsinfilenames;entering
ml.exe-c*.asm
toassembleallassemblyfilesinadirectorywon'tworkasexpected.
AppendixE.Restrictionsofprecompiled16-bitBinaryJWASMR.EXEJWASMRlackssomefeaturesoftheotherprecompiledbinaries:
nosupportforlongfilenames.nosupportforOpenWatcom'sfastcallregisterconvention.supportsOMF,BINandMZoutputformatsonly.nosupportfor64-bit,SSSE3,SSE4andAVX.nosupportforOPTIONvariantsthatarespecificforCOFF,ELFor64-bit.nosupportforOPTIONCODEVIEWdirective.nosupportfordirectiveLABEL'sarraysizesyntaxextension.
SincetheJWasmsourceisavailable,onemayenablethisorthatfeatureifreallyneeded,though.
AppendixF.AdditionalFeaturesofJWasm'sDebugVersionNote:therearenoprecompileddebugversionsofJWasmavailable.Suchversionshavetobecreatedfromthesourcecode.Seethecommentsinthemakefileshowtodothat.
Thedebugversionoffersthefollowingadditionalcommandlineoptions:-af Displayallfilesusedinassemblyprocess-ce Causeanexception-dm Displayallmessages-dr Displayreservedwords-drh Displayreservedwordshashtable-ds Displayglobalsymbols-dsh Displayglobalsymbolshashtable-dt Displaydebugtrace-ls Displaypreprocessedlinestorage-nbp Disableback-patching-nfp Dofullsubsequentpasses(disables"fastpass")-pm=<n> Stopassemblyafternpasses-sp Skippreprocessorstep
AsmcMacroAssemblerReference
OPTIONCSTACK
OPTIONCSTACK:[ON|OFF]
TheCSTACKoptioncontrolthestack-framecreationbyinvoke.ThedefaultsettingisOFF.
Example
OPTIONCSTACK:ON
cstackPROCUSESesiediebxarg
sub esp,arg
ret
cstackENDP
OPTIONCSTACK:OFF
astackPROCUSESesiediebxarg
sub esp,arg
ret
astackENDP
Generatedcode
cstackPROCUSESesiediebxarg
push esi
push edi
push ebx
push ebp
mov ebp,esp
sub esp,arg
leave
pop ebx
pop edi
pop esi
retn 4
cstackENDP
OPTIONCSTACK:OFF
astackPROCUSESesiediebxarg
push ebp
mov ebp,esp
push esi
push edi
push ebx
sub esp,arg
pop ebx
pop edi
pop esi
leave
retn4
astackENDP
SeeAlso
DirectivesReference
AsmcMacroAssemblerReference
OPTIONSWITCH
OPTIONSWITCH:[C|PASCAL|TABLE|NOTABLE|NOREGS|REGAX|NOTEST]
Theswitchcomesintwomaintypes:astructuredswitch(Pascal)oranunstructuredswitch(C).Thedefaulttypeisunstructured.
TheTABLEandNOTABLEoptionscontrolthejump-tablecreationintheswitch.ThedefaultsettingisNOTABLE.
TheNOREGSandREGAXoptionscontroltheusageofregistersinjump-tablecreationintheswitch.ThedefaultsettingisNOREGS.
TheNOTESToptionisshortlivedandskipstherange-testinthejumpcode.Theoptionisturnedoffafterusage.
SeeAlso
DirectivesReference
AsmcMacroAssemblerReference
OPTIONWSTRING
OPTIONWSTRING:[ON|OFF]
Thistogglesascii/unicodestringcreationof"quotedstrings".
Unicodestringsmaybeusedinthe@CStr()macro,infunctioncalls,ordeclearedusing:
DW"string",0
ThedefaultvalueisOFF.Thecommand-lineswitch/wsturnsthisoptionON.
SeeAlso
DirectivesReference
AsmcFatalErrorMessages
A1000cannotopenfile:filenameA1001I/Oerrorclosingfile:filenameA1002I/Oerrorwritingfile:filenameA1005assemblerlimit:macroparameternametablefullA1006invalidcommand-lineoption:optionA1007nestingleveltoodeepA1008unmatchedmacronestingA1009linetoolongA1010unmatchedblocknesting:A1011directivemustbeincontrolblockA1012errorcountexceeds100;stoppingassemblyA1017missingsourcefilenameA1901InternalAssemblerError
SeeAlso
AsmcErrorMessages
ASMCNonfatalErrorMessages
MLcompatibleerrors
MLNonfatalErrorA2004MLNonfatalErrorA2005MLNonfatalErrorA2006MLNonfatalErrorA2007MLNonfatalErrorA2008MLNonfatalErrorA2009MLNonfatalErrorA2010MLNonfatalErrorA2011MLNonfatalErrorA2012MLNonfatalErrorA2013MLNonfatalErrorA2014MLNonfatalErrorA2015MLNonfatalErrorA2016MLNonfatalErrorA2018MLNonfatalErrorA2019MLNonfatalErrorA2022MLNonfatalErrorA2023MLNonfatalErrorA2024MLNonfatalErrorA2025MLNonfatalErrorA2026MLNonfatalErrorA2028MLNonfatalErrorA2029MLNonfatalErrorA2030MLNonfatalErrorA2031MLNonfatalErrorA2032MLNonfatalErrorA2033MLNonfatalErrorA2034MLNonfatalErrorA2036MLNonfatalErrorA2037MLNonfatalErrorA2039MLNonfatalErrorA2041MLNonfatalErrorA2043MLNonfatalErrorA2045
MLNonfatalErrorA2046MLNonfatalErrorA2047MLNonfatalErrorA2048MLNonfatalErrorA2050MLNonfatalErrorA2051MLNonfatalErrorA2052MLNonfatalErrorA2053MLNonfatalErrorA2054MLNonfatalErrorA2055MLNonfatalErrorA2056MLNonfatalErrorA2057MLNonfatalErrorA2058MLNonfatalErrorA2059MLNonfatalErrorA2060MLNonfatalErrorA2061MLNonfatalErrorA2062MLNonfatalErrorA2063MLNonfatalErrorA2064MLNonfatalErrorA2065MLNonfatalErrorA2066MLNonfatalErrorA2068MLNonfatalErrorA2070MLNonfatalErrorA2071MLNonfatalErrorA2072MLNonfatalErrorA2074MLNonfatalErrorA2075MLNonfatalErrorA2076MLNonfatalErrorA2077MLNonfatalErrorA2079MLNonfatalErrorA2080MLNonfatalErrorA2081MLNonfatalErrorA2082MLNonfatalErrorA2083MLNonfatalErrorA2084MLNonfatalErrorA2085MLNonfatalErrorA2086MLNonfatalErrorA2087MLNonfatalErrorA2088MLNonfatalErrorA2089
MLNonfatalErrorA2090MLNonfatalErrorA2091MLNonfatalErrorA2092MLNonfatalErrorA2093MLNonfatalErrorA2094MLNonfatalErrorA2095MLNonfatalErrorA2096MLNonfatalErrorA2097MLNonfatalErrorA2098MLNonfatalErrorA2100MLNonfatalErrorA2101MLNonfatalErrorA2103MLNonfatalErrorA2104MLNonfatalErrorA2105MLNonfatalErrorA2107MLNonfatalErrorA2108MLNonfatalErrorA2110MLNonfatalErrorA2111MLNonfatalErrorA2112MLNonfatalErrorA2113MLNonfatalErrorA2114MLNonfatalErrorA2119MLNonfatalErrorA2120MLNonfatalErrorA2121MLNonfatalErrorA2123MLNonfatalErrorA2125MLNonfatalErrorA2129MLNonfatalErrorA2131MLNonfatalErrorA2132MLNonfatalErrorA2133MLNonfatalErrorA2136MLNonfatalErrorA2141MLNonfatalErrorA2142MLNonfatalErrorA2143MLNonfatalErrorA2144MLNonfatalErrorA2145MLNonfatalErrorA2147MLNonfatalErrorA2148MLNonfatalErrorA2151
MLNonfatalErrorA2154MLNonfatalErrorA2156MLNonfatalErrorA2157MLNonfatalErrorA2159MLNonfatalErrorA2166MLNonfatalErrorA2167MLNonfatalErrorA2169MLNonfatalErrorA2170MLNonfatalErrorA2172MLNonfatalErrorA2175MLNonfatalErrorA2178MLNonfatalErrorA2179MLNonfatalErrorA2181MLNonfatalErrorA2187MLNonfatalErrorA2189MLNonfatalErrorA2190MLNonfatalErrorA2199MLNonfatalErrorA2200MLNonfatalErrorA2202MLNonfatalErrorA2206MLNonfatalErrorA2214MLNonfatalErrorA2217
NonMLcompatibleerrors
ASMCNonfatalErrorA3000ASMCNonfatalErrorA3001ASMCNonfatalErrorA3002ASMCNonfatalErrorA3003ASMCNonfatalErrorA3004ASMCNonfatalErrorA3005ASMCNonfatalErrorA3006ASMCNonfatalErrorA3007ASMCNonfatalErrorA3008ASMCNonfatalErrorA3009ASMCNonfatalErrorA3010ASMCNonfatalErrorA3011ASMCNonfatalErrorA3012ASMCNonfatalErrorA3013
ASMCNonfatalErrorA3014ASMCNonfatalErrorA3015ASMCNonfatalErrorA3016ASMCNonfatalErrorA3017ASMCNonfatalErrorA3018ASMCNonfatalErrorA3019ASMCNonfatalErrorA3020ASMCNonfatalErrorA3021ASMCNonfatalErrorA3022
SeeAlso
AsmcErrorMessages
ASMCWarningMessages
MLcompatiblewarnings
MLWarningA4003MLWarningA4005MLWarningA4006MLWarningA4007MLWarningA4008MLWarningA4011MLWarningA4012MLWarningA4910
MLcompatiblelevel3warnings
MLWarningA6003MLWarningA6004MLWarningA6005
NonMLcompatiblewarnings
ASMCWarningA8000ASMCWarningA8001ASMCWarningA8002ASMCWarningA8003ASMCWarningA8004ASMCWarningA8005ASMCWarningA8006ASMCWarningA8007ASMCWarningA8008ASMCWarningA8009ASMCWarningA8010ASMCWarningA8011ASMCWarningA8012ASMCWarningA8013ASMCWarningA8014ASMCWarningA8015ASMCWarningA8017
ASMCWarningA8018ASMCWarningA8019ASMCWarningA8020
NonMLcompatiblelevel3warnings
ASMCWarningA7000ASMCWarningA7001ASMCWarningA7002ASMCWarningA7003ASMCWarningA7004ASMCWarningA7005ASMCWarningA7006ASMCWarningA7007ASMCWarningA7008
SeeAlso
AsmcErrorMessages
Parsingoflabels
Allexpansionsarepre-processedbytheassemblerandthismayexpandmacrosandotherdirectivesbeforelabels.Ifamacroisaddedatthesamelineasalabelthismayfail.
Example
foo macro reg
bswap reg
exitm <reg>
endm
do: mov eax,foo(eax)
...
mov ecx,"3210"
jmp do
Asaresultthecodeproducedbythemacrowillbeexpandedabovethelabelandthusthejumpwillfail.
bswap ecx
do: mov eax,ecx
...
Asmcwillexpandthelinelefttorightinthiscase.
SeeAlso
AsmcExtensions
Expansionofmacros
ThelabelissuebecomesaproblemintheHLLsectionwherelabelsarecreatedlater:
.WHILE macro(...)
AsmcwillforthisreasondelayexpansionofmacrosinsomeoftheHLLdirectivesuntillabelsarecreated.Thisinclude.WHILE,.ELSEIF,and.CASE.
SeeAlso
AsmcExtensions
Theinvokedirective
InAsmcamacroishandledatthesamelevelasaprocedure.Theheaderfilemaythencontroltheexpansion:
ifdef__INLINE__
strlen macrostring
...
endm
else
strlen proto:dword
endif
Thisisachievedbysimplyexcludinginvokeasapposetoallowinvocationsofmacros.
strlen(esi)
Asmcseesthecombinationofaprocedurefollowedbyanopenbracketasinvoke.Emptybracketswillbegivenspecialhandlingifthetokeninfrontisnotamacro.
plabel proto
extern elabel:dword
.data
dlabel labeldword
.code
clabel:
call ax
call eax
call plabel
call elabel
call dlabel
call clabel
call xlabel
ax()
eax()
plabel()
elabel()
dlabel()
clabel()
xlabel()
xlabel:
Thissimplesolutionavoidsbreakinganyexistingcodewithafewexceptions:Masmallowsbracketstoaccessmemory.
.ifedx<foo(1)
;MASM:cmpedx,foo+1
;ASMC:invokefoo,1:cmpedx,eax
Sosquarebracketsshouldbeusedforaccessingmemoryandroundbracketstoexecute.However,anerrormustthenbeissuedifAsmcextensionsareturnedoffandlabelsareaccessedusingroundbracketstoensurecompatibility.
TheinsideofbracketsmayberecursiveusedatanylengthincludingC-strings.However,thereturncodeforaprocedureis[R|E]AXsothereisalimitwithregardstoOR/ANDtestingofnestedfunctions.
.iffoo(bar(1),2)==TRUE
SeeAlso
AsmcExtensions
AsmcMacroAssemblerReference
TheHLLsection
Asmcextensionsareallowedinthefollowingconditionalcontrolflowdirectives:
.IFexpression
.ELSEIFexpression
.UNTILexpression
.WHILEexpression
.BREAK.IFexpression
.CONTINUE.IFexpression
.SWITCHproc(...)
.CASEexpression
.ENDC.IFexpression
.ASSERTexpression
SeeAlso
AsmcExtensions
Handlingofstrings
Given"quotedstrings"maybeusedasarguments,oringeneralasaconstvalue,C-stringsarelimitedtobeusedinsidebracketsofaprocedure.
.iffopen("readme.txt","rt")
SeeAlso
AsmcExtensions|SymbolsReference
Enhancedvectorextension
Fromversion2.26AsmcsupporttheIntelAVX-512instructionset.
Thisincludes12new128-bitregisters(XMM16toXMM31),12new256-bitregisters(YMM16toYMM31),32new512-bitregisters(ZMM0toZMM31),and8newopmaskregisters(K0toK7).
TheEVEXencodingprefixwillbeomittedbyusinganEVEXexclusiveinstructionoranyoftheextendedSIMDregisters.Aprecedingprefix({evex})maybeusedforEVEXencodingofotherinstructions.
vcomisdxmm0,xmm1;normal
vcomisdxmm0,xmm16;prefix(auto)
{evex}vcomisdxmm0,xmm1;prefix
SeeAlso
AsmcExtensions|InstructionSets
AsmcMacroAssemblerReference
OPTIONASMC
OPTIONASMC:[ON|OFF|0..255]
ThiscontrolsthemainextensionofAsmc.ThedefaultvalueisON.Thecommand-lineswitch/XcturnsthisoptionOFF.
SeeAlso
DirectivesReference
AsmcMacroAssemblerReference
OPTIONLOOPALIGN
OPTIONLOOPALIGN:[0|2|4|8|16]
Thiscontrolsthealignmentfor.WHILEand.REPEATlabels.Thedefaultvalueis0.
jmploop_start
* ALIGN<loopalign>;alignlabelafterjump
loop_label:
SeeAlso
DirectivesReference
AsmcMacroAssemblerReference
OPTIONCASEALIGN
OPTIONCASEALIGN:[0|2|4|8|16]
Thiscontrolsthealignmentfor.CASElabels.Thedefaultvalueis0.
* ALIGN<casealign>;alignlabelafterjump
case:
SeeAlso
DirectivesReference
.IF
.IFcondition1
statements
[[.ELSEIFcondition2
statements]]
[[.ELSE
statements]]
.ENDIF
Generatescodethattestscondition1(forexample,AX>7)andexecutesthestatementsifthatconditionistrue.Ifa.ELSEfollows,itsstatementsareexecutediftheoriginalconditionwasfalse.Notethattheconditionsareevaluatedatruntime.
SeeAlso
DirectivesReference|Flagconditions|Signedcompare|Returncode
.WHILE
.WHILEcondition
statements
.ENDW
Generatescodethatexecutestheblockofstatementswhileconditionremainstrue.
SeeAlso
DirectivesReference|Flagconditions|Signedcompare|Returncode
AsmcMacroAssemblerReference
.REPEAT
.REPEAT
statements
.UNTILcondition
Generatescodethatrepeatsexecutionoftheblockofstatementsuntilconditionbecomestrue..UNTILCXZ,whichbecomestruewhenCXiszero,maybesubstitutedfor.UNTIL.Theconditionisoptionalwith.UNTILCXZ.
SeeAlso
DirectivesReference|Signedcompare|Returncode
AsmcMacroAssemblerReference
.UNTILCXZ
See.REPEAT
SeeAlso
DirectivesReference,.UNTILAXZ,.UNTILBXZ,.UNTILDXZ
.BREAK
.BREAK(n)[[.IFcondition]]
Generatescodetoterminatea.WHILEor.REPEATblockifconditionistrue.
BREAK[(n)]isoptionalnestingleveltoterminate.
.while1
.break;break.while1
.while2
.break(1);break.while1
.while3
.break(2);break.while1
.while4
.break(3);break.while1
.break(2);break.while2
.break(1);break.while3
.endw
.endw
.endw
.endw
SeeAlso
DirectivesReference|.CONTINUE
.CONTINUE
.CONTINUE[([0]1..n)][[.IFcondition]]
Generatescodetojumptothetopofa.WHILEor.REPEATblockifconditionistrue.
.CONTINUE[(1..n)]isoptionalnestingleveltocontinue.
.while1
.continue;continue.while1
.while2
.continue(1);continue.while1
.while3
.continue(2);continue.while1
.while4
.continue(3);continue.while1
.continue(2);continue.while2
.continue(1);continue.while3
.endw
.endw
.endw
.endw
.CONTINUE[(0[1..n])]jump'sdirectlytoSTARTlabel:noTEST.
.while1
.continue(0);JumptoSTARTlabel
.continue;JumptoSTARTlabel
.endw
.whileeax
.continue(0);JumptoSTARTlabel
.continue;JumptoTESTlabel
.endw
.repeat
.continue(0);JumptoSTARTlabel
.continue;JumptoEXITlabel
.break;JumptoEXITlabel
.until1
SeeAlso
.FOR
.FOR[S][initialization]:[condition]:[increment/decrement]
statements
.ENDF
Generatescodethatexecutestheblockofstatementswhileconditionremainstrue.
SeeAlso
DirectivesReference|Flagconditions|Signedcompare|.ENDF
.SWITCH
Theswitchcomesinthreemainvariants:astructuredswitch,asinPascal,whichtakesexactlyonebranch,anunstructuredswitch,asinC,whichfunctionsasatypeofgoto,andacontroltableswitchwiththeaddedpossibilityoftestingforcombinationsofinputvalues,usingbooleanstyleAND/ORconditions,andpotentiallycallingsubroutinesinsteadofjustasinglesetofvalues.
Thecontroltableswitchisdeclaredwithnoargumentsandeach.CASEdirectivedoesallthetesting.
.switch
.casestrchr(esi,'<')
.casestrchr(esi,'>')
jmparound
...
.endsw
TheunstructuredswitchworksasaregularCswitchwhereeach.CASEdirectiveisjustalabel.
.switcheax
.case0:.repeat:movsb
.case7:movsb
.case6:movsb
.case5:movsb
.case4:movsb
.case3:movsb
.case2:movsb
.case1:movsb:.untilcxz
.endsw
ThestructuredswitchworksasaregularPascalswitchwhereeach.CASEdirectiveisaclosedbranch.
.switcheax
.case1:printf("Goldmedal")
.case2:printf("Silvermedal")
.case3:printf("Bronzemedal")
.default
printf("Betterlucknexttime")
.endsw
.CASE
Caseopensacasestatement.Thecasestatementcomparesthevalueofanordinalexpressiontoeachselector,whichcanbeaconstant,asubrange,oralistofthemseparatedbycommas.
TheselectorfieldisseparatedfromactionfieldbyColonoranewline.
.CASE1:movax,2:.ENDC
.CASE2
movax,3
.ENDC
.CASEal
.CASE0,1,4,7
.CASE0..9
Inthecontroltableswitch.CASEisequalto.IF:
.CASEal
.CASEax<=2&&!bx
SeeAlso
.SWITCH|.ENDC|.DEFAULT|.ENDSW
.ENDC
.ENDCclosesa.CASEstatement.
ThenamewasseparatedfromBREAKtohavemoreflexibilitywithregardstocontrolflowofloops.However,ENDChavethesamequalitiesasBREAKandthuscanbeusedincombinationwith.IF:
.ENDC.IFal==2
SeeAlso
.SWITCH|.CASE|.DEFAULT|.GOTOSW|.ENDSW
.GOTOSW
.GOTOSW[1|2|3][[(<case_val>)]|[.IFcondition]]
Generatescodetojumptothetopofa.SWITCHblockifconditionistrue.
.GOTOSWjump'sdirectlytotheTESTlabel.
.switchal
.case1
...
.case9
moval,1
.gotosw ;"Jump"tocase1
GOTOSW[1|2|3]isoptionalnestingleveltocontinue.
.switchal
.case1
.gotosw ;continue.switchal
.switchbl
.case1
.gotosw1 ;continue.switchal
.switchcl
.case1
.gotosw2 ;continue.switchal
.switchdl
.case1
.gotosw3;continue.switchal
.gotosw2;continue.switchbl
.gotosw1;continue.switchcl
;
;Directjumpto.switchcl/case1
;
.gotosw1(1)
.endsw
.endsw
.endsw
.endsw
GOTOSWcanbeusedincombinationwith.IFcondition,oradirectjumpto.GOTOSW(<case_val>).
.DEFAULT
.DEFAULTexecuteswhennoneoftheothercasesmatchthecontrolexpression.
SeeAlso
.SWITCH|.CASE|.ENDC|.ENDSW
.COMDEF
.COMDEFname
DeclaresastructuretypeforaCOMinterfacebasedontheComponentObjectModelintroducedbyMicrosoftin1993.
AtypicalCdeclarationforaCOMinterface:
typedefstructIShellFolderVtbl{
BEGIN_INTERFACE
HRESULT(STDMETHODCALLTYPE*QueryInterface)(
IShellFolder*_This,REFIIDriid,void**ppvObject);
...
END_INTERFACE
}IShellFolderVtbl;
interfaceIShellFolder{
CONST_VTBLstructIShellFolderVtbl*lpVtbl;
};
Sameusing.COMDEF:
.comdefIShellFolder
QueryInterfaceproc:REFIID,:ptr
...
.ends
TheobjectsarenormallyinstantiatedwithaCreateInstance()functionthattakestheclassasargumentandweendupwithapointerorjustAX.Thecalltothemethodisthensomethinglikethis:
movrcx,rax;loadargs
movrdx,riid
movr8,ppvObject
movrax,[rcx];makethecall
call[rax].IShellFolderVtbl.QueryInterface
Theassemblerneedstoknowthenameofthebaseclassinordertousethesemethods.Ifthemethodnameisnotfoundinthebaseclass,'Vtbl'isaddedtotheclassname.IfmethodexistinclassVtblthepointerisassumedtobethefirstmemberofthebase(lpVtbl).
locals:IShellFolder
s.QueryInterface(riid,ppvObject)
*learcx,s
localp:ptrIShellFolder
p.QueryInterface(riid,ppvObject)
*movrcx,p
assumerbx:ptrIShellFolder
[rbx].QueryInterface(riid,ppvObject)
*movrcx,rbx
IfPROCisusedinsideastructure(normallyanerror)Asmcassumesthistobeapointertoafunction.
*T$0001typedefprotoWINAPI:REFIID,:ptr
*P$0001typedefptrT$0001
*QueryInterfaceP$0001?
Thefirstmethodclosethebaseclassandopen(inthiscase)theIShellFolderVtblstructureand.ENDSwillthenclosethecurrentstruct.
.ends
*IShellFolderVtblends
SeeAlso
.ENDS|.CLASSDEF
.CLASSDEF
.CLASSDEFname[args]
DeclaresastructuretypeforaCOMinterface.
.CLASSDEFaddsthefollowingtypes:
.classdefClass
*LPCLASStypedefptrClass
*LPCLASSVtbltypedefptrClassVtbl
*Class@Classproto:ptrClass
*Classstruct8
*lpVtblLPCLASSVtbl?
Release()isaddedasthefirstmethod:
Method1proclocal;static
Method2proc:ptr;firstvirtualfunction
*Classends
*ClassVtblstruct
*T$000Btypedefproto:ptrClass
*P$000BtypedefptrT$000B
*ReleaseP$000B?
*T$000Btypedefproto:ptrClass
*P$000BtypedefptrT$000B
*Method2P$000B?
TodefineamethodlocallyinthebaseclassthekeywordLOCALmaybeused.Locallydefinedfunctionsarecalleddirectlywithoutthe_thisargumentomitted.
assumercx:LPCLASS
fooproc
localp:LPCLASS
[rcx].Method1()
[rcx].Method2(rdx)
[rcx].Release()
ret
fooendp
Codeproduced:
0:55pushrbp
1:488becmovrbp,rsp
4:4883ec30subrsp,0x30
8:ff5110callQWORDPTR[rcx+0x10]
b:488b01movrax,QWORDPTR[rcx]
e:ff5008callQWORDPTR[rax+0x8]
11:488b01movrax,QWORDPTR[rcx]
14:ff10callQWORDPTR[rax]
16:c9leave
17:c3ret
SeeAlso
.ENDS|.COMDEF
.ASSERT
.ASSERT[D|W|B]<assert_expression>
.ASSERT:[<handler>|ON|OFF|PUSH|POP|PUSHF|POPF|CODE|ENDS]
Options
ON/OFF Mainswitch.
PUSH/POP SaveandrestoretheASMCflag.Stacklevelis128.
PUSHF/POPF TogglesusingPUSHF[D|Q]beforecallinghandler.
CODE/ENDS AssemblecodesectionifASSERTisON.
HandlerTheassertmacrocallsthisroutineifexpressionisnottrue.Thedefaulthandlernameisassert_exit.
SeeAlso
DirectivesReference|.IF|Returncode
Flagconditions
Theoptionslistedmaybeusedasdirective.IFxx,.WHILExx,and.UNTILxx.
xxA NBE Above|NotBeloworEqualB C/NAE Below|Carry|NotAboveorEqualG NLE Greater|NotLessorEqual(signed)L NGE Less|NotGreaterorEqual(signed)O Overflow(signed)P PE Parity|ParityEvenS Signed(signed)Z E Zero|EqualNA BE NotAbove|NotBeloworEqualNB NC/AE NotBelow|NotCarry|AboveorEqualNG LE NotGreater|LessorEqual(signed)NL GE NotLess|GreaterorEqual(signed)NO NotOverflow(signed)NP PO NoParity|ParityOddNS NotSigned(signed)NZ NE NotZero|NotEqual
Notethatifusedwithconditionthedirectivemayhaveadifferentmeaning.
SeeAlso
DirectivesReference|Signedcompare|Returncode
Signedcompare
Flipstheexpressiontosignedifthefirstoperandisaregister.
.IFSx,.WHILESx,and.UNTILSx<expression>.
xx
S SignedREGSB SignedALSW SignedAXSD SignedEAX
SeeAlso
DirectivesReference|Flagconditions|Returncode
Returncode
Setssizefromafunctioncalltoxx.
.IFxx,.WHILExx,.UNTILxx,and.ASSERTx<expression>.
xx
B BYTEW WORDD DWORDSB SBYTESW SWORDSD SDWORD
SeeAlso
DirectivesReference|Flagconditions|Signedcompare
@CStr
@CStr(string)
Macrofunctionthatcreatesastringinthe.DATAsegment.ThemacroacceptsC-escapecharactersinthestring.Stringsareaddedtoastackandreusedifduplicatedstringsarefound.Themacroreturnsoffsetstring.
Example
mov eax,@CStr("\tCreatea\"C\"string:%s%d\n")
mov ebx,@CStr("string:%s%d\n")
mov ecx,@CStr("%s%d\n")
mov edx,@CStr("%d\n")
mov edi,@CStr("\n")
Generatedcode
.data
DS0000db9,"Createa",'"',"C",'"',"string:%s%d",10,0
.code
mov eax,offsetDS0000
mov ebx,offsetDS0000[14]
mov ecx,offsetDS0000[22]
mov edx,offsetDS0000[24]
mov edi,offsetDS0000[26]
SeeAlso
SymbolsReference
6.2.1Win64StructuredExceptionHandling(SEH)SEHinWin64differssignificantlyfromtheimplementationinWin32.It'sverywellpossibletoignoreWin64SEHforassembly.However,ifanassemblyroutinewantstocomplytotheserules,athoroughunderstandingoftheWin64ABIisnecessary.Masm(the64-bitversion)suppliessome"primitives"forSEHsupport(.ALLOCSTACK,.PUSHREG,.SAVEREG,...),alongwithanewFRAMEattributeforthePROCdirective.ThesefeaturesarealsosupportedbyJWasm.SeesampleWin64_3howthe"primitives"aretobeusedforSEHsupport.
ThebigdisadvantageisthatusingtheFRAMEkeywordinMasm"disables"mostoftheotherhighlevelfeaturescombinedwithPROC(functionparameters,localsandregisterssavedwithUSES)becausenofunctionprologuesandepiloguesaregeneratedanymore.Additionally,theimplementationinsomeMasmversionsseemstobeabitbuggy.BecauseofthisandtoeasetheusageofSEHinWin64thereisanewdirectiveimplementedinJWasm:
OPTIONFRAME:AUTO
Ifthisoptionisset,JWasmwillcreateWin64SEH-compatibleprologuesandepilogues.Iftheoptionisoff,JWasmwillbehaveMasm-compatible,thatis,FRAMEfoundinaPROCdirectivewilldisableautomaticprologue/epiloguegeneration.SeesampleWin64_3ehowthisoptionissupposedtobeused.
AsforthePROCsyntax:TheMasmdocumentationstatesthatFRAMEcanbeusedincombinationwithUSESandprocedureparametersandmustbelocatedbehindallparameters.However,thissyntaxisn'tacceptedbyanyMasmversion.TheonlysyntaxwhichMasmwillacceptwithoutbeingconfusedisFRAMEastheoneandonlyparameterforPROC.ThereforeJWasmdoesn'tfollowtheMasmdocumentationinthispoint:theoptionalFRAMEkeywordisexpected*before*theprocedureparameters.ThesyntaxinJWasmis:
procnamePROC[public]FRAME[:exc_handler][USES<reglist>][parameters]
TheSEH"primitives"willgeneratesomeadditionaldatainsegments.pdataand.xdata.Thisdataissomewhathidden,butJWasmwilldisplaythecorrespondingdatadefinitionsinthelistingifoption-Sgisset.
ASMCFatalErrorA1000
cannotopenfile:filename
Thefiledoesnotexist.Thefileisinusebyanotherprocess.Thefilenameisnotvalid.Aread-onlyfilewiththeoutputfilenamealreadyexists.Thecurrentdriveisfull.Thecurrentdirectoryistherootandisfull.Thedevicecannotbewrittento.Thedriveisnotready.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1001
I/Oerrorclosingfile
Theoperatingsystemreturnedanerrorwhentheassemblerattemptedtocloseafile.Thiserrorcanbecausedbyhavingacorruptfilesystemorbyremovingadiskbeforethefilecouldbeclosed.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1002
I/Oerrorwritingfile
Theassemblerwasunabletowritetoanoutputfile.Oneofthefollowingmaybeacause:
Thecurrentdriveisfull.Thecurrentdirectoryistherootandisfull.Thedevicecannotbewrittento.Thedriveisnotready.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1005
Assemblerlimit:macroparameternametablefull
Toomanyparameters,locals,ormacrolabelsweredefinedforamacro.Therewasnomoreroominthemacronametable.
Defineshorterorfewernames,orremoveunnecessarymacros.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1006
Invalidcommand-lineoption:option
ASMCdidnotrecognizethegivenparameterasanoption.Thiserrorisgenerallycausedwhenthereisasyntaxerroronthecommandline.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1007
Nestingleveltoodeep
Theassemblerreacheditsnestinglimit.Thelimitis20levelsexceptwherenotedotherwise.
Oneofthefollowingwasnestedtoodeeply:
Ahigh-leveldirectivesuchas.IF,.REPEAT,or.WHILEAstructuredefinitionAconditional-assemblydirectiveAproceduredefinitionAPUSHCONTEXTdirective(thelimitis10).AsegmentdefinitionAnincludefileAmacro
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1008
Unmatchedmacronesting
Eitheramacrowasnotterminatedbeforetheendofthefile,ortheterminatingdirectiveENDMwasfoundoutsideofamacroblock.Onecauseofthiserrorisomissionofthedotbefore.REPEATor.WHILE.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1009
Linetoolong
Alineinasourcefileexceededthelimitof1024characters.
Ifmultiplephysicallinesareconcatenatedwiththeline-continuationcharacter(\),theresultinglogicallineisstilllimitedto1024characters.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1010
Unmatchedblocknesting:
Ablockbeginningdidnothaveamatchingend,orablockenddidnothaveamatchingbeginning.Oneofthefollowingmaybeinvolved:
Ahigh-leveldirectivesuchas.IF,.REPEAT,or.WHILEAconditional-assemblydirectivesuchasIF,REPEAT,orWHILEAstructureoruniondefinitionAproceduredefinitionAsegmentdefinitionAPOPCONTEXTdirectiveAconditional-assemblydirective,suchasanELSE,ELSEIF,orENDIFwithoutamatchingIF
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1011
Directivemustbeincontrolblock
Theassemblerfoundahigh-leveldirectivewhereonewasnotexpected.Oneofthefollowingdirectiveswasfound:
.ELSEwithout.IF
.ENDIFwithout.IF
.ENDWwithout.WHILE
.UNTIL[[CXZ]]without.REPEAT
.CONTINUEwithout.WHILEor.REPEAT
.BREAKwithout.WHILEor.REPEAT
.ELSEfollowing.ELSE
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1012
Errorcountexceeds100;stoppingassembly
Thenumberofnonfatalerrorsexceededtheassemblerlimitof100.NonfatalerrorsareintherangeA2xxx.Whenwarningsaretreatedaserrorstheyareincludedinthecount.Warningsareconsiderederrorsifyouusethe/Wxcommand-lineoption,orifyousettheWarningsTreatedasErrorsoptionintheMacroAssemblerGlobalOptionsdialogboxofPWB.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1017
Missingsourcefilename
MLcouldnotfindafiletoassembleorpasstothelinker.
ThiserrorisgeneratedwhenyougiveASMCcommand-lineoptionswithoutspecifyingafilenametoactupon.Toassemblefilesthatdonothavea.ASMextension,usethe/Tacommand-lineoption.
ThiserrorcanalsobegeneratedbyinvokingASMCwithnoparametersiftheASMCenvironmentvariablecontainscommand-lineoptions.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCFatalErrorA1901
InternalAssemblerError
ContactProductSupportServices
TheASMCdriver,calledASMC.exe,generatedasystemerror.NotethecircumstancesoftheerrorandfileabugreportatASMCDevelopment
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2004
Symboltypeconflict:identifier
TheEXTERNDEForLABELdirectivewasusedonavariable,symbol,datastructure,orlabelthatwasdefinedinthesamemodulebutwithadifferenttype.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2005
Symbolredefinition:identifier
Thegivennonredefinablesymbolwasdefinedintwoplaces.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2006
Undefinedsymbol:identifier
Anattemptwasmadetouseasymbolthatwasnotdefined.Oneofthefollowingmayhaveoccurred:
Asymbolwasnotdefined.Afieldwasnotamemberofthespecifiedstructure.Asymbolwasdefinedinanincludefilethatwasnotincluded.AnexternalsymbolwasusedwithoutanEXTERNorEXTERNDEFdirective.Asymbolnamewasmisspelled.Alocalcodelabelwasreferencedoutsideofitsscope.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2007
Non-benignrecordredefinition
ARECORDdefinitionconflictedwithapreviousdefinition.Oneofthefollowingoccurred:
Thereweredifferentnumbersoffields.Thereweredifferentnumbersofbitsinafield.Therewasadifferentlabel.Thereweredifferentinitializers.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2008
syntaxerror:
Atokenatthecurrentlocationcausedasyntaxerror.Oneofthefollowingmayhaveoccurred:
Adotprefixwasaddedtooromittedfromadirective.Areservedword(suchasCorSIZE)wasusedasanidentifier.Aninstructionwasusedthatwasnotavailablewiththecurrentprocessororcoprocessorselection.Acomparisonrun-timeoperator(suchas==)wasusedinaconditionalassemblystatementinsteadofarelationaloperator(suchasEQ).Aninstructionordirectivewasgiventoofewoperands.Anobsoletedirectivewasused.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2009
syntaxerrorinexpression
Anexpressiononthecurrentlinecontainedasyntaxerror.Thiserrormessagemayalsobeaside-effectofaprecedingprogramerror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2010
invalidtypeexpression
TheoperandtoTHISorPTRwasnotavalidtypeexpression.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2011
distanceinvalidforwordsizeofcurrentsegment
AproceduredefinitionoracodelabeldefinedwithLABELspecifiedanaddresssizethatwasincompatiblewiththecurrentsegmentsize.Oneofthefollowingoccurred:
ANEAR16orFAR16procedurewasdefinedina32-bitsegment.ANEAR32orFAR32procedurewasdefinedina16-bitsegment.AcodelabeldefinedwithLABELspecifiedFAR16orNEAR16ina32-bitsegment.AcodelabeldefinedwithLABELspecifiedFAR32orNEAR32ina16-bitsegment.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2012
PROC,MACRO,ormacrorepeatdirectivemustprecedeLOCAL
ALOCALdirectivemustbeimmediatelyprecededbyaMACRO,PROC,macrorepeatdirective(suchasREPEAT,WHILE,orFOR),oranotherLOCALdirective.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2013
.MODELmustprecedethisdirective
Asimplifiedsegmentdirectiveora.STARTUPor.EXITdirectivewasnotprecededbya.MODELdirective.A.MODELdirectivemustspecifythemodeldefaultsbeforeasimplifiedsegmentdirective,ora.STARTUPor.EXITdirectivemaybeused.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2014
cannotdefineaspublicorexternal:identifier
Onlylabels,procedures,andnumericequatescanbemadepublicorexternalusingPUBLIC,EXTERN,orEXTERNDEF.Localcodelabelscannotbemadepublic.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2015
segmentattributescannotchange:attribute
Asegmentwasreopenedwithdifferentattributesthanitwasopenedwithoriginally.
WhenaSEGMENTdirectiveopensapreviouslydefinedsegment,thenewlyopenedsegmentinheritstheattributesthesegmentwasdefinedwith.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2016
expressionexpected
Theassemblerexpectedanexpressionatthecurrentlocationbutfoundoneofthefollowing:
AunaryoperatorwithoutanoperandAbinaryoperatorwithouttwooperandsAnemptypairofparentheses,(),orbrackets,[]
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2018
invaliduseofexternalsymbol:identifier
Anattemptwasmadetocomparethegivenexternalsymbolusingarelationaloperator.
Thecomparisoncannotbemadebecausethevalueoraddressofanexternalsymbolisnotknownatassemblytime.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2019
operandmustbeRECORDtypeorfield
TheoperandfollowingtheWIDTHorMASKoperatorwasnotvalid.TheWIDTHoperatortakesanoperandthatisthenameofafieldorarecord.TheMASKoperatortakesanoperandthatisthenameofafieldorarecordtype.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2022
instructionoperandsmustbethesamesize
Theoperandstoaninstructiondidnothavethesamesize.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2023
instructionoperandmusthavesize
Atleastoneoftheoperandstoaninstructionmusthaveaknownsize.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2024
invalidoperandsizeforinstruction
Thesizeofanoperandwasnotvalid.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2025
operandsmustbeinsamesegment
Relocatableoperandsusedwitharelationalorminusoperatorwerenotlocatedinthesamesegment.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2026
constantexpected
Theassemblerexpectedaconstantexpressionatthecurrentlocation.Aconstantexpressionisanumericexpressionthatcanberesolvedatassemblytime.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2028
expressionmustbeacodeaddress
Anexpressionevaluatingtoacodeaddresswasexpected.Oneofthefollowingoccurred:
SHORTwasnotfollowedbyacodeaddress.NEARPTRorFARPTRwasappliedtosomethingthatwasnotacodeaddress.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2029
multiplebaseregistersnotallowed
Anattemptwasmadetocombinetwobaseregistersinamemoryexpression.
Forexample,thefollowingexpressionscausethiserror:
[bx+bp]
[bx][bp]
Inanotherexample,giventhefollowingdefinition:
id1procarg1:byte
eitherofthefollowinglinescausesthiserror:
moval,[bx].arg1
leaax,arg1[bx]
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2030
multipleindexregistersnotallowed
Anattemptwasmadetocombinetwoindexregistersinamemoryexpression.
Forexample,thefollowingexpressionscausethiserror:
[si+di]
[di][si]
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2031
mustbeindexorbaseregister
Anattemptwasmadetousearegisterthatwasnotabaseorindexregisterinamemoryexpression.
Forexample,thefollowingexpressionscausethiserror:
[ax]
[bl]
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2032
invaliduseofregister
Anattemptwasmadetousearegisterthatwasnotvalidfortheintendeduse.Oneofthefollowingoccurred:
OFFSETwasappliedtoaregister.(OFFSETcanbeappliedtoaregisterundertheM510option.)Aspecial386registerwasusedinaninvalidcontext.AregisterwascastwithPTRtoatypeofinvalidsize.Aregisterwasspecifiedastherightoperandofasegmentoverrideoperator(:).Aregisterwasspecifiedastherightoperandofabinaryminusoperator(–).Anattemptwasmadetomultiplyregistersusingthe*operator.Brackets([])weremissingaroundaregisterthatwasaddedtosomething.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2033
invalidINVOKEargument:argumentnumber
TheINVOKEdirectivewaspassedaspecial386register,oraregisterpaircontainingabyteregisterorspecial386register.TheseregistersareillegalwithINVOKE.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2034
mustbeinsegmentblock
Oneofthefollowingwasfoundoutsideofasegmentblock:
AninstructionAlabeldefinitionATHISoperatorA$operatorAproceduredefinitionAnALIGNdirectiveAnORGdirective
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2036
toomanyinitialvaluesforstructure:structure
Thegivenstructurewasdefinedwithmoreinitializersthanthenumberoffieldsinthetypedeclarationofthestructure.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2037
statementnotallowedinsidestructuredefinition
Astructuredefinitioncontainedaninvalidstatement.Astructurecannotcontaininstructions,labels,procedures,control-flowdirectives,.STARTUP,or.EXIT.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2039
linetoolong
Asource-filelineexceededthelimitof1024characters.
Ifmultiplephysicallinesareconcatenatedwiththeline-continuationcharacter(\),theresultinglogicallineisstilllimitedto1024characters.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2041
stringortextliteraltoolong
Astringortextliteral,oramacrofunctionreturnvalue,exceededthelimitof255characters.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2043
identifiertoolong
Anidentifierexceededthelimitof247characters.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2045
missinganglebracketorbraceinliteral
Anunmatchedanglebracket(either<or>)orbrace(either{or})wasfoundinaliteralconstantoraninitializer.Oneofthefollowingoccurred:
Apairofanglebracketsorbraceswasnotcomplete.Ananglebracketwasintendedtobeliteral,butitwasnotprecededbyanexclamationpoint(!)toindicatealiteralcharacter.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2046
missingsingleordoublequotationmarkinstring
Anunmatchedquotationmark(either'or")wasfoundinastring.Oneofthefollowingmayhaveoccurred:
Apairofquotationmarksaroundastringwasnotcomplete.Apairofquotationmarksaroundastringwasformedofonesingleandonedoublequotationmark.Asingleordoublequotationmarkwasintendedtobeliteral,butthesurroundingquotationmarkswerethesamekindastheliteralone.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2047
empty(null)string
Astringconsistedofadelimitingpairofquotationmarksandnocharacterswithin.
Forastringtobevalid,itmustcontain1-255characters.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2048
nondigitinnumber
Anumbercontainedacharacterthatwasnotinthesetofcharactersusedbythecurrentradix(base).
ThiserrorcanoccurifaBorDradixspecifierisusedwhenthedefaultradixisonethatincludesthatletterasavaliddigit.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2050
realorBCDnumbernotallowed
Afloating-point(real)numberorbinarycodeddecimal(BCD)constantwasusedotherthanasadatainitializer.
Oneofthefollowingoccurred:
ArealnumberoraBCDwasusedinanexpression.ArealnumberwasusedtoinitializeadirectiveotherthanDWORD,QWORD,orTBYTE.ABCDwasusedtoinitializeadirectiveotherthanTBYTE.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2051
textitemrequired
Aliteralconstantortextmacrowasexpected.
Oneofthefollowingwasexpected:
Aliteralconstant,whichistextenclosedin<>AtextmacronameAmacrofunctioncallA%followedbyaconstantexpression
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2052
forcederror
Theconditional-errordirective.ERRor.ERR1wasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2053
forcederror:valueequalto0
Theconditional-errordirective.ERREwasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2054
forcederror:valuenotequalto0
Theconditional-errordirective.ERRNZwasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2055
forcederror:symbolnotdefined
Theconditional-errordirective.ERRNDEFwasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2056
forcederror:symboldefined
Theconditional-errordirective.ERRDEFwasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2057
forcederror:stringblank
Theconditional-errordirective.ERRBwasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2058
forcederror:stringnotblank
Theconditional-errordirective.ERRNBwasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2059
forcederror:stringsequal
Theconditional-errordirective.ERRIDNor.ERRIDNIwasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2060
forcederror:stringsnotequal
Theconditional-errordirective.ERRDIFor.ERRDIFIwasusedtogeneratethiserror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2061
[[[ELSE]]]IF2/.ERR2notallowed:single-passassembler
Adirectiveforatwo-passassemblerwasfound.
TheMicrosoftMacroAssembler(MASM)isaone-passassembler.MASMdoesnotaccepttheIF2,ELSEIF2,and.ERR2directives.ThiserroralsooccursifanELSEdirectivefollowsanIF1directive.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2062
expressiontoocomplexfor.UNTILCXZ
Anexpressionusedintheconditionthatfollows.UNTILCXZwastoocomplex.The.UNTILCXZdirectivecantakeonlyoneexpression,whichcancontainonly==or!=.Itcannottakeothercomparisonoperatorsormorecomplexexpressionsusingoperatorslike||.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2063
canALIGNonlytopowerof2:expression
TheexpressionspecifiedwiththeALIGNdirectivewasinvalid.TheALIGNexpressionmustbeapowerof2between2and256,andmustbelessthanorequaltothealignmentofthecurrentsegment,structure,orunion.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2064
structurealignmentmustbe1,2,or4
Thealignmentspecifiedinastructuredefinitionwasinvalid.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2065
expected:token
Theassemblerexpectedthegiventoken.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2066
incompatibleCPUmodeandsegmentsize
AnattemptwasmadetoopenasegmentwithaUSE16,USE32,orFLATattributethatwasnotcompatiblewiththespecifiedCPU,ortochangetoa16-bitCPUwhileina32bitsegment.
TheUSE32andFLATattributesmustbeprecededbyoneofthefollowingprocessordirectives:.386,.386C,.386P,.486,or.486P.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2068
instructionprefixnotallowed
OneoftheprefixesREP,REPE,REPNE,orLOCKprecededaninstructionforwhichitwasnotvalid.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2070
invalidinstructionoperands
Oneormoreoperandswerenotvalidfortheinstructiontheywerespecifiedwith.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2071
initializertoolargeforspecifiedsize
Aninitializervaluewastoolargeforthedataareaitwasinitializing.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2072
cannotaccesssymbolingivensegmentorgroup:identifier
Thegivenidentifiercannotbeaddressedfromthesegmentorgroupspecified.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2074
cannotaccesslabelthroughsegmentregisters
Anattemptwasmadetoaccessalabelthroughasegmentregisterthatwasnotassumedtoitssegmentorgroup.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2075
jumpdestinationtoofar[:by'n'bytes]
Thedestinationspecifiedwithajumpinstructionwastoofarfromtheinstruction.Oneofthefollowingmaybeasolution:
EnabletheLJMPoption.RemovetheSHORToperator.IfSHORThasforcedajumpthatistoofar,nisthenumberofbytesoutofrange.Rearrangecodesothatthejumpisnolongeroutofrange.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2076
jumpdestinationmustspecifyalabel
Adirectjumps'destinationmustberelativetoacodelabel.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2077
instructiondoesnotallowNEARindirectaddressing
Aconditionaljumporloopcannottakeamemoryoperand.Itmustbegivenarelativeaddressorlabel.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2079
instructiondoesnotallowFARdirectaddressing
Aconditionaljumporloopcannotbetoadifferentsegmentorgroup.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2080
jumpdistancenotpossibleincurrentCPUmode
Adistancewasspecifiedwithajumpinstructionthatwasincompatiblewiththecurrentprocessormode.
Forexample,48-bitjumpsrequire.386orabove.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2081
missingoperandafterunaryoperator
Anoperatorrequiredanoperand,butnooperandfollowed.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2082
cannotmix16-and32-bitregisters
Anaddressexpressioncontainedboth16-and32-bitregisters.Forexample,thefollowingexpressioncausesthiserror:
[bx+edi]
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2083
invalidscalevalue
Aregisterscalewasspecifiedthatwasnot1,2,4,or8.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2084
constantvaluetoolarge
Aconstantwasspecifiedthatwastoobigforthecontextinwhichitwasused.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2085
instructionorregisternotacceptedincurrentCPUmode
Anattemptwasmadetouseaninstruction,register,orkeywordthatwasnotvalidforthecurrentprocessormode.
Forexample,32-bitregistersrequire.386orabove.ControlregisterssuchasCR0requireprivilegedmode.386Porabove.ThiserrorwillalsobegeneratedfortheNEAR32,FAR32,andFLATkeywords,whichrequire.386orabove.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2086
reservedwordexpected
OneormoreitemsinthelistspecifiedwithaNOKEYWORDoptionwerenotrecognizedasreservedwords.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2087
instructionformrequires80386/486
Aninstructionwasusedthatwasnotcompatiblewiththecurrentprocessormode.
Oneofthefollowingprocessordirectivesmustprecedetheinstruction:.386,.386C,.386P,.486,or.486P.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2088
ENDdirectiverequiredatendoffile
Theassemblerreachedtheendofthemainsourcefileanddidnotfindan.ENDdirective.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2089
toomanybitsinRECORD:identifier
Oneofthefollowingoccurred:
Toomanybitsweredefinedforthegivenrecordfield.Toomanytotalbitsweredefinedforthegivenrecord.Thesizelimitforarecordorafieldinarecordis16bitswhendoing16-bitarithmeticor32bitswhendoing32-bitarithmetic.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2090
positivevalueexpected
Apositivevaluewasnotfoundinoneofthefollowingsituations:
ThestartingpositionspecifiedforSUBSTRor@SubStrThenumberofdataobjectsspecifiedforCOMMTheelementsizespecifiedforCOMM
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2091
indexvaluepastendofstring
AnindexvalueexceededthelengthofthestringitreferredtowhenusedwithINSTR,SUBSTR,@InStr,or@SubStr.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2092
countmustbepositiveorzero
TheoperandspecifiedtotheSUBSTRdirective,@SubStrmacrofunction,SHLoperator,SHRoperator,orDUPoperatorwasnegative.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2093
countvaluetoolarge
ThelengthargumentspecifiedforSUBSTRor@SubStrexceededthelengthofthespecifiedstring.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2094
operandmustberelocatable
Anoperandwasnotrelativetoalabel.Oneofthefollowingoccurred:
AnoperandspecifiedwiththeENDdirectivewasnotrelativetoalabel.AnoperandtotheSEGoperatorwasnotrelativetoalabel.Therightoperandtotheminusoperatorwasrelativetoalabel,buttheleftoperandwasnot.Theoperandstoarelationaloperatorwereeithernotbothintegerconstantsornotbothmemoryoperands.Relationaloperatorscantakeoperandsthatarebothaddressesorbothnon-addressesbutnotoneofeach.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2095
constantorrelocatablelabelexpected
Theoperandspecifiedmustbeaconstantexpressionoramemoryoffset.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2096
segment,group,orsegmentregisterexpected
Asegmentorgroupwasexpectedbutwasnotfound.Oneofthefollowingoccurred:
Theleftoperandspecifiedwiththesegmentoverrideoperator(:)wasnotasegmentregister(CS,DS,SS,ES,FS,orGS),groupname,segmentname,orsegmentexpression.TheASSUMEdirectivewasgivenasegmentregisterwithoutavalidsegmentaddress,segmentregister,group,orthespecialFLATgroup.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2097
segmentexpected:identifier
TheGROUPdirectivewasgivenanidentifierthatwasnotadefinedsegment.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2098
invalidoperandforOFFSET
TheexpressionfollowingtheOFFSEToperatormustbeamemoryexpressionoranimmediateexpression.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2100
segmentorgroupnotallowed
Anattemptwasmadetouseasegmentorgroupinawaythatwasnotvalid.Segmentsorgroupscannotbeadded.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2101
cannotaddtworelocatablelabels
Anattemptwasmadetoaddtwoexpressionsthatwerebothrelativetoalabel.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2103
segmentexceeds64Klimit
A16-bitsegmentexceededthesizelimitof64K.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2104
invalidtypefordatadeclaration:type
Thegiventypewasnotvalidforadatadeclaration.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2105
HIGHandLOWrequireimmediateoperands
TheoperandspecifiedwitheithertheHIGHortheLOWoperatorwasnotanimmediateexpression.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2107
cannothaveimplicitfarjumporcalltonearlabel
Anattemptwasmadetomakeanimplicitfarjumporcalltoanearlabelinanothersegment.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2108
useofregisterassumedtoERROR
AnattemptwasmadetousearegisterthathadbeenassumedtoERRORwiththeASSUMEdirective.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2110
COMMENTdelimiterexpected
AdelimitercharacterwasnotspecifiedforaCOMMENTdirective.
Thedelimitercharacterisspecifiedbythefirstcharacterthatisnotwhitespace(spacesorTABcharacters)aftertheCOMMENTdirective.Thecommentconsistsofalltextfollowingthedelimiteruntiltheendofthelinecontainingthenextappearanceofthedelimiter.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2111
conflictingparameterdefinition
AproceduredefinedwiththePROCdirectivedidnotmatchitsprototypeasdefinedwiththePROTOdirective.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2112
PROCandprototypecallingconventionsconflict
Aprocedurewasdefinedinaprototype(usingthePROTO,EXTERNDEF,orEXTERNdirective),butthecallingconventiondidnotmatchthecorrespondingPROCdirective.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2113
invalidradixtag
Thespecifiedradixwasnotanumberintherange2-16.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2114
INVOKEargumenttypemismatch:argumentnumber
ThetypeoftheargumentspassedusingtheINVOKEdirectivedidnotmatchthetypeoftheparametersintheprototypeoftheprocedurebeinginvoked.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2119
languagetypemustbespecified
Aproceduredefinitionorprototypewasnotgivenalanguagetype.
Alanguagetypemustbedeclaredineachproceduredefinitionorprototypeifadefaultlanguagetypeisnotspecified.Adefaultlanguagetypeissetusingeitherthe.MODELdirective,OPTIONLANG,ortheASMCcommand-lineoptions/Gcor/Gd.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2120
PROLOGUEmustbemacrofunction
TheidentifierspecifiedwiththeOPTIONPROLOGUEdirectivewasnotrecognizedasadefinedmacrofunction.
Theuser-definedprologuemustbeamacrofunctionthatreturnsthenumberofbytesneededforlocalvariablesandanyextraspaceneededforthemacrofunction.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2121
EPILOGUEmustbemacroprocedure
TheidentifierspecifiedwiththeOPTIONEPILOGUEdirectivewasnotrecognizedasadefinedmacroprocedure.Theuser-definedepiloguemacrocannotreturnavalue.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2123
textmacronestingleveltoodeep
Atextmacrowasnestedtoodeeply.Thenestinglimitfortextmacrosis100.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2125
missingmacroargument
Arequiredargumentto@InStr,@SubStr,orauser-definedmacrowasnotspecified.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2129
VARARGparametermustbelastparameter
AparameterotherthanthelastonewasgiventheVARARGattribute.
The:VARARGspecificationcanbeappliedonlytothelastparameterinaparameterlistformacroandproceduredefinitionsandprototypes.Youcannotusemultiple:VARARGspecificationsinamacro.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2131
VARARGparameterrequiresCcallingconvention
AVARARGparameterwasspecifiedinaproceduredefinitionorprototype,buttheC,SYSCALL,orSTDCALLcallingconventionwasnotspecified.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2132
ORGneedsaconstantorlocaloffset
TheexpressionspecifiedwiththeORGdirectivewasnotvalid.ORGrequiresanimmediateexpressionwithnoreferencetoanexternallabelortoalabeloutsidethecurrentsegment.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2133
registervalueoverwrittenbyINVOKE
Aregisterwaspassedasanargumenttoaprocedure,butthecodegeneratedbyINVOKEtopassotherargumentsdestroyedthecontentsoftheregister.
TheAX,AL,AH,EAX,DX,DL,DH,andEDXregistersmaybeusedbytheassemblertoperformdataconversion.
Useadifferentregister.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2136
toomanyargumentstoINVOKE
ThenumberofargumentspassedusingtheINVOKEdirectiveexceededthenumberofparametersintheprototypefortheprocedurebeinginvoked.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2141
toomanyoperandstoinstruction
Toomanyoperandswerespecifiedwithastringcontrolinstruction.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2142
cannothavemorethanone.ELSEclauseper.IFblock
Theassemblerfoundmorethanone.ELSEclausewithinthecurrent.IFblock.Use.ELSEIFforallbutthelastblock.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2143
expecteddatalabel
TheLENGTHOF,SIZEOF,LENGTH,orSIZEoperatorwasappliedtoanon-datalabel,ortheSIZEOForSIZEoperatorwasappliedtoatype.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2144
cannotnestprocedures
Anattemptwasmadetonestaprocedurecontainingaparameter,localvariable,USESclause,orastatementthatgeneratedanewsegmentorgroup.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2145
EXPORTmustbeFAR:procedure
ThegivenprocedurewasgivenEXPORTvisibilityandNEARdistance.AllEXPORTproceduresmustbeFAR.ThedefaultvisibilitymayhavebeensetwiththeOPTIONPROC:EXPORTstatementortheSMALLorCOMPACTmemorymodels.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2147
macrolabelnotdefined:macrolabel
Thegivenmacrolabelwasnotfound.Amacrolabelisdefinedwith:macrolabel.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2148
invalidsymboltypeinexpression:identifier
Thegivenidentifierwasusedinanexpressioninwhichitwasnotvalid.Forexample,amacroprocedurenameisnotallowedinanexpression.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2151
specialregistercannotbefirstoperand
Aspecialregisterwasspecifiedtoaninstructionthatcannottakeitasthefirstoperand.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2154
syntaxerrorincontrol-flowdirective
Theconditionforacontrol-flowdirective(suchas.IFor.WHILE)containedasyntaxerror.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2156
constantvalueoutofrange
AninvalidvaluewasspecifiedforthePAGEdirective.ThefirstparameterofthePAGEdirectivecanbeeither0oravalueintherange10-255.ThesecondparameterofthePAGEdirectivecanbeeither0oravalueintherange60-255.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2157
missingrightparenthesis
Arightparenthesis,),wasmissingfromamacrofunctioncall.Besurethatparenthesesareinpairsifnested.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2159
structurecannotbeinstanced
AnattemptwasmadetocreateaninstanceofastructurewhentherewerenofieldsordatadefinedinthestructuredefinitionorwhenORGwasusedinthestructuredefinition.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2166
structurefieldexpected
Therighthandsideofadotoperator(.)isnotastructurefield.Thiserrormayoccurwithsomecodeacceptabletopreviousversionsoftheassembler.Toenabletheoldbehavior,useOPTIONOLDSTRUCTS,whichisautomaticallyenabledbyOPTIONM510orthe/Zmcommand-lineoption.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2167
unexpectedliteralfoundinexpression
Aliteralwasfoundwhereanexpressionwasexpected.Oneofthefollowingmayhaveoccurred:
AliteralwasusedasaninitializerArecordtagwasomittedfromarecordconstant
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2169
dividebyzeroinexpression
Anexpressioncontainsadivisorwhosevalueisequaltozero.
Checkthatthesyntaxoftheexpressioniscorrectandthatthedivisor(whetherconstantorvariable)iscorrectlyinitialized.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2170
directivemustappearinsideamacro
AGOTOorEXITMdirectivewasfoundoutsidethebodyofamacro.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2172
toofewbitsinRECORD
Therewasanattempttodefinearecordfieldof0bits.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2175
invalidqualifiedtype
Anidentifierwasencounteredinaqualifiedtypethatwasnotatype,structure,record,union,orprototype.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2178
invaliduseofFLAT
TherewasanambiguousreferencetoFLATasagroup.ThiserrorisgeneratedwhenthereisareferencetoFLATinsteadofaFLATsubgroup.Forexample,
movax,FLAT;GeneratesA2178
movax,SEGFLAT:_data;Correct
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2179
structureimproperlyinitialized
Therewasanerrorinastructureinitializer.Oneofthefollowingoccurred:
Theinitializerisnotavalidexpression.TheinitializerisaninvalidDUPstatement.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2181
initializermustbeastringorsingleitem
Therewasanattempttoinitializeastructureelementwithsomethingotherthanasingleitemorstring.
Thiserrorcanbecausedbyomittingbraces({})aroundaninitializer.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2187
mustusefloatingpointinitializer
AvariabledeclaredwiththeREAL4,REAL8,andREAL10directivesmustbeinitializedwithafloating-pointnumberoraquestionmark(?).
Thiserrorcanbecausedbygivinganinitializerinintegerform(suchas18)insteadofinfloating-pointform(18.0).
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2189
invalidcombinationwithsegmentalignment
ThealignmentspecifiedbytheALIGNorEVENdirectivewasgreaterthanthecurrentsegmentalignmentasspecifiedbytheSEGMENTdirective.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2190
INVOKErequiresprototypeforprocedure
TheINVOKEdirectivemustbeprecededbyaPROTOstatementfortheprocedurebeingcalled.WhenusingINVOKEwithanaddressratherthananexplicitprocedurename,youmustprecedetheaddresswithapointertotheprototype.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2199
symbollanguageattributeconflict
Twodeclarationsforthesamesymbolhaveconflictinglanguageattributes(suchasCandPASCAL).Theattributesshouldbeidenticalorcompatible.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2200
.STARTUPdoesnotworkwith32-bitsegments
The.STARTUPdirectivecannotbeusedina32-bitsegment;itisvalidonlywhengenerating16-bitcode.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2202
ORGdirectivenotallowedinunions
TheORGdirectiveisnotvalidinsideaUNIONdefinition.
YoucanusetheORGdirectiveinsideSTRUCTdefinitions,butitismeaninglessinsideaUNION.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2206
illegaluseofsegmentregister
YoucannotusesegmentoverridesfortheFSorGSsegmentregisterswhengeneratingfloating-pointemulationinstructionswiththe/FPicommand-lineoptionorOPTIONEMULATOR.
*ML6.0compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2214
GROUPdirectivenotallowedwith/coffoption
TheGROUPdirectiveisnotpermittedwhencompilingwith/coff.
SeeMLandML64Command-LineReferenceformoreinformation.
*ML8compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA2217
mustbepublicorexternal
Analternatesymbolwasnotpublicorexternal.
Example
ThecodesamplebelowwouldgenerateA2217iftheline:
public alternate
werenotpresent.
.686
.model flat
extrn primary(alternate):near
.code
public alternate
alternate:
ret
end
*ML8compatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3002
/PEoptionrequiresFLATmemorymodel
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3004
cannotuseTR-TRwithcurrentCPUsetting
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3005
nosegmentinformationtocreatefixup:
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3006
notsupportedwithcurrentoutputformat:
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3008
.ENDPROLOGfoundbeforeEHdirectives
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3009
missingFRAMEinPROC,nounwindcodewillbegenerated
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3010
sizeofprologtoobig,mustbe<256bytes
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3011
toomanyunwindcodesinFRAMEprocedure
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3012
registersAH-DHmaynotbeusedwithSPL-DILorR8-R15
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3015
filenameparametermustbeenclosedin<>orquotes
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3019
invalidfixuptypeforformat:typesymbolatlocationoffset
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3020
cannotopenfile:filename
SameasMLA1000.
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3021
I/Oerrorclosingfile
SameasMLA1001.
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages
ASMCNonfatalErrorA3022
.CASEredefinition:identifierA(val):identifierB(val)
Thegivennonredefinablesymbolwasdefinedintwoplaces.
*NonMLcompatibleerror
SeeAlso
ASMCErrorMessages|A2005
ASMCWarningA4003
startaddressonENDdirectiveignoredwith.STARTUP
Both.STARTUPandaprogramloadaddress(optionalwiththeENDdirective)werespecified.TheaddressspecificationwiththeENDdirectivewasignored.
*ML6.0compatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA4005
unknowndefaultprologueargument
Anunknownargumentwaspassedtothedefaultprologue.ThedefaultprologueunderstandsonlytheFORCEFRAMEandLOADDSarguments.
*ML6.0compatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA4006
toomanyargumentsinmacrocall
Thereweremoreargumentsgiveninthemacrocallthantherewereparametersinthemacrodefinition.
*ML6.0compatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA4007
optionuntranslated,directiverequired:option
ThereisnoASMCcommand-lineequivalentforthegivenoption.Thedesiredbehaviorcanbeobtainedbyusingadirectiveinthesourcefile.
OptionDirective
/A
/P
/S
.ALPHA
OPTIONREADONLY
.SEQ
*ML6.0compatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA4008
invalidcommand-lineoptionvalue,defaultisused:option
Thevaluespecifiedwiththegivenoptionwasnotvalid.Theoptionwasignored,andthedefaultwasassumed.
*ML6.0compatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA4011
multiple.MODELdirectivesfound:.MODELignored
Morethanone.MODELdirectivewasfoundinthecurrentmodule.Onlythefirst.MODELstatementisused.
*ML6.0compatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA4012
linenumberinformationforsegmentwithoutclass'CODE'
Therewereinstructionsinasegmentthatdidnothaveaclassnamethatendswith"CODE."TheassemblerdidnotgenerateCodeViewinformationfortheseinstructions.
CodeViewcannotprocessmoduleswithcodeinsegmentswithclassnamesthatdonotendwith"CODE."
*ML6.0compatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA4910
cannotopenfile:filename
Thegivenfilenamecouldnotbeinthecurrentpath.
Makesurethatfilenamewascopiedfromthedistributiondisksandisinthecurrentpath.
*ML6.0compatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA6003
conditionaljumplengthened
Aconditionaljumpwasencodedasareverseconditionaljumparoundanearunconditionaljump.
Youmaybeabletorearrangecodetoavoidthelongerform.
*ML6.0compatiblelevel3warning(-W3)
SeeAlso
ASMCErrorMessages
ASMCWarningA6004
procedureargumentorlocalnotreferenced
YoupassedaprocedureargumentorcreatedavariablewiththeLOCALdirectivethatwasnotusedintheprocedurebody.
Unnecessaryparametersandlocalswastecodeandstackspace.*ML6.0compatiblelevel3warning(-W3)
SeeAlso
ASMCErrorMessages
ASMCWarningA6005
expressionconditionmaybepass-dependent
Thiswarningmessagemayindicatethatthecodeispass-dependentandshouldberewritten.
Example
moval,reg
regequ<cl>
*ML8.0/NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8000
Invalidcommand-lineoption:option
ASMCdidnotrecognizethegivenparameterasanoption.Thiserrorisgenerallycausedwhenthereisasyntaxerroronthecommandline.
SameasA1006
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8005
IF[n]DEFexpectsaplainsymbolasargument:argument
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8006
instructionsandinitializeddatanotsupportedinsegmentsegments
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8008
displacementoutofrange:displacement
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8011
for-coffleadingunderscorerequiredforstartlabel:label
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8013
ELFGNUextensions(8/16-bitrelocations)used
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8015
directiveignoredwithout-switchswitch
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8018
groupdefinitiontoolarge,truncated:group
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA8019
sizenotspecified,assuming:
Thisisawarning.maybeBYTE,WORDorDWORD.Themessagemayoccurifanimmediatevalueiswrittentoanuntypedmemoryreference:
mov[ebx],1
JWasmmakesaguessanddisplaysthewarning,whileMLwilldisplayanerrorinsuchcases.
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages|ErrorA2070
ASMCWarningA7000
symbollanguageattributeconflict
Twodeclarationsforthesamesymbolhaveconflictinglanguageattributes(suchasCandPASCAL).Theattributesshouldbeidenticalorcompatible.
SameasMLErrorA2192
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA7002
registervalueoverwrittenbyINVOKE
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages|ErrorA2133
ASMCWarningA7006
parameter/localnameisreservedword:
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA7007
.CASEwithout.ENDC:assumedfallthrough
IncaseOPTIONSWITCH:Cisset(default)
.switcheax
.case1:moval,1 ;warning
.case2:.endc
.endsw
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
ASMCWarningA7008
cannotdelaymacrofunction:<token>
Macrothatnormallywouldbedelayedexpanded.
.WHILEmacro(<...>)
.ELSEIFmacro(<...>)
.CASEmacro(<...>)
*NonMLcompatiblewarning
SeeAlso
ASMCErrorMessages
AsmcMacroAssemblerReference
.UNTILAXZ
See.REPEAT
SeeAlso
DirectivesReference,.UNTILBXZ,.UNTILCXZ,.UNTILDXZ
AsmcMacroAssemblerReference
.UNTILBXZ
See.REPEAT
SeeAlso
DirectivesReference,.UNTILAXZ,.UNTILCXZ,.UNTILDXZ
AsmcMacroAssemblerReference
.UNTILDXZ
See.REPEAT
SeeAlso
DirectivesReference,.UNTILAXZ,.UNTILBXZ,.UNTILCXZ