News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MASM611 problem

Started by cqzhy1986, February 27, 2009, 07:36:39 AM

Previous topic - Next topic

cqzhy1986


.model tiny

.data
L1 db 30h
L2 db 40h

.code
start:
    org 100h
    mov ax, [L1]
    mov bx, [L2]
    add ax, bx
end start


MASM611 error message is:

Assembling: test.asm
test.asm(10): error A2070: invalid instruction operands
test.asm(11): error A2070: invalid instruction operands

someone tell me what's wrong with my code?  :'(

Neil

You have defined your data as byte and are trying to move it into 16 bit registers, you should use al & bl, also the brackets are not needed.

cqzhy1986

Quote from: Neil on February 27, 2009, 09:29:56 AM
You have defined your data as byte and are trying to move it into 16 bit registers, you should use al & bl, also the brackets are not needed.

I thought if the brackets are missed, the address will be loaded into registers.

I am a newbie and I will try your advice, thank you

FORTRANS

Quote from: Cao Huanyin on February 27, 2009, 03:42:29 PM
Quote from: Neil on February 27, 2009, 09:29:56 AM
You have defined your data as byte and are trying to move it into 16 bit registers, you should use al & bl, also the brackets are not needed.

I thought if the brackets are missed, the address will be loaded into registers.

I am a newbie and I will try your advice, thank you

Hi,

   A diifferent assembler uses that action (NASM).  MASM uses
the OFFSET operator to load an address.


        MOV     BX,L1   ; loads the contents of L1
        MOV     BX,[L1] ; loads the contents of L1
        MOV     BX,OFFSET L1       ; loads the address offset of L1


Steve N.

cqzhy1986

Oh...... different rules for different tools...... it is easy to make newbie confused.....
Quote from: FORTRANS on February 27, 2009, 06:30:43 PM
Hi,

   A diifferent assembler uses that action (NASM).  MASM uses
the OFFSET operator to load an address.


        MOV     BX,L1   ; loads the contents of L1
        MOV     BX,[L1] ; loads the contents of L1
        MOV     BX,OFFSET L1       ; loads the address offset of L1


Steve N.