2 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
\r
3 ³ Xtended Mode - Unchained 640x400x256 ³
\r
4 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
\r
6 Written for the PC-GPE by Mark Feldman
\r
7 e-mail address : u914097@student.canberra.edu.au
\r
8 myndale@cairo.anu.edu.au
\r
10 Please read the file SVGINTRO.TXT
\r
11 (Graphics/SVGA/Intro PC-GPE menu option)
\r
13 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
\r
14 ³ THIS FILE MAY NOT BE DISTRIBUTED ³
\r
15 ³ SEPARATE TO THE ENTIRE PC-GPE COLLECTION. ³
\r
16 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
\r
19 ÚÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
\r
23 I assume no responsibility whatsoever for any effect that this file, the
\r
24 information contained therein or the use thereof has on you, your sanity,
\r
25 computer, spouse, children, pets or anything else related to you or your
\r
26 existance. No warranty is provided nor implied with this information.
\r
29 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
\r
33 I am calling this mode Xtended mode simply because I don't know if it
\r
34 already has a name. It is a variation of mode x and it has worked on every
\r
35 SVGA I have tried it on. It seems very very unlikely that I was the first
\r
36 person to try this, so if this mode has already been documented elsewhere I
\r
37 would very much like to hear about it.
\r
39 Xtended mode is 640x400x256 and will only work on SVGA's supporting the
\r
40 "regular" 640x400x256 mode. It's advantage is that it requires no
\r
41 bank switching to access the entire display memory and, like mode x, polygon
\r
42 fill graphics can be up to 4 times faster.
\r
44 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
\r
45 ³ Setting Xtended Mode ³
\r
46 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
\r
48 Xtended mode is set similar to the way unchained mode 13h is set, the only
\r
49 difference is that you you call BIOS to set the 640x400x256 graphics mode
\r
50 instead of mode 13h. The 640x400x256 mode number varies from card to card.
\r
51 The following table lists the mode number for each of the 7 "standard"
\r
54 640x400x256 mode numbers for various SVGA cards
\r
55 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
\r
56 ³ SVGA Chip Mode Number ³
\r
57 ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
\r
59 ³ Chips & Technologies 78h ³
\r
65 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
\r
67 Alternatively the mode can be set with the VESA Set Super VGA Mode BIOS
\r
68 call, the VESA SVGA mode number is 100h. Refer to the file "VESASP12.TXT"
\r
69 for more information on VESA BIOS calls.
\r
71 The following Pascal procedure will set Xtended mode for a card with a VESA
\r
74 const VIDEO = $10; { Video interrupt number }
\r
75 CRTC_ADDR = $3d4; { Base port of the CRT Controller (color) }
\r
76 SEQU_ADDR = $3c4; { Base port of the Sequencer }
\r
78 procedure InitXtended;
\r
81 { Set VESA 640x400x256 mode }
\r
88 { Turn the VGA screen off }
\r
89 Port[SEQU_ADDR] := 1;
\r
90 Port[SEQU_ADDR + 1] := Port[SEQU_ADDR + 1] or $20;
\r
92 { Turn off the Chain-4 bit (bit 3 at index 4, port 0x3c4) }
\r
93 PortW[SEQU_ADDR] := $0604;
\r
95 { Turn off word mode, by setting the Mode Control register
\r
96 of the CRT Controller (index 0x17, port 0x3d4) }
\r
97 PortW[CRTC_ADDR] := $E317;
\r
99 { Turn off doubleword mode, by setting the Underline Location
\r
100 register (index 0x14, port 0x3d4) }
\r
101 PortW[CRTC_ADDR] := $0014;
\r
103 { Clear entire video memory, by selecting all four planes, then writing
\r
104 color 0 to the entire segment. Stoopid FillChar fills 1 byte too short! }
\r
105 PortW[SEQU_ADDR] := $0F02;
\r
106 FillChar(Mem[$A000 : 0], $8000, 0);
\r
107 FillChar(Mem[$A000 : $8000], $8000, 0);
\r
109 { Give a small delay to let the screen sort itself out }
\r
112 { Turn the screen back on }
\r
113 Port[SEQU_ADDR] := 1;
\r
114 Port[SEQU_ADDR + 1] := Port[SEQU_ADDR + 1] and $DF;
\r
117 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
\r
118 ³ Drawing a Pixel ³
\r
119 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
\r
121 Drawing a pixel in Xtended mode is similar to drawing one in unchained mode
\r
122 13h or mode x, we just have to keep in mind that the display is now twice
\r
123 as wide. Also keep in mind that 640x400 has 4 times as many pixels as
\r
124 320x200, so there is only one page in Xtended mode.
\r
126 This example Pascal routine will draw a pixel at any screen position. I'll
\r
127 let you do the job of converting it to assembly:
\r
129 procedure XtendedPutPixel(x, y : word; color : byte);
\r
131 { Set map mask to select proper plane }
\r
132 PortW[SEQU_ADDR] := $100 shl (x and 3) + 2;
\r
134 { Calculate address (y * 160 + x div 4) and write pixel }
\r
135 Mem[$A000 : y shl 7 + y shl 5 + x shr 2] := color;
\r