UMBC CMSC 211 |
The actual registers are:
Register | Name | for addesses in... |
---|---|---|
cs | Code Segment | call and jmp instructions and instruction fetches (using ip) |
ds | Data Segment | all other instructions. |
es | Extra Segment | when an extra segment register is needed. |
push | ds |
pop | es |
You can call a procedure that is in a different segment. This is known as a far call and both the original cs and ip pushed and popped. There are also far jumps possible.
When DOS loads a program, it gets the initial values of ss:sp and cs:ip from a short header record in the .EXE file. The stack starts at the first paragraph after the code and data segments and its size is the sum of all the values in the .STACK directives (which is what is loaded into the sp). The ip is loaded with the offset of the label that you provided in END Label directives in one of the source code files.