Hi BogdanOntanu,

I use the same technique for my structures as you
use in your example below.

But I have a problem.
I can not use the following instruction:
mov , ecx

I always get an undefined symbol for fildd01
when I assemble.
So I have to compute the offset into the structure
and use:
eax = offset
mov , ecx

Is there a way to tell the assembler that field01
belongs to esi?


;----------------------------------------
;define one array element
;----------------------------------------
Array_element STRUC
field01 dd ?
field02 dw ?
field03 db ?
Array_element ENDS
;-----------------------------------------
; define 1000 elements array
;-----------------------------------------
Array_base Array_element 1000 dup (<?> )

;----------------------------------------------
;calculate base addres of element N
;----------------------------------------------
mov esi,offset Array_base
mov eax,N
mov ebx,SIZE Array_element
mul eax,ebx
add esi,eax
;----------------------------------
; start updating element N
;----------------------------------
mov ,ecx ;dword


Thanks,

Ewayne
Posted on 2001-12-29 23:16:25 by Ewayne
Wasn't it something like

mov (Array_element ).field01, ecx

I really don't remember.
=)
Posted on 2001-12-30 02:45:21 by GogetaSSJ4
it allways works in TASM :)

after all field01 is 0 , filed02 is 4 etc just offsets from structure start. I guess MASM is more strict about this facts. you should try:

assume esi: DWORD PTR Array_element
; ... your code here..
assume esi:nothing

or use:
mov dword ptr , ecx

and even:
mov , ecx

should work, its possible that MASM wants you to "typedef" Array_element for this to work.... i am just happy with TASM :)
Posted on 2001-12-30 07:30:26 by BogdanOntanu
To GogetaSSJ4,

mov (Array_element ).field01, ecx

Thanks, but I don't want to use the structure name.


To BogdanOntanu,

I know the assume works, but thats an extra step.

Your other two suggestions don't work and I have
tried typedef.

Thanks,

Ewayne
Posted on 2001-12-30 08:01:55 by Ewayne