64 bit assembler > UASM Assembler Development

Error A2048: must be the same size: 4 - 8 and Error A2071: Invalid operand size

(1/2) > >>

LiaoMi:
Hi,

UASM cannot determine the type of variables on all possible variations, for example


--- Code: ---    and al,NOT(SET)
    and [ebx].COBii[USER.Look],(1 shl GR) or (1 shl GR)
    or [ebx].COBii[USER.J],eax
--- End code ---

Multiple error messages look like this>

--- Code: ---Error A2048: Operands must be the same size: 4 - 8
Error A2048: Operands must be the same size: 1 - 2
Error A2071: Invalid operand size for instruction
--- End code ---

Then I have to rewrite the code>

--- Code: ---and al,NOT byte PTR (SET)
or dword ptr  [ebx].COBii[USER.J],eax
--- End code ---

JWASM documentation writes - https://wiki.osdev.org/JWasm

--- Quote ---Abbreviated Notation
This notation is a fully specified format which occurs in the following form:


--- Code: ---    mov eax, DWORD PTR [edi]
--- End code ---
Over time, the parsers in assemblers have improved to the stage where if the assembler can recognize the size of the data then the SIZE specifier may be omitted as such.


--- Code: ---    mov eax, [edi]
--- End code ---
This allows for clearer code that is easier to read. However, there are some contexts where the assembler cannot independently determine the data size; For example, if the source operand is a memory operand. In this situation the historical data SIZE specifiers must be used. The following is an example of this situation.


--- Code: ---    movzx eax, [esi]            ; generates an error - data SIZE cannot be determined by the assembler
    movzx eax, BYTE PTR [esi]   ; zero extend a BYTE into the 32 bit EAX register
--- End code ---

--- End quote ---


The same code is well understood by the original macro assembler. In which you do not need to add anything, I consider it as violation in compatibility.

In addition, there is another error with UASM: fatal error LNK1107: invalid or corrupt file: cannot read at 0x15AB


--- Code: ---mainMasm.asm(78) : Error A2048: Operands must be the same size: 1 - 2
mainMasm.asm(79) : Error A2071: Invalid operand size for instruction
mainMasm.asm(80) : Error A2048: Operands must be the same size: 8 - 4
mainMasm.asm: 101 lines, 1 passes, 1 ms, 0 warnings, 3 errors
Microsoft (R) Incremental Linker Version 14.29.30037.0
Copyright (C) Microsoft Corporation.  All rights reserved.
--- End code ---

Because of these errors, I can't assemble a large project  :biggrin:, editing the entire code can't be a solution either  :skrewy:, Microsoft assembler works without errors :badgrin:

jj2007:

--- Code: ---    mov ebx, offset COA

;    assume ebx:PTR _COA avoid this syntax, no good for readability
    Obi equ [ebx._COA.COBii] ; much better
   
    and al, NOT(GET) ; NO fatal error LNK1107 here with polink - which linker do you use?
    int 3 ; have a look...
    and al, NOT(SET) ; -205... does it really fit into a byte? MASM thinks it does, UAsm disagrees
    and ax, NOT(SET) ; works for UAsm and MASM
    and eax, NOT(SET) ; works for UAsm and MASM
    and [ebx._COA.COBii.Look], (1 shl GR) or (1 shl GR)
    or [ebx._COA.COBii.J],eax
    or Obi.J, eax ; isn't that cute?
--- End code ---


--- Quote from: LiaoMi on June 07, 2022, 05:05:32 AM ---
--- Code: ---    movzx eax, [esi]            ; generates an error - data SIZE cannot be determined by the assembler
    movzx eax, BYTE PTR [esi]   ; zero extend a BYTE into the 32 bit EAX register
--- End code ---

The same code is well understood by the original macro assembler. In which you do not need to add anything, I consider it as violation in compatibility.
--- End quote ---

What exactly do you mean? MASM allows movzx eax, [esi]???

LiaoMi:
Hi jj2007,

I meant just my attached example, without taking into account the quote from the documentation.

An example is below:
mainMasm.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0x15C5

Microsoft (R) Incremental Linker Version 14.29.30037.0

1 byte is 255, SET equ 11001100B - > 204 - > NOT 204 - > 51 
Where does the negative number come from?

jj2007:
polink doesn't like your object file...


--- Code: ---\Masm32\Members\LiaoMi\UasmBug>\Masm32\bin\polink /SubSystem:console /machine:x86 mainMasm.obj
POLINK: fatal error: Invalid machine type in object 'mainMasm.obj'.
--- End code ---

tenkey:

--- Quote from: LiaoMi on June 07, 2022, 07:43:49 AM ---1 byte is 255, SET equ 11001100B - > 204 - > NOT 204 - > 51 
Where does the negative number come from?

--- End quote ---

32- or 64-bit arithmetic and logic

NOT CCh --> FFFFFF33h --> -205, which is less than -128

Navigation

[0] Message Index

[#] Next page

Go to full version