. , , ,

,,,

() — ,

Ҡ

... 򠠠 . .

-913 . .

1997

...................-

............................3

            1. ...............4

1.1 09h...................7

            1.2 10h...................9

..........................10

...........11

1 ........12

IBM . MS DOS 6.0 866 . MS DOS 6.0 . . . . ENHFONT, KEYRUSS, LMSCR&LMKEY, KYRILLIC. - , .

1.

, , 816. 4096 . , . , 10h 09h . 27h , DX .

. 1.1 1.2


. 1.1


. 1.2

1.1 INT 09h

09h . 1.3 1.4


. 1.3


. 1.4

1.2 INT 10h

10h . 1.5


. 1.5

:

         -

        

         ,

         816.fnt

- .

ɠ

1.  . IBM PC 蠠

.: , 1992. 447.

2.  . IBM PC .: ,

1996. 224.

1

۠

.MODEL TINY ;

.CODE ;

.STARTUP

.286

LOCALS ;

JUMPS

jmp Install

RSHIFT_SCAN EQU 36h ; RSHIFT scan code

FLAGS record inRussian:1,shiftPressed:1,keyPressed:1,reserved:6

iFlags FLAGS <0, 0, 0, 0>

STable db 'pH'

Hook09 proc far ;p int 09h

push ax

push bx

push cx

push di

push ds

push es

mov ax,cs ;

mov ds,ax ;

in al,60h ;

mov ah,al ;

cmp al,RSHIFT_SCAN ; ?

je gotShift ; pp

test al,80h ; 𠠠

jnz KeyUp ; ? ?

test [iFlags], MASK inRussian ;

jz OldHook09 ; , p p

push ax

mov ax,40h

mov es,ax ; es = BIOS

pop ax

cmp al,34h ; p

jg OldHook09

cmp al,2Ch

jl check2

sub al,2Ch ;

add al,23

jmp short Translate

check2:

cmp al,28h

jg OldHook09

cmp al,1Eh

jl check3

sub al,1Eh ;

add al,12

jmp short Translate

check3:

cmp al,1Bh

jg OldHook09

cmp al,10h

jl OldHook09 ;

sub al,10h ; , al =

Translate:

or [iFlags], MASK keyPressed ;

mov ah,es:[17h] ; shift

test ah,11b ;

jz lowerKey ; -

add al,32 ; .

lowerKey:

mov cx,es:[1Ah] ; p p (30-60)

mov bx,es:[1Ch] ;

cmp cx,60 ; ? J

je h_End ; -

inc cx ;

inc cx

cmp cx,bx ; ?

je Quit ;

jmp short insSymb ;

h_End:

cmp bx,30 ; ?

je Quit

insSymb:

mov di, offset STable ; di =

mov ah,0 ; ax =

add di,ax

mov al,[di] ; al =

mov es:[bx],al ; p p (int 16h)

cmp bx,60 ; ?

jne nextStep

mov bx,28 ;

nextStep:

inc bx ;

inc bx

mov es:[1Ch],bx ;

jmp short Quit ; , pp

gotShift:

or [iFlags], MASK shiftPressed ; shift

and [iFlags], NOT MASK keyPressed ; -------

jmp short OldHook09

KeyUp:

and al,7Fh ; p

cmp al,RSHIFT_SCAN

jne OldHook09 ; shift - p p

test [iFlags], MASK keyPressed

jnz throwShift ; - p shift

test [iFlags], MASK inRussian

jz switchRussian ; - p

and [iFlags], NOT MASK inRussian ;

jmp short OldHook09

switchRussian:

or [iFlags], MASK inRussian

jmp short OldHook09

throwShift:

and [iFlags], NOT MASK shiftPressed ; p pꠠ

; shift

OldHook09:

pop es

pop ds

pop di

pop cx

pop bx

pop ax

db 0EAh ; far jump

OldHandler09 dd ? ; jump xxxx:yyyy

Quit:

in al,61h ;

mov ah,al ; . .

or al,80h ; ?

out 61h,al ;

xchg ah,al ;

out 61h,al

mov al,20h ;

out 20h,al ; 8259

pop es

pop ds

pop di

pop cx

pop bx

pop ax

iret

Hook09 endp

Hook10 proc far

cmp ah,00h ; p

jne @@Quit ; ?

cmp al,2 ; 2 3 ?

je @@myHook ; -

cmp al,3 ; 3

jne @@Quit

@@myHook:

call iBIOS ;

push ax

push cx

push ds

push si

mov ax,cs ; DS

mov ds,ax ;

mov al,0 ;

mov cl,0FFh ;

mov ch,16 ;

mov si, offset NewFont ;

call LoadFont ; p

pop si

pop ds

pop cx

pop ax

iret

@@Quit:

call iBIOS

iret

Hook10 endp

iBIOS proc

pushf

db 09Ah ; far call

OldHandler10 dd ?

ret

iBIOS endp

;┌────────────────────────────────────────┐

;│ Load Font │

;│ │

;│ p pp 堠 │

;│ p . p, │

;│ "p" pࠠ │

;│ : │

;│ AL - p p ࠠ │

;│ CL - ⠠ │

;│ CH - pp ࠠ │

;│ DS:SI - p p⠠ │

;│ : 򠠠 │

;│ p pp: 򠠠 │

;└────────────────────────────────────────┘

LoadFont proc

pushf

push ax

push cx

push dx

push si

push di

push es

mov di,0A000h ;

mov es,di ; .

xor ah,ah ;

imul di,ax,20h ; ?????????????

push ds

push si

mov si,cs ;

mov ds,si ; DS

lea si,WRITE_ON ;

push cx

call SetMode

pop cx

pop si

pop ds

mov dl,ch

xor ch,ch

xor dh,dh

@@All_symbols:

push cx

mov ax,di

mov cx,dx

shr cx,1 ; cx /= 2

rep movsw

mov di,ax

add di,20h

pop cx

loop @@All_symbols

lea si,WRITE_OFF

call SetMode

pop es

pop di

pop si

pop dx

pop cx

pop ax

popf

ret

WRITE_ON db 2,4 ;

db 4,7 ;

db 4,2

db 5,0

db 6,4

WRITE_OFF db 2,3 ;

db 4,3 ;

db 4,0

db 5,10h

db 6

DispType db 0Eh ; 0Eh - CGA/EGA/VGA 0Ah - MDA/HDA

LoadFont endp

SetMode proc

xor cx,cx

mov cl,2

mov dx,3C4h ;

call @@Outport ; EGA

mov cl,3

mov dl,0CEh

@@Outport:

rep outsw

retn

SetMode endp

SetDisplayType proc

push ax

push es

xor ax,ax

mov al,es:[0487h] ; ?

test al,2 ; EGA ?

jz @@Exit

mov al,0Ah ; MDA / HDA -

mov [DispType],al ;

@@Exit:

pop es

pop ax

ret

SetDisplayType endp

NewFont db 16*256 dup(0)

END_TSR:

FileName db '8x16.fnt',0

ErrorMsg db 'Cannot find 8x16.fnt in current directory.

Aborting',13,10,'$'

Install:

mov ax,3D00h ; p

mov dx,offset FileName

int 21h

jc errorExit ; CF=1 -

mov bx,ax ; bx - pp

mov cx,4096 ;

mov dx,offset NewFont ; p

mov ah,3Fh ; p

int 21h ;cx

mov ah,3Eh ; p

int 21h

mov al,0

mov cl,0FFh

mov ch,16

mov si,offset NewFont

call LoadFont ; p p

mov ax,3509h ; 09 ?

int 21h

mov word ptr [OldHandler09],bx ; p p頠

mov word ptr [OldHandler09+2],es ; p int 09

mov dx,offset Hook09

mov ax,2509h ;

int 21h

mov ax,3510h

int 21h

mov word ptr [OldHandler10],bx

mov word ptr [OldHandler10+2],es

mov dx,offset Hook10

mov ax,2510h

int 21h

mov dx,offset END_TSR ; DX

int 27h ; p.

errorExit:

mov ah,09

mov dx,offset ErrorMsg

int 21h

mov ax,4C01h ; p p

int 21h

END

 

 

 

! , , , .
. , :