The MASM Forum

General => The Campus => Topic started by: Lonewolff on March 16, 2016, 09:09:01 AM

Title: Basic register usage
Post by: Lonewolff on March 16, 2016, 09:09:01 AM
Hi Guys,

Is there a list of what registers are available and what their general usage is?

I have worked out that EAX generally holds the return value of an 'invoke' call and EBX and EDX seem to work for general purpose use.

But I have found that if I attempt to use ECX for general use I get crashy behaviour going on.

Any advice is greatly appreciated :)
Title: Re: Basic register usage
Post by: Siekmanski on March 16, 2016, 12:02:11 PM
Download: http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html

Preserve ecx,

Push ecx

use ecx and do your stuff here.

pop ecx
Title: Re: Basic register usage
Post by: Lonewolff on March 16, 2016, 01:03:56 PM
Thanks again dude :)
Title: Re: Basic register usage
Post by: jj2007 on March 16, 2016, 02:33:27 PM
My tips page (http://www.webalice.it/jj2006/Masm32_Tips_Tricks_and_Traps.htm) has a section on register usage. See in particular also the .if eax<0 part ;-)
Title: Re: Basic register usage
Post by: Lonewolff on March 16, 2016, 09:33:43 PM
Good read JJ. I'm learning a massive amount today.

(so much so, that I even started a little gamepad API and got my XBox 360 controller detected in MASM - I'll finish that one off tomorrow  8))