14d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//
24d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  QEMU Cirrus CLGD 54xx VGABIOS Extension.
34d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//
44d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  Copyright (c) 2004 Makoto Suzuki (suzu)
54d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//
64d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  This library is free software; you can redistribute it and/or
74d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  modify it under the terms of the GNU Lesser General Public
84d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  License as published by the Free Software Foundation; either
94d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  version 2 of the License, or (at your option) any later version.
104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//
114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  This library is distributed in the hope that it will be useful,
124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  but WITHOUT ANY WARRANTY; without even the implied warranty of
134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  Lesser General Public License for more details.
154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//
164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  You should have received a copy of the GNU Lesser General Public
174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  License along with this library; if not, write to the Free Software
184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
194d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//
204d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
214d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima//#define CIRRUS_VESA3_PMINFO
224d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#ifdef VBE
234d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#undef CIRRUS_VESA3_PMINFO
244d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#endif
254d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
264d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#define PM_BIOSMEM_CURRENT_MODE 0x449
274d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#define PM_BIOSMEM_CRTC_ADDRESS 0x463
284d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#define PM_BIOSMEM_VBE_MODE 0x4BA
294d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
304d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimatypedef struct
314d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima{
324d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  /* + 0 */
334d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned short mode;
344d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned short width;
354d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned short height;
364d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned short depth;
374d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  /* + 8 */
384d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned short hidden_dac; /* 0x3c6 */
394d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned short *seq; /* 0x3c4 */
404d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned short *graph; /* 0x3ce */
414d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned short *crtc; /* 0x3d4 */
424d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  /* +16 */
434d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char bitsperpixel;
444d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesacolortype;
454d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesaredmask;
464d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesaredpos;
474d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesagreenmask;
484d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesagreenpos;
494d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesabluemask;
504d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesabluepos;
514d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  /* +24 */
524d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesareservedmask;
534d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  unsigned char vesareservedpos;
544d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima} cirrus_mode_t;
554d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#define CIRRUS_MODE_SIZE 26
564d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
574d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
584d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* For VESA BIOS 3.0 */
594d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#define CIRRUS_PM16INFO_SIZE 20
604d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
614d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* VGA */
624d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_vga[] = {0x0007,0xffff};
634d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cgraph_vga[] = {0x0009,0x000a,0x000b,0xffff};
644d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_vga[] = {0x001a,0x001b,0x001d,0xffff};
654d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
664d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* extensions */
674d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cgraph_svgacolor[] = {
684d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0000,0x0001,0x0002,0x0003,0x0004,0x4005,0x0506,0x0f07,0xff08,
694d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0009,0x000a,0x000b,
704d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
714d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
724d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 640x480x8 */
734d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_640x480x8[] = {
744d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
754d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x580b,0x580c,0x580d,0x580e,
764d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
774d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x331b,0x331c,0x331d,0x331e,
784d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
794d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
804d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_640x480x8[] = {
814d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2c11,
824d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x5f00,0x4f01,0x4f02,0x8003,0x5204,0x1e05,0x0b06,0x3e07,
834d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x4009,0x000c,0x000d,
844d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xea10,0xdf12,0x5013,0x4014,0xdf15,0x0b16,0xc317,0xff18,
854d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x221b,0x001d,
864d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
874d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
884d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 640x480x16 */
894d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_640x480x16[] = {
904d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1707,
914d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x580b,0x580c,0x580d,0x580e,
924d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
934d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x331b,0x331c,0x331d,0x331e,
944d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
954d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
964d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_640x480x16[] = {
974d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2c11,
984d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x5f00,0x4f01,0x4f02,0x8003,0x5204,0x1e05,0x0b06,0x3e07,
994d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x4009,0x000c,0x000d,
1004d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xea10,0xdf12,0xa013,0x4014,0xdf15,0x0b16,0xc317,0xff18,
1014d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x221b,0x001d,
1024d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1034d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1044d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 640x480x24 */
1054d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_640x480x24[] = {
1064d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1507,
1074d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x580b,0x580c,0x580d,0x580e,
1084d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
1094d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x331b,0x331c,0x331d,0x331e,
1104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_640x480x24[] = {
1134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2c11,
1144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x5f00,0x4f01,0x4f02,0x8003,0x5204,0x1e05,0x0b06,0x3e07,
1154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x4009,0x000c,0x000d,
1164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xea10,0xdf12,0x0013,0x4014,0xdf15,0x0b16,0xc317,0xff18,
1174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x321b,0x001d,
1184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1194d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1204d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 800x600x8 */
1214d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_800x600x8[] = {
1224d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
1234d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x230b,0x230c,0x230d,0x230e,
1244d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
1254d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x141b,0x141c,0x141d,0x141e,
1264d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1274d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1284d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_800x600x8[] = {
1294d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2311,0x7d00,0x6301,0x6302,0x8003,0x6b04,0x1a05,0x9806,0xf007,
1304d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
1314d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x7d10,0x5712,0x6413,0x4014,0x5715,0x9816,0xc317,0xff18,
1324d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x221b,0x001d,
1334d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1344d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1354d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 800x600x16 */
1364d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_800x600x16[] = {
1374d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1707,
1384d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x230b,0x230c,0x230d,0x230e,
1394d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
1404d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x141b,0x141c,0x141d,0x141e,
1414d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1424d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1434d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_800x600x16[] = {
1444d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2311,0x7d00,0x6301,0x6302,0x8003,0x6b04,0x1a05,0x9806,0xf007,
1454d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
1464d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x7d10,0x5712,0xc813,0x4014,0x5715,0x9816,0xc317,0xff18,
1474d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x221b,0x001d,
1484d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1494d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1504d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 800x600x24 */
1514d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_800x600x24[] = {
1524d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1507,
1534d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x230b,0x230c,0x230d,0x230e,
1544d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
1554d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x141b,0x141c,0x141d,0x141e,
1564d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1574d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1584d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_800x600x24[] = {
1594d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2311,0x7d00,0x6301,0x6302,0x8003,0x6b04,0x1a05,0x9806,0xf007,
1604d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
1614d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x7d10,0x5712,0x2c13,0x4014,0x5715,0x9816,0xc317,0xff18,
1624d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x321b,0x001d,
1634d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1644d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1654d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 1024x768x8 */
1664d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_1024x768x8[] = {
1674d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
1684d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x760b,0x760c,0x760d,0x760e,
1694d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
1704d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x341b,0x341c,0x341d,0x341e,
1714d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1724d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1734d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_1024x768x8[] = {
1744d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2911,0xa300,0x7f01,0x7f02,0x8603,0x8304,0x9405,0x2406,0xf507,
1754d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
1764d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0310,0xff12,0x8013,0x4014,0xff15,0x2416,0xc317,0xff18,
1774d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x221b,0x001d,
1784d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1794d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1804d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 1024x768x16 */
1814d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_1024x768x16[] = {
1824d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1707,
1834d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x760b,0x760c,0x760d,0x760e,
1844d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
1854d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x341b,0x341c,0x341d,0x341e,
1864d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1874d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1884d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_1024x768x16[] = {
1894d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2911,0xa300,0x7f01,0x7f02,0x8603,0x8304,0x9405,0x2406,0xf507,
1904d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
1914d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0310,0xff12,0x0013,0x4014,0xff15,0x2416,0xc317,0xff18,
1924d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x321b,0x001d,
1934d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
1944d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
1954d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 1024x768x24 */
1964d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_1024x768x24[] = {
1974d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1507,
1984d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x760b,0x760c,0x760d,0x760e,
1994d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
2004d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x341b,0x341c,0x341d,0x341e,
2014d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
2024d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
2034d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_1024x768x24[] = {
2044d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2911,0xa300,0x7f01,0x7f02,0x8603,0x8304,0x9405,0x2406,0xf507,
2054d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
2064d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0310,0xff12,0x8013,0x4014,0xff15,0x2416,0xc317,0xff18,
2074d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x321b,0x001d,
2084d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
2094d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
2104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 1280x1024x8 */
2114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_1280x1024x8[] = {
2124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
2134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x760b,0x760c,0x760d,0x760e,
2144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
2154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x341b,0x341c,0x341d,0x341e,
2164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
2174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
2184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_1280x1024x8[] = {
2194d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2911,0xc300,0x9f01,0x9f02,0x8603,0x8304,0x9405,0x2406,0xf707,
2204d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
2214d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0310,0xff12,0xa013,0x4014,0xff15,0x2416,0xc317,0xff18,
2224d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x221b,0x001d,
2234d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
2244d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
2254d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 1280x1024x16 */
2264d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_1280x1024x16[] = {
2274d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1707,
2284d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x760b,0x760c,0x760d,0x760e,
2294d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
2304d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x341b,0x341c,0x341d,0x341e,
2314d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
2324d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
2334d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_1280x1024x16[] = {
2344d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2911,0xc300,0x9f01,0x9f02,0x8603,0x8304,0x9405,0x2406,0xf707,
2354d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
2364d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0310,0xff12,0x4013,0x4014,0xff15,0x2416,0xc317,0xff18,
2374d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x321b,0x001d,
2384d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
2394d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
2404d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
2414d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima/* 1600x1200x8 */
2424d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cseq_1600x1200x8[] = {
2434d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
2444d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x760b,0x760c,0x760d,0x760e,
2454d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0412,0x0013,0x2017,
2464d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x341b,0x341c,0x341d,0x341e,
2474d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
2484d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
2494d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short ccrtc_1600x1200x8[] = {
2504d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x2911,0xc300,0x9f01,0x9f02,0x8603,0x8304,0x9405,0x2406,0xf707,
2514d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x6009,0x000c,0x000d,
2524d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x0310,0xff12,0xa013,0x4014,0xff15,0x2416,0xc317,0xff18,
2534d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0x001a,0x221b,0x001d,
2544d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima0xffff
2554d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
2564d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
2574d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_mode_t cirrus_modes[] =
2584d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima{
2594d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x5f,640,480,8,0x00,
2604d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_640x480x8,cgraph_svgacolor,ccrtc_640x480x8,8,
2614d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   4,0,0,0,0,0,0,0,0},
2624d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x64,640,480,16,0xe1,
2634d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_640x480x16,cgraph_svgacolor,ccrtc_640x480x16,16,
2644d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,5,11,6,5,5,0,0,0},
2654d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x66,640,480,15,0xf0,
2664d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_640x480x16,cgraph_svgacolor,ccrtc_640x480x16,16,
2674d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,5,10,5,5,5,0,1,15},
2684d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x71,640,480,24,0xe5,
2694d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_640x480x24,cgraph_svgacolor,ccrtc_640x480x24,24,
2704d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,8,16,8,8,8,0,0,0},
2714d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
2724d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x5c,800,600,8,0x00,
2734d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_800x600x8,cgraph_svgacolor,ccrtc_800x600x8,8,
2744d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   4,0,0,0,0,0,0,0,0},
2754d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x65,800,600,16,0xe1,
2764d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_800x600x16,cgraph_svgacolor,ccrtc_800x600x16,16,
2774d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,5,11,6,5,5,0,0,0},
2784d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x67,800,600,15,0xf0,
2794d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_800x600x16,cgraph_svgacolor,ccrtc_800x600x16,16,
2804d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,5,10,5,5,5,0,1,15},
2814d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
2824d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x60,1024,768,8,0x00,
2834d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_1024x768x8,cgraph_svgacolor,ccrtc_1024x768x8,8,
2844d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   4,0,0,0,0,0,0,0,0},
2854d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x74,1024,768,16,0xe1,
2864d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_1024x768x16,cgraph_svgacolor,ccrtc_1024x768x16,16,
2874d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,5,11,6,5,5,0,0,0},
2884d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x68,1024,768,15,0xf0,
2894d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_1024x768x16,cgraph_svgacolor,ccrtc_1024x768x16,16,
2904d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,5,10,5,5,5,0,1,15},
2914d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
2924d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x78,800,600,24,0xe5,
2934d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_800x600x24,cgraph_svgacolor,ccrtc_800x600x24,24,
2944d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,8,16,8,8,8,0,0,0},
2954d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x79,1024,768,24,0xe5,
2964d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_1024x768x24,cgraph_svgacolor,ccrtc_1024x768x24,24,
2974d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,8,16,8,8,8,0,0,0},
2984d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
2994d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x6d,1280,1024,8,0x00,
3004d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_1280x1024x8,cgraph_svgacolor,ccrtc_1280x1024x8,8,
3014d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   4,0,0,0,0,0,0,0,0},
3024d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x69,1280,1024,15,0xf0,
3034d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_1280x1024x16,cgraph_svgacolor,ccrtc_1280x1024x16,16,
3044d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,5,10,5,5,5,0,1,15},
3054d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x75,1280,1024,16,0xe1,
3064d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_1280x1024x16,cgraph_svgacolor,ccrtc_1280x1024x16,16,
3074d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   6,5,11,6,5,5,0,0,0},
3084d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3094d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0x7b,1600,1200,8,0x00,
3104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   cseq_1600x1200x8,cgraph_svgacolor,ccrtc_1600x1200x8,8,
3114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   4,0,0,0,0,0,0,0,0},
3124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0xfe,0,0,0,0,cseq_vga,cgraph_vga,ccrtc_vga,0,
3144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   0xff,0,0,0,0,0,0,0,0},
3154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima {0xff,0,0,0,0,0,0,0,0,
3164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima   0xff,0,0,0,0,0,0,0,0},
3174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
3184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3194d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned char cirrus_id_table[] = {
3204d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  // 5430
3214d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0xA0, 0x32,
3224d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  // 5446
3234d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0xB8, 0x39,
3244d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3254d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0xff, 0xff
3264d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
3274d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3284d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3294d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimaunsigned short cirrus_vesa_modelist[] = {
3304d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 640x480x8
3314d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x101, 0x5f,
3324d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 640x480x15
3334d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x110, 0x66,
3344d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 640x480x16
3354d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x111, 0x64,
3364d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 640x480x24
3374d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x112, 0x71,
3384d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 800x600x8
3394d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x103, 0x5c,
3404d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 800x600x15
3414d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x113, 0x67,
3424d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 800x600x16
3434d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x114, 0x65,
3444d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 800x600x24
3454d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x115, 0x78,
3464d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 1024x768x8
3474d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x105, 0x60,
3484d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 1024x768x15
3494d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x116, 0x68,
3504d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 1024x768x16
3514d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x117, 0x74,
3524d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 1024x768x24
3534d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x118, 0x79,
3544d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 1280x1024x8
3554d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x107, 0x6d,
3564d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 1280x1024x15
3574d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x119, 0x69,
3584d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// 1280x1024x16
3594d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0x11a, 0x75,
3604d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima// invalid
3614d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  0xffff,0xffff
3624d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima};
3634d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3644d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3654d07f569799aaae0d7fccf8e76386d450664987fJun NakajimaASM_START
3664d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3674d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_installed:
3684d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.ascii "cirrus-compatible VGA is detected"
3694d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.byte 0x0d,0x0a
3704d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.byte 0x0d,0x0a,0x00
3714d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3724d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_not_installed:
3734d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.ascii "cirrus-compatible VGA is not detected"
3744d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.byte 0x0d,0x0a
3754d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.byte 0x0d,0x0a,0x00
3764d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3774d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_vendorname:
3784d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_productname:
3794d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_oemname:
3804d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.ascii "VGABIOS Cirrus extension"
3814d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.byte 0
3824d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_productrevision:
3834d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.ascii "1.0"
3844d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima.byte 0
3854d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
3864d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_init:
3874d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_check
3884d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jnz no_cirrus
3894d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  SET_INT_VECTOR(0x10, #0xC000, #cirrus_int10_handler)
3904d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x0f ; memory setup
3914d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov dx, #0x3C4
3924d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
3934d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  inc dx
3944d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in  al, dx
3954d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  and al, #0x18
3964d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ah, al
3974d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x0a
3984d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  dec dx
3994d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, ax
4004d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x0007 ; set vga mode
4014d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, ax
4024d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x0431 ; reset bitblt
4034d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov dx, #0x3CE
4044d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, ax
4054d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x0031
4064d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, ax
4074d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimano_cirrus:
4084d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
4094d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_display_info:
4114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ds
4124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push si
4134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push cs
4144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
4154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_check
4164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov si, #cirrus_not_installed
4174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jnz cirrus_msgnotinstalled
4184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov si, #cirrus_installed
4194d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4204d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_msgnotinstalled:
4214d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call _display_string
4224d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop si
4234d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
4244d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
4254d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4264d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_check:
4274d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ax
4284d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push dx
4294d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x9206
4304d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov dx, #0x3C4
4314d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, ax
4324d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  inc dx
4334d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
4344d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp al, #0x12
4354d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop dx
4364d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ax
4374d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
4384d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4394d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4404d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_int10_handler:
4414d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pushf
4424d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bp
4434d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ah, #0x00  ;; set video mode
4444d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jz cirrus_set_video_mode
4454d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ah, #0x12  ;; cirrus extension
4464d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jz cirrus_extbios
4474d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ah, #0x4F  ;; VESA extension
4484d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jz cirrus_vesa
4494d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4504d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_unhandled:
4514d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop bp
4524d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  popf
4534d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jmp vgabios_int10_handler
4544d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4554d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_return:
4564d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#ifdef CIRRUS_DEBUG
4574d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_debug_dump
4584d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#endif
4594d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop bp
4604d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  popf
4614d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  iret
4624d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4634d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_set_video_mode:
4644d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#ifdef CIRRUS_DEBUG
4654d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_debug_dump
4664d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#endif
4674d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push si
4684d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ax
4694d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bx
4704d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ds
4714d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#ifdef CIRRUS_VESA3_PMINFO
4724d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima db 0x2e ;; cs:
4734d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov si, [cirrus_vesa_sel0000_data]
4744d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#else
4754d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  xor si, si
4764d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#endif
4774d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ds, si
4784d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  xor bx, bx
4794d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov [PM_BIOSMEM_VBE_MODE], bx
4804d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
4814d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop bx
4824d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_get_modeentry
4834d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jnc cirrus_set_video_mode_extended
4844d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0xfe
4854d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_get_modeentry_nomask
4864d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_switch_mode
4874d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ax
4884d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop si
4894d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jmp cirrus_unhandled
4904d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
4914d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios:
4924d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#ifdef CIRRUS_DEBUG
4934d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_debug_dump
4944d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#endif
4954d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp bl, #0x80
4964d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jb cirrus_unhandled
4974d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp bl, #0xAF
4984d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ja cirrus_unhandled
4994d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bx
5004d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  and bx, #0x7F
5014d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  shl bx, 1
5024d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima db 0x2e ;; cs:
5034d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bp, cirrus_extbios_handlers[bx]
5044d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop bx
5054d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push #cirrus_return
5064d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bp
5074d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
5084d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5094d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa:
5104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#ifdef CIRRUS_DEBUG
5114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_debug_dump
5124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#endif
5134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp al, #0x10
5144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ja cirrus_vesa_not_handled
5154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bx
5164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  xor bx, bx
5174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bl, al
5184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  shl bx, 1
5194d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima db 0x2e ;; cs:
5204d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bp, cirrus_vesa_handlers[bx]
5214d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop bx
5224d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push #cirrus_return
5234d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bp
5244d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
5254d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5264d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_not_handled:
5274d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x014F ;; not implemented
5284d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jmp cirrus_return
5294d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5304d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#ifdef CIRRUS_DEBUG
5314d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_debug_dump:
5324d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push es
5334d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ds
5344d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pusha
5354d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push cs
5364d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
5374d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call _cirrus_debugmsg
5384d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  popa
5394d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
5404d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop es
5414d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
5424d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#endif
5434d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5444d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_set_video_mode_extended:
5454d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_switch_mode
5464d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ax ;; mode
5474d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  test al, #0x80
5484d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jnz cirrus_set_video_mode_extended_1
5494d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ax
5504d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0xffff ; set to 0xff to keep win 2K happy
5514d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_clear_vram
5524d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ax
5534d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_set_video_mode_extended_1:
5544d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  and al, #0x7f
5554d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5564d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ds
5574d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#ifdef CIRRUS_VESA3_PMINFO
5584d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima db 0x2e ;; cs:
5594d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov si, [cirrus_vesa_sel0000_data]
5604d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#else
5614d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  xor si, si
5624d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima#endif
5634d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ds, si
5644d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov [PM_BIOSMEM_CURRENT_MODE], al
5654d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
5664d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5674d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x20
5684d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5694d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop si
5704d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jmp cirrus_return
5714d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5724d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_pmbios_init:
5734d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  retf
5744d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_pmbios_entry:
5754d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pushf
5764d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bp
5774d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ah, #0x4F
5784d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jnz cirrus_vesa_pmbios_unimplemented
5794d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp al, #0x0F
5804d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ja cirrus_vesa_pmbios_unimplemented
5814d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bx
5824d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  xor bx, bx
5834d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bl, al
5844d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  shl bx, 1
5854d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima db 0x2e ;; cs:
5864d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bp, cirrus_vesa_handlers[bx]
5874d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop bx
5884d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push #cirrus_vesa_pmbios_return
5894d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bp
5904d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
5914d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_pmbios_unimplemented:
5924d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x014F
5934d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_pmbios_return:
5944d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop bp
5954d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  popf
5964d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  retf
5974d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
5984d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima; in si:mode table
5994d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_switch_mode:
6004d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ds
6014d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push bx
6024d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push dx
6034d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push cs
6044d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
6054d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6064d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bx, [si+10] ;; seq
6074d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov dx, #0x3c4
6084d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x1206
6094d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, ax ;; Unlock cirrus special
6104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_switch_mode_setregs
6114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bx, [si+12] ;; graph
6134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov dx, #0x3ce
6144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_switch_mode_setregs
6154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bx, [si+14] ;; crtc
6174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_get_crtc
6184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_switch_mode_setregs
6194d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6204d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov dx, #0x3c6
6214d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x00
6224d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
6234d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
6244d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
6254d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
6264d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
6274d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, [si+8]  ;; hidden dac
6284d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
6294d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0xff
6304d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
6314d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6324d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x00
6334d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bl, [si+17]  ;; memory model
6344d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  or  bl, bl
6354d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jz is_text_mode
6364d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x01
6374d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp bl, #0x03
6384d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jnz is_text_mode
6394d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  or al, #0x40
6404d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimais_text_mode:
6414d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bl, #0x10
6424d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call biosfn_get_single_palette_reg
6434d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  and bh, #0xfe
6444d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  or bh, al
6454d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call biosfn_set_single_palette_reg
6464d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6474d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop dx
6484d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop bx
6494d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
6504d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
6514d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6524d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_enable_16k_granularity:
6534d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ax
6544d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push dx
6554d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov dx, #0x3ce
6564d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x0b
6574d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
6584d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  inc dx
6594d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
6604d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  or al, #0x20 ;; enable 16k
6614d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
6624d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop dx
6634d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ax
6644d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
6654d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6664d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_switch_mode_setregs:
6674d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacsms_1:
6684d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, [bx]
6694d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ax, #0xffff
6704d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jz csms_2
6714d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, ax
6724d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  add bx, #0x2
6734d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jmp csms_1
6744d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacsms_2:
6754d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
6764d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
6774d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_80h:
6784d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push dx
6794d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_get_crtc
6804d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x27
6814d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
6824d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  inc dx
6834d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
6844d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bx, #_cirrus_id_table
6854d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimac80h_1:
6864d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima db 0x2e ;; cs:
6874d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ah, [bx]
6884d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ah, al
6894d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jz c80h_2
6904d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ah, #0xff
6914d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jz c80h_2
6924d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  inc bx
6934d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  inc bx
6944d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jmp c80h_1
6954d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimac80h_2:
6964d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima db 0x2e ;; cs:
6974d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, 0x1[bx]
6984d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop dx
6994d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ah, #0x00
7004d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  xor bx, bx
7014d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7024d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7034d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_81h:
7044d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x100 ;; XXX
7054d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7064d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_82h:
7074d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push dx
7084d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_get_crtc
7094d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  xor ax, ax
7104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x27
7114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
7124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  inc dx
7134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
7144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  and al, #0x03
7154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ah, #0xAF
7164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop dx
7174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7194d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_85h:
7204d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push cx
7214d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push dx
7224d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov dx, #0x3C4
7234d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x0f ;; get DRAM band width
7244d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  out dx, al
7254d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  inc dx
7264d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  in al, dx
7274d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ;; al = 4 << bandwidth
7284d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov cl, al
7294d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  shr cl, #0x03
7304d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  and cl, #0x03
7314d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp cl, #0x03
7324d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  je c85h2
7334d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x04
7344d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  shl al, cl
7354d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jmp c85h3
7364d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimac85h2:
7374d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima;; 4MB or 2MB
7384d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  and al, #0x80
7394d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x20 ;; 2 MB
7404d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  je c85h3
7414d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x40 ;; 4 MB
7424d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimac85h3:
7434d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop dx
7444d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop cx
7454d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7464d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7474d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_9Ah:
7484d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x4060
7494d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov cx, #0x1132
7504d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7514d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7524d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_A0h:
7534d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  call cirrus_get_modeentry
7544d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ah, #0x01
7554d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  sbb ah, #0x00
7564d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bx, cirrus_extbios_A0h_callback
7574d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov si, #0xffff
7584d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov di, bx
7594d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ds, bx
7604d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov es, bx
7614d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7624d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7634d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_A0h_callback:
7644d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ;; fatal: not implemented yet
7654d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cli
7664d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  hlt
7674d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  retf
7684d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7694d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_A1h:
7704d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bx, #0x0E00 ;; IBM 8512/8513, color
7714d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7724d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7734d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_A2h:
7744d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x07   ;; HSync 31.5 - 64.0 kHz
7754d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7764d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7774d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_AEh:
7784d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov al, #0x01   ;; High Refresh 75Hz
7794d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7804d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7814d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_extbios_unimplemented:
7824d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ret
7834d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima
7844d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacirrus_vesa_00h:
7854d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push ds
7864d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push si
7874d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov bp, di
7884d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  push es
7894d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  pop ds
7904d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cld
7914d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, [di]
7924d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ax, #0x4256 ;; VB
7934d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jnz cv00_1
7944d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, [di+2]
7954d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  cmp ax, #0x3245 ;; E2
7964d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  jnz cv00_1
7974d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  ;; VBE2
7984d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  lea di, 0x14[bp]
7994d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x0100 ;; soft ver.
8004d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
8014d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, # cirrus_vesa_vendorname
8024d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
8034d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, cs
8044d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
8054d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, # cirrus_vesa_productname
8064d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
8074d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, cs
8084d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
8094d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, # cirrus_vesa_productrevision
8104d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
8114d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, cs
8124d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
8134d07f569799aaae0d7fccf8e76386d450664987fJun Nakajimacv00_1:
8144d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov di, bp
8154d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x4556 ;; VE
8164d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
8174d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  mov ax, #0x4153 ;; SA
8184d07f569799aaae0d7fccf8e76386d450664987fJun Nakajima  stosw
819