a program error

Hello friends.
I have a problem between as86 and me.
as86 compiler gives me an error which is not exactly understood by me.

what is " Operand must have size " error.


Comments

  • : Hello friends.
    : I have a problem between as86 and me.
    : as86 compiler gives me an error which is not exactly understood by me.
    :
    : what is " Operand must have size " error.
    :
    :
    :
    [blue]Usually, it happens when you do something like this:

    mov [bx], 4

    Here compiler does not know what type this value '4' has, it can be a BYTE (04h), a WORD (0004h) or a DWORD (00000004h), so you have to specifically point that out, like so:

    mov byte ptr [bx], 4
    mov word ptr [bx], 4
    mov dword ptr [bx], 4

    [/blue]
  • Nasm give the SIZE error if destination doesn't have a knowable size
    MOV [BX],AL ;gives error message, sizeof [BX] unknown?
    MOV AL,[BX] ;doesn't give error message, it knows AL is a byte
    why it doesn't know the other way around when AL is the source,
    may have to do with the order the instructions are processed
    MOV BYTE [BX],AL ; works
    MOV BYTE [BX],4 ;works
    MOV BYTE [4],4 ;works
    MOV [4],4 ;fails

    Doesn't Masm need size on source also?
    MOV AX,WORD PTR [BX]


  • thanks.
    It works It works. Oh my god.
  • [b][red]This message was edited by AsmGuru62 at 2003-10-29 14:47:30[/red][/b][hr]
    [b][red]This message was edited by AsmGuru62 at 2003-10-29 14:44:54[/red][/b][hr]
    : Nasm give the SIZE error if destination doesn't have a knowable size
    : MOV [BX],AL ;gives error message, sizeof [BX] unknown?
    : MOV AL,[BX] ;doesn't give error message, it knows AL is a byte
    : why it doesn't know the other way around when AL is the source,
    : may have to do with the order the instructions are processed
    : MOV BYTE [BX],AL ; works
    : MOV BYTE [BX],4 ;works
    : MOV BYTE [4],4 ;works
    : MOV [4],4 ;fails
    :
    : Doesn't Masm need size on source also?
    : MOV AX,WORD PTR [BX]
    :
    :
    :
    [blue]Well, obviously, if you have a register (at any side of a MOV) - the smart ASM compiler should know the size already, and if it does not - then it is not smart enough. The only way - it should be confused - is when you use the immediate value with a memory address. I work with TASM and as soon as register name there - it never complains.[/blue]




  • I guess Nasm has a dumb area. I never got into Tasm darn it, I got stuck on Masm.
    Congrats..... you got the best compliment there is:

    thanks.
    It works It works. Oh my god.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories