ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/slot_rom.cpp
(Generate patch)

Comparing BasiliskII/src/slot_rom.cpp (file contents):
Revision 1.2 by cebix, 1999-10-05T14:59:46Z vs.
Revision 1.8 by gbeauche, 2001-06-28T21:36:46Z

# Line 1 | Line 1
1   /*
2   *  slot_rom.cpp - Slot declaration ROM
3   *
4 < *  Basilisk II (C) 1996-1997 Christian Bauer
4 > *  Basilisk II (C) 1996-2001 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 43 | Line 43 | static uint8 srom[4096];
43   static uint32 p;
44  
45  
46 + // Check whether a mode with the specified depth exists
47 + static bool has_depth(video_depth depth)
48 + {
49 +        std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
50 +        while (i != end) {
51 +                if (i->depth == depth)
52 +                        return true;
53 +                ++i;
54 +        }
55 +        return false;
56 + }
57 +
58 +
59   /*
60   *  Construct slot declaration ROM and copy it into the Mac ROM (must be called after VideoInit())
61   */
# Line 102 | Line 115 | static void PString(char *str)
115                  srom[p++] = 0;
116   }
117  
118 + static uint32 VModeParms(uint32 width, uint32 height, uint32 bytes_per_row, video_depth depth)
119 + {
120 +        uint32 ret = p;
121 +        Long(50);                                       // Length
122 +        Long(0);                                        // Base offset
123 +        Word(bytes_per_row);            // Row bytes
124 +        Word(0);                                        // Bounds
125 +        Word(0);
126 +        Word(height);
127 +        Word(width);
128 +        Word(0);                                        // Version
129 +        Word(0);                                        // Pack type
130 +        Long(0);                                        // Pack size
131 +        Long(0x00480000);                       // HRes
132 +        Long(0x00480000);                       // VRes
133 +        switch (depth) {
134 +                case VDEPTH_1BIT:
135 +                        Word(0);                        // Pixel type (indirect)
136 +                        Word(1);                        // Pixel size
137 +                        Word(1);                        // CmpCount
138 +                        Word(1);                        // CmpSize
139 +                        break;
140 +                case VDEPTH_2BIT:
141 +                        Word(0);                        // Pixel type (indirect)
142 +                        Word(2);                        // Pixel size
143 +                        Word(1);                        // CmpCount
144 +                        Word(2);                        // CmpSize
145 +                        break;
146 +                case VDEPTH_4BIT:
147 +                        Word(0);                        // Pixel type (indirect)
148 +                        Word(4);                        // Pixel size
149 +                        Word(1);                        // CmpCount
150 +                        Word(4);                        // CmpSize
151 +                        break;
152 +                case VDEPTH_8BIT:
153 +                        Word(0);                        // Pixel type (indirect)
154 +                        Word(8);                        // Pixel size
155 +                        Word(1);                        // CmpCount
156 +                        Word(8);                        // CmpSize
157 +                        break;
158 +                case VDEPTH_16BIT:
159 +                        Word(16);                       // Pixel type (direct)
160 +                        Word(16);                       // Pixel size
161 +                        Word(3);                        // CmpCount
162 +                        Word(5);                        // CmpSize
163 +                        break;
164 +                case VDEPTH_32BIT:
165 +                        Word(16);                       // Pixel type (direct)
166 +                        Word(32);                       // Pixel size
167 +                        Word(3);                        // CmpCount
168 +                        Word(8);                        // CmpSize
169 +                        break;
170 +        }
171 +        Long(0);                                        // Plane size
172 +        Long(0);                                        // Reserved
173 +        return ret;
174 + }
175 +
176 + static uint32 VModeDesc(uint32 params, bool direct)
177 + {
178 +        uint32 ret = p;
179 +        Offs(0x01, params);                     // Video parameters
180 +        Rsrc(0x03, 1);                          // Page count
181 +        Rsrc(0x04, direct ? 2 : 0);     // Device type
182 +        EndOfList();
183 +        return ret;
184 + }
185 +
186   bool InstallSlotROM(void)
187   {
188          uint32 boardType, boardName, vendorID, revLevel, partNum, date;
189          uint32 vendorInfo, sRsrcBoard;
190  
191          uint32 videoType, videoName, minorBase, minorLength, videoDrvr, vidDrvrDir;
192 <        uint32 defaultGamma, gammaDir, vidModeParms, vidMode, sRsrcVideo;
192 >        uint32 defaultGamma, gammaDir, sRsrcVideo;
193 >        uint32 vidModeParms1, vidModeParms2, vidModeParms4, vidModeParms8, vidModeParms16, vidModeParms32;
194 >        uint32 vidMode1, vidMode2, vidMode4, vidMode8, vidMode16, vidMode32;
195  
196          uint32 cpuType, cpuName, cpuMajor, cpuMinor, sRsrcCPU;
197  
# Line 148 | Line 231 | bool InstallSlotROM(void)
231          Offs(0x24, vendorInfo);                         // Vendor Info
232          EndOfList();
233  
234 <        // Video sResource
234 >        // Video sResource for default mode
235          videoType = p;                                          // Literals
236 <        Word(3); Word(1); Word(1); Word(0x4232);                        // Display Video Apple 'B2'
236 >        Word(3); Word(1); Word(1); Word(0x4232);        // Display Video Apple 'B2'
237          videoName = p;
238          String("Display_Video_Apple_Basilisk");
239          minorBase = p;
240 <        Long(VideoMonitor.mac_frame_base);                                      // Frame buffer base
240 >        Long(VideoMonitor.mac_frame_base);      // Frame buffer base
241          minorLength = p;
242 <        Long(VideoMonitor.bytes_per_row * VideoMonitor.y);      // Frame buffer size
242 >        Long(0);                                                        // Frame buffer size (unspecified)
243  
244          videoDrvr = p;                                          // Video driver
245          Long(0x72);                                                     // Length
# Line 229 | Line 312 | bool InstallSlotROM(void)
312          Offs(0x80, defaultGamma);
313          EndOfList();
314  
315 <        vidModeParms = p;                                       // Video mode parameters
316 <        Long(50);                                                       // Length
317 <        Long(0);                                                        // Base offset
318 <        Word(VideoMonitor.bytes_per_row);       // Row bytes
319 <        Word(0);                                                        // Bounds
320 <        Word(0);
321 <        Word(VideoMonitor.y);
322 <        Word(VideoMonitor.x);
323 <        Word(0);                                                        // Version
324 <        Word(0);                                                        // Pack type
325 <        Long(0);                                                        // Pack size
326 <        Long(0x00480000);                                       // HRes
327 <        Long(0x00480000);                                       // VRes
245 <        switch (VideoMonitor.mode) {
246 <                case VMODE_1BIT:
247 <                        Word(0);                                        // Pixel type (indirect)
248 <                        Word(1);                                        // Pixel size
249 <                        Word(1);                                        // CmpCount
250 <                        Word(1);                                        // CmpSize
251 <                        break;
252 <                case VMODE_2BIT:
253 <                        Word(0);                                        // Pixel type (indirect)
254 <                        Word(2);                                        // Pixel size
255 <                        Word(1);                                        // CmpCount
256 <                        Word(2);                                        // CmpSize
257 <                        break;
258 <                case VMODE_4BIT:
259 <                        Word(0);                                        // Pixel type (indirect)
260 <                        Word(4);                                        // Pixel size
261 <                        Word(1);                                        // CmpCount
262 <                        Word(4);                                        // CmpSize
263 <                        break;
264 <                case VMODE_8BIT:
265 <                        Word(0);                                        // Pixel type (indirect)
266 <                        Word(8);                                        // Pixel size
267 <                        Word(1);                                        // CmpCount
268 <                        Word(8);                                        // CmpSize
269 <                        break;
270 <                case VMODE_16BIT:
271 <                        Word(16);                                       // Pixel type (direct)
272 <                        Word(16);                                       // Pixel size
273 <                        Word(3);                                        // CmpCount
274 <                        Word(5);                                        // CmpSize
275 <                        break;
276 <                case VMODE_32BIT:
277 <                        Word(16);                                       // Pixel type (direct)
278 <                        Word(32);                                       // Pixel size
279 <                        Word(3);                                        // CmpCount
280 <                        Word(8);                                        // CmpSize
281 <                        break;
282 <        }
283 <        Long(0);                                                        // Plane size
284 <        Long(0);                                                        // Reserved
285 <
286 <        vidMode = p;                                            // Video mode description
287 <        Offs(0x01, vidModeParms);                       // Video parameters
288 <        Rsrc(0x03, 1);                                          // Page count
289 <        Rsrc(0x04, IsDirectMode(VideoMonitor.mode) ? 2 :0);     // Device type
290 <        EndOfList();
315 >        vidModeParms1 = VModeParms(VideoMonitor.mode.x, VideoMonitor.mode.y, VideoMonitor.mode.bytes_per_row, VDEPTH_1BIT);
316 >        vidModeParms2 = VModeParms(VideoMonitor.mode.x, VideoMonitor.mode.y, VideoMonitor.mode.bytes_per_row, VDEPTH_2BIT);
317 >        vidModeParms4 = VModeParms(VideoMonitor.mode.x, VideoMonitor.mode.y, VideoMonitor.mode.bytes_per_row, VDEPTH_4BIT);
318 >        vidModeParms8 = VModeParms(VideoMonitor.mode.x, VideoMonitor.mode.y, VideoMonitor.mode.bytes_per_row, VDEPTH_8BIT);
319 >        vidModeParms16 = VModeParms(VideoMonitor.mode.x, VideoMonitor.mode.y, VideoMonitor.mode.bytes_per_row, VDEPTH_16BIT);
320 >        vidModeParms32 = VModeParms(VideoMonitor.mode.x, VideoMonitor.mode.y, VideoMonitor.mode.bytes_per_row, VDEPTH_32BIT);
321 >
322 >        vidMode1 = VModeDesc(vidModeParms1, false);
323 >        vidMode2 = VModeDesc(vidModeParms2, false);
324 >        vidMode4 = VModeDesc(vidModeParms4, false);
325 >        vidMode8 = VModeDesc(vidModeParms8, false);
326 >        vidMode16 = VModeDesc(vidModeParms16, true);
327 >        vidMode32 = VModeDesc(vidModeParms32, true);
328  
329          sRsrcVideo = p;
330          Offs(0x01, videoType);                          // Video type descriptor
# Line 298 | Line 335 | bool InstallSlotROM(void)
335          Offs(0x0b, minorLength);                        // Frame buffer length
336          Offs(0x40, gammaDir);                           // Gamma directory
337          Rsrc(0x7d, 6);                                          // Video attributes: Default to color, built-in
338 <        Offs(0x80, vidMode);                            // Video mode parameters
338 >        if (has_depth(VDEPTH_1BIT))
339 >                Offs(0x80, vidMode1);                   // Video mode parameters for 1 bit
340 >        if (has_depth(VDEPTH_2BIT))
341 >                Offs(0x81, vidMode2);                   // Video mode parameters for 2 bit
342 >        if (has_depth(VDEPTH_4BIT))
343 >                Offs(0x82, vidMode4);                   // Video mode parameters for 4 bit
344 >        if (has_depth(VDEPTH_8BIT))
345 >                Offs(0x83, vidMode8);                   // Video mode parameters for 8 bit
346 >        if (has_depth(VDEPTH_16BIT))
347 >                Offs(0x84, vidMode16);                  // Video mode parameters for 16 bit
348 >        if (has_depth(VDEPTH_32BIT))
349 >                Offs(0x85, vidMode32);                  // Video mode parameters for 32 bit
350          EndOfList();
351  
352          // CPU sResource

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines