I need to define some terms that have to do with addressing. You know the word byte
it's 8 bits. It's the smallest addressable unit on the computer. That is,
when a computer address is specified it is the unique address of 1 byte. Adding
1 to the address moves it to the next byte. The next sized item is called Word.
A Word is in 2 bytes Ð 16 bits. To move an address from one Word to another, it is
necessary to add 2 to the address. You'll find that a lot of the instructions
operate on Words, which mean they operate on 16 bits as if they were a single
unit. Next comes the Double Word, often written as Dword, and it's 4 bytes Ð 32
bits. To move an address from one double word to the next, add 4. The next step
up is the Quad Word. It's 8 bytes long, or 64 bits. This is about as long a
single data item as you'll encounter. It's common to work with integers this
long and some of the longer floating point formats are 64 bits long, but the
hardware doesn't stop there. The next size is 10 bytes. Now, this one doesn't
come up that often, but it does happen. Next is a Paragraph, which is 16 bytes.
It has a special hardware meaning I'll tell you about in a minute. The next
boundary is called a Page, which is 256 bytes and is used for things like
buffering and IO operations. And, finally we come to the Segment, which is
65,535 bytes, the actual number of bytes in 64K. You can declare any 64K block
of memory to be a segment, but the segment must begin on the same boundary as a
paragraph. That is, the address of the start of a segment must be a multiple of
16. In working with Assembly Language, you'll come across these sizes and
boundaries quite often so you need to know them. For example, some instructions
are designed to work with a double word and to understand it you'll need to
know that a double word is 32 bits. And the computer can be operated in
different modes. The mode determines how much memory can be addressed and where
that memory is located. In Real Mode it's only possible to address 64K of
memory at any one time. The Flat Model uses 16-bit addressing, so it can only
address 64K of memory. The Segmented Memory Model makes it possible for the CPU
to address a total memory space of 1 megabyte, but it uses a 16-bit address so
that you only get to a 64K chunk of that 1 megabyte at any one time. Such a
chunk is called a Segment. Addressing is done with two 16-bit Registers. One of
them is the Base Register. It holds the address of the beginning of the 64K
Segment, the other one holds the offset from the beginning of the Segment to
the byte being addressed. This is the type of addressing used by DOS and
Windows before NT. Using this type of addressing is ugly. You have to keep
track of some strange things and remember some strange rules. The Protected
Flat Model is the flat 32-bit address space that has become used almost
universally these days. It is set up and controlled by the Operating System,
usually Linux or Windows. The programs can then use the full 32-bit address
space. The space addressed by one program goes from an address of zero to 4
gigabytes. The Segment Registers are still there, but an application program
can't mess with them. They're set by the Operating System. These Segment
Registers have a new job. They prevent your program from diddling with things
that they shouldn't; that's the protected part. The protected area may be
within your 4 gigabytes of space but if you try to access it you will get an
error. When a program executes it moves through a set of instructions one at a
time executing each one in turn. It may encounter an instruction that jumps to
another location, but that's just a matter of the program selecting a different
next instruction. But there is one important exception to this flow: the
interrupt. At any time during the execution of a program an outside stimulus
can cause the normal flow of a program to be interrupted. When this happens the
program stops doing whatever it was doing. This usually happens right in the
middle of something, it doesn't matter. The values in the registers are
carefully preserved. The address of the next instruction to be executed is also
saved. A special routine is called to handle the interrupt. It's normally some
form of input or output. For example, the user could have pressed a key on the
keyboard. It's important that the program service the interrupt by reading the
identity of the key before another keystroke overwrites that in the port. Once
done, the interrupt routine turns control back to the main program. Everything
picks up where it left off and things continue as if nothing had happened. Then
the program, at its leisure, can take a look at whatever input or output may
have occurred and act accordingly. I'll be showing you specific examples of how
this works in later lessons.
Assembly Language Programming
Arthur Griffith
US$ 99.95
5.5 hours - 70 Movies
Win Vista XP 2000,ME. Mac OS X
Ground / 2 day / Next Day
33995
285 In Stock
Apex Web Media ( Hyperteach ) P.O Box 398 Bolton BL7 9YS, United Kingdom. Tel: +44 (0) 1204 592071 Fax: +44 (0) 1204 592092 Email:
Apex Web Media ( Hyperteach ) 600 17th Street, Suite 2800, Denver CO 80202 Tel: Toll free 1866 402 1903 (USA) / 434 878 4158 Fax: 1 207 433 4356 Email: