Let me preface this web page with this is messy - sorry. I'm going to try to come back to this page and fix it up once I get a few questions/comments back. I will cover this material better in class. --Barry
Now that you have seen the basics of how to work in Intel 80xxx Assembly, we should probably look at some of the details. Your book covers the different registers and the primary uses for these registers in some detail (p.22-23 ignore i386+ for now) and the flags (p.62-68). What is doesn't cover very well is effective addresses and what the segmentation is for in the Intel architecture.
This is one of those times, I wish I was in front of the board because it will be much easier to explain. However, I will try to do my best, and if you have any questions email me.
A register (DX, BP, etc) is 16-bits wide. With 16 bits, you can represent a number
What Intel did was to add segment registers. Segments are represented by another register (CS, DS, SS, ES) and they are added to another register to compute the effective address. For example, the instruction pointer (IP) register by default uses the code segment (CS) register to compute its effective address. Effective addresses are always computed as segment*16+offset. In hexidecimal, this is easy to do, simply shift the segment value by one position. Let's say our code segment is equal to
89AB + 1234 --------- 1ACEB
Why do we care about this? Well, one advantage of separate segments is protection of data. If we put our code in segment
Of course, advantages do not usually come without some added confusion. Please note that it is possible to represent an address in memory using many different combinations of segments and pointers.
79AB + 1334 --------- 1ACEB
78AB + 1344 --------- 1ACEB
In short, don't get too hung up on effective addresses, but understand that this is how they are computed. If you are using the debugger, you will want to locate some of your data or code and will need to type it in as a segment:offset. I will hopefully put up a short tutorial on how to use the Turbo Debugger in the next few days.
If you go back and look over the book, this may make a little more sense now. If not, please bring questions to class so I can review this material and not put you to sleep.Last Modified: January 26, 1999 - Barry E. Mapen