
cseg          segment
              assume    cs:cseg,ds:cseg
zero:
              org    100h
entry:
              jmp    start
trtab         equ    $
;THE SYMBOLS LOOK MEANINGLESS UNLESS YOU HAVE LOADED THE ega FONT
;RUSSIAN.EGA
      db     001h,01Eh,'ò' ;Umlaut A
      db     000h,01Eh,'ó' ;umlaut a
      db     00Fh,018h,'ô' ;umlaut O
      db     000h,018h,'õ' ;umlaut o
      db     015h,016h,'ö' ;umlaut U
      db     000h,016h,'÷' ;umlaut u
      db     01Ah,02Ch,'ø' ;Cap Eszet
      db     000h,02Ch,'ù' ;eszet
      db     02Dh,00Ch,'í' ;-
      db     05Fh,00Ch,'�' ;_
      db     03Dh,00Dh,'©' ;=
      db     02Bh,00Dh,'‰' ;+
      db     07Ah,02Ch,'§' ;z 
      db     05Ah,02Ch,'‡' ;Z 
      db     078h,02Dh,'å' ;x 
      db     058h,02Dh,'•' ;X 
      db     063h,02Eh,'æ' ;c 
      db     043h,02Eh,'–' ;C 
      db     076h,02Fh,'¢' ;v 
      db     056h,02Fh,'‚' ;V 
      db     062h,030h,'¡' ;b 
      db     042h,030h,'�' ;B 
      db     06Eh,031h,'­' ;n 
      db     04Eh,031h,'�' ;N 
      db     06Dh,032h,'¬' ;m 
      db     04Dh,032h,'Œ' ;M 
      db     060h,029h,'ê' ;`
      db     07Eh,029h,'š' ;~    
      db     071h,010h,'é' ;q 
      db     051h,010h,'™' ;Q 
      db     077h,011h,'è' ;w 
      db     057h,011h,'˜' ;W 
      db     065h,012h,'¥' ;e 
      db     045h,012h,'…' ;E 
      db     072h,013h,'à' ;r 
      db     052h,013h,'�' ;R 
      db     074h,014h,'â' ;t 
      db     054h,014h,'’' ;T 
      db     079h,015h,'ë' ;y 
      db     059h,015h,'›' ;Y 
      db     075h,016h,'ã' ;u 
      db     055h,016h,'“' ;U 
      db     069h,017h,'¨' ;i 
      db     049h,017h,'ˆ' ;I 
      db     06Fh,018h,'®' ;o 
      db     04Fh,018h,'Ž' ;O 
      db     070h,019h,'¯' ;p 
      db     050h,019h,'�' ;P 
      db     05Bh,01Ah,'ï' ;[ 
      db     07Bh,01Ah,'Ÿ' ;{ 
      db     05Dh,01Bh,'î' ;] 
      db     07Dh,01Bh,'ž' ;} 
      db     05Ch,02Bh,'ñ' ;\ 
      db     07Ch,02Bh,'ð' ;|  
      db     061h,01Eh,' ' ;a 
      db     041h,01Eh,'€' ;A 
      db     073h,01Fh,'á' ;s 
      db     053h,01Fh,'‘' ;S 
      db     064h,020h,'¤' ;d 
      db     044h,020h,'„' ;D 
      db     066h,021h,'ä' ;f 
      db     046h,021h,'”' ;F 
      db     067h,022h,'£' ;g 
      db     047h,022h,'ƒ' ;G 
      db     068h,023h,'¦' ;h 
      db     048h,023h,'†' ;H 
      db     06Ah,024h,'ç' ;j 
      db     04Ah,024h,'—' ;J 
      db     06Bh,025h,'ª' ;k 
      db     04Bh,025h,'Š' ;K 
      db     06Ch,026h,'«' ;l 
      db     04Ch,026h,'‹' ;L 
      db     03Bh,027h,'ì' ;; 
      db     03Ah,027h,'œ' ;: 
trtabl     equ    ($-trtab)/3

inah  db   ?              ;ah we called with

newi16:
          mov  cs:inah,ah
          pushf
          db   09ah ;far call
oldi16    dw   0,0
          pushf
          push bx
          mov  bl,cs:inah
          cmp  bl,2
          jb   yes
          cmp  bl,10h
          jb   no
          cmp  bl,12h
          jae  no
yes:
          push ds
          xor  bx,bx
          mov  ds,bx
          test byte ptr ds:[417h],10h
          pop  ds
          jz   no ;only when scroll lock is lit
          push cx
          push ds
          push cs
          pop  ds
          mov  bx,offset trtab
          mov  cx,trtabl
scan:     cmp  ax,ds:[bx]
          jnz  scann
	  mov  al,ds:[bx+2]
          jmp  short scanx
scann:    add  bx,3
          loop scan
scanx:
          pop  ds
          pop  cx
no:
          pop  bx
          popf
          db   0cah ;retf 2
          dw   2
start:    xor  ax,ax
          mov  ds,ax
          mov  ax,offset newi16
          xchg ax,ds:[16h*4]
          mov  cs:oldi16,ax
          mov  ax,cs
          xchg ax,ds:[16h*4+2]
          mov  cs:oldi16+2,ax
    	  push cs
    	  pop  ds
   	  mov  dx,offset msg
    	  mov  ah,9
    	  int  21h
    	  mov  dx,(start-zero+15)/16
   	  mov  ax,3100h
    	  int  21h
msg       db   'Russian keyboard driver loaded. Hot key is Scroll Lock'
          db   13,10,'$'
cseg      ends
	  end  entry
