"IBM personal computer assembly language tutorial" - читать интересную книгу автора (Auerbach J.)

aren't very vital and are covered too sketchily to be of any real help.
The reason I like the Morse book is that you can just read it; it has a
very conversational style, it is very lucid, it tells you what you really
need to know, and a little bit more which is by way of background; because
nothing really gets belabored to much, you can gracefully forget the things
you don't use. And, I very much recommend READING Morse rather than study-
ing it. Get the big picture at this point.

Now, you want to concentrate on those things which are worth fixing in mem-
ory. After you read Morse, you should relate what you have learned to this
outline.

1. You want to fix in your mind the idea of the four segment registers
CODE, DATA, STACK, and EXTRA. This part is pretty easy to grasp. The
8086 and the 8088 use 20 bit addresses for memory, meaning that they
can address up to 1 megabyte of memory. But, the registers and the
address fields in all the instructions are no more that 16 bits long.
So, how to address all of that memory? Their solution is to put
together two 16 bit quantities like this:

calculation SSSS0 ---- value in the relevant segment register SHL 4
depicted in AAAA ---- apparent address from register or instruction
hexadecimal --------
RRRRR ---- real address placed on address bus

In other words, any time memory is accessed, your program will supply a
sixteen bit address. Another sixteen bit address is acquired from a
segment register, left shifted four bits (one nibble) and added to it
to form the real address. You can control the values in the segment
registers and thus access any part of memory you want. But the segment
registers are specialized: one for code, one for most data accesses,
one for the stack (which we'll mention again) and one "extra" one for
additional data accesses.

Most people, when they first learn about this addressing scheme become
obsessed with converting everything to real 20 bit addresses. After a
while, though, you get use to thinking in segment/offset form. You


IBM PC Assembly Language Tutorial 4


tend to get your segment registers set up at the beginning of the pro-
gram, change them as little as possible, and think just in terms of
symbolic locations in your program, as with any assembly language.

EXAMPLE:
MOV AX,DATASEG
MOV DS,AX ;Set value of Data segment
ASSUME DS:DATASEG ;Tell assembler DS is usable