flat assembler
Message board for the users of flat assembler.

Index > Main > pointer to structure

Author
Thread Post new topic Reply to topic
HarryTuttle



Joined: 26 Sep 2003
Posts: 211
Location: Poland
HarryTuttle 23 Jan 2004, 16:45
when I create the structure like:
Code:

do_nothing struc{

lazy_men_counter dd ?
lazy_woma_counter dd ?
}
    

I can get :

Code:
.data
room do_nothing
.code
mov eax,[room.lazy_men_counte]
    

now eax hold the number of men who do nothing

i C the code may looks like this:
Code:
int a =room.lazy_men_counter;
    

when I want to point the system memory I could not create any structure but just to get the pointer and point the place.
Code:
do_nothing * room;
room=getSystemOperation(); //not real function just set the pointer called 'room'
int a=room->lazy_men_counter;
    


How it could be done in ASM Question

THX
harry

_________________
Microsoft: brings power of yesterday to computers of today.
Post 23 Jan 2004, 16:45
View user's profile Send private message Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 23 Jan 2004, 16:50
Code:
        virtual at eax ;assuming that eax contains the pointer to the structure
        .nothing   do_nothing
        end     virtual
        mov     eax,[.nothing.lazy_men_counter ] 
    

If I am not wrong.
Post 23 Jan 2004, 16:50
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 23 Jan 2004, 17:03
You can use struct macro from struct.inc file (from both Fasm and Fresh packages):
Code:
do_nothing struc{ 

lazy_men_counter dd ? 
lazy_woma_counter dd ? 
}
struct do_nothing          ; <----------    


and now you can write:
Code:
mov ebx,[eax+do_nothing.lazy_man_counter]

(assuming that eax contains pointer to your structure)    


regards
Post 23 Jan 2004, 17:03
View user's profile Send private message Visit poster's website Reply with quote
fasm9



Joined: 19 Jun 2003
Posts: 439
fasm9 23 Jan 2004, 22:36
Hi, still i considering a compiler written in FASM, but,

C#(vs.net, mono) produce il assembly,
if (let me say this again, if) FASM understand il assembly, life is much easier.

--
Post 23 Jan 2004, 22:36
View user's profile Send private message Reply with quote
HarryTuttle



Joined: 26 Sep 2003
Posts: 211
Location: Poland
HarryTuttle 25 Jan 2004, 00:10
Decard! Fantastyczne, dzięki za pomoc!

_________________
Microsoft: brings power of yesterday to computers of today.
Post 25 Jan 2004, 00:10
View user's profile Send private message Reply with quote
BiDark



Joined: 22 Jun 2003
Posts: 109
Location: .th
BiDark 25 Jan 2004, 03:35
roticv wrote:
Code:
        virtual at eax ;assuming that eax contains the pointer to the structure
        .nothing   do_nothing
        end     virtual
        mov     eax,[.nothing.lazy_men_counter ] 
    

If I am not wrong.


May be this?

Code:
  virtual at eax
    eax.do_nothing do_nothing
  end virtual
    


So you can access like this:

Code:
  mov eax,[eax.do_nothing.members]
    
Post 25 Jan 2004, 03:35
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.