23 |
|
|
24 |
|
#include <vector> |
25 |
|
|
26 |
+ |
/* |
27 |
+ |
Some of the terminology here is completely frelled. In Basilisk II, a |
28 |
+ |
"video mode" refers to a combination of resolution and color depth, and |
29 |
+ |
this information is stored in a video_mode structure. In Apple |
30 |
+ |
documentation, a "mode" historically refers to the color depth only |
31 |
+ |
(because old Macs had fixed-frequency monitors and could not change the |
32 |
+ |
resolution). These "modes" are assigned a number (0x80, 0x81, etc.), |
33 |
+ |
which we here call "Apple mode". When Macs learned how to deal with |
34 |
+ |
multiscan monitors, Apple introduced another type of "mode", also having |
35 |
+ |
numbers starting from 0x80 but refrerring to the resolution and/or video |
36 |
+ |
timing of the display (it's possible to have two modes with the same |
37 |
+ |
dimension but different refresh rates). We call this a "resolution ID". |
38 |
+ |
The combination of "Apple mode" and "ID" corresponds to a Basilisk II |
39 |
+ |
"video mode". To make the confusion worse, the video driver control call |
40 |
+ |
that sets the color depth is called "SetMode" while the one that sets |
41 |
+ |
both depth and resolution is "SwitchMode"... |
42 |
+ |
*/ |
43 |
+ |
|
44 |
|
// Color depth codes |
45 |
|
enum video_depth { |
46 |
|
VDEPTH_1BIT, // 2 colors |
71 |
|
return IsDirectMode(AppleModeToDepth(mode)); |
72 |
|
} |
73 |
|
|
74 |
+ |
// Return the depth code that corresponds to the specified bits-per-pixel value |
75 |
|
inline video_depth DepthModeForPixelDepth(int depth) |
76 |
|
{ |
77 |
|
switch (depth) { |
85 |
|
} |
86 |
|
} |
87 |
|
|
88 |
< |
// Return a bytes-per-row value that assumes no padding for specified depth and pixel width |
88 |
> |
// Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width |
89 |
|
inline uint32 TrivialBytesPerRow(uint32 width, video_depth depth) |
90 |
|
{ |
91 |
|
switch (depth) { |
98 |
|
} |
99 |
|
} |
100 |
|
|
101 |
< |
// Description of one video mode |
101 |
> |
/* |
102 |
> |
You are not completely free in your selection of depth/resolution |
103 |
> |
combinations: |
104 |
> |
1) the lowest supported color depth must be available in all |
105 |
> |
resolutions |
106 |
> |
2) if one resolution provides a certain color depth, it must also |
107 |
> |
provide all lower supported depths |
108 |
> |
|
109 |
> |
For example, it is possible to have this set of modes: |
110 |
> |
640x480 @ 8 bit |
111 |
> |
640x480 @ 32 bit |
112 |
> |
800x600 @ 8 bit |
113 |
> |
800x600 @ 32 bit |
114 |
> |
1024x768 @ 8 bit |
115 |
> |
|
116 |
> |
But this is not possible (violates rule 1): |
117 |
> |
640x480 @ 8 bit |
118 |
> |
800x600 @ 8 bit |
119 |
> |
1024x768 @ 1 bit |
120 |
> |
|
121 |
> |
And neither is this (violates rule 2, 640x480 @ 16 bit is missing): |
122 |
> |
640x480 @ 8 bit |
123 |
> |
640x480 @ 32 bit |
124 |
> |
800x600 @ 8 bit |
125 |
> |
800x600 @ 16 bit |
126 |
> |
1024x768 @ 8 bit |
127 |
> |
*/ |
128 |
> |
|
129 |
> |
// Description of a video mode |
130 |
|
struct video_mode { |
131 |
|
uint32 x; // X size of screen (pixels) |
132 |
|
uint32 y; // Y size of screen (pixels) |
149 |
|
video_mode mode; // Currently selected video mode description |
150 |
|
}; |
151 |
|
|
152 |
< |
extern monitor_desc VideoMonitor; // Description of the main monitor, set by VideoInit() |
152 |
> |
// Description of the main (and currently the only) monitor, set by VideoInit() |
153 |
> |
extern monitor_desc VideoMonitor; |
154 |
|
|
155 |
|
extern int16 VideoDriverOpen(uint32 pb, uint32 dce); |
156 |
|
extern int16 VideoDriverControl(uint32 pb, uint32 dce); |
165 |
|
extern void VideoInterrupt(void); |
166 |
|
extern void VideoRefresh(void); |
167 |
|
|
168 |
+ |
// Called by the video driver to switch the video mode |
169 |
|
extern void video_switch_to_mode(const video_mode &mode); |
170 |
+ |
|
171 |
+ |
// Called by the video driver to set the color palette (in indexed modes) |
172 |
+ |
// or gamma table (in direct modes) |
173 |
|
extern void video_set_palette(uint8 *pal); |
174 |
|
|
175 |
|
#endif |