.data
myarray dword 20,21,22,23,24,25

_______________________________________________________________________


invoke LoadBitmap,hInstance,myarray[0]





The above array is a set of bitmap IDs

I can get the first element of the array but no others.

I have tried myarray[4] to get the second element because they are dword in size

What am i doing wrong?

Am i referencing the array incorrectly?

Any help appreciated.:mad:
Posted on 2001-08-19 17:46:40 by titan
Increment the array index in 4's. I think it is somthing to do with moving by one bit insead of dword??

See(where by a messege box with '>' in both messege box fields is displayed):



.586p
.model flat,STDCALL
extrn MessageBoxA:PROC
extrn ExitProcess : PROC

.data
myarray dword 64,62,22,23,24,25

.code
start:
xor eax, eax
call MessageBoxA, eax, offset [myarray[4]], offset [myarray+4], eax

call ExitProcess
end start

Posted on 2001-08-19 18:05:24 by -T-
Argh! emptyness !
Posted on 2001-08-19 23:24:36 by latigo
Here's some quick code that will help you understand.
Hope it helps.

Latigo

--------------------------------------------------------------------------------



.586p
.model flat,STDCALL

.DATA
myarray dword 61h,62h,63h,64h,65h,66h

.CODE

start:

XOR ECX,ECX
@@:
LEA EAX,myarray
MOV EBX,[EAX+ECX*4]
CMP ECX,5
INC ECX
JB @B

RET



end start
Posted on 2001-08-19 23:32:47 by latigo
array[1] give you the second elt if you declare
array as a dword array

oh... i'm not so sure...

(s)
Posted on 2001-08-20 06:18:44 by (scalp)
Why not post your code. Using myarray[4] should work fine so maybe something else is wrong.
Posted on 2001-08-20 07:25:02 by Eóin
This became my solution! Its still too cumbersome but it works.
Must be an easier method to access the array.

.DATA
my_array dword 20,0,0,22,300,200,23,25,25,24,108,25,25,188,25

____________________________________________________________

.while N < sizeof my_array
lea esi,my_array
add esi,N
mov eax, dword ptr
mov BMID,eax

add esi,4
mov eax, dword ptr
mov XPOS,eax
add esi,4
mov eax, dword ptr
mov YPOS,eax
add N,12
GETDIM
.endw
______________________________________________________________

GETDIM macro
invoke LoadBitmap,hInstance,BMID
mov hBitmap,eax
invoke SelectObject,cdc,hBitmap
mov obitmap,eax
invoke GetObject,hBitmap,sizeof buffer, addr buffer
lea esi,buffer
add esi,4
mov eax,dword ptr
mov wide, eax
add esi,4
mov eax,dword ptr
mov tal, eax
invoke BitBlt,hdc,XPOS,YPOS,wide,tal,cdc,0,0,SRCCOPY
invoke DeleteObject,hBitmap
invoke SelectObject,cdc,obitmap
endm
:alright:
Posted on 2001-08-20 10:37:53 by titan
i am now restructuring my program thanks to latigo

i guess it helped
Posted on 2001-08-21 05:33:50 by titan
Glad it helped :)
You're welcome dude !


Latigo
Posted on 2001-08-21 07:04:22 by latigo