Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1106 lines
37 KiB

  1. AltLeftShift EQU 10
  2. AltRightShift EQU 9
  3. CtrlLeftShift EQU 5
  4. CtrlRightShift EQU 4
  5. CtrlAlt EQU 12
  6. caps_bit equ 01000000b
  7. nums_bit equ 00100000b
  8. NUMKBTONOI EQU 29
  9. NUMKBDIAL EQU 9
  10. NUMKBTONDIAL EQU 9
  11. NUMSEMICODES EQU 122
  12. NUMKBCODES EQU 124
  13. NUMEVERYTIME EQU 51
  14. ISWINDOWSNT EQU 3205H
  15. NumOfKeyCodes EQU 344
  16. ROM_BIOS_DATA SEGMENT AT 40H ;BIOS statuses held here, also kb buffer
  17. ORG 17h
  18. bios_kbd_stat db ? ;keyboard status byte
  19. ORG 1AH
  20. HEAD DW ? ;Unread chars go from Head to Tail
  21. TAIL DW ?
  22. BUFFER DW 16 DUP (?) ;The buffer itself
  23. BUFFER_END LABEL WORD
  24. ROM_BIOS_DATA ENDS
  25. CODE SEGMENT PARA PUBLIC 'CODE'
  26. ASSUME CS:CODE
  27. ORG 100H
  28. BEGIN: JMP INITIALIZE
  29. MYSIG DB 'G.Kozyrakis'
  30. NEW_INT09H PROC NEAR ;The keyboard interrupt will now come here.
  31. ASSUME CS:CODE
  32. PUSH AX ;Save the used registers for good form
  33. PUSH BX
  34. PUSH CX
  35. PUSH DX
  36. PUSH DI
  37. PUSH SI
  38. PUSH DS
  39. PUSH ES
  40. PUSHF ;First, call old keyboard interrupt
  41. CALL OLD_INT09H
  42. CMP CS:[CHECKFLAG],1
  43. JNE JEXIT
  44. CLI
  45. ASSUME DS:ROM_BIOS_DATA ;Examine the char just put in
  46. MOV BX,ROM_BIOS_DATA
  47. MOV DS,BX
  48. MOV BX,TAIL ;Point to current tail
  49. MOV CL,Bios_kbd_stat
  50. MOV CH,CL
  51. AND CH,1FH
  52. AND CL,0Fh
  53. CMP CL,AltRightShift
  54. JNE NOGREEKSWITCH
  55. MOV GrFlag,AltRightShift
  56. MOV SemiFlag,0
  57. JMP SHORT START
  58. NOGREEKSWITCH:
  59. CMP CL,AltLeftShift
  60. JNE CHKSEMI
  61. MOV GrFlag,0
  62. MOV SemiFlag,0
  63. JMP SHORT START
  64. CHKSEMI:
  65. MOV CL,Bios_kbd_stat
  66. AND CL,CtrlLeftShift
  67. CMP CL,CtrlLeftShift
  68. JNE START
  69. SemiGr:
  70. XOR SemiFlag,CtrlLeftShift
  71. START:
  72. CMP BX,HEAD ;If at head, kbd int has deleted char
  73. JE JEXIT ;So leave
  74. SUB BX,2 ;Point to just read in character
  75. CMP BX,OFFSET BUFFER ;Did we undershoot buffer?
  76. JAE NO_WRAP ;Nope
  77. MOV BX,OFFSET BUFFER_END ;Yes -- move to buffer top
  78. SUB BX,2 ;Point to just read in character
  79. NO_WRAP:
  80. MOV DX, [BX] ;** Typed character in DX now **
  81. cmp DL,32
  82. jne NOTOGGLE
  83. mov CL,CH
  84. and CL,0Fh
  85. cmp CL,CtrlAlt
  86. jne NOTOGGLE
  87. xor GrFlag,AltRightShift
  88. MOV SemiFlag,0
  89. MOV TAIL,BX ;take tono out of kbr buffer
  90. JMP EXIT
  91. NOTOGGLE:
  92. TEST CH,10h
  93. JZ NOSCROLL
  94. cmp dh,7ah
  95. ja NOSCROLL
  96. cmp dh,78h
  97. jb NOSCROLL
  98. push es
  99. push ds
  100. mov ax,CS
  101. mov es,ax
  102. mov ds,ax
  103. push bx
  104. mov al,dh
  105. sub al,77h
  106. CALL ChangeCP
  107. pop bx
  108. pop ds
  109. pop es
  110. MOV TAIL,BX ;take tono out of kbr buffer
  111. JMP EXIT
  112. NOSCROLL:
  113. MOV SI,KBOffset
  114. ADD SI,(NUMKBTONOI+NUMKBDIAL+NUMKBTONDIAL)*2 ;Semicodes
  115. CMP SemiFlag,CtrlLeftShift
  116. JE GREEKS
  117. ADD SI,NUMSEMICODES*2 ;KBCodes
  118. CMP GrFlag,AltRightShift
  119. JE GREEKS
  120. ADD SI,NUMKBCODES*2 ;EVERYTIME
  121. JMP SHORT TCNT
  122. JEXIT: JMP EXIT
  123. GREEKS:
  124. CMP ToneStat,-1
  125. JE CHKTN
  126. MOV SI,KBOffset ;KBTONOI
  127. CMP ToneStat,3bh
  128. JE TCNT
  129. ADD SI,NUMKBTONOI*2 ;KBDIAL
  130. CMP ToneStat,3ah
  131. JE TCNT
  132. ADD SI,NUMKBDIAL*2 ;KBTONDIAL
  133. TCNT: CMP DX,CS:[SI] ;Compare to first key
  134. JE FOUNDONE ;yes
  135. ADD SI,4 ;Point to next key
  136. CMP CS:[SI],0FFFFH ;check for end;
  137. JNE TCNT ;No continue with next table entry
  138. CMP ToneStat,-1
  139. Je NoTonos
  140. cmp DH,27h
  141. JE ISTONOS
  142. MOV TAIL,BX
  143. NoTonos:
  144. MOV ToneStat,-1
  145. JMP EXIT
  146. CHKTN: CMP DH,27H ;is it a tonos
  147. JNE CONT
  148. ISTONOS:
  149. MOV TAIL,BX ;take tono out of kbr buffer
  150. CMP ToneStat,DL
  151. JE EXIT
  152. CMP ToneStat,-1
  153. Jne CHNGTONE
  154. Mov ToneStat,DL
  155. JMP SHORT EXIT
  156. CHNGTONE:
  157. Mov ToneStat,0
  158. JMP SHORT EXIT
  159. CONT: CMP DX,CS:[SI] ;Compare to first key
  160. JE FOUNDONE ;yes
  161. ADD SI,4 ;Point to next key
  162. CMP CS:[SI],0FFFFH ;check for end;
  163. JNE CONT ;No continue with next table entry
  164. JMP SHORT EXIT ;No keys matched. Jump Out.
  165. FOUNDONE:
  166. MOV DX,CS:[SI+2]
  167. MOV [BX],DX
  168. MOV ToneStat,-1
  169. EXIT:
  170. STI
  171. PUSH BP
  172. MOV AH,03
  173. INT 10H
  174. CMP CH,CL
  175. JAE NO_CURSOR
  176. MOV CX,CURSOR1
  177. XOR CH,CH
  178. CMP SemiFlag,0
  179. JNE SET_CURSOR
  180. MOV CX,CURSOR1
  181. CMP GRFlag,0
  182. JNE SET_CURSOR
  183. MOV CX,CURSOR0
  184. SET_CURSOR:
  185. MOV AH,1
  186. INT 10h
  187. NO_CURSOR:
  188. POP BP
  189. POP ES ;Do the Pops of all registers.
  190. POP DS
  191. POP SI
  192. POP DI
  193. POP DX
  194. POP CX
  195. POP BX
  196. POP AX
  197. IRET ;An interrupt needs an IRET
  198. NEW_INT09H ENDP
  199. ChangeCP PROC NEAR
  200. CLI
  201. Mov ES:[KBOffset],OFFSET ES:[TAB928]
  202. CMP AL,3
  203. JE ChangeAll
  204. Mov ES:[KBOffset],OFFSET ES:[TAB869]
  205. CMP AL,2
  206. JE ChangeAll
  207. Mov ES:[KBOffset],OFFSET ES:[TAB737]
  208. CMP AL,1
  209. JNE NOCHCP
  210. ChangeAll:
  211. MOV CS:[CPTable],AL
  212. NOCHCP:
  213. STI
  214. RET
  215. ChangeCP ENDP
  216. ;* Multiplex - Handler for Interrupt 2Fh (Multiplex Interrupt). Checks
  217. ;* AH for this TSR's identity number. If no match (indicating call is
  218. ;* not intended for this TSR), Multiplex passes control to the previous
  219. ;* Interrupt 2Fh handler.
  220. ;*
  221. ;* Params: AH = Handler identity number
  222. ;* AL = Function number 0-2
  223. ;*
  224. ;* Return: AL = 0FFh (function 0)
  225. ;* "GK" in BX (function 0)
  226. ;* ES = Current CS (function 0)
  227. ;* DH = Greek State for function 1 ( 9 or 10)
  228. ;* DL = Code Page (1:=737 2:=869 3:=928) for function 2
  229. Multiplex PROC FAR
  230. .IF ah != 0CCh ; If this handler not requested,
  231. jmp cs:MULTEX_ISR ; pass control to old Int 2Fh
  232. .ENDIF ; handler
  233. push cs
  234. pop es
  235. .IF al == 0 ; If function 0 (verify presence),
  236. mov al, 0FFh ; AL = 0FFh,
  237. mov bx, "GK"
  238. mov dh, CS:[GRFlag]
  239. mov dl, CS:[CPTable]
  240. .ELSEIF al == 1
  241. mov CS:[GRFlag],dh
  242. .ELSEIF al == 2
  243. mov al,dl
  244. push ds
  245. push cs
  246. pop ds
  247. CALL ChangeCP
  248. pop ds
  249. .ENDIF ; set ES:DI = far address
  250. iret
  251. Multiplex ENDP
  252. BIOS_ISR LABEL DWORD
  253. OLD_INT09H DD ? ;Location of old kbd interrupt
  254. MULTEX_ISR LABEL DWORD
  255. OLD_INT2FH DD ? ;Location of old multiplex interrupt
  256. ToneStat DB -1 ;Set to >-1 when tonos is pressed
  257. GrFlag DB 0
  258. SemiFlag DB 0
  259. CURSOR0 DW 0B0CH
  260. CURSOR1 DW 070CH
  261. CHECKFLAG DB 1
  262. CPTable DB 0
  263. OS_Ver DW 0
  264. KBOffset DW OFFSET TAB737
  265. TAB737 dw 1E61H, 1EE1H ; a KBTONOI
  266. dw 1265H, 12E2H ; e
  267. dw 2368H, 23E3H ; h
  268. dw 1769H, 17E5H ; i
  269. dw 186FH, 18E6H ; o
  270. dw 1579H, 15E7H ; y
  271. dw 2F76H, 2FE9H ; v
  272. DW 1e41H, 1EEAH ; A
  273. dw 1245H, 12EBH ; E
  274. DW 2348H, 23ECH ; H
  275. DW 1749H, 17EDH ; I
  276. DW 184fH, 18EEH ; O
  277. DW 1559H, 15EFH ; Y
  278. DW 2f56H, 00F0H ; V
  279. dw 0FFFFH
  280. KBDIAL dw 1769H, 17E4H ; i
  281. dw 1579H, 15E8H ; y
  282. dw 1749H, 1749H
  283. DW 1559H, 1559H
  284. dw 0FFFFH
  285. KBTONDIAL dw 1769H, 17F9H ; i
  286. dw 1579H, 15FAH ; y
  287. dw 1749H, 1749H
  288. DW 1559H, 1559H
  289. dw 0FFFFH
  290. SEMICODES dw 3b00H, 3bC9H ; � F1
  291. dw 3c00H, 3cBBH ; � F2
  292. dw 3e00H, 3eC8H ; � F3
  293. dw 3d00H, 3dBCH ; � F4
  294. dw 3f00H, 3fCDH ; � F5
  295. dw 4000H, 40BAH ; � F6
  296. dw 4100H, 41CCH ; � F7
  297. dw 4200H, 42B9H ; � F8
  298. dw 4300H, 43CBH ; � F9
  299. dw 4400H, 44CAH ; � F10
  300. dw 5400H, 54DAH ; � shift+F1
  301. dw 5500H, 55BFH ; �
  302. dw 5700H, 57C0H ; �
  303. dw 5600H, 56D9H ; �
  304. dw 5800H, 58C4H ; �
  305. dw 5900H, 59B3H ; �
  306. dw 5a00H, 5aC3H ; �
  307. dw 5b00H, 5bB4H ; �
  308. dw 5c00H, 5cC2H ; �
  309. dw 5d00H, 5dC1H ; � shift+F10
  310. dw 6200H, 62CEH ; �
  311. dw 6C00H, 6CC5H ; �
  312. dw 1000h, 10DBH ; � alt +Q
  313. dw 1100h, 11B0H ; � alt +E
  314. dw 1200h, 12B1H ; �
  315. dw 1300h, 13B2H ; �
  316. dw 1400h, 14DCH ; �
  317. dw 1500h, 15DFH ; �
  318. dw 6F00H, 6FB5H ; �
  319. dw 6500H, 65B6H ; �
  320. dw 5f00H, 5fB7H ; �
  321. dw 6900H, 69B8H ; �
  322. dw 6000H, 60BDH ; �
  323. dw 6A00H, 6ABEH ; �
  324. dw 6E00H, 6EC6H ; �
  325. dw 6400H, 64C7H ; �
  326. dw 6700H, 67CFH ; � ctrl +F10
  327. dw 7100H, 71D0H ; � alt +F10
  328. dw 6600H, 66D1H ; �
  329. dw 7000H, 70D2H ; �
  330. dw 6100H, 61D3H ; �
  331. dw 6B00H, 6BD4H ; �
  332. dw 6800H, 68D5H ; � alt +F1
  333. dw 5e00H, 5eD6H ; � ctrl +F1
  334. dw 6300H, 63D7H ; �
  335. dw 6D00H, 6DD8H ; �
  336. dw 1600h, 16DDH ; �
  337. dw 1700h, 17DEH ; �
  338. dw 7800h, 78F1H ; � alt +1
  339. dw 7A00H, 7AF2H ; �
  340. dw 7900H, 79F3H ; � alt +2
  341. dw 1800h, 18F4H ; �
  342. dw 1900h, 19F5H ; � alt +P
  343. dw 7B00H, 7BF6H ; �
  344. dw 7C00H, 7CF7H ; �
  345. dw 7D00H, 7DF8H ; �
  346. dw 7E00H, 7EF9H ; �
  347. dw 7F00H, 7FFBH ; �
  348. dw 8000H, 80FDH ; �
  349. dw 8100H, 81FCH ; �
  350. dw 8200H, 82FEH ; � alt +-
  351. KBCODES dw 1E61H, 1898H ; a
  352. dw 3062H, 3099H ; b
  353. dw 2267H, 229AH ; g
  354. dw 2064H, 209BH ; d
  355. dw 1265H, 129CH ; e
  356. dw 2C7AH, 2C9DH ; z
  357. dw 2368H, 239EH ; h
  358. dw 1675H, 169FH ; u
  359. dw 1769H, 17A0H ; i
  360. dw 256BH, 25A1H ; k
  361. dw 266CH, 26A2H ; l
  362. dw 326DH, 32A3H ; m
  363. dw 316EH, 31A4H ; n
  364. dw 246AH, 24A5H ; j
  365. dw 186FH, 18A6H ; o
  366. dw 1970H, 19A7H ; p
  367. dw 1372H, 13A8H ; r
  368. dw 1F73H, 1FA9H ; s
  369. dw 1474H, 14ABH ; t
  370. dw 1579H, 15ACH ; y
  371. dw 2166H, 21ADH ; f
  372. dw 2D78H, 2DAEH ; x
  373. dw 2E63H, 2EAFH ; c
  374. dw 2F76H, 00E0H ; v
  375. dw 1177H, 11AAH ; w
  376. dw 1E41H, 1E80H ; A
  377. dw 3042H, 3081H ; B
  378. dw 2247H, 2282H ; G
  379. dw 2044H, 2083H ; D
  380. dw 1245H, 1284H ; E
  381. dw 2C5AH, 2C85H ; Z
  382. dw 2348H, 2386H ; H
  383. dw 1655H, 1687H ; U
  384. dw 1749H, 1788H ; I
  385. dw 254BH, 2589H ; K
  386. dw 264CH, 268AH ; L
  387. dw 324DH, 328BH ; M
  388. dw 314EH, 318CH ; N
  389. dw 244AH, 248DH ; J
  390. dw 184FH, 188EH ; O
  391. dw 1950H, 198FH ; P
  392. dw 1352H, 1390H ; R
  393. dw 1F53H, 1F91H ; S
  394. dw 1454H, 1492H ; T
  395. dw 1559H, 1593H ; Y
  396. dw 2146H, 2194H ; F
  397. dw 2D58H, 2D95H ; X
  398. dw 2E43H, 2E96H ; C
  399. dw 2F56H, 2F97H ; V
  400. dw 1157H, 117eH ; w
  401. dw 565CH, 563CH ; <
  402. dw 567CH, 563EH ; >
  403. dw 0423h, 0423h ;
  404. dw 0000h, 0000h
  405. dw 0000h, 0000h
  406. dw 0000h, 0000h
  407. dw 0000h, 0000h
  408. dw 0000h, 0000h
  409. dw 0000h, 0000h
  410. dw 0000h, 0000h
  411. dw 0000h, 0000h
  412. dw 0000h, 0000h
  413. EVERYTIME dw 7a00H, 04F9H ; �
  414. DW 2960H, 295CH ; \
  415. dw 297EH, 297CH ; |
  416. dw 0340H, 0322H ; "
  417. dw 075EH, 0726H ; &
  418. dw 0826H, 082FH ; /
  419. dw 092AH, 0928H ; (
  420. dw 0A28H, 0A29H ; )
  421. dw 0B29H, 0B3DH ; =
  422. dw 0C5FH, 0C3FH ; ?
  423. dw 0C2DH, 0C27H ; '
  424. dw 0D3DH, 0D2BH ; +
  425. dw 0D2BH, 0D2AH ; *
  426. dw 2B5CH, 2B23H ; #
  427. dw 2B7CH, 2B40H ; @
  428. dw 565CH, 563CH ; <
  429. dw 567CH, 563EH ; >
  430. dw 333CH, 333BH ; ;
  431. dw 343EH, 343AH ; :
  432. dw 352FH, 352DH ; -
  433. dw 353FH, 355FH ; _
  434. dw 273BH, 2727H ; '
  435. dw 1B1dH, 1b5EH ;
  436. dw 2827H, 285EH ; ^
  437. dw 2822H, 287EH ; ~
  438. dw 0FFFFH
  439. TAB869 dw 1E61H, 1E9BH ; a
  440. dw 1265H, 129DH ; e
  441. dw 2368H, 239EH ; h
  442. dw 1769H, 179FH ; i
  443. dw 186FH, 18A2H ; o
  444. dw 1579H, 15A3H ; y
  445. dw 2F76H, 2FFDH ; v
  446. DW 1e41H, 1E86H ; A
  447. dw 1245H, 128DH ; E
  448. DW 2348H, 238FH ; H
  449. DW 1749H, 1790H ; I
  450. DW 184fH, 1892H ; O
  451. DW 1559H, 1595H ; Y
  452. DW 2f56H, 2F98H ; V
  453. dw 0FFFFH
  454. dw 1769H, 17A0H ; i
  455. dw 1579H, 15FBH ; y
  456. dw 1749H, 17ADH ; I
  457. DW 1559H, 15D1H ; Y
  458. dw 0FFFFH
  459. dw 1769H, 17A1H ; i
  460. dw 1579H, 15FCH ; y
  461. dw 1749H, 1749H
  462. DW 1559H, 1559H
  463. dw 0FFFFH
  464. dw 3b00H, 3bC9H ; � F1
  465. dw 3c00H, 3cBBH ; � F2
  466. dw 3e00H, 3eC8H ; � F3
  467. dw 3d00H, 3dBCH ; � F4
  468. dw 3f00H, 3fCDH ; � F5
  469. dw 4000H, 40BAH ; � F6
  470. dw 4100H, 41CCH ; � F7
  471. dw 4200H, 42B9H ; � F8
  472. dw 4300H, 43CBH ; � F9
  473. dw 4400H, 44CAH ; � F10
  474. dw 5400H, 54DAH ; � shift+F1
  475. dw 5500H, 55BFH ; �
  476. dw 5700H, 57C0H ; �
  477. dw 5600H, 56D9H ; �
  478. dw 5800H, 58C4H ; �
  479. dw 5900H, 59B3H ; �
  480. dw 5a00H, 5aC3H ; �
  481. dw 5b00H, 5bB4H ; �
  482. dw 5c00H, 5cC2H ; �
  483. dw 5d00H, 5dC1H ; � shift+F10
  484. dw 6200H, 62CEH ; �
  485. dw 6C00H, 6CC5H ; �
  486. dw 1000h, 10DBH ; � alt +Q
  487. dw 1100h, 11B0H ; � alt +E
  488. dw 1200h, 12B1H ; �
  489. dw 1300h, 13B2H ; �
  490. dw 1400h, 14DCH ; �
  491. dw 1500h, 15DFH ; �
  492. dw 6F00H, 6FABH ; �
  493. dw 6500H, 65AEH ; �
  494. dw 5f00H, 5fAFH ; �
  495. dw 6900H, 69B8H ; �
  496. dw 6000H, 60BDH ; �
  497. dw 6A00H, 6ABEH ; �
  498. dw 6E00H, 6EC6H ; �
  499. dw 6400H, 64C7H ; �
  500. dw 6700H, 67CFH ; � ctrl +F10
  501. dw 7100H, 71D0H ; � alt +F10
  502. dw 6600H, 66D1H ; �
  503. dw 7000H, 70D2H ; �
  504. dw 6100H, 61D3H ; �
  505. dw 6B00H, 6BD4H ; �
  506. dw 6800H, 68D5H ; � alt +F1
  507. dw 5e00H, 5eD6H ; � ctrl +F1
  508. dw 6300H, 63D7H ; �
  509. dw 6D00H, 6DD8H ; �
  510. dw 1600h, 16DDH ; �
  511. dw 1700h, 17DEH ; �
  512. dw 7800h, 78AEH ; � alt +1
  513. dw 7A00H, 7AABH ; �
  514. dw 7900H, 79AFH ; � alt +2
  515. dw 1800h, 18F0H ; �
  516. dw 1900h, 19F1H ; � alt +P
  517. dw 7B00H, 7BF7H ; �
  518. dw 7C00H, 7CF5H ; �
  519. dw 7D00H, 7DF8H ; �
  520. dw 7E00H, 7EF9H ; �
  521. dw 7F00H, 7FFBH ; �
  522. dw 8000H, 80FDH ; �
  523. dw 8100H, 81FCH ; �
  524. dw 8200H, 82FEH ; � alt +-
  525. dw 1E61H, 18D6H ; a
  526. dw 3062H, 30D7H ; b
  527. dw 2267H, 22D8H ; g
  528. dw 2064H, 20DDH ; d
  529. dw 1265H, 12DEH ; e
  530. dw 2C7AH, 00E0H ; z
  531. dw 2368H, 23E1H ; h
  532. dw 1675H, 16E2H ; u
  533. dw 1769H, 17E3H ; i
  534. dw 256BH, 25E4H ; k
  535. dw 266CH, 26E5H ; l
  536. dw 326DH, 32E6H ; m
  537. dw 316EH, 31E7H ; n
  538. dw 246AH, 24E8H ; j
  539. dw 186FH, 18E9H ; o
  540. dw 1970H, 19EAH ; p
  541. dw 1372H, 13EBH ; r
  542. dw 1F73H, 1FECH ; s
  543. dw 1474H, 14EEH ; t
  544. dw 1579H, 15F2H ; y
  545. dw 2166H, 21F3H ; f
  546. dw 2D78H, 2DF4H ; x
  547. dw 2E63H, 2EF6H ; c
  548. dw 2F76H, 2FFAH ; v
  549. dw 1177H, 11EDH ; w
  550. dw 1E41H, 1EA4H ; A
  551. dw 3042H, 30A5H ; B
  552. dw 2247H, 22A6H ; G
  553. dw 2044H, 20A7H ; D
  554. dw 1245H, 12A8H ; E
  555. dw 2C5AH, 2CA9H ; Z
  556. dw 2348H, 23AAH ; H
  557. dw 1655H, 16ACH ; U
  558. dw 1749H, 17ADH ; I
  559. dw 254BH, 25B5H ; K
  560. dw 264CH, 26B6H ; L
  561. dw 324DH, 32B7H ; M
  562. dw 314EH, 31B8H ; N
  563. dw 244AH, 24BDH ; J
  564. dw 184FH, 18BEH ; O
  565. dw 1950H, 19C6H ; P
  566. dw 1352H, 13C7H ; R
  567. dw 1F53H, 1FCFH ; S
  568. dw 1454H, 14D0H ; T
  569. dw 1559H, 15D1H ; Y
  570. dw 2146H, 21D2H ; F
  571. dw 2D58H, 2DD3H ; X
  572. dw 2E43H, 2ED4H ; C
  573. dw 2F56H, 2FD5H ; V
  574. dw 1157H, 117eH ; w
  575. dw 565CH, 56F5H ; Para
  576. dw 567CH, 5697H ; Copyright
  577. dw 0423h, 049ch ;
  578. dw 1a7bH, 1aaeH ;
  579. dw 1b7dH, 1bafH ;
  580. dw 2827H, 288cH ; ^
  581. dw 2822H, 288BH ; ~
  582. DW 2960H, 29ABH ; \
  583. dw 297EH, 29F1H ; |
  584. dw 0C5FH, 0CF8H ; ?
  585. dw 2B5CH, 2B99H ; #
  586. dw 2B7CH, 2B9aH ; @
  587. dw 7a00H, 049CH ; �
  588. DW 2960H, 295CH ; \
  589. dw 297EH, 297CH ; |
  590. dw 0340H, 0322H ; "
  591. dw 075EH, 0726H ; &
  592. dw 0826H, 082FH ; /
  593. dw 092AH, 0928H ; (
  594. dw 0A28H, 0A29H ; )
  595. dw 0B29H, 0B3DH ; =
  596. dw 0C5FH, 0C3FH ; ?
  597. dw 0C2DH, 0C27H ; '
  598. dw 0D3DH, 0D2BH ; +
  599. dw 0D2BH, 0D2AH ; *
  600. dw 2B5CH, 2B23H ; #
  601. dw 2B7CH, 2B40H ; @
  602. dw 565CH, 563CH ; <
  603. dw 567CH, 563EH ; >
  604. dw 333CH, 333BH ; ;
  605. dw 343EH, 343AH ; :
  606. dw 352FH, 352DH ; -
  607. dw 353FH, 355FH ; _
  608. dw 273BH, 2727H ; '
  609. dw 1B1dH, 1b5EH ;
  610. dw 2827H, 285EH ; ^
  611. dw 2822H, 287EH ; ~
  612. dw 0FFFFH
  613. TAB928 dw 1E61H, 1EDCH ; a
  614. dw 1265H, 12DDH ; e
  615. dw 2368H, 23DEH ; h
  616. dw 1769H, 17DFH ; i
  617. dw 186FH, 18FCH ; o
  618. dw 1579H, 15FDH ; y
  619. dw 2F76H, 2FFEH ; v
  620. DW 1e41H, 1EB6H ; A
  621. dw 1245H, 12B8H ; E
  622. DW 2348H, 23B9H ; H
  623. DW 1749H, 17BAH ; I
  624. DW 184fH, 18BCH ; O
  625. DW 1559H, 15BEH ; Y
  626. DW 2f56H, 2FBFH ; V
  627. dw 0FFFFH
  628. dw 1769H, 17FAH ; i
  629. dw 1579H, 15FBH ; y
  630. dw 1749H, 17DAH ; I
  631. DW 1559H, 15DBH ; Y
  632. dw 0FFFFH
  633. dw 1769H, 17C0H ; i
  634. dw 1579H, 15E0H ; y
  635. dw 1749H, 1749H
  636. DW 1559H, 1559H
  637. dw 0FFFFH
  638. dw 3b00H, 3b91H ; � F1
  639. dw 3c00H, 3c87H ; � F2
  640. dw 3e00H, 3e90H ; � F3
  641. dw 3d00H, 3d88H ; � F4
  642. dw 3f00H, 3f95H ; � F5
  643. dw 4000H, 4086H ; � F6
  644. dw 4100H, 4194H ; � F7
  645. dw 4200H, 4285H ; � F8
  646. dw 4300H, 4393H ; � F9
  647. dw 4400H, 4492H ; � F10
  648. dw 5400H, 5498H ; � shift+F1
  649. dw 5500H, 5589H ; �
  650. dw 5700H, 578AH ; �
  651. dw 5600H, 5697H ; �
  652. dw 5800H, 588EH ; �
  653. dw 5900H, 5983H ; �
  654. dw 5a00H, 5a8dH ; �
  655. dw 5b00H, 5b84H ; �
  656. dw 5c00H, 5c8cH ; �
  657. dw 5d00H, 5d8bH ; � shift+F10
  658. dw 6200H, 6296H ; �
  659. dw 6C00H, 6C8fH ; �
  660. dw 1000h, 1099H ; � alt +Q
  661. dw 1100h, 1180H ; � alt +E
  662. dw 1200h, 1281H ; �
  663. dw 1300h, 1382H ; �
  664. dw 1400h, 149aH ; �
  665. dw 1600h, 169bH ; �
  666. ; differ in other CPs
  667. dw 6F00H, 6F00H ; �
  668. dw 6500H, 6500H ; �
  669. dw 5f00H, 5f00H ; �
  670. dw 6900H, 6900H ; �
  671. dw 6000H, 6000H ; �
  672. dw 6A00H, 6A00H ; �
  673. dw 6E00H, 6E00H ; �
  674. dw 6400H, 6400H ; �
  675. dw 6700H, 6700H ; � ctrl +F10
  676. dw 7100H, 7100H ; � alt +F10
  677. dw 6600H, 6600H ; �
  678. dw 7000H, 7000H ; �
  679. dw 6100H, 6100H ; �
  680. dw 6B00H, 6B00H ; �
  681. dw 6800H, 6800H ; � alt +F1
  682. dw 5e00H, 5e00H ; � ctrl +F1
  683. dw 6300H, 6300H ; �
  684. dw 2b00H, 00a7H ; �
  685. dw 1500h, 00e0H ; �
  686. dw 1700h, 17c0H ; �
  687. dw 7800h, 78B1H ; � alt +1
  688. dw 7A00H, 7AABH ; �
  689. dw 7900H, 79BBH ; � alt +2
  690. dw 1800h, 18a7H ; �
  691. dw 1900h, 19a9H ; � alt +P
  692. dw 7B00H, 7BF6H ; �
  693. dw 7C00H, 7CF7H ; �
  694. dw 7D00H, 7Db0H ; �
  695. dw 7E00H, 7Eb7H ; �
  696. dw 7F00H, 7F9cH ; �
  697. dw 8000H, 80b2H ; �
  698. dw 8100H, 81b3H ; �
  699. dw 8200H, 82bdH ; � alt +-
  700. dw 1E61H, 18E1H ; a
  701. dw 3062H, 30E2H ; b
  702. dw 2267H, 22E3H ; g
  703. dw 2064H, 20E4H ; d
  704. dw 1265H, 12E5H ; e
  705. dw 2C7AH, 2CE6H ; z
  706. dw 2368H, 23E7H ; h
  707. dw 1675H, 16E8H ; u
  708. dw 1769H, 17E9H ; i
  709. dw 256BH, 25EAH ; k
  710. dw 266CH, 26EBH ; l
  711. dw 326DH, 32ECH ; m
  712. dw 316EH, 31EDH ; n
  713. dw 246AH, 24EEH ; j
  714. dw 186FH, 18EFH ; o
  715. dw 1970H, 00F0H ; p
  716. dw 1372H, 13F1H ; r
  717. dw 1F73H, 1FF3H ; s
  718. dw 1474H, 14F4H ; t
  719. dw 1579H, 15F5H ; y
  720. dw 2166H, 21F6H ; f
  721. dw 2D78H, 2DF7H ; x
  722. dw 2E63H, 2EF8H ; c
  723. dw 2F76H, 2FF9H ; v
  724. dw 1177H, 11F2H ; w
  725. dw 1E41H, 1EC1H ; A
  726. dw 3042H, 30C2H ; B
  727. dw 2247H, 22C3H ; G
  728. dw 2044H, 20C4H ; D
  729. dw 1245H, 12C5H ; E
  730. dw 2C5AH, 2CC6H ; Z
  731. dw 2348H, 23C7H ; H
  732. dw 1655H, 16C8H ; U
  733. dw 1749H, 17C9H ; I
  734. dw 254BH, 25CAH ; K
  735. dw 264CH, 26CBH ; L
  736. dw 324DH, 32CCH ; M
  737. dw 314EH, 31CDH ; N
  738. dw 244AH, 24CEH ; J
  739. dw 184FH, 18CFH ; O
  740. dw 1950H, 19D0H ; P
  741. dw 1352H, 13D1H ; R
  742. dw 1F53H, 1FD3H ; S
  743. dw 1454H, 14D4H ; T
  744. dw 1559H, 15D5H ; Y
  745. dw 2146H, 21D6H ; F
  746. dw 2D58H, 2DD7H ; X
  747. dw 2E43H, 2ED8H ; C
  748. dw 2F56H, 2FD9H ; V
  749. dw 1157H, 117eH ; w
  750. dw 565CH, 56A7H ; Para
  751. dw 567CH, 56A9H ; Copyright
  752. dw 0423h, 04A3h ;
  753. dw 1a7bH, 1aabH ;
  754. dw 1b7dH, 1bbbH ;
  755. dw 2827H, 28A2H ; ^
  756. dw 2822H, 28A1H ; ~
  757. DW 2960H, 29BDH ; \
  758. dw 297EH, 29B1H ; |
  759. dw 0C5FH, 0CB0H ; ?
  760. dw 2B5CH, 2Bb2H ; #
  761. dw 2B7CH, 2Bb3H ; @
  762. dw 7a00H, 04A3H ; �
  763. DW 2960H, 295CH ; \
  764. dw 297EH, 297CH ; |
  765. dw 0340H, 0322H ; "
  766. dw 075EH, 0726H ; &
  767. dw 0826H, 082FH ; /
  768. dw 092AH, 0928H ; (
  769. dw 0A28H, 0A29H ; )
  770. dw 0B29H, 0B3DH ; =
  771. dw 0C5FH, 0C3FH ; ?
  772. dw 0C2DH, 0C27H ; '
  773. dw 0D3DH, 0D2BH ; +
  774. dw 0D2BH, 0D2AH ; *
  775. dw 2B5CH, 2B23H ; #
  776. dw 2B7CH, 2B40H ; @
  777. dw 565CH, 563CH ; <
  778. dw 567CH, 563EH ; >
  779. dw 333CH, 333BH ; ;
  780. dw 343EH, 343AH ; :
  781. dw 352FH, 352DH ; -
  782. dw 353FH, 355FH ; _
  783. dw 273BH, 2727H ; '
  784. dw 1B1dH, 1b5EH ;
  785. dw 2827H, 285EH ; ^
  786. dw 2822H, 287EH ; ~
  787. dw 0FFFFH
  788. INITIALIZE PROC NEAR
  789. ASSUME DS:CODE
  790. PUSH CS
  791. POP ES
  792. MOV AX,3306H
  793. INT 21H
  794. MOV OS_Ver,BX
  795. MOV AX,0CC00h
  796. INT 2Fh
  797. CMP AL,0FFh
  798. JNE PARSE
  799. CMP BX,"GK"
  800. JNE PARSE
  801. MOV INSTALL_FLAG,1 ;Program is already installed
  802. MOV CS:[CodePage],DL
  803. ;
  804. ;
  805. PARSE:
  806. CLD ;CLEAR DIRECTION
  807. XOR CH,CH
  808. MOV SI,80H ;Point DS:SI to command line
  809. MOV CL,[SI]
  810. CMP CL,0
  811. JE ENDSCAN
  812. INC SI
  813. INIT1: LODSB
  814. CMP AL,"/"
  815. JE SLASHCAR
  816. INIT6: LOOP INIT1
  817. JMP ENDSCAN
  818. SLASHCAR:
  819. CMP BYTE PTR [SI],'?'
  820. JNE NO_HELP
  821. JMP DISP_HELP
  822. NO_HELP:
  823. CMP BYTE PTR [SI],'8'
  824. JE INIT2
  825. CMP BYTE PTR [SI],'9'
  826. JE INIT3
  827. CMP BYTE PTR [SI],'7'
  828. JE INIT4
  829. CMP BYTE PTR [SI],'4'
  830. JE INIT4
  831. AND BYTE PTR [SI],0DFh ;Change char to uppercase
  832. ; CMP BYTE PTR [SI],'U'
  833. ; JE UNINSTALL ;Yes, then uninstall program
  834. CHK_H:
  835. CMP BYTE PTR [SI],'H' ; Ask for help
  836. JNE INIT6 ; No branch
  837. DISP_HELP:
  838. CALL DISP_BANNER
  839. MOV DX,OFFSET HELP_BANNER
  840. MOV AH,9
  841. INT 21H
  842. MOV AX,4C00H ;Exit with ERRORLEVEL = 0
  843. INT 21H
  844. INIT2:
  845. CMP BYTE PTR [SI+1],'6'
  846. JNE INIT6
  847. CMP BYTE PTR [SI+2],'9'
  848. JNE INIT6
  849. MOV CS:[CodePage],2
  850. JMP INIT6
  851. INIT3:
  852. CMP BYTE PTR [SI+1],'2'
  853. JNE INIT6
  854. CMP BYTE PTR [SI+2],'8'
  855. JNE INIT6
  856. MOV CS:[CodePage],3
  857. JMP INIT6
  858. INIT4:
  859. CMP BYTE PTR [SI+1],'3'
  860. JNE INIT6
  861. CMP BYTE PTR [SI+2],'7'
  862. JNE INIT6
  863. MOV CS:[CodePage],1
  864. JMP INIT6
  865. ENDSCAN:
  866. MOV AL,CS:[CodePage]
  867. CMP AL,ES:[CPTable]
  868. JE NOCP
  869. MOV ES:[CHECKFLAG],1 ;Clear CHECKFLAG byte
  870. MOV ES:[CPTable],AL
  871. CALL ChangeCP
  872. NOCP:
  873. CMP INSTALL_FLAG,1 ;Branch if not installed
  874. JNE INSTALL1
  875. MOV DX,OFFSET CONFIRM_MSG3 ;Print confirmation message
  876. JMP SHORT CONFIRM_AND_EXIT ;And exit
  877. UNINSTALL:
  878. CMP INSTALL_FLAG,1 ;Error if not installed
  879. JE UNINSTALL2
  880. MOV AL,3
  881. MOV DX,OFFSET ERRMSG1 ;Initialize error pointer
  882. JMP ERROR_EXIT
  883. UNINSTALL2:
  884. CALL REMOVE ;Uninstall the program
  885. JNC UNINSTALL3
  886. MOV AL,4
  887. MOV DX,OFFSET ERRMSG2 ;Initialize error pointer
  888. JMP ERROR_EXIT
  889. UNINSTALL3:
  890. MOV DX,OFFSET CONFIRM_MSG2 ;Print confirmation message
  891. CONFIRM_AND_EXIT:
  892. PUSH DX
  893. CALL DISP_BANNER
  894. POP DX
  895. MOV AH,9
  896. INT 21H
  897. MOV AX,4C00H ;Exit with ERRORLEVEL = 0
  898. INT 21H
  899. ERROR_EXIT:
  900. PUSH AX ;Save registers
  901. MOV AH,9
  902. INT 21H
  903. POP AX ;Error code
  904. MOV AH,4CH ;Terminate with ERRORLEVEL set
  905. INT 21H
  906. INSTALL1:
  907. PUSH ES
  908. MOV AX,3509H
  909. INT 21H
  910. MOV WORD PTR OLD_INT09H,BX ;Address and put it in our location
  911. MOV WORD PTR OLD_INT09H+2,ES
  912. MOV DX,OFFSET NEW_INT09H
  913. MOV AX,2509H
  914. INT 21h
  915. mov ax, 352Fh ; Request DOS Function 35h
  916. int 21h ; Get interrupt vector in ES:BX
  917. MOV WORD PTR OLD_INT2FH,BX ;Address and put it in our location
  918. MOV WORD PTR OLD_INT2FH+2,ES
  919. MOV DX,OFFSET MultiPlex
  920. MOV AX,252Fh
  921. INT 21h
  922. CALL DISP_BANNER
  923. POP ES
  924. MOV AX,DS:[2CH] ;Get environment segment
  925. MOV ES,AX ; address from PSP
  926. MOV AH,49H ;Then deallocate environment
  927. INT 21H ; space reserved by DOS
  928. INT 11H
  929. TEST AL,10H
  930. JNZ NOCGA
  931. MOV CURSOR0,0607H
  932. MOV CURSOR1,0307H
  933. NOCGA:
  934. MOV DX,OFFSET INITIALIZE
  935. INT 27H
  936. DISP_BANNER:
  937. MOV DX,OFFSET MSGSTRT
  938. MOV AH,9
  939. INT 21h
  940. MOV DX,OFFSET MSG869
  941. CMP CS:[CodePage],2
  942. JE DISPREST
  943. MOV DX,OFFSET MSG928
  944. CMP CS:[CodePage],3
  945. JE DISPREST
  946. MOV DX,OFFSET MSG737
  947. DISPREST:
  948. MOV AH,9
  949. INT 21h
  950. CMP OS_Ver,ISWINDOWSNT
  951. JNE BANNER_END
  952. MOV DX,OFFSET MSGONNT
  953. MOV AH,9
  954. INT 21H
  955. BANNER_END:
  956. RET
  957. INITIALIZE ENDP
  958. ;-----------------------------------------------------------------------------
  959. ;REMOVE deallocates the memory block addressed by ES and restores the
  960. ;Interrupt vector displaced on installation.
  961. ;-----------------------------------------------------------------------------
  962. REMOVE PROC NEAR
  963. PUSH ES ;Get current interrupt
  964. MOV AX,352FH
  965. INT 21H
  966. MOV BX,ES
  967. POP ES
  968. MOV AX,ES
  969. CMP BX,AX ;Program cannot be uninstalled
  970. JNE NO_RESTORE_VECTOR
  971. PUSH ES ;Get current interrupt
  972. MOV AX,3509H
  973. INT 21H
  974. MOV BX,ES
  975. POP ES
  976. MOV AX,ES
  977. CMP BX,AX ;Program cannot be uninstalled
  978. JE RESTORE_VECTOR
  979. NO_RESTORE_VECTOR:
  980. STC ;Return with CF = 1 for error
  981. RET
  982. RESTORE_VECTOR:
  983. PUSH DS ;Restore displaced interrupt
  984. ASSUME DS:NOTHING ; vector
  985. LDS DX,ES:[BIOS_ISR]
  986. MOV AX,2509H
  987. INT 21H
  988. LDS DX,ES:[MULTEX_ISR]
  989. MOV AX,252fH
  990. INT 21H
  991. POP DS
  992. ASSUME DS:CODE
  993. NOT WORD PTR ES:[BEGIN] ;Remove fingerprint
  994. MOV AH,49H ;Free memory given to
  995. INT 21H ; original program block
  996. RET ;Exit with CF intact
  997. REMOVE ENDP
  998. INSTALL_FLAG DB 0
  999. CodePage DB 1
  1000. MSGSTRT DB 0ah,0dh
  1001. DB 'GREEK Driver for MS-DOS. Copyright 1994 Microsoft Hellas',0ah,0dh
  1002. DB 'Layout for IBM Keyboard 319 (ELOT 1000). Active Code Page is ','$'
  1003. MSG737 DB '737',0ah,0dh,'$'
  1004. MSG869 DB '869',0ah,0dh,'$'
  1005. MSG928 DB '928',0ah,0dh,'$'
  1006. MSGONNT DB 'Running under MS Windows NT',10,13,'$'
  1007. ERRMSG1 DB "Greek driver not loaded",0dh,0ah,"$"
  1008. ERRMSG2 DB "Cannot unload Greek driver",0dh,0ah,"$"
  1009. CONFIRM_MSG2 DB "Driver unloaded.",0dh,0ah,"$"
  1010. CONFIRM_MSG3 DB "Driver loaded."
  1011. Dummy DB 0dh,0ah,"$"
  1012. HELP_BANNER DB 0ah,0dh
  1013. DB 'Hotkeys for keyboard switching are:',0ah,0dh
  1014. DB ' Alt + Right Shift, Greek On ',0ah,0dh
  1015. DB ' Alt + Left Shift, Greek Off',0ah,0dh
  1016. DB ' Ctrl + Right Shift, Semigraphics',0ah,0dh,0ah,0dh
  1017. DB 'For code page switching,',0ah,0dh
  1018. DB 'set Scroll Lock on and press:',0ah,0dh
  1019. DB ' Alt + 1 for C.P. 737',0ah,0dh
  1020. DB ' Alt + 2 for C.P. 869',0ah,0dh
  1021. DB ' Alt + 3 for C.P. 928',0ah,0dh
  1022. DB 0dh,0ah,'Valid switches are:',0dh,0ah
  1023. DB ' /737: code page 737 (default)',0dh,0ah
  1024. DB ' /869: code page IBM 869',0dh,0ah
  1025. DB ' /928: code page ELOT 928',0dh,0ah,'$'
  1026. CODE ENDS
  1027. END BEGIN