flat assembler
Message board for the users of flat assembler.

Index > Windows > Register Usage

Author
Thread Post new topic Reply to topic
Kuemmel



Joined: 30 Jan 2006
Posts: 198
Location: Stuttgart, Germany
Kuemmel
Hi people,

as far as I understood x86 assembly, I can use EAX,EBX,ECX,EDX and also ESI and EDI for general purpose stuff. So is that 6 registers all that are available ? I would like to have more to minimize memory access sometimes...

I know that there are EBP, ESP and EIP. But I think as long as I use subroutines in my code these can't be used for general purpose. Is that right ? Or in which case I could use these also ?
Post 18 Jul 2006, 15:57
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
right.

EIP is not general-purpose register, and you can't directly access it.
ESP is pointer to top of stack, when it's value is changed "push", "call", "ret" etc. instructions won't work
EBP is used as frame pointer in procedures, you can use it yourself, but not inside "proc" - declared procedure. i suggest not to use it unless you know what you are doing.
Post 18 Jul 2006, 16:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
The thread is in 'Windows' section so remember that you have to preserve EBX, EDI and ESI. Push them, use in any way you want and pop them to return their values.
Post 19 Jul 2006, 19:00
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Reverend: you forgot EBP... there are so called "leaf" procs which don't have stack frame even in "good" win32 code
Post 19 Jul 2006, 22:05
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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-2020, Tomasz Grysztar.

Powered by rwasa.