Ввод-вывод информации средствами BIOS и DOS. Работа с консолью

Страницы работы

3 страницы (Word-файл)

Содержание работы

Рудов Д.П. ЭМ - 41

Лабораторная работа №1

Ввод-вывод информации средствами BIOS и DOS.

Работа с консолью.

Цель работы: получить практические навыки разработки и отладки простейших программ на Ассемблере. Изучить порядок использования средств BIOS и DOS для обмена с консолью в программах на Ассемблере.

1)  Использованные функции:

a)  AH = 08h

INT 21h

Ввод с клавиатуры без эха с проверкой на CTRL+Break и ожиданием.

b)  AH = 06h

INT 10h

Очистка экрана

c)  AH = 02h

INT 10h

Установить положение курсора

d)  AH = 0Eh

INT 10h

Вывести символ в режиме телетайпа

e)  AH = 09h

INT 21h

Записать строку в STDOUT с проверкой на CTRL+Break

2)  листинг программы

; proga

              .model          tiny

              .code            

              org               100h

Start:

              mov              ah,08h

              int                21h

              cmp              al,64h

              jnz                Next

              jmp              Dos

Next:       cmp              al,62h

              jz                 Bios

        ret

Bios:

              mov              ax, 0600h     

              mov              bh, 07h        

              mov              cx, 0000h

              mov              dx, 0184fh    

              int                010h                                

              mov              ah, 02h                                                

              mov              bh, 00h                                                

              mov              dh, 05                                                 

              mov              dl, 012                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, " "                                                  

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 02h                                                

              mov              bh, 00h                                                

              mov              dh, 06                                                 

              mov              dl, 012                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, " "                                                  

              mov              bh, 00h                                               

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, " "                                                  

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 02h                                                

              mov              bh, 00h                                                

              mov              dh, 07                                                 

              mov              dl, 012                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, " "                                                  

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, " "                                                  

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 02h                                                

              mov              bh, 00h                                                

              mov              dh, 08                                                 

              mov              dl, 012                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, "*"                                                 

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              mov              ah, 0Eh                                                

              mov              al, " "                                                  

              mov              bh, 00h                                                

              mov              bl, 0f0h                            

              mov              cx, 05h                                                

              int                010h                                                   

              ret

Dos:

              mov              ah,9

              mov              dx,offset message

              int                21h

              ret

message                       db                "ima!",'$'

              end               Start

3)  при вводе символа “d”

Microsoft Windows 2000 [Версия 5.00.2195]

(С) Корпорация Майкрософт, 1985-2000.

J:\Asm>dima3

ima!

J:\Asm>

при вводе символа “b”

            ***

            *  *

            *  *

            ***

J:\Asm>

Вывод: для работы с консолью предоставлено большое количество функций BIOS и DOS, но более обширное количество функций предоставляется средствами BIOS, которые поглощают в себя все функции DOS, но в то же время функции DOS более короче и удобнее в использовании.

Похожие материалы

Информация о работе