.model tiny .code .startup jmp init old_09 dw 0, 0 buf db 'Mode: x; Columns: xx; Lines: 25',0 filled db 0 btn_shift db 0 ; 42 btn_alt db 0 ; 56 btn_m db 0 ; 50 new_09: push ds push es push ax push bx push cx push dx push di push cs pop ds in al, 60h cmp al, 42+80h je reset_shift cmp al, 56+80h je reset_alt cmp al, 50+80h je reset_m jmp if_fill reset_shift: mov btn_shift, 0 jmp stop reset_alt: mov btn_alt, 0 jmp stop reset_m: mov btn_m, 0 jmp stop if_fill: cmp filled, 1 ; если экран не заполнен информацией, jne catch ; то отправим отлавливать клавиши дальше, mov ax, 0500h ; иначе int 10h ; сменим страницу на 0 mov filled, 0 ; и уйдём в in al,61h push ax or al,80h out 61h,al pop ax out 61h,al mov al,20h out 20h,al pop di pop dx pop cx pop bx pop ax pop es pop ds iret catch: cmp al, 42 je set_shift cmp al, 56 je set_alt cmp al, 50 je set_m jmp stop set_m: mov btn_m, 1 jmp if_comb set_alt: mov btn_alt, 1 jmp if_comb set_shift: mov btn_shift, 1 jmp if_comb if_comb: mov ch, btn_alt test ch, 1 jz stop mov ch, btn_shift test ch, 1 jz stop mov ch, btn_m test ch, 1 jz stop jmp info info: mov ah, 0Fh ; получаем из BIOS int 10h ; видеорежим и количество столбцов add al, '0' ; заполняем видеорежим mov buf[6], al ; в буфере-шаблоне mov al, ah ; количество столбцов xor ah, ah ; делим на mov bl, 10 ; 10 div bl add ah, '0' mov buf[19], ah add al, '0' mov buf[18], al mov ax, 0B900h ; 1 страница mov es, ax xor di, di xor bx, bx mov ah, 1Bh @@1: mov al, buf[bx] stosw inc bx cmp buf[bx], 0 jnz @@1 mov filled, 1 mov ax, 0501h int 10h stop: pop di pop dx pop cx pop bx pop ax pop es pop ds jmp dword ptr cs:old_09 init: mov ax, 3509h int 21h mov old_09, bx mov old_09+2, es mov ax, 2509h lea dx, new_09 int 21h lea dx, init int 27h end