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.

2795 lines
82 KiB

  1. TITLE Initialization routines
  2. ;=======================================================================;
  3. ; (C)Copyright Qnix Computer Co. Ltd. 1985-1992. ;
  4. ; This program contains proprietary and confidential information. ;
  5. ; All rights reserved. ;
  6. ;=======================================================================;
  7. ;=======================================================================;
  8. ; ;
  9. ; SPECIFICATION for initialize ;
  10. ; ;
  11. ;=======================================================================;
  12. ;
  13. ; Keyboard type : english 84 KBD
  14. ; : hangeul 86 KBD(none standard)
  15. ; : hangeul 86 KBD(KS C 5853)
  16. ; : 101 KBD
  17. ; : 103 KBD(KS C 5853)
  18. ;
  19. ; Video card : MGA
  20. ; CGA
  21. ; EGA-mono
  22. ; EGA-color
  23. ; VGA
  24. ; Font card
  25. ; Dual monitor
  26. ; �ѱ�/���� video card
  27. ; �������� file ��ġ : HIMEM, EMS, Ext., real memory
  28. ; UDC file ��ġ
  29. ;
  30. ; User definable �ѿ�/���� key
  31. ; Configuration file ó��
  32. ;
  33. CODE SEGMENT PUBLIC WORD 'CODE'
  34. ASSUME CS:CODE, DS:CODE, ES:CODE
  35. INCLUDE EQU.INC
  36. INCLUDE debug.inc
  37. INCLUDE compose.INC
  38. ;************************************************************************
  39. ;** **
  40. ;** GLOBAL DATA & FLAG **
  41. ;** **
  42. ;************************************************************************
  43. ; ----------- EQUATION -----------
  44. ; ------------- FLAG -------------
  45. ; ------------- DATA -------------
  46. extrn OldKbInt:dword, OldKbioInt:dword, OldRtcInt:dword, OldVdParms:dword
  47. extrn OldVideo:dword, OldSavePtr:dword, OldInt15:dword, OldInt17:dword
  48. extrn EndSegment:word, EndOffset:word
  49. extrn MemStat:byte, MemSize:word
  50. extrn EmsSeg:word, EmsHandle:word, MaxMemSize:word, CurEmsPage:word
  51. extrn HanAddr:word, HanAddrH:byte, UdcAddr:word, UdcAddrH:byte
  52. extrn CodeStat:byte, Card1st:byte, Card2nd:byte, HeKey:byte, HjKey:byte
  53. extrn KbStat:byte, Printer:byte, ErrStat:byte, HjStat:byte, MachineType:byte
  54. extrn WinSegment:word, WinOffset:word, KbdType:byte
  55. extrn HanPatternPtr:word, PatGenAddr:word
  56. extrn CodeBuf2Addr:dword, CodeBufSize:word
  57. extrn GetHan1st:word, GetHan2nd:word, GetUdc1st:word, GetUdc2nd:word
  58. extrn PutUdc1st:word, PutUdc2nd:word, HanOn1st:word, HanOn2nd:word
  59. extrn HanOff1st:word, HanOff2nd:word
  60. extrn GetFontHanExt:near, GetFontUdcExt:near, PutFontUdcExt:near
  61. extrn GdtDataTbl:word
  62. extrn GetFontHanEms:near, GetFontUdcEms:near, PutFontUdcEms:near
  63. extrn GetFontHanReal:near, GetFontUdcReal:near, PutFontUdcReal:near
  64. extrn Int9:near, Int16:near, Int8:near, Int10:near, Int17:near, Int15Srv:near
  65. extrn ChgCode:near, VgaService:near
  66. extrn InitEnd:near, Install:near
  67. extrn VideoParms:byte
  68. extrn Mda70h:byte, Mda07h:byte
  69. extrn Cga40h:byte, Cga23h:byte
  70. extrn RegSize:byte, CrtcSet:byte
  71. extrn HanSavePtr:dword, VideoParmsTbl:byte
  72. extrn Mode2E:byte, Mode3E:byte, Mode7:byte
  73. extrn Mode07:byte, Mode23:byte
  74. extrn Mode3V:byte, Mode07V:byte, Mode3Ega:byte, Mode7Ega:byte
  75. extrn FontFilename:byte, iVersion:byte
  76. extrn vdm_info:near
  77. if Hwin31Sw
  78. extrn OldInt2f:dword, Int2f:near
  79. endif ; Hwin31Sw
  80. if GetSwitch
  81. if not comfile
  82. extrn PtrSav:dword
  83. InitBpb = 18 ; init BPB(Bios Parameter Block)
  84. endif
  85. endif ; GetSwitch
  86. ;************************************************************************
  87. ;** **
  88. ;** INITIALIZE **
  89. ;** **
  90. ;************************************************************************
  91. ;
  92. ParsKeyboard PROC Near
  93. @push bx, dx
  94. lodsb ; Skip ':' character
  95. xor bx, bx
  96. @@:
  97. lodsb
  98. cmp al, '0'
  99. jb @f
  100. cmp al, '9'
  101. ja @f
  102. xchg ax, bx
  103. mov dx, 10
  104. mul dx
  105. xor bh, bh
  106. sub bl, '0'
  107. add bx, ax
  108. jmp @b
  109. @@:
  110. dec bx
  111. dec si
  112. cmp bx, 6
  113. jae @HEUnknown
  114. cmp bx, 0
  115. jne @F
  116. mov cs:HeKey, 38h
  117. mov cs:HjKey, 1Dh
  118. jmp short @HEend
  119. @@:
  120. cmp bx, 1
  121. jne @f
  122. mov cs:HeKey, 1Dh
  123. mov cs:HjKey, 38h
  124. jmp SHORT @HEend
  125. @@:
  126. cmp bx, 2
  127. je @HEdefined
  128. cmp bx, 4
  129. jne @f
  130. @HEdefined:
  131. mov cs:HeKey, 0F0h
  132. mov cs:HjKey, 0F1h
  133. jmp short @HEend
  134. @@:
  135. cmp bx, 3
  136. jne @F
  137. mov cs:HeKey, 2
  138. mov cs:HjKey, 2
  139. jmp short @HEend
  140. @@:
  141. cmp bx, 5 ; BUGBUG - Testing code
  142. jne @HEUnknown ; BUGBUG - Testing code
  143. mov cs:HeKey, 1 ; BUGBUG - Testing code
  144. mov cs:HjKey, 1 ; BUGBUG - Testing code
  145. jmp short @HEend
  146. @HEUnknown:
  147. @pop dx, bx
  148. stc ; Unknown number
  149. ret
  150. @HEend: ; OK
  151. @pop dx, bx
  152. clc
  153. ret
  154. ParsKeyboard ENDP
  155. ;------------------------------------------------------------------------
  156. ; << HanInit >>
  157. ; FUNCTION = �ѱ� BIOS �ʱ�ȭ
  158. ; INPUT : SS, SP
  159. ; OUTPUT : CX:DX = �ѱ� BIOS�� ������ segment:offset address
  160. ; PROTECT : SS, SP
  161. ;
  162. ; HanInit(-/CX, DX)
  163. ; {
  164. ; Save DS, ES, SI, DI, BP;
  165. ; DS = CS;
  166. ; ES = CS;
  167. ; SetMachineType(-/-);
  168. ; SetHeHjKey(-/-);
  169. ; if (CheckVideoCardType(-/flag) == CY)
  170. ; {
  171. ; /* disp error message */
  172. ; CX = CS;
  173. ; DX = 0;
  174. ; return;
  175. ; }
  176. ; CheckHanCard(-/-);
  177. ; GetConfigFile(-/-);
  178. ; SetVideoParms(-/-);
  179. ; CalcEndAddr(-/-);
  180. ; SetPatGen(-/-);
  181. ; SetCodeBuffer(-/-);
  182. ; CheckMemory(-/-);
  183. ; SetVector(-/-);
  184. ; InstallFontFile(-/-);
  185. ; jmp Install;
  186. ;
  187. hbiosExist DB 0
  188. codePage DB 0
  189. public HanInit
  190. HanInit:
  191. push ds
  192. push es
  193. push di
  194. push si
  195. push bp
  196. mov ax,cs
  197. mov ds,ax
  198. mov es,ax
  199. if ComFile
  200. mov ah, 66h
  201. mov al, 1
  202. int 21h ; Get Current Code Page
  203. cmp bx, 949
  204. jne @f
  205. mov codePage, 2
  206. jmp @join
  207. @@:
  208. cmp bx, 1361
  209. jne @join
  210. mov codePage, 4
  211. @join:
  212. push es
  213. mov ax,0fd00h
  214. int 10h
  215. pop es
  216. cmp al,0fdh
  217. jne @f
  218. mov hbiosExist, 1
  219. @@:
  220. call ParsCommand
  221. mov dx,offset DupErrMsg
  222. jc ComFileEnd
  223. cmp [hbiosExist], 0
  224. je @f
  225. ComFileEnd:
  226. mov ah, 9
  227. int 21h
  228. mov ax, 4C00h
  229. int 21h
  230. @@:
  231. endif ; if ComFile
  232. call SetMachineType
  233. cmp [HeKey], 0
  234. jnz @f
  235. call SetHeHjKey
  236. @@:
  237. call CheckVideoCardType
  238. jnc @f
  239. mov dx,offset CardErrMsg
  240. if ComFile
  241. jmp short ComFileEnd
  242. else
  243. mov ah,9
  244. int 21h
  245. mov cx,cs
  246. xor dx,dx
  247. jmp InitEnd
  248. endif ; if ComFile
  249. @@:
  250. mov [WinSegment],cs
  251. ;
  252. ; Get VDM Information.
  253. ;
  254. mov si,offset vdm_info
  255. mov ah,20h
  256. BOP 43H
  257. call GetConfigFile
  258. call CheckHanCard
  259. call InstPrinter
  260. call SetVideoParms
  261. call CalcEndAddr
  262. call SetPatGen
  263. call SetCodeBuffer
  264. call CheckMemory
  265. call SetVector
  266. call InstallFontFile
  267. if hdos60
  268. push ax
  269. mov ax,04f02h
  270. int 2fh
  271. pop ax
  272. endif ; hdos60
  273. jmp Install
  274. CardErrMsg db cr,lf,'Invalid video card !!!',7,'$'
  275. DupErrMsg db '�ѱ� BIOS�� �̹� ��ġ�Ǿ� �ֽ��ϴ�!',7,cr,lf,'$'
  276. ;CardErrMsg db cr,lf,'Invalid video card !!!',7,'$'
  277. ;DupErrMsg db cr,lf,'Already installed !!!',7,'$'
  278. ParsSkipOptions PROC Near
  279. @@:
  280. lodsb
  281. cmp al, ' '
  282. je @f
  283. cmp al, 9
  284. je @f
  285. cmp al, cr
  286. je @f
  287. cmp al, lf
  288. jne @b
  289. @@:
  290. dec si
  291. ret
  292. ParsSkipOptions ENDP
  293. ;------------------------------------------------------------------------
  294. if ComFile
  295. ParsCommand:
  296. mov si,81h
  297. @@:
  298. lodsb
  299. cmp al,cr
  300. je ParsEnd
  301. cmp al,lf
  302. je ParsEnd
  303. cmp al,'/'
  304. jnz @b
  305. lodsb
  306. or al,20h
  307. cmp al, 'u' ; "/u" = uninstall option
  308. je ParsRemove
  309. cmp al, '?'
  310. je ParsHelp
  311. call ParsSkipOptions
  312. jmp @b
  313. ParsEnd:
  314. clc
  315. ret
  316. ;-------------------------------
  317. DispRemoveEnd:
  318. mov ax, cs
  319. mov ds, ax
  320. mov bl, [codePage]
  321. xor bh, bh
  322. mov si, [si+bx]
  323. mov ah, 0fh
  324. int 10h
  325. mov bl, 7
  326. @@:
  327. lodsb
  328. or al,al
  329. jz @ParsExit
  330. mov ah,0eh
  331. int 10h
  332. jmp short @b
  333. @ParsExit:
  334. mov ax,4c00h
  335. int 21h
  336. ParsHelp:
  337. mov bx, Offset msgHelp
  338. call ShowMultiMessage
  339. jmp @ParsExit
  340. ParsBadCmd:
  341. mov bx, Offset msgBadCmd
  342. call ShowMultiMessage
  343. jmp @ParsExit
  344. ParsRemove:
  345. cmp cs:[hbiosExist], 0
  346. jnz @f
  347. mov ax, cs
  348. mov ds, ax
  349. mov dx, Offset msgNotExist
  350. mov ah, 9
  351. int 21h
  352. jmp @ParsExit
  353. @@:
  354. mov ax,0fd00h
  355. int 10h
  356. mov si,offset iVersion
  357. mov di,si
  358. mov cx,5
  359. rep cmpsb ; compare same BIOS
  360. mov si,offset msgUnknown
  361. jnz DispRemoveEnd
  362. mov si,offset msgUnable
  363. push ds
  364. xor ax,ax
  365. mov ds,ax
  366. ASSUME DS:DATA
  367. mov dx,es
  368. cmp dx,word ptr [rKbInt+2]
  369. jnz DispRemoveEnd
  370. cmp dx,word ptr [rVideoInt+2]
  371. jnz DispRemoveEnd
  372. cmp dx,word ptr [rKbioInt+2]
  373. jnz DispRemoveEnd
  374. cmp dx,word ptr [rRtcInt+2]
  375. jnz DispRemoveEnd
  376. and es:[CodeStat],not HangeulMode
  377. call dword ptr es:[WinOffset]
  378. cli
  379. mov ax,word ptr es:[OldKbint]
  380. mov bx,word ptr es:[OldKbint+2]
  381. mov word ptr [rKbInt],ax
  382. mov word ptr [rKbInt+2],bx
  383. mov ax,word ptr es:[OldVideo]
  384. mov bx,word ptr es:[OldVideo+2]
  385. mov word ptr [rVideoInt],ax
  386. mov word ptr [rVideoInt+2],bx
  387. mov ax,word ptr es:[OldKbioInt]
  388. mov bx,word ptr es:[OldKbioInt+2]
  389. mov word ptr [rKbioInt],ax
  390. mov word ptr [rKbioInt+2],bx
  391. mov ax,word ptr es:[OldRtcInt]
  392. mov bx,word ptr es:[OldRtcInt+2]
  393. mov word ptr [rRtcInt],ax
  394. mov word ptr [rRtcInt+2],bx
  395. if Hwin31Sw
  396. mov ax,word ptr es:[OldInt2f]
  397. mov bx,word ptr es:[OldInt2f+2]
  398. mov word ptr [rInt2f],ax
  399. mov word ptr [rInt2f+2],bx
  400. endif ; Hwin31Sw
  401. mov ax,word ptr es:[OldVdParms]
  402. mov bx,word ptr es:[OldVdParms+2]
  403. mov word ptr [rVdParm],ax
  404. mov word ptr [rVdParm+2],bx
  405. mov ax,word ptr es:[OldInt17]
  406. mov bx,word ptr es:[OldInt17+2]
  407. cmp dx,word ptr [rPrinter+2]
  408. jnz @f
  409. mov word ptr [rPrinter],ax
  410. mov word ptr [rPrinter+2],bx
  411. @@:
  412. mov ax,word ptr es:[OldSavePtr]
  413. mov bx,word ptr es:[OldSavePtr+2]
  414. cmp dx,word ptr [rSavePtr+2]
  415. jnz @f
  416. mov word ptr [rSavePtr],ax
  417. mov word ptr [rSavePtr+2],bx
  418. @@:
  419. mov ax,word ptr es:[OldInt15]
  420. mov bx,word ptr es:[OldInt15+2]
  421. cmp dx,word ptr [rCasetInt+2] ; same segment ?
  422. jnz @f ; jump if no
  423. mov word ptr [rCasetInt],ax
  424. mov word ptr [rCasetInt+2],bx
  425. @@:
  426. sti
  427. pop ds
  428. ASSUME DS:CODE
  429. mov dx,es:[EmsHandle]
  430. test es:[MemStat],HiMem
  431. jz @f
  432. mov ah,0dh
  433. call es:[OldInt15]
  434. mov ah,0ah
  435. call es:[OldInt15]
  436. @@:
  437. test es:[MemStat],EmsMem
  438. jz @f
  439. mov ah,45h ; close handle
  440. int 67h
  441. @@:
  442. mov ah,49h
  443. int 21h
  444. mov si,offset msgRemove
  445. jmp DispRemoveEnd
  446. U_Unable db 'Cannot remove installed HBIOS!', 7,cr,lf,0
  447. C_Unable DB '���� ��ġ�Ǿ� �ִ� HBIOS�� ������ �� �����ϴ�!', 7,cr,lf,0
  448. W_Unable DB '�e�� ��á�A�� ���e HBIOS�i �A���i �� ���s���a!', 7,cr,lf,0
  449. msgUnable DW U_Unable, C_Unable, W_Unable
  450. U_Unknown db 'Unknown Hangeul BIOS!', 7,cr,lf,0
  451. C_Unknown DB '�ٸ� ������ �ѱ� BIOS�� ��ġ�Ǿ� �ֽ��ϴ�!', 7,cr,lf,0
  452. W_Unknown DB '�a�e ���巁 �e�i BIOS�a ��á�A�� ���s���a!', 7,cr,lf,0
  453. msgUnknown DW U_Unknown, C_Unknown, W_Unknown
  454. U_Remove db 'Uninstalled!',cr,lf,0
  455. msgRemove DW U_Remove, U_Remove, U_Remove
  456. U_Help DB 'Usage: HBIOS [/?|/U|/F|/K|/E|/P]', 0Dh, 0Ah
  457. DB ' /? - Help', 0Dh, 0Ah
  458. DB ' /U - Uninstall', 0Dh, 0Ah
  459. DB ' /F:<font file name>', 0Dh,0Ah
  460. DB ' - Specify Extended Font File', 0Dh,0Ah
  461. DB ' /K:# - Set Han/Eng toggle key', 0Dh, 0Ah
  462. DB ' 1 - Right Alt, Right Ctrl', 0Dh, 0Ah
  463. DB ' 2 - Right Ctrl, Right Alt', 0Dh, 0Ah
  464. DB ' 3 - 103 Key Keyboard Defined', 0Dh, 0Ah
  465. DB ' 4 - 84 Key Keyboard (Alt-Shift, Ctrl-Shift)', 0Dh,0Ah
  466. DB ' 5 - 86 Key Keyboard Defined', 0Dh,0Ah
  467. DB ' 6 - Left Shift-Space, Left Ctrl-Space', 0Dh, 0Ah
  468. DB ' /E - English Card Only', 0Dh, 0Ah
  469. DB ' /P - Page 1 Only', 0Dh, 0Ah, '$'
  470. W_Help DB '������: HBIOS [/?|/U|/F|/K|/E|/P]', 0Dh, 0Ah
  471. DB ' /? - ������', 0Dh, 0Ah
  472. DB ' /U - �޸𸮿��� ����', 0Dh, 0Ah
  473. DB ' /F:<�۲� ���� �̸�>', 0Dh,0Ah
  474. DB ' - Ȯ�� �۲� ���� ����', 0Dh,0Ah
  475. DB ' /K:# - ��/�� ��ȯŰ �� ���� ��ȯŰ ����', 0Dh, 0Ah
  476. DB ' 1 - ������ Alt, ������ Ctrl', 0Dh, 0Ah
  477. DB ' 2 - ������ Ctrl, ������ Alt', 0Dh, 0Ah
  478. DB ' 3 - 103 ���� ���� ����', 0Dh, 0Ah
  479. DB ' 4 - 84 ���� (Alt-Shift, Ctrl-Shift)', 0Dh, 0Ah
  480. DB ' 5 - 86 ���� ���� ����', 0Dh,0Ah
  481. DB ' 6 - ���� Shift-Space, ���� Ctrl-Space', 0Dh,0Ah
  482. DB ' /E - �ѱ� ī�� üũ���� ����', 0Dh, 0Ah
  483. DB ' /P - ����ī�忡�� 1Page ����', 0Dh, 0Ah, '$'
  484. C_Help DB '�a�w��: HBIOS [/?|/U|/F|/K|/E|/P]', cr,lf
  485. DB ' /? - �����i', cr,lf
  486. DB ' /U - �A�����A�� �b�A', cr,lf
  487. DB ' /F:<�i�� �a�� ���q>', cr,lf
  488. DB ' - �¸w �i�� �a�� ����', cr,lf
  489. DB ' /K:# - ', cr,lf,'$'
  490. DB ' /E - English Card Only', 0Dh, 0Ah
  491. DB ' /P - Page 1 Only', 0Dh, 0Ah
  492. msgHelp DW U_Help, W_Help, C_Help
  493. U_BadCmd DB 'Invalid option parameter', cr,lf,'$'
  494. W_BadCmd DB '�Ű� ������ �߸��Ǿ����ϴ�.', cr,lf,'$'
  495. C_BadCmd DB '���� �e���a �i���A���s���a.', cr,lf,'$'
  496. msgBadCmd DW U_BadCmd, W_BadCmd, C_BadCmd
  497. msgNotExist DB 'Cannot find resident HBIOS!', 0Dh,0Ah,'$'
  498. ShowMultiMessage PROC Near
  499. ;
  500. ; BX < Offset Table for Message
  501. ; DS = Unknown
  502. ;
  503. add bl, [codePage]
  504. adc bh, 0
  505. mov dx, [bx]
  506. mov ah, 9
  507. int 21h
  508. ret
  509. ShowMultiMessage ENDP
  510. endif ; if ComFile
  511. ;------------------------------------------------------------------------
  512. ; << SetMachineType >>
  513. ; FUNCTION = check XT or AT machine type, KBD type
  514. ; INPUT : none
  515. ; OUTPUT : none
  516. ; PROTECT : SS, SP, DS, ES
  517. ;
  518. ; SetMachineType(-/-)
  519. ; {
  520. ; Save ES;
  521. ; ES = 0f000h;
  522. ; if (ES:[0fffeh] == 0fch), [MachineType] = AtMachine;
  523. ; ES = KbSeg
  524. ; if (ES:[rKbFlag] == Ext10xKey), [KbStat] = [KbStat] || Ext10xKey;
  525. ; Restore ES;
  526. ; }
  527. ;
  528. TmpPatBuf label byte
  529. SetMachineType:
  530. push es
  531. mov ax,0f000h
  532. mov es,ax
  533. mov di,0fffeh
  534. cmp byte ptr es:[di],0fch
  535. jnz @f
  536. or [MachineType],AtMachine
  537. @@:
  538. ASSUME ES:KbSeg
  539. mov ax,SEG KbSeg
  540. mov es,ax
  541. test es:[rKbFlag3],Ext10xKey
  542. jz @f
  543. or [KbStat],Ext10xKey
  544. @@:
  545. pop es
  546. ASSUME ES:CODE
  547. ret
  548. ;------------------------------------------------------------------------
  549. ; << SetHeHjKey >>
  550. ; FUNCTION = set �ѿ�/���� key
  551. ; INPUT : none
  552. ; OUTPUT : none
  553. ; PROTECT : SS, SP, DS, ES
  554. ;
  555. ; SetHeHjKey(-/-)
  556. ; {
  557. ; if ([KbStat] == Ext10xKey)
  558. ; {
  559. ; [HeKey] = Def101HeKey;
  560. ; [HjKey] = Def101HjKey;
  561. ; }
  562. ; else
  563. ; {
  564. ; if ([MachineType] == AtMachine)
  565. ; {
  566. ; [HeKey] = DefAtHeKey;
  567. ; [HjKey] = DefAtHjKey;
  568. ; }
  569. ; else
  570. ; {
  571. ; [HeKey] = DefXtHeKey;
  572. ; [HjKey] = DefXtHjKey;
  573. ; }
  574. ; }
  575. ; }
  576. ;
  577. SetHeHjKey:
  578. if not Kbd101On
  579. test [KbStat],Ext10xKey
  580. jz @f
  581. mov al,DefAtKsHeKey
  582. mov ah,DefKsHjKey
  583. test [MachineType],AtMachine
  584. jnz SetHeHjKeyRet
  585. mov al,DefXtKsHeKey
  586. mov ah,DefKsHjKey
  587. jmp SetHeHjKeyRet
  588. @@:
  589. mov al,DefAtHeKey
  590. mov ah,DefAtHjKey
  591. test [MachineType],AtMachine
  592. jnz SetHeHjKeyRet
  593. mov al,DefXtHeKey
  594. mov ah,DefXtHjKey
  595. SetHeHjKeyRet:
  596. else
  597. mov al,Def101HeKey
  598. mov ah,Def101HjKey
  599. test [KbStat],Ext10xKey
  600. jnz @f
  601. mov al,DefAtHeKey
  602. mov ah,DefAtHjKey
  603. test [MachineType],AtMachine
  604. jnz @f
  605. mov al,DefXtHeKey
  606. mov ah,DefXtHjKey
  607. @@:
  608. endif
  609. mov [HeKey],al
  610. mov [HjKey],ah
  611. ret
  612. ;------------------------------------------------------------------------
  613. ; << CheckVideoCardType >>
  614. ; FUNCTION = video card type�� dual monitor ���θ� �˻���.
  615. ; INPUT : none
  616. ; OUTPUT : CARRY(set = invalid video card)
  617. ; PROTECT : SS, SP, DS, ES
  618. ;
  619. ; CheckVideoCardType(-/-)
  620. ; {
  621. ; DX = -1;
  622. ; AX = 101ah;
  623. ; BX = -1;
  624. ; int 10h; /* VGA function */
  625. ; AX = 1a00h;
  626. ; int 10h; /* get card type */
  627. ; if ((BX != -1) && (AL == 1ah) && (BL < 14) && (BH < 14))
  628. ; {
  629. ; switch(BL)
  630. ; {
  631. ; case 1:
  632. ; [Card1st] = MgaCard;
  633. ; break;
  634. ; case 2:
  635. ; [Card1st] = CgaCard || ColorMnt;
  636. ; break;
  637. ; case 4:
  638. ; [Card1st] = EgaCardC || ColorMnt;
  639. ; break;
  640. ; case 5:
  641. ; [Card1st] = EgaCardM;
  642. ; break;
  643. ; case 0bh:
  644. ; [Card1st] = VgaCard;
  645. ; break;
  646. ; case 0ah:
  647. ; case 0ch:
  648. ; default:
  649. ; [Card1st] = VgaCard || ColorMnt;
  650. ; break;
  651. ; case 7:
  652. ; [Card1st] = McgaCard;
  653. ; break;
  654. ; case 6:
  655. ; case 8:
  656. ; [Card1st] = McgaCard || ColorMnt;
  657. ; }
  658. ; switch(BH)
  659. ; {
  660. ; case 1:
  661. ; [Card2nd] = MgaCard || DualMnt;
  662. ; break;
  663. ; case 2:
  664. ; [Card2nd] = CgaCard || ColorMnt || DualMnt;
  665. ; break;
  666. ; case 4:
  667. ; [Card2nd] = EgaCardC || ColorMnt || DualMnt;
  668. ; break;
  669. ; case 5:
  670. ; [Card2nd] = EgaCardM || DualMnt;
  671. ; break;
  672. ; case 0bh:
  673. ; [Card2nd] = VgaCard || DualMnt;
  674. ; break;
  675. ; case 0ah:
  676. ; case 0ch:
  677. ; [Card2nd] = VgaCard || ColorMnt || DualMnt;
  678. ; break;
  679. ; case 7:
  680. ; [Card2nd] = McgaCard || DualMnt;
  681. ; break;
  682. ; case 6:
  683. ; case 8:
  684. ; [Card2nd] = McgaCard || ColorMnt || DualMnt;
  685. ; default:
  686. ; }
  687. ; return;
  688. ; }
  689. ; else
  690. ; {
  691. ; AH = 12h;
  692. ; BX = 0ff10h;
  693. ; int 10h;
  694. ; if (BL == 0), return(CY);
  695. ; if ((BL != 10h) || (!BL))
  696. ; {
  697. ; if (ES:[rEquip] == 30h)
  698. ; {
  699. ; [Card1st] = EgaCard;
  700. ; AH = 0b8h;
  701. ; if (CheckVram(AH/flag) == ZR)
  702. ; [Card2nd] = CgaCard || ColorMnt || DualMnt;
  703. ; }
  704. ; else
  705. ; {
  706. ; [Card1st] = EgaCard || ColorMnt;
  707. ; AH = 0b0h;
  708. ; if (CheckVram(AH/flag) == ZR)
  709. ; [Card2nd] = MgaCard || DualMnt;
  710. ; }
  711. ; }
  712. ; if (ES:[rEquip] == 30h)
  713. ; {
  714. ; [Card1st] = MgaCard;
  715. ; AH = 0b8h;
  716. ; if (CheckVram(AH/flag) == ZR)
  717. ; [Card2nd] = CgaCard || ColorMnt || DualMnt;
  718. ; }
  719. ; else
  720. ; {
  721. ; [Card1st] = CgaCard || ColorMnt;
  722. ; AH = 0b0h;
  723. ; if (CheckVram(AH/flag) == ZR)
  724. ; [Card2nd] = MgaCard || DualMnt;
  725. ; }
  726. ; }
  727. ; if ([Card2nd] == DualMnt)
  728. ; [Card1st] = DualMnt;
  729. ; }
  730. ;
  731. ; CheckVram(AH/flag)
  732. ; {
  733. ; Save DS;
  734. ; AL = 0;
  735. ; DS = AX;
  736. ; AX = 55aah;
  737. ; DI = 0;
  738. ; xchg [DI+3],AX;
  739. ; xchg [DI+3],AX;
  740. ; xchg [DI+9],AX;
  741. ; xchg [DI+9],AX;
  742. ; Restore DS;
  743. ; /* cmp AX,55aah */
  744. ; }
  745. ;
  746. CheckVideoCardType:
  747. mov dx,-1
  748. mov ax,101ah
  749. mov bx,-1
  750. int 10h
  751. cmp bx,-1
  752. jz CheckEga
  753. mov ax,1a00H
  754. int 10h
  755. cmp al,1aH ; VGA?
  756. jne CheckEga ; jump if no
  757. VgaBoard:
  758. cmp bl,VgaModeTblLng
  759. jae CheckEga
  760. cmp bh,VgaModeTblLng
  761. jae CheckEga
  762. mov al,bh
  763. xor bh,bh
  764. mov dl,[bx+VgaModeTbl]
  765. cmp dl,-1 ; invalid vide card ?
  766. jnz @f ; jump if no
  767. mov dl,VgaCard or ColorMnt
  768. xor dh,dh
  769. jmp SetCardParm
  770. @@:
  771. mov bl,al
  772. mov dh,[bx+VgaModeTbl]
  773. jmp short SetCardParm
  774. CheckEga:
  775. mov ah,12H
  776. mov bx,0ff10H
  777. int 10h
  778. cmp bl,10H ; which video mode
  779. jz CheckCga
  780. or bl,bl
  781. jz CheckCardErr ; jump if installed 64KByte video memory only
  782. or bh,bh ; color mode?
  783. jz Check2ndEColor
  784. int 11h
  785. test al,00110000b
  786. jpo Set1CE2M
  787. jmp short SetE1M2C
  788. CheckCardErr:
  789. stc
  790. ret
  791. Check2ndEColor:
  792. int 11h
  793. test al,00110000b
  794. jpo SetE1C2M
  795. jmp short Set1ME2C
  796. SetE1C2M:
  797. mov dl,EgaCardC or ColorMnt
  798. mov ah,0b0h
  799. call CheckVRam
  800. jnz SetCardParm
  801. mov dh,MgaCard
  802. jmp short SetCardParm
  803. SetE1M2C:
  804. mov dl,EgaCardM
  805. mov ah,0b8h
  806. call CheckVRam
  807. jnz SetCardParm
  808. mov dh,CgaCard or ColorMnt
  809. jmp short SetCardParm
  810. Set1CE2M:
  811. mov dl,CgaCard or ColorMnt
  812. mov ah,0b8h
  813. call CheckVRam
  814. jnz SetCardParm
  815. mov dh,EgaCardM
  816. jmp short SetCardParm
  817. Set1ME2C:
  818. mov dl,MgaCard
  819. mov ah,0b0h
  820. call CheckVRam
  821. jnz SetCardParm
  822. mov dh,EgaCardC or ColorMnt
  823. jmp short SetCardParm
  824. CheckCga:
  825. int 11h
  826. test al,30h
  827. jpo Check2ndMono
  828. mov dl,MgaCard
  829. mov ah,0b8h
  830. call CheckVRam
  831. jnz SetCardParm
  832. mov dh,CgaCard or ColorMnt
  833. jmp short SetCardParm
  834. Check2ndMono:
  835. mov dl,CgaCard or ColorMnt
  836. mov ah,0b0h
  837. call CheckVRam
  838. jnz SetCardParm
  839. mov dh,MgaCard
  840. SetCardParm:
  841. cmp dh,-1
  842. jz @f
  843. or dl,DualMnt
  844. or dh,DualMnt
  845. @@:
  846. mov [Card1st],dl
  847. mov [Card2nd],0
  848. test dl,DualMnt
  849. jz @f
  850. mov [Card2nd],dh
  851. @@:
  852. clc
  853. ret
  854. VgaModeTbl db -1 ; 0
  855. db MgaCard ; 1
  856. db CgaCard or ColorMnt ; 2
  857. db -1 ; 3
  858. db EgaCardC or ColorMnt ; 4
  859. db EgaCardM ; 5
  860. db McgaCard or ColorMnt ; 6
  861. db McgaCard ; 7
  862. db McgaCard or ColorMnt ; 8
  863. db -1 ; 9
  864. db VgaCard or ColorMnt ; A
  865. db VgaCard ; B
  866. db VgaCard or ColorMnt ; C
  867. VgaModeTblLng = $-VgaModeTbl
  868. CheckVram:
  869. push ds
  870. xor al,al
  871. mov ds,ax
  872. mov ax,55aah
  873. xor di,di
  874. xchg [di+3],ax
  875. xchg [di+3],ax
  876. xchg [di+7],ax
  877. xchg [di+7],ax
  878. cmp ax,55aah
  879. pop ds
  880. ret
  881. ;------------------------------------------------------------------------
  882. ; << CheckHanCard >>
  883. ; FUNCTION = �ѱ� video card���� �˻���
  884. ; INPUT : none
  885. ; OUTPUT : none
  886. ; PROTECT : SS, SP, DS, ES
  887. ;
  888. ; CheckHanCard(-/-)
  889. ; {
  890. ; switch([Card1st])
  891. ; {
  892. ; case MgaCard :
  893. ; if (MgaInit(-/flag) == NC)
  894. ; {
  895. ; [Card1st] = [Card1st] || HanCard;
  896. ; [GetHan1st] = AX;
  897. ; [GetUdc1st] = AX;
  898. ; [PutUdc1st] = BX;
  899. ; [HanOn1st] = CX;
  900. ; [HanOff1st] = DX;
  901. ; }
  902. ; break;
  903. ; case CgaCard :
  904. ; if (CgaInit(-/flag) == NC)
  905. ; {
  906. ; [Card1st] = [Card1st] || HanCard;
  907. ; [GetHan1st] = AX;
  908. ; [GetUdc1st] = AX;
  909. ; [PutUdc1st] = BX;
  910. ; [HanOn1st] = CX;
  911. ; [HanOff1st] = DX;
  912. ; }
  913. ; break;
  914. ; case EgaCardM :
  915. ; case EgaCardC :
  916. ; if (EgaInit(-/flag) == NC)
  917. ; {
  918. ; [Card1st] = [Card1st] || HanCard;
  919. ; [GetHan1st] = AX;
  920. ; [GetUdc1st] = AX;
  921. ; [PutUdc1st] = BX;
  922. ; [HanOn1st] = CX;
  923. ; [HanOff1st] = DX;
  924. ; }
  925. ; break;
  926. ; case McgaCard :
  927. ; case VgaCard :
  928. ; if (VgaInit(-/flag) == NC)
  929. ; {
  930. ; [Card1st] = [Card1st] || HanCard;
  931. ; [GetHan1st] = AX;
  932. ; [GetUdc1st] = AX;
  933. ; [PutUdc1st] = BX;
  934. ; [HanOn1st] = CX;
  935. ; [HanOff1st] = DX;
  936. ; }
  937. ; }
  938. ; switch([Card2nd])
  939. ; {
  940. ; case MgaCard :
  941. ; if (MgaInit(-/flag) == NC)
  942. ; {
  943. ; [Card2nd] = [Card2nd] || HanCard;
  944. ; [GetHan2nd] = AX;
  945. ; [GetUdc2nd] = AX;
  946. ; [PutUdc2nd] = BX;
  947. ; [HanOn2nd] = CX;
  948. ; [HanOff2nd] = DX;
  949. ; }
  950. ; break;
  951. ; case CgaCard :
  952. ; if (CgaInit(-/flag) == NC)
  953. ; {
  954. ; [Card2nd] = [Card2nd] || HanCard;
  955. ; [GetHan2nd] = AX;
  956. ; [GetUdc2nd] = AX;
  957. ; [PutUdc2nd] = BX;
  958. ; [HanOn2nd] = CX;
  959. ; [HanOff2nd] = DX;
  960. ; }
  961. ; break;
  962. ; case EgaCardM :
  963. ; case EgaCardC :
  964. ; if (EgaInit(-/flag) == NC)
  965. ; {
  966. ; [Card2nd] = [Card2nd] || HanCard;
  967. ; [GetHan2nd] = AX;
  968. ; [GetUdc2nd] = AX;
  969. ; [PutUdc2nd] = BX;
  970. ; [HanOn2nd] = CX;
  971. ; [HanOff2nd] = DX;
  972. ; }
  973. ; break;
  974. ; case McgaCard :
  975. ; case VgaCard :
  976. ; if (VgaInit(-/flag) == NC)
  977. ; {
  978. ; [Card2nd] = [Card2nd] || HanCard;
  979. ; [GetHan2nd] = AX;
  980. ; [GetUdc2nd] = AX;
  981. ; [PutUdc2nd] = BX;
  982. ; [HanOn2nd] = CX;
  983. ; [HanOff2nd] = DX;
  984. ; }
  985. ; }
  986. ; if (([Card1st] != HanCard) && ([Card2nd] != HanCard))
  987. ; {
  988. ; if (FontInit(-/flag) == NC)
  989. ; {
  990. ; [Card1st] = [Card1st] || FontCard;
  991. ; [Card2nd] = [Card2nd] || FontCard;
  992. ; [HjStat] = [HjStat] || HjLoaded;
  993. ; [GetHan1st] = AX;
  994. ; [GetUdc1st] = AX;
  995. ; [PutUdc1st] = BX;
  996. ; [HanOn1st] = CX;
  997. ; [HanOff1st] = DX;
  998. ; [GetHan2nd] = AX;
  999. ; [GetUdc2nd] = AX;
  1000. ; [PutUdc2nd] = BX;
  1001. ; [HanOn2nd] = CX;
  1002. ; [HanOff2nd] = DX;
  1003. ; }
  1004. ; }
  1005. ; if (([Card1st] == HanCard) || ([Card2nd] == HanCard))
  1006. ; [HjStat] = [HjStat] || HjLoaded;
  1007. ; if (([Card1st] != HanCard) && ([Card2nd] == HanCard))
  1008. ; {
  1009. ; [GetHan1st] = [GetHan2nd];
  1010. ; [GetUdc1st] = [GetUdc2nd];
  1011. ; [PutUdc1st] = [PutUdc2nd];
  1012. ; [HanOn1st] = [HanOn2nd];
  1013. ; [HanOff1st] = [HanOff2nd];
  1014. ; }
  1015. ; if (([Card1st] == HanCard) && ([Card2nd] != HanCard))
  1016. ; {
  1017. ; [GetHan2nd] = [GetHan1st];
  1018. ; [GetUdc2nd] = [GetUdc1st];
  1019. ; [PutUdc2nd] = [PutUdc1st];
  1020. ; [HanOn2nd] = [HanOn1st];
  1021. ; [HanOff2nd] = [HanOff1st];
  1022. ; }
  1023. ; }
  1024. ;
  1025. extrn GetFontMga:near, PutFontMga:near, HanOnMga:near, HanOffMga:near
  1026. extrn GetFontCga:near, PutFontCga:near, HanOnCga:near, HanOffCga:near
  1027. extrn GetFontEga:near, PutFontEga:near, HanOnEga:near, HanOffEga:near
  1028. extrn GetFontFont:near, PutFontFont:near, HanOnFont:near, HanOffFont:near
  1029. CheckHanCard:
  1030. mov bl,[Card1st]
  1031. and bx,CardType
  1032. call [bx+HanInitTbl]
  1033. jc @f
  1034. or [Card1st],HanCard
  1035. mov [GetHan1st],ax
  1036. mov [GetUdc1st],ax
  1037. mov [PutUdc1st],bx
  1038. mov [HanOn1st],cx
  1039. mov [HanOff1st],dx
  1040. @@:
  1041. test [Card1st],DualMnt
  1042. jz @f
  1043. mov bl,[Card2nd]
  1044. and bx,CardType
  1045. call [bx+HanInitTbl]
  1046. jc @f
  1047. or [Card2nd],HanCard
  1048. mov [GetHan2nd],ax
  1049. mov [GetUdc2nd],ax
  1050. mov [PutUdc2nd],bx
  1051. mov [HanOn2nd],cx
  1052. mov [HanOff2nd],dx
  1053. @@:
  1054. test [Card1st],HanCard
  1055. jnz @f
  1056. test [Card2nd],HanCard
  1057. jnz @f
  1058. call FontInit
  1059. jc @f
  1060. or [Card1st],FontCard
  1061. or [Card2nd],FontCard
  1062. or [HjStat],HjLoaded
  1063. mov [GetHan1st],ax
  1064. mov [GetUdc1st],ax
  1065. mov [PutUdc1st],bx
  1066. mov [HanOn1st],cx
  1067. mov [HanOff1st],dx
  1068. mov [GetHan2nd],ax
  1069. mov [GetUdc2nd],ax
  1070. mov [PutUdc2nd],bx
  1071. mov [HanOn2nd],cx
  1072. mov [HanOff2nd],dx
  1073. @@:
  1074. mov al,[Card1st]
  1075. or al,[Card2nd]
  1076. test al,HanCard
  1077. jz @f
  1078. or [HjStat],HjLoaded or UdcArea
  1079. @@:
  1080. xor bx,bx
  1081. test [Card1st],HanCard
  1082. jz @f
  1083. or bx,00000010b
  1084. @@:
  1085. test [Card2nd],HanCard
  1086. jz @f
  1087. or bx,00000100b
  1088. @@:
  1089. call [bx+SetFontPtrTbl]
  1090. ret
  1091. SetFontPtrTbl label word
  1092. dw offset NoFont ; 00
  1093. dw offset C1to2 ; 01
  1094. dw offset C2to1 ; 10
  1095. dw offset NoFont ; 11
  1096. C1to2:
  1097. mov ax,[GetHan1st]
  1098. mov [GetHan2nd],ax
  1099. mov ax,[GetUdc1st]
  1100. mov [GetUdc2nd],ax
  1101. mov ax,[PutUdc1st]
  1102. mov [PutUdc2nd],ax
  1103. mov ax,[HanOn1st]
  1104. mov [HanOn2nd],ax
  1105. mov ax,[HanOff1st]
  1106. mov [HanOff2nd],ax
  1107. NoFont:
  1108. ret
  1109. C2to1:
  1110. mov ax,[GetHan2nd]
  1111. mov [GetHan1st],ax
  1112. mov ax,[GetUdc2nd]
  1113. mov [GetUdc1st],ax
  1114. mov ax,[PutUdc2nd]
  1115. mov [PutUdc1st],ax
  1116. mov ax,[HanOn2nd]
  1117. mov [HanOn1st],ax
  1118. mov ax,[HanOff2nd]
  1119. mov [HanOff1st],ax
  1120. ret
  1121. ;------------------------------------------------------------------------
  1122. HanInitTbl label word
  1123. dw offset MgaInit
  1124. dw offset CgaInit
  1125. dw offset EgaInit
  1126. dw offset EgaInit
  1127. dw offset VgaInit
  1128. dw offset VgaInit
  1129. ;------------------------------------------------------------------------
  1130. MgaInit:
  1131. if AltHotKey
  1132. if AtiVga
  1133. call CheckAti
  1134. jc @f
  1135. ret
  1136. @@:
  1137. endif ; if AtiVga
  1138. endif ; AltHotKey
  1139. mov di,offset TmpPatBuf
  1140. push di
  1141. push ds
  1142. mov cx,0a1a2h
  1143. call GetFontMga
  1144. pop ds
  1145. pop si
  1146. mov cx,32/2
  1147. xor dx,dx
  1148. @@:
  1149. lodsw
  1150. add dx,ax
  1151. loop @b
  1152. cmp dx,30h
  1153. jz @f
  1154. cmp dx,0c0h
  1155. jz @f
  1156. stc
  1157. ret
  1158. @@:
  1159. mov ax,offset GetFontMga
  1160. mov bx,offset PutFontMga
  1161. mov cx,offset HanOnMga
  1162. mov dx,offset HanOffMga
  1163. ret
  1164. ;------------------------------------------------------------------------
  1165. CgaInit:
  1166. mov di,offset TmpPatBuf
  1167. push di
  1168. push ds
  1169. mov cx,0a1a2h
  1170. call GetFontCga
  1171. pop ds
  1172. pop si
  1173. mov cx,32/2
  1174. xor dx,dx
  1175. @@:
  1176. lodsw
  1177. add dx,ax
  1178. loop @b
  1179. cmp dx,30h
  1180. jz @f
  1181. stc
  1182. ret
  1183. @@:
  1184. mov ax,offset GetFontCga
  1185. mov bx,offset PutFontCga
  1186. mov cx,offset HanOnCga
  1187. mov dx,offset HanOffCga
  1188. ret
  1189. ;------------------------------------------------------------------------
  1190. EgaInit:
  1191. VgaInit:
  1192. if ChkW32Trident
  1193. call CheckTrident
  1194. endif ; ChkW32Trident
  1195. test [KseCard],PassHanCdCheck
  1196. jz @f
  1197. stc
  1198. ret
  1199. @@:
  1200. if AtiVga
  1201. call CheckAti
  1202. jnc @f
  1203. endif ; if AtiVga
  1204. if KseVga
  1205. call CheckKasan
  1206. jnc @f
  1207. endif ; if KseVga
  1208. if ChkW32Trident
  1209. call CheckW32Tseng
  1210. endif ; ChkW32Trident
  1211. @@:
  1212. if not (KseVga or AtiVga)
  1213. stc
  1214. endif ; if not (KseVga or AtiVga)
  1215. ret
  1216. if ChkW32Trident
  1217. CheckW32Tseng:
  1218. push ds
  1219. mov ax,0c000h
  1220. mov ds,ax
  1221. mov bx,0076h
  1222. cmp ds:[bx],'sT'
  1223. jnz @f
  1224. add bx,2
  1225. cmp ds:[bx],'ne'
  1226. jnz @f
  1227. or cs:[KseCard],Page1Fix
  1228. @@:
  1229. pop ds
  1230. stc
  1231. ret
  1232. CheckTrident:
  1233. push ds
  1234. mov ax,0c000h
  1235. mov ds,ax
  1236. mov bx,0065h
  1237. cmp ds:[bx],'RT'
  1238. jnz @f
  1239. add bx,2
  1240. cmp ds:[bx],'DI'
  1241. jnz @f
  1242. or cs:[KseCard],PassHanCdCheck
  1243. @@:
  1244. pop ds
  1245. ret
  1246. endif ; ChkW32Trident
  1247. if KseVga
  1248. extrn KseGetFontVga:near, KsePutFontVga:near, KseHanOnVga:near
  1249. extrn KseHanOffVga:near, KseCard:byte
  1250. CheckKasan:
  1251. mov dx,258h
  1252. mov ax,0aaf1h ; sample data
  1253. out dx,ax
  1254. mov ax,002f2h ; init F2-02
  1255. out dx,ax
  1256. mov al,0f1h
  1257. out dx,al
  1258. inc dx
  1259. in al,dx
  1260. cmp al,0aah ; GaSan video card ?
  1261. jz @f
  1262. jmp NoneKasan
  1263. @@:
  1264. dec dl
  1265. mov ax,050f1h ; init F1-50
  1266. out dx,ax
  1267. mov ax,006f3h ; init F3-06
  1268. out dx,ax
  1269. mov ax,0fff5h ; init F5-FF
  1270. out dx,ax
  1271. mov ax,0c9f6h ; init F6-C9
  1272. out dx,ax
  1273. mov ax,0fef7h ; init F7-FE
  1274. out dx,ax
  1275. mov al,0f4h
  1276. out dx,al
  1277. inc dx
  1278. in al,dx
  1279. and al,11110111b ; release KEY bit(FONT)
  1280. out dx,al
  1281. dec dl
  1282. mov al,0f0h
  1283. out dx,al
  1284. inc dx
  1285. in al,dx
  1286. or al,00000011b ; UDC write operation
  1287. out dx,al
  1288. mov dl,56h
  1289. mov al,80h
  1290. out dx,al ; set UDC write ready
  1291. mov bx,0c9a1h ; UDC code
  1292. mov ax,bx
  1293. shl al,1
  1294. shr ax,1
  1295. mov cx,32
  1296. mul cx
  1297. mov cx,dx
  1298. mov dx,250h ; font address register 250
  1299. mov bl,al
  1300. out dx,al
  1301. inc dl ; font address register 251
  1302. mov al,ah
  1303. out dx,al
  1304. inc dl ; font address register 252
  1305. mov al,cl
  1306. out dx,al
  1307. mov dl,54h ; font data register 254
  1308. mov al,55h ; sample data
  1309. out dx,al
  1310. mov dl,56h
  1311. out dx,al ; write data to UDC RAM
  1312. mov dl,54h
  1313. xor al,al
  1314. out dx,al
  1315. mov dl,58h
  1316. mov al,0f0h
  1317. out dx,al
  1318. inc dl
  1319. in al,dx
  1320. and al,11111110b ; set font read operation
  1321. out dx,al
  1322. mov dl,54h
  1323. in al,dx ; read sample data
  1324. mov ah,20h
  1325. mov dl,58h
  1326. mov al,0f0h
  1327. out dx,al
  1328. inc dl
  1329. in al,dx
  1330. and al,11111100b
  1331. or al,ah
  1332. out dx,al
  1333. or [KseCard],00000001b
  1334. clc
  1335. jmp CheckKasanRet
  1336. NoneKasan:
  1337. stc
  1338. ret
  1339. CheckKasanRet:
  1340. mov si,offset KseVga23
  1341. mov di,offset Mode23TextV
  1342. mov cx,64/2
  1343. rep movsw
  1344. mov si,offset KseVga23
  1345. mov di,offset Mode2TextE
  1346. mov cl,64/2
  1347. rep movsw
  1348. mov si,offset KseVga7
  1349. mov di,offset Mode7TextV
  1350. mov cl,64/2
  1351. rep movsw
  1352. mov si,offset KseVga7
  1353. mov di,offset Mode7TextE
  1354. mov cl,64/2
  1355. rep movsw
  1356. if AltHotKey
  1357. mov ax,01a00h
  1358. int 10h
  1359. cmp bl,5
  1360. jnz @f
  1361. or [KseCard],MonoMntC
  1362. mov si,offset KseMda7
  1363. mov di,offset Mode7TextE
  1364. mov cl,64/2
  1365. rep movsw
  1366. @@:
  1367. endif ; AltHotKey
  1368. mov ax,offset KseGetFontVga
  1369. mov bx,offset KsePutFontVga
  1370. mov cx,offset KseHanOnVga
  1371. mov dx,offset KseHanOffVga
  1372. ret
  1373. KseVga23 label byte
  1374. db 50h,18h,10h,00h,10h,00h,03h,00h,02h,063h
  1375. db 61h,52h,53h,23h,57h,06fh,0bfh,01fh,0,04fh,0eh,0fh,0,0,0,0
  1376. db 9ch,00eh,08fh,28h,1fh,96h,0b9h,0a3h,0ffh
  1377. db 0,01h,02h,03h,04h,05h,14h,07h,38h,39h,3Ah,3Bh,3Ch,3Dh,3Eh,3Fh
  1378. db 0Ch,00h,0Fh,0;8h
  1379. db 00h,00h,00h,00h,00h,10h,0Eh,00h,0FFh
  1380. KseVga7 label byte
  1381. db 50h,18h,10h,00h,10h,00h,03h,00h,02h,062h
  1382. db 61h,52h,53h,23h,57h,06Fh,0bfh,01fh,0,04fh,0eh,0fh,0,0,0,0
  1383. db 9ch,00eh,08fh,28h,0fh,96h,0b9h,0a3h,0ffh
  1384. db 0,8,8,8,8,8,8,8,10h,18h,18h,18h,18h,18h,18h,18h
  1385. db 0Eh,0,0Fh,0;8h
  1386. db 00h,00h,00h,00h,00h,10h,0Ah,00h,0FFh
  1387. KseMda7 label byte
  1388. db 50h,18h,10h,00h,10h,00h,03h,00h,02h,0A6h
  1389. db 5Fh,52h,55h,25h,53h,0E3h,0B0h,01fh,0,00Fh,0eh,060h,0,0,0,0
  1390. db 90h,020h,08fh,28h,0Dh,90h,000h,0a3h,0ffh
  1391. db 0,8,8,8,8,8,8,8,10h,18h,18h,18h,18h,18h,18h,18h
  1392. db 0Eh,0,0Fh,0;8h
  1393. db 00h,00h,00h,00h,00h,10h,0Ah,00h,0FFh
  1394. endif ; if KseVga
  1395. if AtiVga
  1396. extrn AtiGetFontVga:near, AtiPutFontVga:near, AtiHanOnVga:near
  1397. extrn AtiHanOffVga:near, KseCard:byte
  1398. CheckAti:
  1399. mov cx,0a1a2h
  1400. mov dx,3ddh
  1401. mov ah,ch
  1402. mov al,10h
  1403. out dx,ax
  1404. mov ah,cl
  1405. mov al,8
  1406. out dx,ax
  1407. mov ax,201h
  1408. mov cl,4
  1409. cmp ch,0feh ; assume FExx
  1410. jnz @f
  1411. mov ah,6 ; set C9xx
  1412. mov cl,2
  1413. @@:
  1414. cmp ch,0c9h
  1415. jnz @f
  1416. mov cl,2
  1417. @@:
  1418. out dx,ax
  1419. mov al,cl
  1420. out dx,al
  1421. inc dx
  1422. xor bx,bx
  1423. mov cx,16
  1424. @@:
  1425. in al,dx
  1426. add bl,al
  1427. adc bh,0
  1428. inc di
  1429. loop @b
  1430. mov cl,16
  1431. @@:
  1432. inc di
  1433. in al,dx
  1434. add bh,al
  1435. loop @b
  1436. dec dx
  1437. mov ax,1
  1438. out dx,ax
  1439. cmp bx,8004h
  1440. jnz NoneAtiVga
  1441. mov dx,3ddh
  1442. mov ax,101h
  1443. out dx,ax
  1444. mov dx,1ceh
  1445. mov al,0bfh
  1446. mov ah,al
  1447. out dx,al
  1448. inc dx
  1449. in al,dx
  1450. or al,00100000b
  1451. dec dx
  1452. xchg al,ah
  1453. out dx,ax
  1454. mov dx,1ceh
  1455. mov al,0bbh
  1456. out dx,al
  1457. inc dx
  1458. in al,dx
  1459. mov bh,al
  1460. dec dx
  1461. mov ax,55bbh
  1462. out dx,ax
  1463. out dx,al
  1464. inc dx
  1465. in al,dx
  1466. mov bl,al
  1467. dec dx
  1468. mov ax,0aabbh
  1469. out dx,ax
  1470. out dx,al
  1471. inc dx
  1472. in al,dx
  1473. mov ah,bl
  1474. dec dx
  1475. cmp ax,55aah
  1476. jz @f
  1477. NoneAtiVga:
  1478. stc
  1479. ret
  1480. @@:
  1481. mov al,0bbh ;restore register value
  1482. mov ah,bh
  1483. out dx,ax
  1484. call AtiHanOffVga
  1485. mov si,offset AtiVga23
  1486. mov di,offset Mode23TextV
  1487. mov cx,64/2
  1488. rep movsw
  1489. mov si,offset AtiVga23
  1490. mov di,offset Mode2TextE
  1491. mov cl,64/2
  1492. rep movsw
  1493. mov si,offset AtiVga7
  1494. mov di,offset Mode7TextV
  1495. mov cl,64/2
  1496. rep movsw
  1497. mov si,offset AtiVga7
  1498. mov di,offset Mode7TextE
  1499. mov cl,64/2
  1500. rep movsw
  1501. mov ax,01a00h
  1502. int 10h
  1503. cmp bl,5
  1504. jnz @f
  1505. or [KseCard],MonoMntC
  1506. @@:
  1507. mov ax,offset AtiGetFontVga
  1508. mov bx,offset AtiPutFontVga
  1509. mov cx,offset AtiHanOnVga
  1510. mov dx,offset AtiHanOffVga
  1511. clc
  1512. ret
  1513. AtiVga23 label byte
  1514. db 80,24,16,0,10H, 1,3,0,2, 063H
  1515. db 5Fh,4Fh,50h,82h,54h,80h,0BFh,1Fh,0,4Fh,0DH,0EH,0,0,0,0
  1516. db 9Ch,0Eh,8Fh,28h,1FH,96h,0B9h,0A3h,0FFh
  1517. db 0,1,2,3,4,5,14H,7,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH
  1518. db 0CH,0,0FH,0;8
  1519. db 0,0,0,0,0,10H,0EH,0,0FFH
  1520. AtiVga7 label byte
  1521. db 80,24,16,0,10H, 1,3,0,2, 062h
  1522. db 5Fh,4Fh,50h,82h,54h,80h,0BFh,1Fh,0,4Fh,0DH,0EH,0,0,0,0
  1523. db 9Ch,0Eh,8Fh,28h,1FH,96h,0B9h,0A3h,0FFh
  1524. db 0,8,8,8,8,8,8,8,10H,18H,18H,18H,18H,18H,18H,18H
  1525. db 0EH,0,0FH,0;8
  1526. db 0,0,0,0,0,10H,0AH,0,0FFH
  1527. endif ; if AtiVga
  1528. ;------------------------------------------------------------------------
  1529. FontInit:
  1530. mov ax,offset GetFontFont
  1531. mov bx,offset PutFontFont
  1532. mov cx,offset HanOnFont
  1533. mov dx,offset HanOffFont
  1534. stc
  1535. ret
  1536. ;------------------------------------------------------------------------
  1537. ; << GetConfigFile >>
  1538. ; FUNCTION = "HECON.CFG" file�� �о �ش��Ǵ� ������ ��ġ��
  1539. ; INPUT : none
  1540. ; OUTPUT : none
  1541. ; PROTECT : SS, SP, DS, ES
  1542. ;
  1543. ; GetConfigFile(-/-)
  1544. ; {
  1545. ; /* open 'HECON.CFG' file */
  1546. ; /* read file to end of file */
  1547. ; /* copy data */
  1548. ; }
  1549. ;
  1550. GetConfigFile:
  1551. push ds
  1552. call SetPreConfig
  1553. mov ah,19h
  1554. int 21h
  1555. cmp al,2
  1556. jbe @f
  1557. mov al,2
  1558. @@:
  1559. add al,'A'
  1560. mov si,offset CfgFilename
  1561. mov [si],al ; set drive latter
  1562. if not GetSwitch
  1563. mov ax,3d00h
  1564. mov dx,offset CfgFilename
  1565. int 21h
  1566. jc GetConfigFileEnd
  1567. mov bx,ax
  1568. mov ah,3fh
  1569. mov cx,100
  1570. mov dx,offset EndOfInit
  1571. int 21h
  1572. jc GetConfigFileClose
  1573. mov si,dx
  1574. mov di,offset CfgFilename
  1575. add di,3
  1576. mov cx,9
  1577. rep cmpsb
  1578. jnz GetConfigFileClose
  1579. mov si,dx
  1580. add si,sFont
  1581. mov di,offset FontFileName
  1582. mov cx,StringLng
  1583. rep movsb
  1584. mov si,dx
  1585. mov al,[si].sCodeType
  1586. if hdos60
  1587. and al,WSung or Chab or WSung7 or HangeulMode
  1588. and [CodeStat],not (WSung or Chab or WSung7 or HangeulMode)
  1589. else ;hdos60
  1590. and al,WSung or Chab or WSung7 or HangeulMode or ChabLoad
  1591. and [CodeStat],not (WSung or Chab or WSung7 or HangeulMode or ChabLoad)
  1592. endif ; hdos60
  1593. or [CodeStat],al
  1594. mov al,[si].sMemory
  1595. and al,HiMem or EmsMem or ExtMem or RealMem
  1596. and [MemStat],not (HiMem or EmsMem or ExtMem or RealMem)
  1597. or [MemStat],al
  1598. mov al,[si].sKbdType
  1599. and al,SetKbd101
  1600. and [KbdType],not SetKbd101
  1601. or [KbdType],al
  1602. mov al,[si].sHeKey
  1603. or al,al
  1604. jz @f
  1605. or [KbStat],UserDefineKey
  1606. mov [HeKey],al
  1607. @@:
  1608. mov al,[si].sHjKey
  1609. or al,al
  1610. jz @f
  1611. or [KbStat],UserDefineKey
  1612. mov [HjKey],al
  1613. @@:
  1614. mov al,[si].sPrinterType
  1615. mov [Printer],al
  1616. GetConfigFileClose:
  1617. mov ah,3eh
  1618. int 21h
  1619. else
  1620. if ComFile
  1621. mov si,81h
  1622. else
  1623. lds si,[PtrSav]
  1624. lds si,[si].InitBpb ; ds:si points to CONFIG.SYS
  1625. endif ; ComFile
  1626. DBGNum 1
  1627. mov di,offset FontFileName
  1628. @gcfLoop:
  1629. lodsb
  1630. DBGNum ax
  1631. cmp al,CR ; terminate with CR or LF
  1632. je GetConfigFileEndj
  1633. cmp al,LF
  1634. je GetConfigFileEndj
  1635. cmp al,9
  1636. je GetConfigFileEndj
  1637. Cmp AL,"/" ; MS-DOS 5.00
  1638. jnz @gcfLoop
  1639. lodsb
  1640. or al, 20h
  1641. cmp al, 'f' ; file spec?
  1642. jne @f
  1643. call @fontFileOption
  1644. jmp @gcfLoop
  1645. @@:
  1646. cmp al, 'k'
  1647. jne @f
  1648. call ParsKeyboard
  1649. jmp @gcfLoop
  1650. @@:
  1651. if not ChkW32Trident
  1652. cmp al, 'e'
  1653. jne @f
  1654. or [KseCard],PassHanCdCheck
  1655. jmp @gcfLoop
  1656. @@:
  1657. cmp al, 'p'
  1658. jne @f
  1659. or [KseCard],Page1Fix
  1660. jmp @gcfLoop
  1661. @@:
  1662. endif ; not ChkW32Trident
  1663. call ParsSkipOptions
  1664. jmp @gcfLoop
  1665. GetConfigFileEndj:
  1666. jmp GetConfigFileEnd
  1667. @fontFileOption:
  1668. lodsb
  1669. cmp al,CR ; ill-terminate with CR or LF
  1670. je GetConfigFileEnd
  1671. cmp al,LF
  1672. je GetConfigFileEnd
  1673. cmp al," " ; skip delimiter " ", tab
  1674. je @b
  1675. cmp al,":" ; "/F:"?
  1676. jne GetConfigFileEnd
  1677. GetParmsFileSpec:
  1678. lodsb
  1679. cmp al,CR ; ill-terminate with CR or LF
  1680. je GetConfigFileEnd
  1681. cmp al,LF
  1682. je GetConfigFileEnd
  1683. cmp al," " ; skip delimiter " ", tab
  1684. je GetParmsFileSpec
  1685. cmp al,9
  1686. je GetConfigFileEnd
  1687. ; je GetParmsFileSpec
  1688. mov ah,al
  1689. lodsb
  1690. xchg ah,al
  1691. cmp ah,":" ; is drive name given?
  1692. je HaveDrvName ; jump if so
  1693. ; inc di
  1694. ; inc di
  1695. HaveDrvName:
  1696. stosw
  1697. @@:
  1698. lodsb
  1699. cmp al,CR ; terminate with CR or LF
  1700. je ParseBpbRetJ
  1701. cmp al,LF
  1702. je ParseBpbRetJ
  1703. cmp al," " ; skip delimiter " ", tab, ","
  1704. je ParseBpbRetJ
  1705. cmp al,9
  1706. je ParseBpbRetJ
  1707. stosb
  1708. jmp @b
  1709. ParseBpbRetJ:
  1710. sub ax,ax
  1711. stosw
  1712. ret
  1713. endif
  1714. GetConfigFileEnd:
  1715. test [KbStat],UserDefineKey
  1716. jnz @f
  1717. test [KbdType],SetKbd101
  1718. jz @f
  1719. mov [HeKey],Def101HeKey
  1720. mov [HjKey],Def101HjKey
  1721. @@:
  1722. pop ds
  1723. ret
  1724. CfgFilename db 'C:\HECON.CFG',0
  1725. SetPreConfig:
  1726. and [CodeStat],not (WSung or Chab or WSung7 or HangeulMode or ChabLoad)
  1727. or [CodeStat],WSung or HangeulMode or ChabLoad
  1728. and [MemStat],not (HiMem or EmsMem or ExtMem or RealMem)
  1729. and [KbdType],not SetKbd101
  1730. and [Printer],11111000b
  1731. ret
  1732. ;------------------------------------------------------------------------
  1733. extrn EscCode2Tbl:word, EscCode3Tbl:word, EscCodeNTbl:word, EscCode4Tbl:word
  1734. extrn EscCode2Addr:word, EscCode3Addr:word, EscCodeNAddr:word, EscCode4Addr:word
  1735. InstPrinter:
  1736. test [CodeStat],ChabLoad
  1737. jz InstPrinterEnd
  1738. mov al,[Printer]
  1739. xor ah,ah
  1740. mov si,ax
  1741. shl si,1
  1742. mov ax,[si].EscCode2Tbl
  1743. mov [EscCode2Addr],ax
  1744. mov ax,[si].EscCode3Tbl
  1745. mov [EscCode3Addr],ax
  1746. mov ax,[si].EscCodeNTbl
  1747. mov [EscCodeNAddr],ax
  1748. mov ax,[si].EscCode4Tbl
  1749. mov [EscCode4Addr],ax
  1750. InstPrinterEnd:
  1751. ret
  1752. ;------------------------------------------------------------------------
  1753. ; << SetVideoParms >>
  1754. ; FUNCTION = video parm�� ��ġ��
  1755. ; INPUT : none
  1756. ; OUTPUT : none
  1757. ; PROTECT : SS, SP, DS, ES
  1758. ;
  1759. ; SetVideoParms(-/-)
  1760. ; {
  1761. ; }
  1762. ;
  1763. SetVideoParms:
  1764. mov al,[Card1st]
  1765. call SetVdParmsDo
  1766. test [Card1st],DualMnt
  1767. jz @f
  1768. mov al,[Card2nd]
  1769. call SetVdParmsDo
  1770. @@:
  1771. ret
  1772. SetVdParmsDo:
  1773. mov dl,al
  1774. and al,CardType
  1775. xor ah,ah
  1776. mov si,ax
  1777. jmp [si+SetVdParmsTbl]
  1778. SetVdParmsTbl label word
  1779. dw offset MParms
  1780. dw offset CParms
  1781. dw offset EParms
  1782. dw offset EParms
  1783. dw offset VParms
  1784. dw offset VParms
  1785. MParms:
  1786. test dl,HanCard
  1787. jnz @f
  1788. mov si,offset Mda70H
  1789. mov di,offset Mda07H
  1790. mov cx,10/2
  1791. rep movsw
  1792. mov ax,0e0dh
  1793. stosw
  1794. inc si
  1795. inc si
  1796. movsw
  1797. movsw
  1798. mov di,offset RegSize
  1799. add di,6
  1800. mov ax,8000h
  1801. stosw
  1802. mov di,offset CrtcSet
  1803. add di,7
  1804. mov al,0ah
  1805. test dl,DualMnt
  1806. jnz MgaTextEmu
  1807. mov al,8ah
  1808. MgaTextEmu:
  1809. stosb
  1810. @@:
  1811. ret
  1812. CParms:
  1813. test dl,HanCard
  1814. jnz @f
  1815. mov si,offset Cga40H
  1816. mov di,offset Cga23H
  1817. mov cx,10/2
  1818. rep movsw
  1819. mov ax,706h
  1820. stosw
  1821. inc si
  1822. inc si
  1823. movsw
  1824. movsw
  1825. mov di,offset RegSize
  1826. add di,4
  1827. mov ax,8000h
  1828. stosw
  1829. mov di,offset CrtcSet
  1830. add di,6
  1831. mov al,1eh
  1832. stosb
  1833. @@:
  1834. ret
  1835. EParms:
  1836. call InstallVdParmsPtr
  1837. xor ch,ch
  1838. mov si,offset Mode7Ega
  1839. mov bx,offset Mode3Ega
  1840. test dl,HanCard
  1841. jz @f
  1842. mov si,offset Mode7TextE
  1843. mov bx,offset Mode2TextE
  1844. @@:
  1845. mov di,offset Mode7
  1846. mov cl,64/2
  1847. rep movsw
  1848. mov si,bx
  1849. mov di,offset Mode2E
  1850. mov cl,64/2
  1851. rep movsw
  1852. test dl,DualMnt
  1853. jz @f
  1854. mov di,offset Mode7Ega
  1855. mov [di].cMap,9
  1856. mov di,offset Mode3Ega
  1857. mov [di].cMap,0dh
  1858. test dl,HanCard
  1859. jnz @f
  1860. mov di,offset Mode7
  1861. mov [di].cMap,9
  1862. mov di,offset Mode2E
  1863. mov [di].cMap,0dh
  1864. @@:
  1865. mov si,offset Mode2E
  1866. mov di,offset Mode3E
  1867. mov cl,64/2
  1868. rep movsw
  1869. ret
  1870. VParms:
  1871. call InstallVdParmsPtr
  1872. xor ch,ch
  1873. IFDEF _X86_ ; On ALPHA, doesn't have full screen mode
  1874. mov si,offset Mode7TextV
  1875. mov bx,offset Mode23TextV
  1876. test dl,HanCard
  1877. jnz @f
  1878. ;
  1879. ; Hangul Video card is not found.
  1880. ; HBIOS should emulate Hangul Video card for display Hangul character.
  1881. ; We use graphic video mode.
  1882. ;
  1883. mov si,offset Mode07V
  1884. mov bx,offset Mode3V
  1885. push es
  1886. push di
  1887. les di,dword ptr cs:[vdm_info.windowed_add]
  1888. mov al,es:[di]
  1889. pop es
  1890. pop di
  1891. cmp al,0 ; windowed mode ?
  1892. ; 0 = windowed, 1 = full screen
  1893. jne @f
  1894. ENDIF ; _X86_
  1895. ;
  1896. ; Windowed mode doesn't need for set graphics video mode.
  1897. ; Becase console window can display Hangul character without HBIOS.
  1898. ;
  1899. mov si,offset Mode7TextV
  1900. mov bx,offset Mode23TextV
  1901. @@:
  1902. mov di,offset Mode07
  1903. mov cl,64/2
  1904. rep movsw
  1905. mov si,bx
  1906. mov di,offset Mode23
  1907. mov cl,64/2
  1908. rep movsw
  1909. test dl,DualMnt
  1910. jz @f
  1911. mov di,offset Mode07V
  1912. mov [di].cMap,9
  1913. mov di,offset Mode3V
  1914. mov [di].cMap,0dh
  1915. test dl,DualMnt
  1916. jnz @f
  1917. mov di,offset Mode07
  1918. mov [di].cMap,9
  1919. mov di,offset Mode23
  1920. mov [di].cMap,0dh
  1921. @@:
  1922. ret
  1923. InstallVdParmsPtr:
  1924. push es
  1925. push ds
  1926. xor ax,ax
  1927. mov ds,ax
  1928. ASSUME DS:DATA
  1929. les di,[rSavePtr]
  1930. mov word ptr cs:[OldSavePtr],di
  1931. mov word ptr cs:[OldSavePtr+2],es
  1932. mov word ptr [rSavePtr],offset HanSavePtr
  1933. mov word ptr [rSavePtr+2],cs
  1934. mov si,es
  1935. mov ds,si
  1936. mov si,di
  1937. mov di,cs
  1938. mov es,di
  1939. mov di,offset HanSavePtr
  1940. mov cx,7*2
  1941. rep movsw
  1942. mov word ptr cs:[HanSavePtr],offset VideoParmsTbl
  1943. mov word ptr cs:[HanSavePtr+2],cs
  1944. pop ds
  1945. pop es
  1946. ASSUME DS:CODE
  1947. push ds
  1948. lds si,[OldSavePtr]
  1949. lds si,[si]
  1950. mov di,offset VideoParmsTbl
  1951. test cs:[Card1st],00001000b
  1952. jnz @f
  1953. mov cx,64*23/2
  1954. rep movsw
  1955. pop ds
  1956. ret
  1957. @@:
  1958. mov cx,64*8/2
  1959. rep movsw
  1960. add si,64*3
  1961. add di,64*3
  1962. mov cx,64*18/2
  1963. rep movsw
  1964. pop ds
  1965. ret
  1966. ;------------------------------------------------------------------------
  1967. ; text VGA mode 7
  1968. Mode7TextV label byte
  1969. db 80,24,16,0,10H, 1,3,0,2, 062h
  1970. db 5Fh,4Fh,50h,82h,54h,80h,0BFh,1Fh,0,4Fh,0DH,0EH,0,0,0,0
  1971. db 9Ch,0Eh,8Fh,28h,1FH,96h,0B9h,0A3h,0FFh
  1972. db 0,8,8,8,8,8,8,8,10H,18H,18H,18H,18H,18H,18H,18H
  1973. db 0EH,0,0FH,8
  1974. db 0,0,0,0,0,10H,0AH,0,0FFH
  1975. Mode23TextV label byte
  1976. db 80,24,16,0,10H, 1,3,0,2, 063H
  1977. db 5Fh,4Fh,50h,82h,54h,80h,0BFh,1Fh,0,4Fh,0DH,0EH,0,0,0,0
  1978. db 9Ch,0Eh,8Fh,28h,1FH,96h,0B9h,0A3h,0FFh
  1979. db 0,1,2,3,4,5,14H,7,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH
  1980. db 0CH,0,0FH,8
  1981. db 0,0,0,0,0,10H,0EH,0,0FFH
  1982. ; text EGA mode 7
  1983. Mode7TextE label byte
  1984. db 80,24,16,0,10h, 1,3,0,3, 0A6h
  1985. db 5Bh,4Fh,53h,37h,52h,00h,09Fh,1Fh,0,0,0DH,0EH,0,0,0,0 ; crtc
  1986. db 90h,2Bh,8Fh,28h,0FH,95h,1Dh,0E3h,0FFh ; crtc
  1987. db 0,8,8,8,8,8,8,8,10h,18h,18h,18h,18h,18h,18h,18h
  1988. db 0EH,0,0FH,8
  1989. db 0,0,0,0,0,10H,0Ah,0,0FFh
  1990. Mode2TextE label byte
  1991. db 80,24,16,0,10h, 1,3,0,3, 0A7h
  1992. db 5Bh,4Fh,53h,37h,52h,00h,09Fh,1Fh,0,0,0DH,0EH,0,0,0,0 ; crtc
  1993. db 90h,2Bh,8Fh,28h,0FH,95h,1Dh,0E3h,0FFh ; crtc
  1994. db 0,1,2,3,4,5,14H,7,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH
  1995. db 0CH,0,0FH,8
  1996. db 0,0,0,0,0,10H,0Eh,0,0FFh
  1997. ;------------------------------------------------------------------------
  1998. ; << CalcEndAddr >>
  1999. ; FUNCTION = calculate end of program
  2000. ; INPUT : none
  2001. ; OUTPUT : none
  2002. ; PROTECT : SS, SP, DS, ES
  2003. ;
  2004. ; CalcEndAddr(-/-)
  2005. ; {
  2006. ; [EndSegment] = CS;
  2007. ; [EndOffset] = ChgCode;
  2008. ; if ([CodeStat] == ChabLoad), return;
  2009. ; [EndOffset] = GenFont;
  2010. ; if (([Card1st] < EgaCardM) || ([Card2nd] < EgaCardM))
  2011. ; [EndOffset] = VgaService;
  2012. ; }
  2013. ;
  2014. CalcEndAddr:
  2015. mov [EndSegment],cs
  2016. mov [EndOffset],offset GenFont ; max size
  2017. test [CodeStat],ChabLoad
  2018. jnz @f
  2019. mov [EndOffset],offset ChgCode ; W/O code conversion & printer
  2020. mov al,[Card1st]
  2021. or al,[Card2nd]
  2022. test al,00001100b
  2023. jnz @f
  2024. mov [EndOffset],offset VgaService ; W/O VGA service
  2025. @@:
  2026. ret
  2027. ;------------------------------------------------------------------------
  2028. ; << SetPatGen >>
  2029. ; FUNCTION = install pattern generator
  2030. ; INPUT : none
  2031. ; OUTPUT : none
  2032. ; PROTECT : SS, SP, DS, ES
  2033. ;
  2034. ; SetPatGen(-/-)
  2035. ; {
  2036. ; if ([Card1st != FontCard or HanCard) && ([Card1st != FontCard or HanCard)
  2037. ; {
  2038. ; [Ks2ChAddr] = Ks2Ch;
  2039. ; DI = [EndOffset];
  2040. ; [GetHan1st] = DI;
  2041. ; [GetHan2nd] = DI;
  2042. ; SI = GenFont;
  2043. ; CX = GenFontLng;
  2044. ; /* rep movsb */
  2045. ; [EndOffset] = DI;
  2046. ; }
  2047. ; }
  2048. ;
  2049. extrn Ks2Ch:near, Ks2ChAddr:word
  2050. SetPatGen:
  2051. mov di,[EndOffset]
  2052. test [Card1st],FontCard or HanCard
  2053. jnz @f
  2054. test [Card2nd],FontCard or HanCard
  2055. jnz @f
  2056. mov [GetHan1st],di
  2057. mov [GetHan2nd],di
  2058. jmp short SetPatGenDo
  2059. @@:
  2060. test [CodeStat],ChabLoad
  2061. jz @f
  2062. SetPatGenDo:
  2063. or [CodeStat],InstPatGen
  2064. mov [Ks2ChAddr],offset Ks2Ch
  2065. mov si,offset GenFont
  2066. mov [PatGenAddr],di
  2067. mov cx,offset CharTbl
  2068. sub cx,si
  2069. add cx,di
  2070. mov [HanPatternPtr],cx
  2071. mov cx,GenFontLng
  2072. rep movsb
  2073. mov [EndOffset],di
  2074. @@:
  2075. ret
  2076. ;------------------------------------------------------------------------
  2077. ; << SetCodeBuffer >>
  2078. ; FUNCTION = code buffer�� Ȯ����
  2079. ; INPUT : none
  2080. ; OUTPUT : none
  2081. ; PROTECT : SS, SP, DS, ES
  2082. ;
  2083. ; SetCodeBuffer(-/-)
  2084. ; {
  2085. ; [CodeBuf2Addr] = [EndOffset];
  2086. ; [CodeBuf2Addr+2] = CS;
  2087. ; switch ([Card1st])
  2088. ; {
  2089. ; case MgaCard:
  2090. ; AX = 80*25;
  2091. ; return;
  2092. ; case CgaCard:
  2093. ; AX = 80*25;
  2094. ; return;
  2095. ; case EgaCardM:
  2096. ; AX = 80*25;
  2097. ; return;
  2098. ; case EgaCardC:
  2099. ; AX = 80*25;
  2100. ; return;
  2101. ; case McgaCard:
  2102. ; AX = 80*30;
  2103. ; return;
  2104. ; case VgaCard:
  2105. ; AX = 80*05;
  2106. ; }
  2107. ; switch ([Card2nd])
  2108. ; {
  2109. ; case MgaCard:
  2110. ; AX = 80*25;
  2111. ; return;
  2112. ; case CgaCard:
  2113. ; AX = 80*25;
  2114. ; return;
  2115. ; case EgaCardM:
  2116. ; AX = 80*25;
  2117. ; return;
  2118. ; case EgaCardC:
  2119. ; AX = 80*25;
  2120. ; return;
  2121. ; case McgaCard:
  2122. ; AX = 80*30;
  2123. ; return;
  2124. ; case VgaCard:
  2125. ; AX = 80*30;
  2126. ; }
  2127. ; [EndOffset] = [EndOffset] + AX;
  2128. ; }
  2129. ;
  2130. SetCodeBuffer:
  2131. mov ax,[EndOffset]
  2132. mov word ptr [CodeBuf2Addr],ax
  2133. mov word ptr [CodeBuf2Addr+2],cs
  2134. mov bl,[Card1st]
  2135. and bl,CardType
  2136. mov bh,[Card2nd]
  2137. and bh,CardType
  2138. cmp bl,bh
  2139. jae @f
  2140. mov bl,bh
  2141. @@:
  2142. xor bh,bh
  2143. mov ax,[bx+BufferSizeTbl]
  2144. add [EndOffset],ax
  2145. mov [CodeBufSize],ax
  2146. ret
  2147. BufferSizeTbl label word
  2148. dw 80*25*2 ; MGA card
  2149. dw 80*25*2 ; CGA card
  2150. dw 80*25*2 ; EGA mono card
  2151. dw 80*25*2 ; EGA color card
  2152. dw 80*30*2 ; MCGA card
  2153. dw 80*30*2 ; VGA card
  2154. ;------------------------------------------------------------------------
  2155. ; << CheckMemory >>
  2156. ; CheckMemory(-/-)
  2157. ; {
  2158. ; }
  2159. ;
  2160. CheckMemory:
  2161. mov dx,offset FontFileName
  2162. mov ax,3d00h ; find first filename
  2163. int 21h
  2164. jc CheckMemErr
  2165. mov bx,ax
  2166. mov ah,3eh ; close file
  2167. int 21h
  2168. test [Card1st],HanCard
  2169. jnz CheckMemErr
  2170. test [Card2nd],HanCard
  2171. jnz CheckMemErr
  2172. mov ax,188+6 ; 32*94*64+94*2*32 = 192512+6016 Byte
  2173. test [Card1st],FontCard
  2174. jz @f
  2175. mov ax,6 ; 94*2*32 = 6016 Byte
  2176. @@:
  2177. mov [MemSize],ax
  2178. test [MemStat],RealMem or ExtMem or EmsMem or HiMem
  2179. jz AutoMemory
  2180. test [MemStat],EmsMem
  2181. jz @f
  2182. call CheckEms
  2183. jc CheckMemErr
  2184. jmp short CheckMemEnd
  2185. @@:
  2186. test [MemStat],HiMem
  2187. jz @f
  2188. call CheckHimem
  2189. jc CheckMemErr
  2190. jmp short CheckMemEnd
  2191. @@:
  2192. test [MemStat],ExtMem
  2193. jz @f
  2194. call CheckExt
  2195. jc CheckMemErr
  2196. jmp short CheckMemEnd
  2197. @@:
  2198. test [MemStat],RealMem
  2199. jz CheckMemEnd
  2200. call CheckReal
  2201. jc CheckMemErr
  2202. CheckMemEnd:
  2203. ret
  2204. CheckMemErr:
  2205. and [MemStat],not (RealMem or ExtMem or EmsMem or HiMem)
  2206. ret
  2207. AutoMemory:
  2208. call CheckEms
  2209. jc @f
  2210. or [MemStat],EmsMem
  2211. jmp short AutoMemEnd
  2212. @@:
  2213. call CheckHimem
  2214. jc @f
  2215. or [MemStat],HiMem
  2216. jmp short AutoMemEnd
  2217. @@:
  2218. call CheckExt
  2219. jc @f
  2220. or [MemStat],ExtMem
  2221. jmp short AutoMemEnd
  2222. @@:
  2223. call CheckReal
  2224. jc CheckMemErr
  2225. or [MemStat],RealMem
  2226. AutoMemEnd:
  2227. ret
  2228. CheckEms:
  2229. push es
  2230. mov ax,3567h
  2231. int 21h
  2232. mov di,0ah
  2233. mov si,offset EmmDrvName
  2234. mov cx,EmmDrvNameLng
  2235. repe cmpsb
  2236. pop es
  2237. jnz @f
  2238. mov ah,46h ; get version
  2239. int 67h
  2240. or ah,ah
  2241. jnz @f
  2242. cmp al,30h ; version 3.0
  2243. jb @f
  2244. mov ah,41h ; get segment address
  2245. int 67h
  2246. or ah,ah
  2247. jnz @f
  2248. mov [EmsSeg],bx
  2249. mov ah,42h ; get page number
  2250. int 67h
  2251. or ah,ah
  2252. jnz @f
  2253. mov ax,16 ; kbyte units
  2254. mul bx
  2255. cmp [MemSize],ax
  2256. ja @f
  2257. mov [MaxMemSize],ax
  2258. clc
  2259. ret
  2260. @@:
  2261. stc
  2262. ret
  2263. EmmDrvName db 'EMMXXXX0'
  2264. EmmDrvNameLng = $-EmmDrvName
  2265. CheckHimem:
  2266. mov ax,4300h
  2267. int 2fh
  2268. cmp al,80h
  2269. jnz @f
  2270. push es
  2271. mov ax,4310h
  2272. int 2fh
  2273. mov ax,es
  2274. pop es
  2275. mov word ptr [OldInt15],bx
  2276. mov word ptr [OldInt15+2],ax
  2277. xor ah,ah
  2278. call [OldInt15]
  2279. cmp dl,1
  2280. jnz @f
  2281. cmp ax,200h ; V2.00
  2282. jb @f
  2283. mov ah,8
  2284. call [OldInt15]
  2285. or bl,bl
  2286. jnz @f
  2287. cmp [MemSize],ax
  2288. ja @f
  2289. mov [MaxMemSize],ax
  2290. clc
  2291. ret
  2292. @@:
  2293. stc
  2294. ret
  2295. CheckExt:
  2296. test [MachineType],AtMachine
  2297. jz @f
  2298. mov ah,88h
  2299. int 15h
  2300. cmp [MemSize],ax
  2301. ja @f
  2302. mov [MaxMemSize],ax
  2303. clc
  2304. ret
  2305. @@:
  2306. stc
  2307. ret
  2308. CheckReal:
  2309. int 12h
  2310. mov bx,cs
  2311. mov cl,6
  2312. shr bx,cl
  2313. sub ax,bx
  2314. sub ax,256 ; add 256 kbyte
  2315. cmp [MemSize],ax
  2316. ja @f
  2317. mov [MaxMemSize],ax
  2318. clc
  2319. ret
  2320. @@:
  2321. stc
  2322. ret
  2323. ;------------------------------------------------------------------------
  2324. ; << SetVector >>
  2325. ; FUNCTION = initialize vector table
  2326. ; INPUT : none
  2327. ; OUTPUT : none
  2328. ; PROTECT : SS, SP, DS, ES
  2329. ;
  2330. ; SetVector(-/-)
  2331. ; {
  2332. ; Save ES;
  2333. ; ES = 0;
  2334. ; [OldKbInt] = ES:[rKbInt];
  2335. ; [OldKbInt+2] = ES:[rKbInt+2];
  2336. ; ES:[rKbInt] = Int9;
  2337. ; ES:[rKbInt+2] = CS;
  2338. ; [OldKbioInt] = ES:[rKbioInt];
  2339. ; [OldKbioInt+2] = ES:[rKbioInt+2];
  2340. ; ES:[rKbioInt] = Int16;
  2341. ; ES:[rKbioInt+2] = CS;
  2342. ; [OldRtcInt] = ES:[rRtcInt];
  2343. ; [OldRtcInt+2] = ES:[rRtcInt+2];
  2344. ; ES:[rRtcInt] = Int8;
  2345. ; ES:[rRtcInt+2] = CS;
  2346. ; [OldVideo] = ES:[rVideoInt];
  2347. ; [OldVideo+2] = ES:[rVideoInt+2];
  2348. ; ES:[rVideoInt] = Int10;
  2349. ; ES:[rVideoInt+2] = CS;
  2350. ; [OldVdParms] = ES:[rVdParm];
  2351. ; [OldVdParms+2] = ES:[rVdParm+2];
  2352. ; ES:[rVdParm] = VideoParms;
  2353. ; ES:[rVdParm+2] = CS;
  2354. ; if ([CodeStat] == ChabLoad)
  2355. ; {
  2356. ; [OldInt17] = ES:[rPrinter];
  2357. ; [OldInt17+2] = ES:[rPrinter+2];
  2358. ; ES:[rPrinter] = Int17;
  2359. ; ES:[rPrinter+2] = CS;
  2360. ; }
  2361. ; Restore ES;
  2362. ; }
  2363. ;
  2364. SetVector:
  2365. cli
  2366. push es
  2367. xor ax,ax
  2368. mov es,ax
  2369. mov ax,word ptr es:[rKbInt]
  2370. mov bx,word ptr es:[rKbInt+2]
  2371. mov word ptr [OldKbInt],ax
  2372. mov word ptr [OldKbInt+2],bx
  2373. mov word ptr es:[rKbInt],offset Int9
  2374. mov word ptr es:[rKbInt+2],cs
  2375. mov ax,word ptr es:[rKbioInt]
  2376. mov bx,word ptr es:[rKbioInt+2]
  2377. mov word ptr [OldKbioInt],ax
  2378. mov word ptr [OldKbioInt+2],bx
  2379. mov word ptr es:[rKbioInt],offset Int16
  2380. mov word ptr es:[rKbioInt+2],cs
  2381. mov ax,word ptr es:[rRtcInt]
  2382. mov bx,word ptr es:[rRtcInt+2]
  2383. mov word ptr [OldRtcInt],ax
  2384. mov word ptr [OldRtcInt+2],bx
  2385. mov word ptr es:[rRtcInt],offset Int8
  2386. mov word ptr es:[rRtcInt+2],cs
  2387. if Hwin31Sw
  2388. mov ax,word ptr es:[rInt2f]
  2389. mov bx,word ptr es:[rInt2f+2]
  2390. mov word ptr [OldInt2f],ax
  2391. mov word ptr [OldInt2f+2],bx
  2392. mov word ptr es:[rInt2f],offset Int2f
  2393. mov word ptr es:[rInt2f+2],cs
  2394. endif ; Hwin31Sw
  2395. mov ax,word ptr es:[rVideoInt]
  2396. mov bx,word ptr es:[rVideoInt+2]
  2397. mov word ptr [OldVideo],ax
  2398. mov word ptr [OldVideo+2],bx
  2399. mov word ptr es:[rVideoInt],offset Int10
  2400. mov word ptr es:[rVideoInt+2],cs
  2401. mov ax,word ptr es:[rVdParm]
  2402. mov bx,word ptr es:[rVdParm+2]
  2403. mov word ptr [OldVdParms],ax
  2404. mov word ptr [OldVdParms+2],bx
  2405. mov word ptr es:[rVdParm],offset VideoParms
  2406. mov word ptr es:[rVdParm+2],cs
  2407. test [CodeStat],ChabLoad
  2408. jz @f
  2409. mov ax,word ptr es:[rPrinter]
  2410. mov bx,word ptr es:[rPrinter+2]
  2411. mov word ptr [OldInt17],ax
  2412. mov word ptr [OldInt17+2],bx
  2413. mov word ptr es:[rPrinter],offset Int17
  2414. mov word ptr es:[rPrinter+2],cs
  2415. @@:
  2416. pop es
  2417. sti
  2418. ret
  2419. ;------------------------------------------------------------------------
  2420. ; << InstallFontFile >>
  2421. ; FUNCTION = �������� ȭ���� EMS/Ext./HIMEM memory�� ��ġ��
  2422. ; INPUT : none
  2423. ; OUTPUT : none
  2424. ; PROTECT : SS, SP, DS, ES
  2425. ;
  2426. ; InstallFontFile(-/-)
  2427. ; {
  2428. ; }
  2429. ;
  2430. InstallFontFile:
  2431. test [MemStat],HiMem
  2432. jz @f
  2433. mov ah,9
  2434. mov dx,[MemSize]
  2435. call [OldInt15]
  2436. dec ax
  2437. jnz HimemErr
  2438. mov [EmsHandle],dx
  2439. mov ah,0ch
  2440. call [OldInt15]
  2441. dec ax
  2442. jnz HimemErr
  2443. mov ax,bx
  2444. call InstallFontHi
  2445. jmp short InstallFileEnd
  2446. HimemErr:
  2447. or [ErrStat],FontLoadErr
  2448. and [MemStat],not HiMem
  2449. jmp short InstallFileEnd
  2450. @@:
  2451. test [MemStat],ExtMem
  2452. jz @f
  2453. call InstallFontExt
  2454. jmp short InstallFileEnd
  2455. @@:
  2456. test [MemStat],EmsMem
  2457. jz @f
  2458. call InstallFontEms
  2459. jmp short InstallFileEnd
  2460. @@:
  2461. test [MemStat],RealMem
  2462. jz InstallFileEnd
  2463. call InstallFontReal
  2464. InstallFileEnd:
  2465. ret
  2466. InstallFontExt:
  2467. mov dx,[MaxMemSize]
  2468. sub dx,[MemSize]
  2469. mov [MaxMemSize],dx
  2470. mov ax,1024
  2471. mul dx
  2472. add dl,10h ; 1MByte boundary
  2473. InstallFontHi:
  2474. mov bl,dl
  2475. test [MemStat],ExtMem
  2476. jz @f
  2477. push ds
  2478. push es
  2479. ASSUME DS:DATA
  2480. xor dx,dx
  2481. mov ds,dx
  2482. les di,[rCasetInt]
  2483. mov word ptr cs:[OldInt15],di
  2484. mov word ptr cs:[OldInt15+2],es
  2485. mov word ptr [rCasetInt],offset Int15Srv
  2486. mov word ptr [rCasetInt+2],cs
  2487. pop es
  2488. pop ds
  2489. ASSUME DS:CODE
  2490. @@:
  2491. test [HjStat],HjLoaded
  2492. jnz @f
  2493. mov [HanAddr],ax
  2494. mov [HanAddrH],bl
  2495. mov [GetHan1st],offset GetFontHanExt
  2496. mov [GetHan2nd],offset GetFontHanExt
  2497. mov dx,offset FontFileName
  2498. call SaveFontFile
  2499. or [HjStat],HjLoaded
  2500. add ax,61440 ; 32*94*64 = 192512
  2501. adc bl,2
  2502. @@:
  2503. mov [UdcAddr],ax ; 94*2*32 = 6016
  2504. mov [UdcAddrH],bl
  2505. mov [GetUdc1st],offset GetFontUdcExt
  2506. mov [GetUdc2nd],offset GetFontUdcExt
  2507. mov [PutUdc1st],offset PutFontUdcExt
  2508. mov [PutUdc2nd],offset PutFontUdcExt
  2509. or [HjStat],UdcArea
  2510. ret
  2511. SaveFontFile:
  2512. push ax
  2513. push bx
  2514. push cx
  2515. mov si,offset GdtDataTbl
  2516. mov [si].GdtDL,ax
  2517. mov [si].GdtDH,bl
  2518. mov ax,3d00h
  2519. int 21h
  2520. jc SaveFontFileErr
  2521. mov bx,ax ; copy handle
  2522. mov ax,4200h
  2523. xor cx,cx
  2524. mov dx,30h
  2525. int 21h ; set absolute file pointer
  2526. push ds
  2527. mov ax,cs
  2528. add ah,10h ; next segment
  2529. mov ds,ax
  2530. mov cl,4
  2531. shl ax,cl
  2532. mov cs:[si].GdtSL,ax
  2533. mov ax,ds
  2534. shr ah,cl
  2535. mov cs:[si].GdtSH,ah
  2536. @@:
  2537. xor dx,dx
  2538. mov cx,8000h
  2539. mov ah,3fh
  2540. int 21h
  2541. jc SaveFontFileErr2
  2542. mov cx,ax
  2543. jcxz @f
  2544. inc cx
  2545. shr cx,1 ; word count
  2546. push cx
  2547. mov ah,87h
  2548. int 15h
  2549. pop cx
  2550. shl cx,1
  2551. add cs:[si].GdtDL,cx
  2552. adc cs:[si].GdtDH,0
  2553. jmp short @b
  2554. SaveFontFileErr2:
  2555. or cs:[ErrStat],FontLoadErr
  2556. @@:
  2557. pop ds
  2558. mov ah,3eh
  2559. int 21h ; close handle
  2560. jmp short @f
  2561. SaveFontFileErr:
  2562. or [ErrStat],FontLoadErr
  2563. @@:
  2564. pop cx
  2565. pop bx
  2566. pop ax
  2567. ret
  2568. InstallFontEms:
  2569. mov bx,[MemSize]
  2570. mov cl,4
  2571. shr bx,cl
  2572. inc bx
  2573. mov ah,43h ; allocate page
  2574. int 67h
  2575. or ah,ah
  2576. jz @f
  2577. mov ah,45h ; close handle
  2578. int 67h
  2579. ret
  2580. @@:
  2581. mov [EmsHandle],dx
  2582. xor bl,bl
  2583. xor ax,ax
  2584. test [HjStat],HjLoaded
  2585. jnz @f
  2586. mov [HanAddr],ax
  2587. mov [HanAddrH],bl
  2588. mov [GetHan1st],offset GetFontHanEms
  2589. mov [GetHan2nd],offset GetFontHanEms
  2590. mov si,offset FontFileName
  2591. call SaveEmsFontFile
  2592. or [HjStat],HjLoaded
  2593. add ax,12288 ; 32*94*64 = 192512
  2594. add bl,11
  2595. cmp ax,16384
  2596. jb @f
  2597. sub ax,16384
  2598. inc bl
  2599. @@:
  2600. mov [UdcAddr],ax ; 94*2*32 = 6016
  2601. mov [UdcAddrH],bl
  2602. mov [GetUdc1st],offset GetFontUdcEms
  2603. mov [GetUdc2nd],offset GetFontUdcEms
  2604. mov [PutUdc1st],offset PutFontUdcEms
  2605. mov [PutUdc2nd],offset PutFontUdcEms
  2606. or [HjStat],UdcArea
  2607. ret
  2608. SaveEmsFontFile:
  2609. push ax
  2610. push bx
  2611. push cx
  2612. push es
  2613. mov es,[EmsSeg]
  2614. mov di,ax
  2615. mov ax,4400h ; set page
  2616. xor bh,bh
  2617. mov [CurEmsPage],bx
  2618. mov dx,[EmsHandle]
  2619. int 67h
  2620. or ah,ah
  2621. jnz SaveEmsFontFileErr
  2622. mov dx,si
  2623. mov ax,3d00h
  2624. int 21h
  2625. jc SaveEmsFontFileErr
  2626. mov bx,ax ; BX = file handle
  2627. mov ax,4200h
  2628. xor cx,cx
  2629. mov dx,30h
  2630. int 21h ; set absolute file pointer
  2631. push ds
  2632. mov ax,cs
  2633. add ah,10h ; next segment
  2634. mov ds,ax
  2635. EmsSaveLoop:
  2636. xor dx,dx
  2637. mov cx,8000h
  2638. mov ah,3fh
  2639. int 21h
  2640. jc SaveEmsFontFileErr2
  2641. mov cx,ax
  2642. jcxz SaveEmsFontFileEnd2
  2643. xor si,si
  2644. @@:
  2645. cmp di,16384
  2646. jae IncEmsPage
  2647. movsb
  2648. dec cx
  2649. jz EmsSaveLoop
  2650. jmp short @b
  2651. IncEmsPage:
  2652. push bx
  2653. mov ax,4400h ; set page
  2654. inc cs:[CurEmsPage]
  2655. mov bx,cs:[CurEmsPage]
  2656. mov dx,cs:[EmsHandle]
  2657. int 67h
  2658. pop bx
  2659. or ah,ah
  2660. jnz SaveEmsFontFileErr2
  2661. xor di,di
  2662. jmp short @b
  2663. SaveEmsFontFileErr2:
  2664. or cs:[ErrStat],FontLoadErr
  2665. SaveEmsFontFileEnd2:
  2666. pop ds
  2667. mov ah,3eh
  2668. int 21h ; close handle
  2669. jmp short @f
  2670. SaveEmsFontFileErr:
  2671. or [ErrStat],FontLoadErr
  2672. @@:
  2673. pop es
  2674. pop cx
  2675. pop bx
  2676. pop ax
  2677. ret
  2678. InstallFontReal:
  2679. test [HjStat],HjLoaded
  2680. jnz @f
  2681. mov [GetHan1st],offset GetFontHanReal
  2682. mov [GetHan2nd],offset GetFontHanReal
  2683. @@:
  2684. mov [GetUdc1st],offset GetFontUdcReal
  2685. mov [GetUdc2nd],offset GetFontUdcReal
  2686. mov [PutUdc1st],offset PutFontUdcReal
  2687. mov [PutUdc2nd],offset PutFontUdcReal
  2688. or [HjStat],UdcArea
  2689. ret
  2690. public EndOfInit ; for .MAP file
  2691. EndOfInit label byte
  2692. CODE ENDS
  2693. END
  2694.