; Interrupt service routine for KA-Security V2.0 ; Keystokes received from parallel port are buffered. ; int 255 returns last key stroke and count. ; AL -> Character code of first entry in buffer. ; AH -> Character count in buffer. ; SI -> Number between 0-11 to be used in state transitions. ; ; In this version ; * The input from the printer port is further processed ; * The lookup table has been modified to have 16 entries only ; ; (C) 1998 Ayhan Bozkurt ; DOSSEG .MODEL SMALL .DATA INTA0 EQU 20h INTA1 EQU 21h EOI EQU 67h .CODE mov ax,@Data mov dx,ax ; Enable printer interrupt on 8259 mov dx,INTA1 in al,dx and al,01111111b out dx,al ; Enable printer interrupt on port mov dx,03BEh in al,dx or al,00010000b out dx,al ; Zero ES mov ax,0 mov es,ax ; Install software interrupt routine pointer mov ax,OFFSET SoftInt mov bx,1020 mov es:[bx],ax mov ax,cs mov bx,1022 mov es:[bx],ax ; Install hardware interrupt routine pointer mov ax,OFFSET HardInt mov es:[3Ch],ax mov ax,cs mov es:[3Eh],ax ; Stay resident and terminate mov ah,31h mov dx,OFFSET Last inc dx int 21h DataBuf DB 16 DUP(65) DataCnt DB 0 StrPtr DW 0 EndPtr DW 0 LookUp DB 32,55,56,57,32,42,48,35,32,49,50,51,32,52,53,54 KeyTble DW 11,00,00,00,11,02,00,04,11,00,00,00,11,00,00,00 ; 00 Ordinary Character ; 02 The * sign ; 04 The # sign ; 11 Nothing SoftInt: push bx push ds mov ax,cs mov ds,ax mov ah,DataCnt and ah,ah jz EndSI mov si,EndPtr mov bl,DataBuf[si] mov bh,0 mov al,LookUp[bx] add bx,bx mov si,KeyTble[bx] dec DataCnt inc EndPtr and EndPtr,00001111b EndSI: pop ds pop bx iret HardInt: push ax push bx push cx push dx push ds mov ax,cs mov ds,ax mov al,DataCnt cmp al,16 je BufferFull mov dx,003BDh in al,dx mov bl,al mov bh,al and bl,00111000b and bh,10000000b mov cl,3 shr bl,cl mov cl,4 shr bh,cl add bl,bh mov al,bl mov bx,StrPtr mov DataBuf[bx],al inc DataCnt inc StrPtr and StrPtr,00001111b BufferFull: mov dx,INTA0 mov al,EOI out dx,al pop ds pop dx pop cx pop bx pop ax iret Last: END