A2155: cannot use 16-bit register with a 32-bit address

Started by bala_j, May 09, 2007, 06:33:34 AM

Previous topic - Next topic

bala_j

Hi all,

can any one let me know what is wrong with the below code segment and why it is throwing A2155: cannot use 16-bit register with a 32-bit address.

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .486                                ; create 32 bit code
    .model flat, stdcall                ; 32 bit memory model
    option casemap :none                ; case sensitive
 
    include \masm32\include\windows.inc
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\Comctl32.inc
    include \masm32\include\comdlg32.inc
    include \masm32\include\shell32.inc
    include \masm32\include\oleaut32.inc
    include \masm32\include\msvcrt.inc

    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib
    includelib \masm32\lib\Comctl32.lib
    includelib \masm32\lib\comdlg32.lib
    includelib \masm32\lib\shell32.lib
    includelib \masm32\lib\oleaut32.lib
    includelib \masm32\lib\msvcrt.lib

    .data?


    .data
     double REAL8 0.1,1.0,10.0, 100.5, 1000.0, 400.0, 40.5, 60.6,8.9,10.1
     count db 0ah

    .code

start:

 
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
;
;   write your code here

    Lea si, double
    Mov cl, count
    Mov al,[si]


;
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start

eek

I dont do 32 bit stuff btw but

Lea si, double                   is double a dw or a db or a dd ?

    Mov cl, count               count is a db so mov cl,[count] ok...but if you're loading count
                                     as a pointer reference I think  mov cx,count may be better

    Mov al,[si]                    could be      mov al,b[si] methinks.(The BYTE at si)
                                      or whatever you 32bit-speak chaps do


You're mixing 8 bit apples and 16bit bananas into a bag for 32bit oranges here.



sinsi

eek: look here - with all that masm32 stuff, don't know why it's in the 16-bit forum...
Light travels faster than sound, that's why some people seem bright until you hear them.