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 |
|
*/ |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
171 |
> |
Long(0); // Plane size |
172 |
> |
Long(0); // Reserved |
173 |
|
return ret; |
174 |
|
} |
175 |
|
|
233 |
|
|
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.mode.bytes_per_row * VideoMonitor.mode.y); // Frame buffer size |
242 |
> |
Long(0); // Frame buffer size (unspecified) |
243 |
|
|
244 |
|
videoDrvr = p; // Video driver |
245 |
|
Long(0x72); // Length |
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 |
< |
#if 0 |
339 |
< |
Offs(0x80, vidMode1); // Video mode parameters for 1 bit |
340 |
< |
Offs(0x81, vidMode2); // Video mode parameters for 2 bit |
341 |
< |
Offs(0x82, vidMode4); // Video mode parameters for 4 bit |
342 |
< |
Offs(0x83, vidMode8); // Video mode parameters for 8 bit |
343 |
< |
Offs(0x84, vidMode16); // Video mode parameters for 16 bit |
344 |
< |
Offs(0x85, vidMode32); // Video mode parameters for 32 bit |
345 |
< |
#else |
346 |
< |
switch (VideoMonitor.mode.depth) { |
347 |
< |
case VDEPTH_1BIT: |
348 |
< |
Offs(0x80, vidMode1); // Video mode parameters |
349 |
< |
break; |
337 |
< |
case VDEPTH_2BIT: |
338 |
< |
Offs(0x80, vidMode2); // Video mode parameters |
339 |
< |
break; |
340 |
< |
case VDEPTH_4BIT: |
341 |
< |
Offs(0x80, vidMode4); // Video mode parameters |
342 |
< |
break; |
343 |
< |
case VDEPTH_8BIT: |
344 |
< |
Offs(0x80, vidMode8); // Video mode parameters |
345 |
< |
break; |
346 |
< |
case VDEPTH_16BIT: |
347 |
< |
Offs(0x80, vidMode16); // Video mode parameters |
348 |
< |
break; |
349 |
< |
case VDEPTH_32BIT: |
350 |
< |
Offs(0x80, vidMode32); // Video mode parameters |
351 |
< |
break; |
352 |
< |
} |
353 |
< |
#endif |
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 |