OSDN Git Service

modified: Project 16.bfproject
[proj16/16.git] / 16 / PCGPE10 / XTENDED.TXT
1 \r
2                  ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
3                  ³ Xtended Mode - Unchained 640x400x256 ³\r
4                  ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
5 \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
9 \r
10                     Please read the file SVGINTRO.TXT\r
11                 (Graphics/SVGA/Intro PC-GPE menu option)\r
12 \r
13                ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
14                ³      THIS FILE MAY NOT BE DISTRIBUTED     ³\r
15                ³ SEPARATE TO THE ENTIRE PC-GPE COLLECTION. ³\r
16                ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
17 \r
18 \r
19 ÚÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\r
20 ³ Disclaimer ³\r
21 ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
22 \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
27 \r
28 \r
29 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\r
30 ³ Introduction ³\r
31 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
32 \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
38 \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
43 \r
44 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\r
45 ³ Setting Xtended Mode ³\r
46 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
47 \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
52 SVGAs:\r
53 \r
54            640x400x256 mode numbers for various SVGA cards\r
55                ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
56                ³      SVGA Chip          Mode Number ³\r
57                ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
58                ³ ATI                        61h      ³\r
59                ³ Chips & Technologies       78h      ³\r
60                ³ Genoa                      7Eh      ³\r
61                ³ Paradise                   5Eh      ³\r
62                ³ Trident                    5Ch      ³\r
63                ³ Tseng                      2Fh      ³\r
64                ³ Video 7                    66h      ³\r
65                ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
66 \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
70 \r
71 The following Pascal procedure will set Xtended mode for a card with a VESA\r
72 driver:\r
73 \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
77 \r
78 procedure InitXtended;\r
79 begin\r
80 \r
81   { Set VESA 640x400x256 mode }\r
82   asm\r
83     mov ax, $4F02\r
84     mov bx, $100\r
85     int VIDEO\r
86   end;\r
87 \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
91 \r
92   { Turn off the Chain-4 bit (bit 3 at index 4, port 0x3c4) }\r
93   PortW[SEQU_ADDR] := $0604;\r
94 \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
98 \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
102 \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
108 \r
109   { Give a small delay to let the screen sort itself out }\r
110   Delay(100);\r
111 \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
115 end;\r
116 \r
117 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\r
118 ³ Drawing a Pixel ³\r
119 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
120 \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
125 \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
128 \r
129 procedure XtendedPutPixel(x, y : word; color : byte);\r
130 begin\r
131   { Set map mask to select proper plane }\r
132   PortW[SEQU_ADDR] := $100 shl (x and 3) + 2;\r
133 \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
136 end;\r