КАТЕГОРИИ: Архитектура-(3434)Астрономия-(809)Биология-(7483)Биотехнологии-(1457)Военное дело-(14632)Высокие технологии-(1363)География-(913)Геология-(1438)Государство-(451)Демография-(1065)Дом-(47672)Журналистика и СМИ-(912)Изобретательство-(14524)Иностранные языки-(4268)Информатика-(17799)Искусство-(1338)История-(13644)Компьютеры-(11121)Косметика-(55)Кулинария-(373)Культура-(8427)Лингвистика-(374)Литература-(1642)Маркетинг-(23702)Математика-(16968)Машиностроение-(1700)Медицина-(12668)Менеджмент-(24684)Механика-(15423)Науковедение-(506)Образование-(11852)Охрана труда-(3308)Педагогика-(5571)Полиграфия-(1312)Политика-(7869)Право-(5454)Приборостроение-(1369)Программирование-(2801)Производство-(97182)Промышленность-(8706)Психология-(18388)Религия-(3217)Связь-(10668)Сельское хозяйство-(299)Социология-(6455)Спорт-(42831)Строительство-(4793)Торговля-(5050)Транспорт-(2929)Туризм-(1568)Физика-(3942)Философия-(17015)Финансы-(26596)Химия-(22929)Экология-(12095)Экономика-(9961)Электроника-(8441)Электротехника-(4623)Энергетика-(12629)Юриспруденция-(1492)Ядерная техника-(1748) |
Structure of assembly program log.exe
В моей работе я исследовал алгоритмы работы логических операций на основе полученных данных в течении семестра. Я использовал логические опарторы И(and), ИЛИ(or), Исключающие ИЛИ(xor) и Отрицание(not). The AND instruction is used for supporting logical expressions by performing bitwise AND operation. The bitwise AND operation returns 1, if the matching bits from both the operands are 1, otherwise it returns 0. For my example I use HEX 5FFF and 2345. In binary system 5FFF is 10111111111111, 2345 is 10001101000101. Then, when I used command AND I get HEX 0234. 10001101000101 That 0234 HEX. In 13 line i use MOV instruction that is used for moving data from one storage space to another. The MOV instruction takes two operands. First operand is ax and second is 5FFFh. I copy in register AX hex number 5FFF. Register AX I used for arithmetic operation with my logic operator. Потом я провожу логическую операцию И. Для ее использования нужно 2 операнда. First operand is ax and second is 2345h. Cохраняю результат копируя значения АХ в переменную REZ.
Переменную REZ я инициализировал в 4 строке. Инициализируется переменная в несколько этапов. Изначально мы выделяем память в сегменте стека. Segmented memory model divides the system memory into groups of independent segments referenced by pointers located in the segment registers. Each segment is used to contain a specific type of data. One segment is used to contain instruction codes, another segment stores the data elements, and a third segment keeps the program stack. In the light of the above discussion, we can specify various memory segments as − · Data segment − It is represented by .data section and the .bss. The.data section is used to declare the memory region, where data elements are stored for the program. This section cannot be expanded after the data elements are declared, and it remains static throughout the program. The.bss section is also a static memory section that contains buffers for data to be declared later in the program. This buffer memory is zero-filled. · Code segment − It is represented by .text section. This defines an area in memory that stores the instruction codes. This is also a fixed area. · Stack − This segment contains data values passed to functions and procedures within the program. В программе я выделил 256 байт командой DB 256 DUP(0) DB – одно слово(1 байт, 8 бит) 256 – количество байтов DUP – дубликат (0)- стартовое значения слова.
В сегменте даты я занимался последним шагом объявление переменной. rez Dw 1 DUP(0) rez – название DW – 2 слова(2 байта, 16 бит) Информацию о регистрах можно посмотреть в таблице 4. В 2 программе я использовал логический оператор ИЛИ. The OR instruction is used for supporting logical expression by performing bitwise OR operation. The bitwise OR operator returns 1, if the matching bits from either or both operands are one. It returns 0, if both the bits are zero.
Я показал использование инструкции ИЛИ для 1 байта. Для примера были взяты числа 29 HEX и 45 HEX. Командой Mov поместил в переменную ax число 29HEX. Дальше использовал логический оператор OR и к первому операнду AX додал второй операнд 45 HEX. В результате получил число 6D HEX. 00101001 Number 29 HEX in binary system is 00101001, 45 HEX in binary system is 01000101, 6D in binary system is 01101101, so answer is correct. Дальше для сохранения результата я использовал команду OFFSET. mov bx, OFFSET REZ OFFSET will get the address of a variable which already has it's address allocated. This in turn means, OFFSET could be used to get the address of global variables only. We cannot receive the address of a local variable by using OFFSET as the address of a local variable is not decided during assembly time. Для переменной REZ я выделяю память в ячейку BX. Mov [bx],ax На выделеную память копирую значение з регистра AX.
В программе 3 я использовал два оператора XOR и NOT. The XOR instruction implements the bitwise XOR operation. The XOR operation sets the resultant bit to 1, if and only if the bits from the operands are different. If the bits from the operands are same (both 0 or both 1), the resultant bit is cleared to 0. The NOT instruction implements the bitwise NOT operation. NOT operation reverses the bits in an operand. The operand could be either in a register or in the memory. В программе как и для оператора AND я использовал числа 5FFF и 2345. 10001101000101 Registers meanings in table 6
Table 3
Table 4
Table 5
Table 6
Дата добавления: 2017-01-14; Просмотров: 254; Нарушение авторских прав?; Мы поможем в написании вашей работы! Нам важно ваше мнение! Был ли полезен опубликованный материал? Да | Нет |