Advertisement
Guest User

Untitled

a guest
Oct 14th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. org 0x100
  2. section .text
  3.  
  4. mov ah, 0 ; Номер функции прерывания
  5. mov al, 0x13 ;Видеорежим - 0x2 или 0x13
  6. int 0x10 ; Прерывание
  7.  
  8. inf_loop:
  9.   mov dh, 0
  10.   mov dl, 0
  11.   mov bp, discs_msg
  12.   call draw_string
  13.   mov al, 14h
  14.   out 0x70, al
  15.   in al, 0x70
  16.   call draw_discs_amount
  17.  
  18.   mov dh, 1
  19.   mov dl, 0
  20.   mov bp, display_type_msg
  21.   call draw_string
  22.   mov al, 14h
  23.   out 0x70, al
  24.   in al, 0x70
  25.   call draw_monitor_type
  26.  
  27.   mov dh, 2
  28.   mov dl, 0
  29.   mov bp, keyboard_connected
  30.   call draw_string
  31.   mov al, 14h
  32.   out 0x70, al
  33.   in al, 0x70
  34.   call draw_keyboard_connected
  35. jmp inf_loop
  36. ret
  37.  
  38. draw_string:
  39.   call set_cursor
  40.   draw_string_loop:
  41.     mov al, [bp]
  42.     cmp al, 0
  43.     je exit_draw_string
  44.     call draw_char
  45.     inc bp
  46.     inc dl
  47.     call set_cursor
  48.     jmp draw_string_loop
  49.   exit_draw_string:
  50.     ret
  51.  
  52. set_cursor:
  53.   mov ah, 2 ; Функция установки курсора
  54.   mov bh, 0 ; Какую страницу изменяем
  55.   int 0x10
  56.   ret
  57.  
  58. draw_char:
  59.   mov ah, 9 ; Выводит символ на экран в место курсора
  60.   mov bl, 5 ; Цвет
  61.   mov bh, 0 ; Страница, на которой выводить
  62.   mov cx, 1 ; Сколько раз выводить символ друг за другом
  63.   int 0x10
  64.   ret
  65.  
  66. draw_num:
  67.   add al, 48
  68.   call draw_char
  69.   ret
  70.  
  71. draw_discs_amount:
  72.   call set_cursor
  73.   push ax
  74.   shr al, 6
  75.   dec al
  76.   call draw_num
  77.   pop ax
  78.   ret
  79.  
  80. draw_monitor_type:
  81.   call set_cursor
  82.   and al, 00110000b
  83.   cmp al, 00000000b
  84.   je draw_display_type_00
  85.   cmp al, 00010000b
  86.   je draw_display_type_01
  87.   cmp al, 00100000b
  88.   je draw_display_type_10
  89.   cmp al, 00110000b
  90.   je draw_display_type_11
  91.   ret
  92.   draw_display_type_00:
  93.     mov bp, display_type_00
  94.     call draw_string
  95.     ret
  96.   draw_display_type_01:
  97.     mov bp, display_type_01
  98.     call draw_string
  99.     ret
  100.   draw_display_type_10:
  101.     mov bp, display_type_10
  102.     call draw_string
  103.     ret
  104.   draw_display_type_11:
  105.     mov bp, display_type_11
  106.     call draw_string
  107.     ret
  108.  
  109. draw_keyboard_connected:
  110.   call set_cursor
  111.   and al, 00000100b
  112.   cmp al, 0
  113.   jz draw_keyboard_connected_no
  114.   mov bp, yes
  115.   call draw_string
  116.   ret
  117.   draw_keyboard_connected_no:
  118.     mov bp, no
  119.     call draw_string
  120.     ret
  121.  
  122.  
  123. section .data
  124. discs_msg db 'Floppy discs installed: ', 0
  125. display_type_msg db 'Display type: ', 0
  126. display_type_00 db 'EGA/VGA', 0
  127. display_type_01 db '40x25 CGA', 0
  128. display_type_10 db '80x25 CGA', 0
  129. display_type_11 db 'MDA', 0
  130. keyboard_connected db 'Keyboard connected: ', 0
  131. yes db 'Yes', 0
  132. no db 'No', 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement