Defining Segments
You have already defined two segments in your programs, because
the .DATA (and .CODE) directive is the equivalent to:
@data SEGMENT PUBLIC
.... data declarations ....
@data ENDS
Segments not declared to be PUBLIC are assumed to be PRIVATE. That
means that if separately compiled procedures are link with the
same segment name, they will not be combined.
There is an AT option:
Video SEGMENT AT 0B800h
.... data declarations ....
Video ENDS
This assumes that you are using a Color Graphics Adaptor (CGA)
that starts at 0b800:0h. Note that AT segments do not generate any
code or data of their own, they just give you a symbolic menas to
reference things that already exist at predefined locations.
An extension of this is where physical address 410h is word
that uses bits 4 and 5 to specify whether the display is
color (10B or monochrome(11B):
BIOSData SEGMENT AT 40h
ORG 10h
EquipList DW ?
BIOSData ENDS
Then we can have:
mov AX, BIOSData
mov es, AX
ASSUME es : BIOSData
test EquipList, 10000B
jz Color
(The BIOS INT 11 call which returns the equipment
list is a much safer and more machine-independent method of getting
the equipment list.)
SEGMENT AT 40h and ORG 10h put EquipList at address 40h:10h or
40h * 16 + 10h which is 410h. This could have been represented
as 0h:410h, 41h:0 or 25h:1C0h. You are responsible to insure
that the proper paragraph is put into the segment register.
UMBC |
CSEE |