These tutorials are highly useful in the development of win32 applications through the assembly language. However, I am finding that the information provided doesn't properly explain the registers.

1. How do you know which registers to use? There are so many types!!!
2. Are all registers 16 or 32 bit?
3. Tutorial 5 discusses an RGB macro, where is the registers in this macro properly explained?
4. Tutorial 8 discusses menus and uses the following code

mov eax, wParam
.IF lParam == 0

a) What is the relationship between eax and ax in this sample code?
b) Why is ax used to compare against the messages and not eax?
5. In Tutorial 10 - Dialog Box as Main Window - Why is edx used in the following code?

mov edx, wParam
shr edx, 16
  .IF ax == IDC_BUTTON

Again, what is the relationship between edx, dx and ax?

Are there tutorials available which discusses registers in more detail? Hopefully also providing step by step practice opportunities with full discussion of code?
Posted on 2007-01-03 20:20:46 by tornado
1) Try not to touch ESP and EBP. EAX is used for return value and ECX is usually used as a counter. Any registers can be used in anyway, except in certain instructions like div etc etc. When using EDI, ESI and EBX on windows, remember to preserve their values.

2) The 32bit registers are EAX, EBX, ECX, EDX, EDI, ESI, ESP, EBP. The 16bit version of them are AX, BX, CX, DX, DI, SI, SP, BP. Most of the time we are using the 32bit registers.

4a) AX is part of the EAX. It is either the lower 16bit or the higher 16bit. I can't really recall now and I don't really have the means to check it out. So I guess you will need to wait for someone else to answer that question.

b) It is because only that part contains the information needed to compare.

5) It is because the upper 16bit of the lparam contains the required information. Refer to msdn for the return values.

Posted on 2007-01-03 22:46:46 by roticv
A full "tutorial" on asm:
Posted on 2007-01-03 23:35:39 by Ultrano
You're absolutely right.
A couple of years ago, at the request of a number of individuals, I wrote a series of tutorials aimed at bridging the gaps between 'total village idiot' and 'absorber of iczelions tutorials'.
These included such illustrious titles as 'Masm for Morons',  'My first book of number systems', and 'Registers - a guidebook for tourists'. All together there was over a dozen tutorials, none of them were huge, and all were written for the layman.

Google should be able to turn up references to these, but if not, I'll dig them up and repost them.
Posted on 2007-01-04 03:05:58 by Homer
Thank you everybody for your very helpful responses.

Homer:  I have searched google for your titles and haven't located them, could you please post a link to these?
Posted on 2007-01-04 08:20:03 by tornado