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

represent numbers in other forms of notation such as hex or bit, you gener-
ally use a trailing letter. For example,

21H
is hexidecimal 21,
00010000B
is the eight bit binary number pictured.

The next elements we should point to are the SEGMENT...ENDS pair and the
END instruction. Every assembler program has to have these elements.

SEGMENT tells the assembler you are starting a section of contiguous mate-
rial (code and/or data). The symmetrically named ENDS statement tells the
assembler you are finished with a section of contiguous material. I wish
they didn't use the word SEGMENT in this context. To me, a "segment" is a
hardware construct: it is the 64K of real storage which becomes address-
able by virtue of having a particular value in a segment register. Now, it


IBM PC Assembly Language Tutorial 17


is true that the "segments" you make with the assembler often correspond to
real hardware "segments" at execution time. But, if you look at things
like the GROUP and CLASS options supported by the linker, you will discover
that this correspondence is by no means exact. So, at risk of maybe con-
fusing you even more, I am going to use the more informal term "section" to
refer to the area set off by means of the SEGMENT and ENDS instructions.

The sections delimited by SEGMENT...ENDS pairs are really a lot like CSECTs
and DSECTs in the 370 world.

I strongly recommend that you be selective in your study of the SEGMENT
pseudo-op as described in the manual. Let me just touch on it here.

name SEGMENT
name SEGMENT PUBLIC
name SEGMENT AT nnn

Basically, you can get away with just the three forms given above. The
first form is what you use when you are writing a single section of assem-
bler code which will not be combined with other pieces of code at link
time. The second form says that this assembly only contains part of the
section; other parts might be assembled separately and combined later by
the linker.

I have found that one can construct reasonably large modular applications
in assembler by simply making every assembly use the same segment name and
declaring the name to be PUBLIC each time. If you read the assembler and
linker documentation, you will also be bombarded by information about more