Студопедия

КАТЕГОРИИ:

АстрономияБиологияГеографияДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРиторикаСоциологияСпортСтроительствоТехнологияФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника


End begin ;The end of the text with an entry point




It should be noticed, that:

- the text may be inputted as by capital, so by small letters, as the translator perceives them as the same:

- every sentence can occupy only one string(line) of the text;

- comments are separated from sentences by “;”;

There are three segments described by the program: instructions segment with a name code; data segment with a name data and segment of a stack with a name stk. Description of any segment begins with a key word(directive) segment, anticipated by an arbitrary name, and completed by the key word(directive) ends, it is also necessary to point out its name before these key words(it is important for the translator). Segments names can be chosen arbitrarily . The order of segments description is not of great importance (as a rule), but sometimes the order may eliminate possible inadequate interpretation of instructions, which refer to data which have not been described yet .But the chosen here order is preferable for the debugging process. It is important to remember, that in RAM these segments will be located in the order, which coincides with the order of the segments description in the given program.

Text of any program is completed by a directive end, before which the entry point (in our program the entry point is begin) must be pointed .

One more directive is used in this program:

assume CS:code,DS:data

The correspondence of the instructions segment code to the segment register CS and of the data segment to the segment register DS is established here. The first announcement says that this segment is a segment of instructions, and all labels belong to this segment, it helps the assembler (translator) correctly interpret jumps instructions. The second announcement helps the assembler correctly process sentences, in which calls to the data fields take place. There are two segment registers in the microprocessor (DS and ES), and we may use any of them for an access to the memory. It is obvious, that processor must “know” in which of these registers is located the segment address of the instruction to be executed (instructions of access to the memory through registers DS and ES are coded differently). By the way, it doesn’t follow from here, that at the moment of the instruction execution the DS register will contain the segment address of the required segment. The directive assume influences only on the type of instructions coding but it doesn’t influence on the contents of segment registers. That is why any program must be started by sentences, in which the segment address of that segment, where the data is contained is inputted into the segment register (as a rule, it is the register DS). In the considered program it is realized with help of two instructions:


Поделиться:

Дата добавления: 2015-09-14; просмотров: 80; Мы поможем в написании вашей работы!; Нарушение авторских прав





lektsii.com - Лекции.Ком - 2014-2024 год. (0.008 сек.) Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав
Главная страница Случайная страница Контакты