From 143f34d941f32e0808fc9344d4c4126ff530d64a Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 22 Oct 2020 21:03:24 +0400 Subject: =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20=D1=80?= =?UTF-8?q?=D0=B5=D1=88=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D1=81=D0=B5=D0=BC=D0=B5=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sem2/lab5/test.asm | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sem2/lab5/test.asm (limited to 'sem2/lab5/test.asm') diff --git a/sem2/lab5/test.asm b/sem2/lab5/test.asm new file mode 100644 index 0000000..4006e27 --- /dev/null +++ b/sem2/lab5/test.asm @@ -0,0 +1,105 @@ +.model small +.data +int09h dw 2 dup (0) +msg db "To exit press ESC! $" +tsr_end equ $ +; B_UP equ 1Ch ; вверх + +.stack 100h +.486 +.code + +; pNewInterrupt PROC far +; PUSHF + +; PUSH ax + +; in al, 60h ; Читаем сканкод +; cmp al, B_UP +; JE hotkey + +; ; ; Наш код +; ; mov dx, offset mesg +; ; MOV ah,09h +; ; INT 21h + +; POP ax +; POPF +; PUSHF + +; CALL cs:[int09h] +; jmp exit + +; hotkey: +; ; Обработка аппаратного прерывания +; in al,61h +; mov ah,al +; or al,80h +; out 61h,al +; xchg ah,al +; out 61h,al +; mov al,20h +; out 20h,al + +; ; Наш код +; mov dx, offset mesg +; MOV ah,09h +; INT 21h + +; exit: +; POPF +; IRET + +; pNewInterrupt ENDP + + +start: + JMP program + +pNewInterrupt PROC far + PUSHF + CALL dword ptr cs:int09h + IRET +pNewInterrupt ENDP + +program: + + MOV ax, @DATA + MOV ds, ax + + ; MOV ax,3509h ;Hook interrupt 09H + ; INT 21h + ; MOV word ptr int09h,bx + ; MOV word ptr int09h[2],es + + ; ; MOV ax, 2509h + ; ; MOV dx, offset pNewInterrupt + ; ; INT 21h + + ; ; Восстанавливаем прерывание + ; MOV ax, 2509h + ; MOV ds, word ptr int09h[2] + ; MOV dx, offset int09h + ; INT 21h + ; INT 09h + + MOV ax, 3509h + INT 21h + MOV word ptr int09h, bx + MOV word ptr int09h[2], es + + MOV ax, 2509h + MOV dx, offset pNewInterrupt + INT 21h + + MOV ah,09h + MOV dx, offset msg + INT 21h + + MOV dx, offset tsr_end + INT 27h + + ; ; Выходим из программы + ; MOV ax, 4c00h + ; INT 21h +END start \ No newline at end of file -- cgit v1.2.3