flat assembler
Message board for the users of flat assembler.
Index
> Windows > C to ASM |
Author |
|
dacid 06 Sep 2008, 07:47
PSOMESTRUCT *AnyName = NULL;
Thx in advance. |
|||
06 Sep 2008, 07:47 |
|
okasvi 06 Sep 2008, 08:07
Code: AnyName dd 0 ;ptr to SOMESTRUCT I like these easy questions too.. |
|||
06 Sep 2008, 08:07 |
|
dacid 06 Sep 2008, 10:20
i need some sleep before asking haha
But i need more help accesing some values in SOMESTRUCT: AnyName[dwIndex]->Value |
|||
06 Sep 2008, 10:20 |
|
dacid 06 Sep 2008, 11:41
forgive me if im wrong but i need to acces "value" in structure
|
|||
06 Sep 2008, 11:41 |
|
dacid 06 Sep 2008, 11:44
PSOMESTRUCT *AnyName = NULL;
PSOMESTRUCT typedef ptr SOMESTRUCT SOMESTRUCT STRUCT .. .. .. SOMESTRUCT ENDS |
|||
06 Sep 2008, 11:44 |
|
edfed 06 Sep 2008, 12:26
yes, of course.
|
|||
06 Sep 2008, 12:26 |
|
dacid 06 Sep 2008, 13:50
I still dont get it...
AnyName is a pointer to an array of pointers. SOMESTRUCT STRUCT value1 DWORD ? value2 LPBYTE ? .... value5 LPSTR ? SOMESTRUCT ENDS How i access to value5? mov eax,index mov esi,anyname mov eax,[esi+eax].value5 <- i need something like this index can be 1,2,3,4 and later i need to INC index and check again value5. Excuse my poor english. |
|||
06 Sep 2008, 13:50 |
|
dacid 06 Sep 2008, 14:01
Something like this?
mov esi,AnyName assume esi:PTR SOMESTRUCT xor eax,eax mov ax,Index mov eax,[esi+eax].SOMESTRUCT.Value5 inc Index I think i need to MUL the SOMESTRUCT size by index or something. |
|||
06 Sep 2008, 14:01 |
|
LocoDelAssembly 06 Sep 2008, 15:44
In general:
Code: mov ebx, array mov esi, index imul esi, sizeof.structure mov {eax|ax|al}, [ebx+esi+structure.field] |
|||
06 Sep 2008, 15:44 |
|
dacid 06 Sep 2008, 17:16
ok, seems more clear now...
can you explain me this? mov eax,[esi+eax*4] why *4? |
|||
06 Sep 2008, 17:16 |
|
edfed 06 Sep 2008, 17:23
eax*4 is a dword ptr
the processor can apply a scale to registers in addressing. *1 *2 *3 *4 *5 *8 *9 [eax] [eax*1+eax] [eax*2] [eax*2+eax] [eax*4] [eax*4+eax] [eax*8] [eax*8+eax] to access multidimentional arrays, it is the best, use a set of registers to accelerate the addressing. and to accelerate address calculation, you can use LEA reg,[reg+reg*s+offset] |
|||
06 Sep 2008, 17:23 |
|
dacid 06 Sep 2008, 20:12
thx to all who reply! i learned a lot
|
|||
06 Sep 2008, 20:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.