881 ; Replaces INT 09H with an ISR which only returns the Make or Break ; from the keyboard processor, useful in music keyboard playing routines ;************************************************* ;* function prototypes: * ;* * ;* void init_mkbrk(void) * ;* void exit_mkbrk(void) * ;* unsigned char get_mkbrk_code(void) * ;************************************************* DOSSEG .MODEL SMALL .DATA Org_Rutin dword ? mkbrk byte ? .CODE PUBLIC _init_mkbrk PUBLIC _exit_mkbrk PUBLIC _get_mkbrk_code MKBRK_ISR PROC FAR ASSUME CS:_TEXT,DS:DGROUP push ds push ax push dx mov ax,@data mov ds, ax in al, 60h ;fetch byte from keyboard mov byte ptr[mkbrk], al ;processor cli ; Disable interrupts while resetting in al, 61h ; Get current port 61h state or al, 10000000b ; Turn on bit 7 to signal clear keybrd out 61h, al ; Send to port and al, 01111111b ; Turn off bit 7 to signal break out 61h, al ; Send to port sti mov al, 20h ;EOI out 20h, al pop dx pop ax pop ds iret MKBRK_ISR ENDP ;======================================================================= _init_mkbrk PROC push di push es mov al, 09h ;H„mta vektorn till INT 09 mov ah, 35h int 21h mov word ptr[Org_Rutin], bx ;Org_Rutinens OFFSET h„mtas mov word ptr[Org_Rutin+2], es ;Segment sparas cli ;Fixa till ISR mov ax, 0 mov es, ax mov di, 24h mov ax, OFFSET MKBRK_ISR stosw mov ax, cs stosw sti mov byte ptr[mkbrk], 0 ;Clear keycode byte pop es pop di ret _init_mkbrk ENDP _get_mkbrk_code PROC mov ax, 0 mov al, byte ptr[mkbrk] ;return scan in al ret _get_mkbrk_code ENDP _exit_mkbrk PROC push di push es cli mov ax, 0 ;Restore INT 9 mov es, ax mov di, 24h mov ax, word ptr[Org_Rutin] stosw mov ax, word ptr[Org_Rutin+2] stosw sti pop es pop di ret _exit_mkbrk ENDP END . 0