╖ A newbie guide to Assembler programing ╖

╖ Registers ╖

© 1997 by Cruehead / MiB


Registers.

Now, this is a word you'll hear quite a lot in the future. Registers can be compared with variables in a high level language. What it accually is is a place in the CPU where numbers can be stored and manipulated. There are 4 diffrent kinds of registers, general purpose registers, stack registers, segment registers and index registers.


General purpose registers:

These registers are 16 bits large, and there are four of them - AX,BX,CX and DX. They are all split up in 8 bits registers, AX is split up into AL (low byte) and AH (high byte), and BX is split up into BL and BH and so on...here is an example:

Lets say that AX=1234. Then AL=34 (the low bytes) and AH=12 (the high bytes).

On the 386 and above, there are also 32 bits registers, which have the same name as the 16 bits registers but with an E infront of their names (EAX,EBX,ECX,EDX).


Stack registers:

BP and SP are the two stack registers. We will describe what the stack is and what it's good for here.


Segment registers:

there are four of them (6 on the 386 and above):

CS - Code segment. This is the block of memory where the code is located
DS - Data segment. This is where data can be accessed. When dealing with string operations this is often the source segment.
ES - Extra segment. Simply an extra segment that also can be used as a data segment. This is often the source segment when dealing with string operations.
FS - Just another segment (only 386+), seldom used in cracking
GS - And yet another one (only 386+), seldom used in cracking.


Index registers:

These are "pointer registers" and is very often used for instructions involving strings. There are only two of them, and they are 16 bits large (on the 386+ you can put an E infront of them and make them 32 bits large):

SI - Source Index. Used by string operations as the source.
DI - Destination Index. Used by string operations as the destination.

BX can also be used as an index register. These register are used together with the segment registers as an offset.
So, what does DS:SI mean then? Well, simply that DS points to the datasegment and SI is an offset in the datasegment.


Back to Asm tutorial page!Back to Asm tutorial page...
Back to Main page!Back to Main page...

Copyright © MiB 1997. All rights reversed.