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.

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