newint9: push eax edi es xor ax,ax mov es,ax cli mov edi,9*4 mov ax,cs shl eax,16 mov ax,int9 mov [es:edi],eax sti pop es edi eax ret getkey: push ds cs pop ds mov al,[key+eax] pop ds ret int9: cli push eax ebx ecx ds cs pop ds in al,64h and al,1 je .end in al,60h mov ebx,.154f xlat [ebx] mov ebx,key cmp al,80h je .reset or al,al je .tmp cmp al,0e0h je .tmp cmp al,0e1h je .tmp cmp al,0f0h je .tmp mov cl,[ebx+key.tmp] cmp cl,0e1h je .pause and al,7fh cmp al,70h jge .end cmp cl,0e0h jne @f call .extended jc .end jmp .normal @@: cmp al,key.home jb @f cmp al,key.delete ja @f add al,key.num7-key.home @@: cmp al,key.prtscr jne @f mov al,key.nummul @@: .normal: in al,60h movzx eax,al mov ecx,eax and cl,7fh add ecx,key.map or al,al jl .break .make: mov ah,[ebx+ecx] inc ah jne @f dec ah @@: .break: mov [ebx+ecx],ah mov ah,[ebx+key.cur] mov [ebx+key.cur],ax xor ecx,ecx jmp .end .reset: mov eax,(128+4)-1 @@: mov [ebx+eax],ah dec eax jne @b jmp .end .extended: mov cl,0 cmp al,key.majleft je .shift cmp al,key.entrée jne @f mov al,key.numenter ret @@: cmp al,key.alt jne @f mov al,key.ralt ret @@: cmp al,key.control jne @f mov al,key.rctrl ret @@: cmp al,key.div jne @f mov al,key.numdiv ret @@: ret .shift: stc ret .pause: mov al,0 .tmp: mov cl,al jmp .end .end: mov [ebx+key.tmp],cl mov ecx,128/4 xor eax,eax @@: dec ecx je @f or eax,[ebx+ecx*4] je @b @@: or eax,eax je @f mov al,1 @@: mov [ebx+key.rien],al mov cl,0 cmp byte[ebx+key.verrnum],1 jne @f or cl,key.numled @@: cmp byte[ebx+key.scrollock],1 jne @f or cl,key.scrolled @@: cmp byte[ebx+key.verrmaj],1 jne @f or cl,key.majled @@: in al,61h or al,80h out 61h,al and al,7fh out 61h,al .leds: or cl,cl je .exit xor [ebx+key.status],cl mov al,0edh out 60h,al @@: in al,64h test al,2 jne @b mov al,[ebx+key.status] out 60h,al in al,60h .exit: mov al,20h out 20h,al sti pop ds ecx ebx eax iret include 'keylookup.inc' include 'scancode.inc'