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.

1192 lines
31 KiB

  1. ;========================================================================
  2. ;
  3. ; Hot Key Service Function
  4. ;
  5. ;========================================================================
  6. ASSUME CS:CODE, DS:CODE, ES:CODE
  7. MainPos = 0
  8. Sub1Pos = 112h
  9. Sub2Pos = 133h
  10. MsgLength = 16
  11. eom = '$'
  12. DataStr STRUC
  13. mCurValue db ?
  14. mMaxValue db ?
  15. mCurPos dw ?
  16. mDataAddr dw ?
  17. mMsgs dw ?
  18. DataStr ENDS
  19. CurMenu dw 0 ; current main menu
  20. tCodeStat db 0
  21. tPrinter db 0
  22. NorAttr db 70h
  23. SelAttr db 7
  24. BakAttr db 70h
  25. OldCodeStat db 0
  26. BilingCall db 0 ; [CHM001]
  27. MainTbl label word
  28. dw offset Menu1
  29. dw offset Menu2
  30. MainTblLng = ($-MainTbl)/2
  31. Menu1 label word
  32. Menu1Cur db 0
  33. Menu1Max db Sub1DataLng-1
  34. dw Sub1Pos
  35. dw offset Sub1Data
  36. dw offset Menu1Msg1
  37. dw offset Menu1Msg2
  38. dw offset Menu1Msg3
  39. ; dw offset Menu1Msg4
  40. Sub1Data label byte
  41. db 0
  42. db HangeulMode or WSung
  43. db HangeulMode or Chab
  44. ; db HangeulMode or WSung7
  45. Sub1DataLng = $-Sub1Data
  46. Menu1Msg1 db 'English',eom
  47. Menu1Msg2 db 'KS C 5842 - 1991',eom
  48. Menu1Msg3 db 'Chohab',eom
  49. ;Menu1Msg4 db 'Wansung 7 bit',eom
  50. Menu2 label word
  51. Menu2Cur db 0
  52. Menu2Max db Sub2DataLng-1
  53. dw Sub2Pos
  54. dw offset Sub2Data
  55. dw offset Menu2Msg1
  56. dw offset Menu2Msg2
  57. ; dw offset Menu2Msg3
  58. dw offset Menu2Msg4
  59. dw offset Menu2Msg5
  60. dw offset Menu2Msg6
  61. Sub2Data label byte
  62. db NoPrt
  63. db KsPrt
  64. ; db wLbp
  65. db wKmPrt
  66. db cKmPrt
  67. db TgPrt
  68. Sub2DataLng = $-Sub2Data
  69. Menu2Msg1 db 'None selected',eom
  70. Menu2Msg2 db 'KS',eom
  71. ;Menu2Msg3 db 'QLBP',eom
  72. Menu2Msg4 db 'KSSM',eom
  73. Menu2Msg5 db 'KSSM(Chohab)',eom
  74. Menu2Msg6 db 'TG(Chohab)',eom
  75. MainMenu label byte
  76. dw 0fh
  77. db 'Hangeul BIOS environment changing program',0
  78. dw 10bh
  79. db 'CODE :',0
  80. dw 129h
  81. db 'PRINTER :',0
  82. dw 215h
  83. db 'USAGE : Enter, Esc, Arrows',eom
  84. ;========================================================================
  85. ; << EnvrChange >>
  86. ; FUNCTION = Hot_ key function ó
  87. ; INPUT : none
  88. ; OUTPUT : none
  89. ; PROTECT : all
  90. EXTRN PushKeyBuf:near
  91. PUBLIC EnvrChange
  92. public EscCode2Tbl, EscCode3Tbl, EscCodeNTbl, EscCode4Tbl
  93. public EscCode2Addr, EscCode3Addr, EscCodeNAddr, EscCode4Addr
  94. dSaveCurrPage db 0
  95. dSaveCurPos dw 0
  96. dSaveCurType dw 0
  97. INCLUDE debug.inc
  98. EnvrChange:
  99. ASSUME DS:DATA, ES:CODE
  100. @push ax,bx,cx,dx,si,di,es,ds
  101. xor bx,bx
  102. mov ds,bx
  103. mov bx,cs
  104. cmp bx,word ptr [rKbioInt+2]
  105. jnz EnvrChgRet
  106. mov bx,cs
  107. mov es,bx
  108. mov ds,bx
  109. ASSUME DS:CODE
  110. mov al,[CodeStat]
  111. mov [OldCodeStat],al
  112. if AltHotKey
  113. test [HotStat],AltHotChg
  114. jz NotAltChg
  115. test [CodeStat],(Chab or WSung7)
  116. jnz EnvrChgRet
  117. and [CodeStat],not (HangeulMode or Chab or WSung or WSung7)
  118. test al,HangeulMode
  119. jnz @f
  120. or [CodeStat],(HangeulMode or WSung)
  121. @@:
  122. call AltHotChgProc
  123. jmp EnvrChgRet
  124. NotAltChg:
  125. endif ; if AltHotKey
  126. call AdjustParms
  127. call SaveScrn
  128. call DispMain
  129. call DispStatus
  130. call MainLoop
  131. call RestoreScrn
  132. jc EnvrChgRet
  133. call ChgEnvr
  134. EnvrChgRet:
  135. @pop ds,es,di,si,dx,cx,bx,ax
  136. ret
  137. if AltHotKey
  138. AltHotChgProc:
  139. test cs:[Card1st],HanCard
  140. jz @f
  141. mov ah,0fh
  142. int 10h
  143. cmp al,2
  144. jz AltHotChgText
  145. cmp al,3
  146. jz AltHotChgText
  147. test cs:[Card1st],VgaCard
  148. jz @f
  149. test cs:[Card1st],DualMnt
  150. jnz @f
  151. cmp al,7
  152. jz AltHotChgText
  153. @@:
  154. if AtiVga
  155. mov [PreModeV],al
  156. endif ;AtiVga
  157. call ChgEnvrProc
  158. ret
  159. AltHotChgText:
  160. call SaveScrData
  161. ;if KseVga
  162. ; test cs:[KseCard],00000001b
  163. ; jz @f
  164. ; test [CodeStat],HangeulMode
  165. ; jnz @f
  166. ; CALL SaveEngPat
  167. ;@@:
  168. ;endif ; if KseVga
  169. push es
  170. test cs:[CodeStat],HangeulMode
  171. jnz SetHanVideoI
  172. call ChgParmH2E
  173. jmp @f
  174. SetHanVideoI:
  175. call ChgParmE2H
  176. @@:
  177. push ax
  178. push bx
  179. mov ax,0
  180. mov es,ax
  181. ASSUME ES:DATA
  182. mov ah,0fh
  183. int 10h
  184. or al, 80h
  185. mov ah, 0
  186. int 10h
  187. JMP SetParmKse
  188. cli
  189. push ax
  190. mov [ModeStat],0
  191. and [KbStat],not HanKeyinMode
  192. and [CodeStat],not HangeulVideoMode
  193. mov [CurMode],al
  194. call HanCardReset
  195. call SearchMode
  196. jnc @f
  197. pop ax
  198. or al, 080h
  199. pushf
  200. call [OLDVIDEO]
  201. if KseVga
  202. test cs:[KseCard],00000001b
  203. jz SetParmKse
  204. ;or al,080h
  205. ;PUSHF
  206. ;CALL [OLDVIDEO]
  207. ; CALL LoadEngPat
  208. call SetParmAlt
  209. endif ; KseVga
  210. JMP SetParmKse
  211. @@:
  212. pop ax
  213. or [KbStat],HanKeyInMode
  214. or [CodeStat],HangeulVideoMode
  215. if KseVga
  216. test cs:[KseCard],00000001b
  217. jnz ProContKA
  218. endif ; KseVga
  219. if AtiVga
  220. test cs:[KseCard],00000001b
  221. jnz @f
  222. call LoadEngPattern
  223. mov bx,ax
  224. cmp al,[PreModeV]
  225. jnz @f
  226. call HanCardSet
  227. push si
  228. call GetParmTbl
  229. mov dx,03cch
  230. in al,dx
  231. mov ah,al
  232. lodsb
  233. pop si
  234. cmp ah,al
  235. jnz @f
  236. jmp SetParmKse
  237. @@:
  238. mov [PreModeV],bl
  239. mov ax,bx
  240. endif ;AtiVga
  241. ProContKA:
  242. call PreModeSet
  243. call ClearGrpBuf
  244. if KseVga
  245. test cs:[KseCard],00000001b
  246. jz @f
  247. or al,080h
  248. PUSHF
  249. CALL [OLDVIDEO]
  250. @@:
  251. endif ; KseVga
  252. call LoadEngPattern
  253. CALL SettingVariables
  254. call HanCardSet
  255. call SetParmAlt
  256. SetParmKse:
  257. pop bx
  258. pop ax
  259. pop es
  260. assume es:code
  261. sti
  262. call WritScrData
  263. if KseVga
  264. test cs:[KseCard],00000001b
  265. jz @f
  266. call KseVEop
  267. @@:
  268. endif ; if KseVga
  269. ret
  270. SetParmAlt:
  271. call GetParmTbl
  272. mov dx,03c2h
  273. lodsb
  274. out dx,al
  275. mov dx,03c4h
  276. mov ah,1
  277. lodsb
  278. xchg ah,al
  279. out dx,ax
  280. mov dx,cx
  281. mov cx,25
  282. mov ax,0
  283. out dx,ax
  284. xor ah,ah
  285. call OutParms
  286. add dl,0ah-4
  287. in al,dx
  288. in al,dx
  289. mov dx,03c0h
  290. mov al,13h
  291. out dx,al
  292. lodsb
  293. out dx,al
  294. mov al,03fh
  295. out dx,al
  296. if KseVga
  297. test cs:[KseCard],00000001b
  298. jz @f
  299. jmp SetParmVgaRet
  300. @@:
  301. endif ; KseVga
  302. mov cx,02h
  303. mov dx,01ceh
  304. mov ah,0a8h
  305. call OutParms
  306. SetParmVgaRet:
  307. ret
  308. GetParmTbl:
  309. push bx
  310. mov bx,0
  311. test [CodeStat],HangeulMode
  312. jz @f
  313. mov bx,1
  314. @@:
  315. push es
  316. mov ax,0
  317. mov es,ax
  318. mov cx,ES:[rAddr6845]
  319. pop es
  320. test cs:[KseCard],MonoMntC
  321. jz @f
  322. or bx,000000100b
  323. jmp SetParmProc
  324. @@:
  325. cmp cx,3b4h
  326. jnz SetParmProc
  327. or bx,000000010b
  328. SetParmProc:
  329. shl bx,1
  330. if AtiVga
  331. mov si,offset AttrTblAti
  332. endif ; AtiVga
  333. if KseVga
  334. test cs:[KseCard],00000001b
  335. jz @f
  336. mov si,offset AttrTblKse
  337. @@:
  338. endif ; KseVga
  339. mov si,[si+bx]
  340. pop bx
  341. ret
  342. OutParms:
  343. lodsb
  344. xchg al,ah
  345. out dx,ax
  346. xchg al,ah
  347. inc ah
  348. loop OutParms
  349. ret
  350. if KseVga
  351. KseEng2Vga db 067h
  352. db 000h
  353. db 05Fh,04Fh,050h,082h,055h,081h,0BFh,01Fh,000h,04Fh,00Dh,00Eh,000h,000h,000h,000h
  354. db 09Ch,00Eh,08Fh,028h,01Fh,096h,0B9h,0A3h,0FFh
  355. db 008h
  356. KseHan2Vga db 063h
  357. db 001h
  358. db 061h,052h,053h,023h,057h,06Fh,0BFh,01Fh,000h,04Fh,00Dh,06Eh,000h,000h,000h,000h
  359. db 09Ch,00Eh,08Fh,028h,01Fh,096h,0B9h,0A3h,0FFh
  360. db 000h
  361. KseEng7Vga db 066h
  362. db 000h
  363. db 05Fh,04Fh,050h,082h,055h,081h,0BFh,01Fh,000h,04Fh,00Dh,00Eh,000h,000h,000h,000h
  364. db 09Ch,00Eh,08Fh,028h,00Fh,096h,0B9h,0A3h,0FFh
  365. db 008h
  366. KseHan7Vga db 062h
  367. db 001h
  368. db 061h,052h,053h,023h,057h,06Fh,0BFh,01Fh,000h,04Fh,00Dh,06Eh,000h,000h,000h,000h
  369. db 09Ch,00Eh,08Fh,028h,00Fh,096h,0B9h,0A3h,0FFh
  370. db 000h
  371. KseEng7Mda db 0A6h
  372. db 000h
  373. db 060h,04Fh,056h,03Ah,051h,060h,070h,01Fh,000h,00Dh,00Bh,00Dh,000h,000h,000h,000h
  374. db 05Eh,02Eh,05Dh,028h,00Dh,05Eh,00Eh,0A3h,0FFh
  375. db 008h
  376. KseHan7Mda db 0A6h
  377. db 001h
  378. db 05Fh,052h,055h,025h,053h,0E3h,0B0h,01Fh,000h,00Fh,00Eh,060h,000h,000h,000h,000h
  379. db 090h,020h,08Fh,028h,00Dh,090h,000h,0A3h,0FFh
  380. db 000h
  381. AttrTblKse label byte
  382. dw offset KseEng2Vga
  383. dw offset KseHan2Vga
  384. dw offset KseEng7Vga
  385. dw offset KseHan7Vga
  386. dw offset KseEng7Mda
  387. dw offset KseHan7Mda
  388. endif ; KseVga
  389. if AtiVga
  390. PreModeV DB 0
  391. AtiEng2Vga db 067h
  392. db 000h
  393. db 05Fh,04Fh,050h,082h,055h,081h,0BFh,01Fh,000h,04Fh,00Dh,00Eh,000h,000h,007h,080h
  394. db 09Ch,00Eh,08Fh,028h,01Fh,096h,0B9h,0A3h,0FFh
  395. db 008h
  396. db 001h,072h
  397. ; db 048h,012h,000h,000h,054h,076h,004h,000h,001h,072h,005h,080h,000h,000h,000h,000h
  398. ; db 010h,000h,000h,000h,000h,008h,000h,02Dh,040h,073h,000h,063h,000h,090h,010h,008h
  399. AtiHan2Vga db 063h
  400. db 001h
  401. db 05Fh,04Fh,050h,082h,054h,080h,0BFh,01Fh,000h,04Fh,00Dh,00Eh,000h,000h,007h,080h
  402. db 09Ch,00Eh,08Fh,028h,01Fh,096h,0B9h,0A3h,0FFh
  403. db 000h
  404. db 001h,0aeh
  405. ; db 048h,012h,000h,000h,054h,076h,004h,000h,001h,0AEh,005h,080h,000h,000h,000h,000h
  406. ; db 010h,000h,000h,000h,000h,008h,000h,02Dh,040h,073h,000h,063h,000h,090h,010h,028h
  407. AtiEng7Vga db 066h
  408. db 000h
  409. db 05Fh,04Fh,050h,082h,055h,081h,0BFh,01Fh,000h,04Fh,00Dh,00Eh,000h,000h,002h,030h
  410. db 09Ch,00Eh,08Fh,028h,00Fh,096h,0B9h,0A3h,0FFh
  411. db 008h
  412. db 01h,079h
  413. ; db 048h,012h,000h,000h,054h,076h,004h,000h,001h,079h,005h,080h,000h,000h,000h,000h
  414. ; db 010h,000h,000h,000h,000h,008h,000h,02Dh,040h,073h,000h,063h,000h,090h,010h,008h
  415. AtiHan7Vga db 062h
  416. db 001h
  417. db 05Fh,04Fh,050h,082h,054h,080h,0BFh,01Fh,000h,04Fh,00Dh,00Eh,000h,000h,007h,080h
  418. db 09Ch,00Eh,08Fh,028h,01Fh,096h,0B9h,0A3h,0FFh
  419. db 000h
  420. db 00h,0cdh
  421. ; db 048h,012h,000h,000h,054h,076h,004h,000h,000h,0CDh,005h,080h,000h,000h,000h,000h
  422. ; db 010h,000h,000h,000h,000h,008h,000h,025h,040h,073h,000h,063h,000h,090h,010h,028h
  423. AtiEng7Mda db 0A6h
  424. db 001h
  425. db 06Ch,04Fh,050h,02Bh,055h,067h,09Fh,01Fh,000h,00Fh,00Dh,00Fh,000h,000h,007h,080h
  426. db 000h,000h,08Fh,028h,00Fh,091h,015h,0A3h,0FFh
  427. db 000h
  428. db 00h,093h
  429. ; db 058h,017h,000h,000h,054h,076h,004h,000h,000h,093h,005h,080h,000h,000h,000h,000h
  430. ; db 010h,007h,000h,000h,002h,008h,0A2h,025h,086h,0F1h,00Fh,062h,000h,0D0h,015h,008h
  431. AtiHan7Mda db 0A6h
  432. db 001h
  433. db 06Ch,04Fh,050h,02Bh,055h,067h,09Fh,01Fh,000h,00Fh,00Dh,00Fh,000h,000h,007h,080h
  434. db 000h,000h,08Fh,028h,00Fh,091h,015h,0A3h,0FFh
  435. db 000h
  436. db 00h,0e6h
  437. ; db 058h,017h,000h,000h,054h,076h,004h,000h,000h,0E6h,005h,080h,000h,000h,000h,000h
  438. ; db 000h,007h,000h,000h,002h,008h,0A2h,025h,086h,0F1h,00Fh,042h,000h,0D0h,015h,008h
  439. AttrTblAti label byte
  440. dw offset AtiEng2Vga
  441. dw offset AtiHan2Vga
  442. dw offset AtiEng7Vga
  443. dw offset AtiHan7Vga
  444. dw offset AtiEng7Mda
  445. dw offset AtiHan7Mda
  446. endif ; AtiVga
  447. SaveScrData:
  448. @push ds,es,cx,di,si
  449. mov ah,0fh
  450. int 10h
  451. push ax
  452. mov cs:[dSaveCurrPage],bh
  453. mov ah,03h
  454. int 10h
  455. mov cs:[dSaveCurType],cx
  456. mov cs:[dSaveCurPos],dx
  457. mov cx,0
  458. mov es,cx
  459. mov cx,es:[rCrtStart]
  460. les di,[CodeBuf2Addr]
  461. lds si,[CodeBuf1Addr]
  462. pop ax
  463. mov dx,0b000h
  464. cmp al,07h
  465. jz @f
  466. mov dx,0b800h
  467. @@:
  468. mov ds,dx
  469. shr cx,1
  470. shr cx,1
  471. shr cx,1
  472. shr cx,1
  473. mov dx,ds
  474. add cx,dx
  475. mov ds,cx
  476. mov cx,25*80
  477. mov ax,ds
  478. mov bx,si
  479. rep movsw
  480. @pop si,di,cx,es,ds
  481. ret
  482. WritScrData:
  483. @push es,ds
  484. lds si,[CodeBuf2Addr]
  485. mov es,ax
  486. mov di,bx
  487. mov cx,25*80
  488. rep movsw
  489. mov bh,cs:[dSaveCurrPage]
  490. mov dx,cs:[dSaveCurPos]
  491. mov ah,02h
  492. int 10h
  493. mov cx,cs:[dSaveCurType]
  494. mov ah,01h
  495. int 10h
  496. @pop ds,es
  497. ret
  498. endif ; AltHotKey
  499. ;------------------------------------------------------------------------
  500. ; << AdjustParms >>
  501. ; FUNCTION = initialize menu value
  502. ; INPUT : none
  503. ; OUTPUT : none
  504. ; PROTECT : DS, ES, BP
  505. AdjustParms:
  506. mov [CurMenu],0
  507. mov ah,[Printer]
  508. and ah,00000111b
  509. mov al,[CodeStat]
  510. and al,HangeulMode or Chab or WSung or WSung7
  511. test [CodeStat],ChabLoad
  512. jnz @f
  513. mov [Menu1Max],2-1
  514. mov [Menu2Max],1-1
  515. and al,HangeulMode or WSung
  516. mov ah,NoPrt
  517. @@:
  518. mov [tPrinter],ah
  519. mov [tCodeStat],al
  520. mov si,offset Sub1Data
  521. mov dx,si
  522. mov cx,Sub1DataLng
  523. @@:
  524. cmp [si],al
  525. jz @f
  526. inc si
  527. loop @b
  528. mov si,dx ; initiale
  529. @@:
  530. sub si,dx
  531. mov dx,si
  532. mov [Menu1Cur],dl
  533. mov al,[tPrinter]
  534. mov si,offset Sub2Data
  535. mov dx,si
  536. mov cx,Sub2DataLng
  537. @@:
  538. cmp [si],al
  539. jz @f
  540. inc si
  541. loop @b
  542. mov si,dx ; initiale
  543. @@:
  544. sub si,dx
  545. mov dx,si
  546. mov [Menu2Cur],dl
  547. ret
  548. ;------------------------------------------------------------------------
  549. ; << SaveScrn >>
  550. ; FUNCTION = save menu screen
  551. ; INPUT : none
  552. ; OUTPUT : none
  553. ; PROTECT : DS, ES, BP
  554. SaveScrn:
  555. mov ah,0fh
  556. int 10h
  557. mov [dSaveCurrPage],bh
  558. mov [NorAttr],70h
  559. mov [SelAttr],7
  560. mov [BakAttr],70h
  561. cmp al,3
  562. jbe @f
  563. cmp al,7
  564. jz @f
  565. mov [NorAttr],7
  566. mov [SelAttr],0fh
  567. mov [BakAttr],0
  568. @@:
  569. mov ah,3
  570. int 10h
  571. mov [dSaveCurType],cx
  572. mov [dSaveCurPos],dx
  573. mov ah,1
  574. or ch,20h
  575. int 10h
  576. xor dx,dx
  577. mov di,offset MenuBuffer
  578. mov cx,80*3
  579. SaveLp:
  580. mov ah,2
  581. int 10h
  582. mov ah,8
  583. int 10h
  584. stosw
  585. inc dl
  586. cmp dl,80
  587. jb @f
  588. xor dl,dl
  589. inc dh
  590. @@:
  591. loop SaveLp
  592. ret
  593. ;------------------------------------------------------------------------
  594. ; << DispMain >>
  595. ; FUNCTION = Display main menu
  596. ; INPUT : none
  597. ; OUTPUT : none
  598. ; PROTECT : DS, ES, BP
  599. DispMain:
  600. mov bh,[BakAttr]
  601. xor cx,cx
  602. mov dx,024fh
  603. mov ax,600h
  604. int 10h
  605. mov bh,[dSaveCurrPage]
  606. mov bl,[NorAttr]
  607. mov si,offset MainMenu
  608. inc cx
  609. DispMainLp:
  610. lodsw
  611. mov dx,ax
  612. @@:
  613. mov ah,2
  614. int 10h
  615. lodsb
  616. cmp al,eom
  617. jz @f
  618. cmp al,0
  619. jz DispMainLp
  620. mov ah,9
  621. int 10h
  622. inc dl
  623. jmp short @b
  624. @@:
  625. ret
  626. ;------------------------------------------------------------------------
  627. ; << DispStatus >>
  628. ; FUNCTION = display sub Menu
  629. ; INPUT : none
  630. ; OUTPUT : none
  631. ; PROTECT : DS, ES, BP
  632. DispStatus:
  633. mov cx,MainTblLng
  634. @@:
  635. push cx
  636. mov bl,[NorAttr]
  637. call DispMenu
  638. inc [CurMenu]
  639. pop cx
  640. loop @b
  641. mov [CurMenu],0
  642. mov bl,[SelAttr]
  643. call DispMenu
  644. ret
  645. ;------------------------------------------------------------------------
  646. ; << MainLoop >>
  647. ; FUNCTION = user interface
  648. ; INPUT : none
  649. ; OUTPUT : none
  650. ; PROTECT : DS, ES, BP
  651. MainLoop:
  652. call GetKey
  653. jc MainLoopAbort
  654. xor ah,ah
  655. shl ax,1
  656. mov si,ax
  657. call [si].KeySrv
  658. jnc MainLoop
  659. clc
  660. MainLoopAbort:
  661. ret
  662. KeySrv label word
  663. dw offset MenuUp ; up
  664. dw offset MenuDown ; down
  665. dw offset MenuLeft ; left
  666. dw offset MenuRight; right
  667. dw offset MenuSave ; enter
  668. ;--------------------------------
  669. MenuUp:
  670. mov bl,[NorAttr]
  671. call DispMenu
  672. mov si,[CurMenu]
  673. shl si,1
  674. mov si,[si].MainTbl
  675. mov al,[si].mCurValue
  676. dec al
  677. cmp al,-1
  678. jnz @f
  679. mov al,[si].mMaxValue
  680. @@:
  681. mov [si].mCurValue,al
  682. mov bl,[SelAttr]
  683. call DispMenu
  684. clc
  685. ret
  686. ;--------------------------------
  687. MenuDown:
  688. mov bl,[NorAttr]
  689. call DispMenu
  690. mov si,[CurMenu]
  691. shl si,1
  692. mov si,[si].MainTbl
  693. mov al,[si].mCurValue
  694. mov ah,[si].mMaxValue
  695. inc al
  696. cmp al,ah
  697. jbe @f
  698. mov al,0
  699. @@:
  700. mov [si].mCurValue,al
  701. mov bl,[SelAttr]
  702. call DispMenu
  703. clc
  704. ret
  705. ;--------------------------------
  706. MenuLeft:
  707. mov bl,[NorAttr]
  708. call DispMenu
  709. dec [CurMenu]
  710. cmp [CurMenu],-1
  711. jnz @f
  712. mov [CurMenu],MainTblLng-1
  713. @@:
  714. mov bl,[SelAttr]
  715. call DispMenu
  716. clc
  717. ret
  718. ;--------------------------------
  719. MenuRight:
  720. mov bl,[NorAttr]
  721. call DispMenu
  722. inc [CurMenu]
  723. cmp [CurMenu],MainTblLng
  724. jb @f
  725. mov [CurMenu],0
  726. @@:
  727. mov bl,[SelAttr]
  728. call DispMenu
  729. clc
  730. ret
  731. ;--------------------------------
  732. MenuSave:
  733. stc
  734. ret
  735. ;--------------------------------
  736. DispMenu:
  737. mov si,[CurMenu]
  738. shl si,1
  739. mov si,[si].MainTbl
  740. mov dx,[si].mCurPos
  741. mov al,[si].mCurValue
  742. xor ah,ah
  743. shl ax,1
  744. add si,ax
  745. mov si,[si].mMsgs
  746. mov bh,[dSaveCurrPage]
  747. push bx
  748. mov ah,2
  749. int 10h
  750. mov cx,MsgLength
  751. mov ah,9
  752. mov al,' '
  753. mov bl,[NorAttr]
  754. int 10h
  755. pop bx
  756. mov cx,1
  757. @@:
  758. mov ah,2
  759. int 10h
  760. lodsb
  761. cmp al,eom
  762. jz @f
  763. inc dl
  764. mov ah,9
  765. int 10h
  766. jmp short @b
  767. @@:
  768. ret
  769. ;--------------------------------
  770. GetKey:
  771. xor ah,ah
  772. pushf
  773. call [OldKbioInt]
  774. cmp ah,1 ; ESC key
  775. jz GetKeyEnd
  776. mov bl,ah
  777. mov si,offset KeyTbl
  778. mov cx,KeyTblLng
  779. @@:
  780. lodsw
  781. cmp al,bl
  782. jz @f
  783. loop @b
  784. mov ax,0e07h
  785. int 10h
  786. jmp short GetKey
  787. @@:
  788. mov al,ah
  789. ret
  790. GetKeyEnd:
  791. stc
  792. ret
  793. KeyTbl label byte
  794. db 48h,0 ; up
  795. db 50h,1 ; down
  796. db 4bh,2 ; left
  797. db 4dh,3 ; right
  798. db 1ch,4 ; enter
  799. KeyTblLng = ($-KeyTbl)/2
  800. ;------------------------------------------------------------------------
  801. ; << ChgEnvr >>
  802. ; FUNCTION = check status & environment change
  803. ; INPUT : none
  804. ; OUTPUT : carry(set = no change & exit)
  805. ; PROTECT : DS, ES, BP
  806. ChgEnvr:
  807. test [CodeStat],ChabLoad
  808. jz @f
  809. mov al,[Menu2Cur]
  810. xor ah,ah
  811. mov si,ax
  812. mov al,[si].Sub2Data
  813. cmp [tPrinter],al
  814. jz @f
  815. mov [Printer],al
  816. mov [PrtAuto],0
  817. mov [HanCnt],0
  818. xor ah,ah
  819. mov si,ax
  820. shl si,1
  821. mov ax,[si].EscCode2Tbl
  822. mov [EscCode2Addr],ax
  823. mov ax,[si].EscCode3Tbl
  824. mov [EscCode3Addr],ax
  825. mov ax,[si].EscCodeNTbl
  826. mov [EscCodeNAddr],ax
  827. mov ax,[si].EscCode4Tbl
  828. mov [EscCode4Addr],ax
  829. @@:
  830. mov al,[Menu1Cur]
  831. xor ah,ah
  832. mov si,ax
  833. mov al,[si].Sub1Data
  834. cmp [tCodeStat],al
  835. jz ChgEnvrEnd
  836. and [CodeStat],not (HangeulMode or Chab or WSung or WSung7)
  837. or [CodeStat],al
  838. ChgEnvrProc:
  839. if not ComFile
  840. push bx
  841. mov bx,437
  842. test [CodeStat],HangeulMode
  843. jz @f
  844. mov bx,1361
  845. test [CodeStat],Chab
  846. jnz @f
  847. mov bx,949
  848. @@:
  849. mov ax,6602h
  850. int 21h
  851. pop bx
  852. endif ; not ComFile
  853. mov ah,0fh
  854. int 10h
  855. call ChgEnvrDo
  856. mov ah,0f3h
  857. int 16h
  858. mov ah,0f3h
  859. int 16h
  860. if 0
  861. ; mov ah,0fh ; [CHM001]
  862. ; int 10h ; [CHM001]
  863. ; call ChgEnvrDo ; [CHM001]
  864. mov ax, 6602h ; [CHM001]
  865. mov bx, 437 ; [CHM001]
  866. test [CodeStat], HangeulMode ; [CHM001]
  867. jz ChangeCodePage ; [CHM001]
  868. mov bx, 1361 ; [CHM001]
  869. test [CodeStat], Chab ; [CHM001]
  870. jnz ChangeCodePage ; [CHM001]
  871. ; test [CodeStat], Wsung7 ; [CHM001]
  872. ; jnz ChangeCodePage ; [CHM001]
  873. mov bx, 949 ; [CHM001]
  874. ChangeCodePage: ; [CHM001]
  875. mov [BilingCall], 0ffh ; [CHM001]
  876. int 21h ; [CHM001]
  877. mov ah,0f3h
  878. int 16h
  879. mov ah,0f3h
  880. int 16h
  881. ;@@:
  882. ; mov ah,1
  883. ; int 16h
  884. ; jz @f
  885. ; mov ah,0
  886. ; int 16h
  887. ; jmp short @b
  888. ;@@:
  889. endif
  890. test [KbStat],ReqEnvrChg
  891. jnz ChgEnvrEnd
  892. push ds
  893. ASSUME DS:KbSeg
  894. mov ax,SEG KbSeg
  895. mov ds,ax
  896. mov ax,1c0dh
  897. mov bx,[rBufferTail]
  898. call PushKeyBuf
  899. pop ds
  900. ASSUME DS:CODE
  901. ChgEnvrEnd:
  902. ret
  903. ;------------------------------------------------------------------------
  904. ; << ChgEnvrDo >>
  905. ; FUNCTION = mode set with given mode & status
  906. ; INPUT : AL = mode value
  907. ; OUTPUT : none
  908. ; PROTECT : DS, ES, BP
  909. ChgEnvrDo:
  910. push ax
  911. test cs:[Card1st],VgaCard
  912. jnz @f
  913. test cs:[CodeStat],HangeulMode
  914. jnz SetHanEnvr
  915. call ChgParmH2E
  916. jmp @f
  917. SetHanEnvr:
  918. call ChgParmE2H
  919. @@:
  920. test [CodeStat],ChabLoad
  921. jz ChgEnvrContin
  922. ; push ds
  923. ; mov ax,6300h
  924. ; int 21h
  925. ; cmp byte ptr [si+1],0feh
  926. ; jnz @f
  927. ; mov byte ptr [si],0a1h
  928. ; test cs:[CodeStat],CHab
  929. ; jz @f
  930. ; mov byte ptr [si],084h
  931. ;@@:
  932. ; pop ds
  933. mov [PrtAuto],0
  934. mov [HanCnt],0
  935. xor ah,ah
  936. mov si,ax
  937. shl si,1
  938. mov ax,[si].EscCode2Tbl
  939. mov [EscCode2Addr],ax
  940. mov ax,[si].EscCode3Tbl
  941. mov [EscCode3Addr],ax
  942. mov ax,[si].EscCodeNTbl
  943. mov [EscCodeNAddr],ax
  944. mov ax,[si].EscCode4Tbl
  945. mov [EscCode4Addr],ax
  946. ChgEnvrContin:
  947. pop ax
  948. and al,01111111b
  949. test [CodeStat],HangeulMode
  950. jnz EnvrValidMode
  951. cmp al,40h
  952. jz @f
  953. cmp al,60h
  954. jz @f
  955. cmp al,70h
  956. jnz EnvrValidMode
  957. @@:
  958. and [KbStat],not ReqEnvrChg
  959. int 11h
  960. cmp al,00110000b
  961. mov al,7
  962. jpe EnvrValidMode
  963. mov al,3
  964. EnvrValidMode:
  965. cmp al,3
  966. jbe @f
  967. cmp al,7
  968. jz @f
  969. and [KbStat],not ReqEnvrChg
  970. @@:
  971. push ax
  972. mov al,[CodeStat]
  973. xchg al,[OldCodeStat]
  974. mov [CodeStat],al
  975. call SaveCodeBuffer
  976. mov dx,3bfh
  977. mov al,3
  978. out dx,al
  979. mov dl,0b8h
  980. mov al,28h
  981. out dx,al
  982. xor al,al
  983. mov dl,0bfh
  984. out dx,al
  985. mov al,[OldCodeStat]
  986. mov [CodeStat],al
  987. test [Card1st],DualMnt
  988. jz ModeSet1st
  989. push ds
  990. xor ax,ax
  991. mov ds,ax
  992. ASSUME DS:DATA
  993. mov bl,byte ptr [rEquip]
  994. mov ax,7
  995. or byte ptr [rEquip],00110000b
  996. test cs:[Card2nd],ColorMnt
  997. jz @f
  998. mov al,3
  999. and byte ptr [rEquip],11101111b
  1000. @@:
  1001. int 10h
  1002. mov byte ptr [rEquip],bl
  1003. pop ds
  1004. ASSUME DS:CODE
  1005. ModeSet1st:
  1006. pop ax
  1007. if WINNT
  1008. call RestoreCodeBuffer
  1009. ret
  1010. else
  1011. xor ah,ah
  1012. if AltHotKey and AtiVga
  1013. mov [PreModeV],ah
  1014. endif ; AltHotKey and AtiVga
  1015. int 10h
  1016. call RestoreCodeBuffer
  1017. ret
  1018. endif
  1019. ;--------------------------------
  1020. SaveCodeBuffer:
  1021. test [KbStat],ReqEnvrChg
  1022. jz SaveCodeBufferEnd
  1023. mov ah,0fh
  1024. int 10h ; get page #
  1025. mov [dSaveCurrPage],bh
  1026. mov ah,3
  1027. int 10h ; get cursor position
  1028. mov [dSaveCurPos],dx
  1029. mov [dSaveCurType],cx ; save cursor type
  1030. or ch,20h ; disable cursor
  1031. mov ah,1
  1032. int 10h
  1033. xor dx,dx
  1034. mov di,word ptr [CodeBuf2Addr]
  1035. @@:
  1036. mov ah,2
  1037. int 10h
  1038. mov ah,8
  1039. int 10h
  1040. stosw
  1041. inc dl
  1042. cmp dl,80
  1043. jb @b
  1044. xor dl,dl
  1045. inc dh
  1046. cmp dh,25
  1047. jb @b
  1048. jmp short ChgEnvrRestore
  1049. SaveCodeBufferEnd:
  1050. ret
  1051. ;--------------------------------
  1052. RestoreCodeBuffer:
  1053. test [KbStat],ReqEnvrChg
  1054. jz RestoreCodeBufferEnd
  1055. mov al,[dSaveCurrPage]
  1056. mov ah,5
  1057. int 10h
  1058. mov bh,[dSaveCurrPage]
  1059. mov ah,3
  1060. int 10h ; get cursor position
  1061. ; mov [dSaveCurType],cx ; save cursor type
  1062. or ch,20h ; disable cursor
  1063. mov ah,1
  1064. int 10h
  1065. xor dx,dx
  1066. mov cx,1
  1067. mov si,word ptr [CodeBuf2Addr]
  1068. @@:
  1069. mov ah,2
  1070. int 10h
  1071. lodsw
  1072. mov bl,ah
  1073. mov ah,9
  1074. int 10h
  1075. inc dl
  1076. cmp dl,80
  1077. jb @b
  1078. xor dl,dl
  1079. inc dh
  1080. cmp dh,25
  1081. jb @b
  1082. ChgEnvrRestore:
  1083. mov bh,[dSaveCurrPage]
  1084. mov cx,[dSaveCurType] ; restore cursor type
  1085. mov ah,1
  1086. int 10h
  1087. mov dx,[dSaveCurPos] ; restore cursor position
  1088. mov ah,2
  1089. int 10h
  1090. RestoreCodeBufferEnd:
  1091. ret
  1092. ;------------------------------------------------------------------------
  1093. ; << RestoreScrn >>
  1094. ; FUNCTION = restore menu screen
  1095. ; INPUT : none
  1096. ; OUTPUT : none
  1097. ; PROTECT : DS, ES, BP, FLAG
  1098. RestoreScrn:
  1099. pushf
  1100. mov bh,[dSaveCurrPage]
  1101. mov dx,MainPos
  1102. mov si,offset MenuBuffer
  1103. mov cx,80*3
  1104. RestoreLp:
  1105. mov ah,2
  1106. int 10h
  1107. push cx
  1108. lodsw
  1109. mov cx,1
  1110. mov bl,ah
  1111. mov ah,9
  1112. int 10h
  1113. pop cx
  1114. inc dl
  1115. cmp dl,80
  1116. jb @f
  1117. xor dl,dl
  1118. inc dh
  1119. @@:
  1120. loop RestoreLp
  1121. mov dx,[dSaveCurPos]
  1122. mov ah,2
  1123. int 10h
  1124. mov cx,[dSaveCurType]
  1125. mov ah,1
  1126. int 10h
  1127. popf
  1128. ret
  1129.