2010. 1.23 JWasm 2.02 と MASM の動作の違い 1. MASM 5.1 のマクロ MASM の v5.1 モードで使用可能なマクロがサポートされていません。 例えば、MASM の v5.1 モードでは、マクロの区切り文字にスペースを使うこと ができますが、JWasm の v5.1 モードでは、マクロの区切り文字は、',' だけです。 2. .if で eax と 0 を比較すると MASM : or eax,eax JWasm : cmp eax,0 と異なるコードになります。 MASM と同じようなコードにしたいときは、オプションの -Zg を指定します。 3. comment の区切り記号に '\' が使えない。MASM や TASM で '\' を区切り記号に 使っている場合があります。JWasm ではエラーになりますが、comment内で使用さ れていない他の記号に変えてやればエラーは出なくなります。 MASM : '\' OK JWasm : '\' NG 4. JWasm で修正されている MASM のバグ 以下は、JWasm v2.02 に付属の Manual.txt からの引用です。 ---8<-------8<-------8<-------8<------- 8. Masm bugs fixed in JWasm - the infamous "invoke" bug: using invoke with variables of type BYTE (or WORD in 32bit code) causes bad code to be generated in Masm. - Masm does align structure members if requested, but it doesn't pad bytes at the end of the structure, as C compilers do. - PROTOs contained twice in the source caused an EXTDEF entry to be generated in the object module. - "TYPE xmm0" will return 10 in Masm v6 and v7, JWasm returns 16, same as Masm v8. - a nested structure might cause a GPF in Masm if the embedded STRUCT's starting offset has to be adjusted due to alignment. - defining huge arrays in Masm is very slow and might even cause a deadlock if COFF has been selected as output format. - for Masm v6 and v7, if an array > 64 kB is defined and output format OMF is selected, the array's size will be mod 0x10000 only. - Masm doesn't flag invalid numbers in struct/array initializer strings. - if an ALIAS is defined somewhere in the source and the symbol table is listed, a 'General Failure' error occurs in Masm if output format is OMF. - Type "coerces" for DWORD data items defined in a 32bit segment are ignored by Masm, i.e., "dd far16 ptr " will generate a near32 fixup instead of a far16 one. - if the ALIGN directive has to add 5 bytes in 32bit code segments, Masm includes an "add eax,0" opcode, which isn't a no-op because flags are modified. - silent truncation of immediate constants: Masm v6 and v7 will accept line "mov [word_variable],12345h" without error. - preprocessed output with option -EP may erroneously contain text macros and macro function calls if the macros are located in the initialization string of a structured variable. - Masm generates wrong code if a conditional jump is coupled with a type coercion which modifies offset magnitude. Examples: "jz near32 ptr ..." in 16bit code or "jz near16 ptr ..." in 32bit code). - if the arguments given to Masm end with an option which expects a parameter (i.e. "ml -c -Fo"), a 'General Failure' may occur. - floating-point data items in Masm can be followed by any suffix (example: REAL4 1.0foo, 2.0bar). JWasm won't accept this. - If a local is defined inside a macro, Masm will create a unique name for it. The name is constructed by using '??' as prefix, followed by a hexadecimal number with 4 digits. There is no check for overflow, however, so if the total of locals in all macros exceeds 65536, strange errors will occur. It's slightly dangerous to fix old Masm bugs, since some code might work only if the bugs exists. So no, JWasm won't achieve 100% Masm compatibility. ---8<-------8<-------8<-------8<-------