Source code of Windows XP (NT5)
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.

645 lines
20 KiB

  1. /*/****************************************************************************
  2. * name: mtxvga.c
  3. *
  4. * description: Routine for switching between VGA mode and TERMINATOR mode
  5. *
  6. * designed: Christian Toutant
  7. * last modified: $Author: nphung $, $Date: 94/01/04 05:11:34 $
  8. *
  9. * version: $Id: mtxvga.c 2.0 94/01/04 05:11:34 nphung Exp $
  10. *
  11. * parameters: -
  12. * modifies: -
  13. * calls: -
  14. * returns: -
  15. ******************************************************************************/
  16. #include "switches.h"
  17. #if USE_SETUP_VGA
  18. #ifndef WINDOWS_NT
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <dos.h>
  23. #include <conio.h>
  24. #include <os2.h>
  25. #endif
  26. #include "bind.h"
  27. #include "sxci.h"
  28. #include "defbind.h"
  29. #include "def.h"
  30. #include "mga.h"
  31. #include "mgai_c.h"
  32. #include "mgai.h"
  33. #include "mtxvga.h"
  34. #include "mtxfont.h"
  35. #ifdef WINDOWS_NT
  36. #include "mga_nt.h"
  37. PUCHAR address; // where to store the return value of setmgasel
  38. #else /* #ifdef WINDOWS_NT */
  39. /*MTX* added by mp on thursday, 5/20/93 */
  40. extern volatile byte far *setmgasel(dword MgaSel, dword phyadr, word limit);
  41. extern dword getmgasel(void);
  42. /*MTX* added by mp on friday, 5/21/93 */
  43. extern ULONG current_phys_address;
  44. extern USHORT current_num_pages;
  45. /*END*/
  46. dword vgasel; // selector to use in setmgasel
  47. volatile byte far *address; // where to store the return value of setmgasel
  48. /*END*/
  49. #endif /* #ifdef WINDOWS_NT */
  50. /*----------------------- Load Font -----------------------------------*/
  51. extern byte CharSet14[];
  52. extern byte CharSet16[];
  53. byte OpenFont[] =
  54. { 0x02, 0x04, 0x04, 0x07, 0x04, 0x02,
  55. 0x05, 0x00, 0x06, 0x04
  56. };
  57. byte CloseFont[] =
  58. { 0x02, 0x03, 0x04, 0x03, 0x04, 0x00,
  59. 0x05, 0x10, 0x06, 0x0e, 0x06, 0x0a
  60. };
  61. void OCFont(byte *d)
  62. {
  63. _outp(VGA_SEQ_ADDR, d[0] );
  64. _outp(VGA_SEQ_DATA, d[1] );
  65. _outp(VGA_SEQ_ADDR, d[2] );
  66. _outp(VGA_SEQ_DATA, d[3] );
  67. _outp(VGA_GRAPHIC_ADDR, d[4] );
  68. _outp(VGA_GRAPHIC_DATA, d[5] );
  69. _outp(VGA_GRAPHIC_ADDR, d[6] );
  70. _outp(VGA_GRAPHIC_DATA, d[7] );
  71. _outp(VGA_GRAPHIC_ADDR, d[8] );
  72. _outp(VGA_GRAPHIC_DATA, d[9] );
  73. }
  74. void loadFont16(void)
  75. {
  76. #ifndef WINDOWS_NT
  77. #ifndef OS2
  78. struct overlay{int off; short seg;};
  79. #endif
  80. int i, j;
  81. #ifndef OS2
  82. volatile char _Far *vgaRam;
  83. ((struct overlay *)&vgaRam) -> seg = 0x60;
  84. ((struct overlay *)&vgaRam) -> off = 0xa0000;
  85. #else
  86. vgasel = getmgasel();
  87. address = setmgasel(vgasel, (ULONG)0xA0000, 16);
  88. #endif
  89. OCFont(OpenFont);
  90. for (i = 0; i < 256; i++)
  91. for (j = 0; j < 16; j++)
  92. #ifndef OS2
  93. vgaRam[i * 32 + j] = CharSet16[i * 16 + j];
  94. #else
  95. *((volatile unsigned char far *)(address + i * 32 + j)) =
  96. CharSet16[i * 16 + j];
  97. #endif
  98. OCFont(CloseFont);
  99. #else /* #ifndef WINDOWS_NT */
  100. int i, j;
  101. address = VGA_RAM;
  102. OCFont(OpenFont);
  103. for (i = 0; i < 256; i++)
  104. for (j = 0; j < 16; j++)
  105. mgaWriteBYTE((*((PUCHAR)(address + i*32 + j))),CharSet16[i*16 + j]);
  106. OCFont(CloseFont);
  107. #endif /* #ifndef WINDOWS_NT */
  108. }
  109. /*----------------------- fin Load Font -----------------------------------*/
  110. void clearVgaMem()
  111. {
  112. #ifndef WINDOWS_NT
  113. #ifndef OS2
  114. struct overlay{int off; short seg;};
  115. #endif
  116. word i;
  117. #ifndef OS2
  118. volatile char _Far *vgaRam;
  119. ((struct overlay *)&vgaRam) -> seg = 0x60;
  120. ((struct overlay *)&vgaRam) -> off = 0xb8000;
  121. #else
  122. vgasel = getmgasel();
  123. address = setmgasel(vgasel, (ULONG)0xB8000, 8);
  124. #endif
  125. for (i = 0; i < (word)8000; i += 2)
  126. {
  127. #ifndef OS2
  128. vgaRam[i] = ' ';
  129. vgaRam[i+1] = 0x07;
  130. #else
  131. *((volatile unsigned char far *)(address + i)) = ' ';
  132. *((volatile unsigned char far *)(address + i + 1)) = 0x07;
  133. #endif
  134. }
  135. #else /* #ifndef WINDOWS_NT */
  136. word i;
  137. address = VGA_MEM;
  138. for (i = 0; i < (word)8000; i += 2)
  139. {
  140. mgaWriteBYTE((*((PUCHAR)(address + i))),' ');
  141. mgaWriteBYTE((*((PUCHAR)(address + i + 1))),0x07);
  142. }
  143. #endif /* #ifndef WINDOWS_NT */
  144. }
  145. /*----------------------- fin Load Font -----------------------------------*/
  146. /*----------------------- SETUP VGA -----------------------------------*/
  147. VideoHardware videoHw =
  148. {
  149. 0x00,
  150. { 0x00, 0x03, 0x00, 0x02 }, /* Sequencer 01-04 */
  151. 0x67, /* Misc Output Register */
  152. {
  153. 0x5F,0x4F,0x50,0x82,0x55,0x81, /* Crtc 00-05 */
  154. 0xBF,0x1F,0x00,0x4f,0x0d,0x0e, /* Crtc 06-0b */
  155. 0x00,0x00,0x07,0x80,0x9C,0x8E, /* Crtc 0c-11 */
  156. 0x8F,0x28,0x1F,0x96,0xB9,0xA3, /* Crtc 12-17 */
  157. 0xFF /* Crtc 18 */
  158. },
  159. {
  160. 0x00,0x01,0x02,0x03,0x04,0x05, /* Attributes Ctlr 00-05 */
  161. 0x14,0x07,0x38,0x39,0x3a,0x3b, /* Attributes Ctlr 06-0b */
  162. 0x3c,0x3d,0x3e,0x3f,0x0c,0x00, /* Attributes Ctlr 0c-11 */
  163. 0x0F,0x08 /* Attributes Ctlr 12-13 */
  164. },
  165. {
  166. 0x00,0x00,0x00,0x00,0x00,0x10, /* Graphics Ctlr 00-05 */
  167. 0x0E,0x00,0xFF /* Graphics Ctlr 06-08 */
  168. },
  169. {
  170. 0x40,0x00,0x00,0x00,0x00,0x00, /* Auxiliary reg 00-05 */
  171. 0x00,0xc0,0xa7,0x00,0x00,0x00, /* Auxiliary reg 06-0b */
  172. 0x80, 0x20, 0x00 /* Auxiliary reg 0c-0e */
  173. },
  174. 0x3d4, /* CRTC base port */
  175. { 0x07, 0x07, 0x03, 0x03 } /* Latch Data */
  176. };
  177. VideoData vidData =
  178. {
  179. 0x410, 0x20,
  180. 0x449,
  181. {
  182. 0x03, 0x50, 0x00, 0x00, 0x10, 0x00, 0x00,
  183. 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  184. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  185. 0x07, 0x06, 0x00, 0xD4, 0x03, 0x29, 0x30
  186. },
  187. 0x484,
  188. { 0x18, 0x10, 0x00, 0x70, 0xF9, 0x31, 0x0B },
  189. 0x4a8,
  190. { 0xDC, 0x05, 0x5A, 0x02 }
  191. };
  192. void setupVgaHw(void)
  193. {
  194. #ifndef WINDOWS_NT
  195. #ifndef OS2
  196. struct overlay{int off; short seg;};
  197. #endif
  198. int i;
  199. #ifndef OS2
  200. volatile char _Far *vgaRam;
  201. ((struct overlay *)&vgaRam) -> seg = 0x60;
  202. ((struct overlay *)&vgaRam) -> off = 0xa0000;
  203. #else
  204. vgasel = getmgasel();
  205. address = setmgasel(vgasel, (ULONG)0xA0000, 16);
  206. #endif
  207. _outp(VGA_GRAPHIC_ADDR, 05); /* Set write mode 0 */
  208. _outp(VGA_GRAPHIC_DATA, 00);
  209. _outp(VGA_GRAPHIC_ADDR, 06); /* Set map to A000h */
  210. _outp(VGA_GRAPHIC_DATA, 04);
  211. _outp(VGA_GRAPHIC_ADDR, 04); /* Setup memory mode */
  212. _outp(VGA_GRAPHIC_DATA, 07);
  213. _outp(VGA_GRAPHIC_ADDR, 02); /* Set map mask register */
  214. _outp(VGA_GRAPHIC_DATA, 1); /* Setup plane 0 access */
  215. #ifndef OS2
  216. vgaRam[0xffff] = videoHw.latchData[0]; /* Get saved latch 0 data */
  217. #else
  218. *((volatile unsigned char far *)(address + 0xFFFF)) = videoHw.latchData[0];
  219. #endif
  220. /* and Write to Vram */
  221. _outp(VGA_GRAPHIC_DATA, 2); /* Setup plane 1 access */
  222. #ifndef OS2
  223. vgaRam[0xffff] = videoHw.latchData[1]; /* Get saved latch 1 data */
  224. #else
  225. *((volatile unsigned char far *)(address + 0xFFFF)) = videoHw.latchData[1];
  226. #endif
  227. /* and Write to Vram */
  228. _outp(VGA_GRAPHIC_DATA, 4); /* Setup plane 2 access */
  229. #ifndef OS2
  230. vgaRam[0xffff] = videoHw.latchData[2]; /* Get saved latch 0 data */
  231. #else
  232. *((volatile unsigned char far *)(address + 0xFFFF)) = videoHw.latchData[2];
  233. #endif
  234. /* and Write to Vram */
  235. _outp(VGA_GRAPHIC_DATA, 8); /* Setup plane 8 access */
  236. #ifndef OS2
  237. vgaRam[0xffff] = videoHw.latchData[3]; /* Get saved latch 0 data */
  238. #else
  239. *((volatile unsigned char far *)(address + 0xFFFF)) = videoHw.latchData[3];
  240. #endif
  241. /* and Write to Vram */
  242. _outp(VGA_GRAPHIC_DATA, 0x0f); /* Setup plane 8 access */
  243. #ifndef OS2
  244. i = vgaRam[0xffff];
  245. #else
  246. i = *((volatile unsigned char far *)(address + 0xFFFF));
  247. #endif
  248. /* ----------------------------------- Reset sequenceur ------------------------------------ */
  249. _outp(VGA_SEQ_ADDR, 00);
  250. _outp(VGA_SEQ_DATA, 01);
  251. /* ------------------------------------------------------------------------------------------ */
  252. /* -------------------------- Programmation du sequenceur ----------------------------------- */
  253. for(i = 0; i < 4; i++)
  254. {
  255. _outp(VGA_SEQ_ADDR, i + 1);
  256. _outp(VGA_SEQ_DATA, videoHw.seqData[i]);
  257. }
  258. /* ------------------------------------------------------------------------------------------ */
  259. /* -------------------------- Programmation du Misc output register ------------------------- */
  260. _outp(VGA_MISC, videoHw.mor);
  261. /* ------------------------------------------------------------------------------------------ */
  262. /* ----------------------------------- Start sequenceur ------------------------------------ */
  263. _outp(VGA_SEQ_ADDR, 00);
  264. _outp(VGA_SEQ_DATA, 03);
  265. /* ------------------------------------------------------------------------------------------ */
  266. /* ----------------------------------- Programmation du crtc ------------------------------- */
  267. _outp(VGA_CRT_ADDR, 0x11); /* Setup no protect bit */
  268. _outp(VGA_CRT_DATA, 0x00);
  269. for(i = 0; i < 25; i++)
  270. {
  271. _outp(VGA_CRT_ADDR, i);
  272. _outp(VGA_CRT_DATA, videoHw.crtcData[i]);
  273. }
  274. /* ------------------------------------------------------------------------------------------ */
  275. i = _inp(VGA_FEAT); /* Clear attribute flip/flop */
  276. _outp(VGA_FEAT, 0); /* Zero feature control register */
  277. /* ---------------- Programmation du attribute controler (reg 10h, 12h-13h ) ---------------- */
  278. _outp(VGA_ATTRIB_ADDR, 0x10); /* Write attribute index 10h */
  279. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[0x10]);
  280. _outp(VGA_ATTRIB_ADDR, 0x12); /* Write attribute index 12h */
  281. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[0x12]);
  282. _outp(VGA_ATTRIB_ADDR, 0x13); /* Write attribute index 13h */
  283. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[0x13]);
  284. /* ------------------------------------------------------------------------------------------ */
  285. /* --------------------------- Programmation du graphics controlers ------------------------- */
  286. for(i = 0; i < 9; i++)
  287. {
  288. _outp(VGA_GRAPHIC_ADDR, i);
  289. _outp(VGA_GRAPHIC_DATA, videoHw.graphicsCtl[i]);
  290. }
  291. /* ------------------------------------------------------------------------------------------ */
  292. /* ------------------ Programmation du graphics controlers ---------------- */
  293. for(i = 0; i < 15; i++)
  294. {
  295. _outp(VGA_AUX_ADDR, i);
  296. _outp(VGA_AUX_DATA, videoHw.auxilaryReg[i]);
  297. }
  298. /* ------------------------------------------------------------------------------------------ */
  299. /* ----------------- Programmation du auxiliary register ----------------- */
  300. for(i = 0; i < 15; i++)
  301. {
  302. _outp(VGA_AUX_ADDR, i);
  303. _outp(VGA_AUX_DATA, videoHw.auxilaryReg[i]);
  304. }
  305. /* ------------------------------------------------------------------------------------------ */
  306. _outp(VGA_FEAT, videoHw.featureCtl); /* \restore feature control register */
  307. /* -------------------- Programmation du attribute controler (0-0fh et 11h) ----------------- */
  308. for(i = 0; i < 16; i++)
  309. {
  310. _outp(VGA_ATTRIB_ADDR, i);
  311. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[i]);
  312. }
  313. _outp(VGA_ATTRIB_ADDR, 0x11); /* Write attribute index 11h */
  314. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[0x11]);
  315. /* ------------------------------------------------------------------- */
  316. _outp(VGA_ATTRIB_ADDR, 0xff); /* Write attribute index 11h */
  317. #else /* ifndef WINDOWS_NT */
  318. UCHAR i;
  319. PUCHAR pVgaRam;
  320. pVgaRam = VGA_RAM;
  321. _outp(VGA_GRAPHIC_ADDR, 05); /* Set write mode 0 */
  322. _outp(VGA_GRAPHIC_DATA, 00);
  323. _outp(VGA_GRAPHIC_ADDR, 06); /* Set map to A000h */
  324. _outp(VGA_GRAPHIC_DATA, 04);
  325. _outp(VGA_GRAPHIC_ADDR, 04); /* Setup memory mode */
  326. _outp(VGA_GRAPHIC_DATA, 07);
  327. _outp(VGA_GRAPHIC_ADDR, 02); /* Set map mask register */
  328. _outp(VGA_GRAPHIC_DATA, 1); /* Setup plane 0 access */
  329. mgaWriteBYTE((*(pVgaRam+0xFFFF)), videoHw.latchData[0]);
  330. /* and Write to Vram */
  331. _outp(VGA_GRAPHIC_DATA, 2); /* Setup plane 1 access */
  332. mgaWriteBYTE((*(pVgaRam+0xFFFF)), videoHw.latchData[1]);
  333. /* and Write to Vram */
  334. _outp(VGA_GRAPHIC_DATA, 4); /* Setup plane 2 access */
  335. mgaWriteBYTE((*(pVgaRam+0xFFFF)), videoHw.latchData[2]);
  336. /* and Write to Vram */
  337. _outp(VGA_GRAPHIC_DATA, 8); /* Setup plane 8 access */
  338. mgaWriteBYTE((*(pVgaRam+0xFFFF)), videoHw.latchData[3]);
  339. /* and Write to Vram */
  340. _outp(VGA_GRAPHIC_DATA, 0x0f); /* Setup plane 8 access */
  341. mgaReadBYTE((*(pVgaRam+0xFFFF)), i);
  342. /* ----------------------------------- Reset sequenceur ------------------------------------ */
  343. _outp(VGA_SEQ_ADDR, 00);
  344. _outp(VGA_SEQ_DATA, 01);
  345. /* ------------------------------------------------------------------------------------------ */
  346. /* -------------------------- Programmation du sequenceur ----------------------------------- */
  347. for(i = 0; i < 4; i++)
  348. {
  349. _outp(VGA_SEQ_ADDR, (UCHAR)(i + 1));
  350. _outp(VGA_SEQ_DATA, videoHw.seqData[i]);
  351. }
  352. /* ------------------------------------------------------------------------------------------ */
  353. /* -------------------------- Programmation du Misc output register ------------------------- */
  354. _outp(VGA_MISC, videoHw.mor);
  355. /* ------------------------------------------------------------------------------------------ */
  356. /* ----------------------------------- Start sequenceur ------------------------------------ */
  357. _outp(VGA_SEQ_ADDR, 00);
  358. _outp(VGA_SEQ_DATA, 03);
  359. /* ------------------------------------------------------------------------------------------ */
  360. /* ----------------------------------- Programmation du crtc ------------------------------- */
  361. _outp(VGA_CRT_ADDR, 0x11); /* Setup no protect bit */
  362. _outp(VGA_CRT_DATA, 0x00);
  363. for(i = 0; i < 25; i++)
  364. {
  365. _outp(VGA_CRT_ADDR, i);
  366. _outp(VGA_CRT_DATA, videoHw.crtcData[i]);
  367. }
  368. /* ------------------------------------------------------------------------------------------ */
  369. i = _inp(VGA_FEAT); /* Clear attribute flip/flop */
  370. _outp(VGA_FEAT, 0); /* Zero feature control register */
  371. /* ---------------- Programmation du attribute controler (reg 10h, 12h-13h ) ---------------- */
  372. _outp(VGA_ATTRIB_ADDR, 0x10); /* Write attribute index 10h */
  373. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[0x10]);
  374. _outp(VGA_ATTRIB_ADDR, 0x12); /* Write attribute index 12h */
  375. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[0x12]);
  376. _outp(VGA_ATTRIB_ADDR, 0x13); /* Write attribute index 13h */
  377. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[0x13]);
  378. /* ------------------------------------------------------------------------------------------ */
  379. /* --------------------------- Programmation du graphics controlers ------------------------- */
  380. for(i = 0; i < 9; i++)
  381. {
  382. _outp(VGA_GRAPHIC_ADDR, i);
  383. _outp(VGA_GRAPHIC_DATA, videoHw.graphicsCtl[i]);
  384. }
  385. /* ------------------------------------------------------------------------------------------ */
  386. /* ------------------ Programmation du graphics controlers ---------------- */
  387. for(i = 0; i < 15; i++)
  388. {
  389. _outp(VGA_AUX_ADDR, i);
  390. _outp(VGA_AUX_DATA, videoHw.auxilaryReg[i]);
  391. }
  392. /* ------------------------------------------------------------------------------------------ */
  393. /* ----------------- Programmation du auxiliary register ----------------- */
  394. for(i = 0; i < 15; i++)
  395. {
  396. _outp(VGA_AUX_ADDR, i);
  397. _outp(VGA_AUX_DATA, videoHw.auxilaryReg[i]);
  398. }
  399. /* ------------------------------------------------------------------------------------------ */
  400. _outp(VGA_FEAT, videoHw.featureCtl); /* \restore feature control register */
  401. /* -------------------- Programmation du attribute controler (0-0fh et 11h) ----------------- */
  402. for(i = 0; i < 16; i++)
  403. {
  404. _outp(VGA_ATTRIB_ADDR, i);
  405. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[i]);
  406. }
  407. _outp(VGA_ATTRIB_ADDR, 0x11); /* Write attribute index 11h */
  408. _outp(VGA_ATTRIB_WRITE, videoHw.attrData[0x11]);
  409. /* ------------------------------------------------------------------- */
  410. _outp(VGA_ATTRIB_ADDR, 0xff); /* Write attribute index 11h */
  411. #endif /* ifndef WINDOWS_NT */
  412. }
  413. /*----------------------- FIN SETUP VGA -----------------------------------*/
  414. #ifndef WINDOWS_NT
  415. #ifndef OS2
  416. void cust_memcpy(byte _Far *dest,byte _Far *src, size_t n)
  417. {
  418. int i;
  419. for(i = 0; i < n; i++) dest[i] = src[i];
  420. }
  421. #endif
  422. #endif
  423. void setupVgaData(void)
  424. {
  425. #ifndef WINDOWS_NT
  426. #ifndef OS2
  427. struct overlay{int off; short seg;};
  428. byte _Far *vgaData;
  429. ((struct overlay *)&vgaData) -> seg = 0x60;
  430. ((struct overlay *)&vgaData) -> off = vidData.addrEquipementLow;
  431. *vgaData &= 0xcf;
  432. *vgaData |= vidData.EquipementLow;
  433. ((struct overlay *)&vgaData) -> off = vidData.addrCRTMode;
  434. cust_memcpy(vgaData,(byte _Far *)vidData.CRTMode, sizeof(vidData.CRTMode));
  435. ((struct overlay *)&vgaData) -> off = vidData.addrMaxRow;
  436. cust_memcpy(vgaData,(byte _Far *)vidData.MaxRow, sizeof(vidData.MaxRow));
  437. #else
  438. byte vgaData;
  439. int i;
  440. vgasel = getmgasel();
  441. address = setmgasel(vgasel, (ULONG)vidData.addrEquipementLow, 1);
  442. vgaData = *((volatile unsigned char far *)(address));
  443. vgaData &= 0xCF;
  444. // I'm not sure if this has to be done sequentially,
  445. // so i'll do it that way.
  446. *((volatile unsigned char far *)(address)) = vgaData;
  447. vgaData |= vidData.EquipementLow;
  448. *((volatile unsigned char far *)(address)) = vgaData;
  449. address = setmgasel(vgasel, (ULONG)vidData.addrCRTMode, 1);
  450. for(i = 0; i < (int)sizeof(vidData.CRTMode); i++)
  451. *((volatile unsigned char far *)(address + i)) = vidData.CRTMode[i];
  452. address = setmgasel(vgasel, (ULONG)vidData.addrMaxRow, 1);
  453. for(i = 0; i < (int)sizeof(vidData.MaxRow); i++)
  454. *((volatile unsigned char far *)(address + i)) = vidData.MaxRow[i];
  455. #endif
  456. /*
  457. ((struct overlay *)&vgaData) -> off = vidData.addrSavePtr;
  458. cust_memcpy(vgaData, vidData.SavePtr, sizeof(vidData.SavePtr));
  459. */
  460. #else /* #ifndef WINDOWS_NT */
  461. byte vgaData;
  462. int i;
  463. address = ADDR_EQUIP_LO;
  464. mgaReadBYTE((*((PUCHAR)(address))),vgaData);
  465. vgaData &= 0xCF;
  466. // I'm not sure if this has to be done sequentially,
  467. // so i'll do it that way.
  468. mgaWriteBYTE((*((PUCHAR)(address))),vgaData);
  469. vgaData |= vidData.EquipementLow;
  470. mgaWriteBYTE((*((PUCHAR)(address))),vgaData);
  471. address = ADDR_CRT_MODE;
  472. for(i = 0; i < (int)sizeof(vidData.CRTMode); i++)
  473. mgaWriteBYTE((*((PUCHAR)(address + i))),vidData.CRTMode[i]);
  474. address = ADDR_MAX_ROW;
  475. for(i = 0; i < (int)sizeof(vidData.MaxRow); i++)
  476. mgaWriteBYTE((*((PUCHAR)(address + i))),vidData.MaxRow[i]);
  477. #endif /* #ifndef WINDOWS_NT */
  478. }
  479. /*----------------------- fin SETUP VGA -----------------------------------*/
  480. void setupVga(void)
  481. {
  482. #ifndef WINDOWS_NT
  483. /*MTX* added by mp on friday, 5/21/93 */
  484. ULONG original_phys_address = current_phys_address;
  485. USHORT original_num_pages = current_num_pages;
  486. /*END*/
  487. #endif /* #ifndef WINDOWS_NT */
  488. setupVgaHw();
  489. setupVgaData();
  490. loadFont16();
  491. #ifndef WINDOWS_NT
  492. clearVgaMem();
  493. #endif /* #ifndef WINDOWS_NT */
  494. #ifndef WINDOWS_NT
  495. /*MTX* added by mp on friday, 5/21/93 */
  496. vgasel = getmgasel();
  497. setmgasel(vgasel, original_phys_address, original_num_pages);
  498. /*END*/
  499. #endif /* #ifndef WINDOWS_NT */
  500. }
  501. #endif /* #if USE_SETUP_VGA */