You are on page 1of 2

LESSON1 - THE REGISTERS AND SEGMENTS ok, assembly is not a language like pascal or c because unlike them there

is no predefined command link let say "writeln", "printf", assembly doesn't provide those tools for you so how those assembly works, well first they have predefine registers : AX BX CX DX SP BP SI DI IP CS DS SS ES accumulator index Base index Count index Data index -\ all of these are the data holders -/

Stack pointer -\ Base pointer Source index all of these are the pointing and index storage Destination indec registers Instruction pointer -/ Code segment Data segment Stack segment Extra segment -\ all of these are segments holder -/

FLAGS - Holds some of the function conditions ok now to be more specific : Data registers : they each high AX BX CX DX are the basic registers for all the computer calcs, and position of the registers is 16bit and they are divided into two registers and low which are 8 bit : ah (high), al (lo) bh (high), bl (lo) ch (high), cl (lo) dh (high), dl (lo)

high is MSB - most significent byte lo is LSB - least significent byte Pointing registers : each of these registers has an unique job : SP BP SI DI IP is the offset of the stack (-n-) a pointer for the stack (-n-) is the source index, uses as an offset in memory transfers is the destination index, uses as an offset in memory transfers is the offset of the current instruction (-n-)

(-n-) means don't change unless you know what your'e doing Segment registers : CS DS SS ES is is is is the segment of the code (-n-) the segment (usually) of the data the segment for the stack (-n-) an extra segment, uses for memory transfers

Flags, will be disscussed later

now assembly works with segments and each segment max limit is 64K, so when we have a segment we will have to give it a definition, so we will need the command "Assume" which gives each one of the segments registers it's default segment, so lets see a typical assembly structure Sseg segment ; a semicolon (;) is a remark and will not be compiled db 10 dup (?) ends ; each segment has a name and the "segment" after it ; when we finished to define stuff in the segment ; we close it with ends (end segment) Dseg segment ends Cseg segment assume cs:cseg,ds:dseg,ss:sseg ends end know as we saw segment is built as follow : Name Segment . . . Ends know in the dseg all the data will be stored, in the sseg the stack and in the cseg the code.

You might also like