ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/include/video.h
Revision: 1.6
Committed: 2001-06-27T19:03:38Z (23 years, 4 months ago) by cebix
Content type: text/plain
Branch: MAIN
Changes since 1.5: +44 -14 lines
Log Message:
added infrastructure for resolution/depth switching (currently, all video
drivers only support one mode, the one selected by the user)

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * video.h - Video/graphics emulation
3     *
4 cebix 1.5 * Basilisk II (C) 1997-2001 Christian Bauer
5 cebix 1.1 *
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
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19     */
20    
21     #ifndef VIDEO_H
22     #define VIDEO_H
23    
24 cebix 1.6 #include <vector>
25    
26     // Color depth codes
27     enum video_depth {
28     VDEPTH_1BIT, // 2 colors
29     VDEPTH_2BIT, // 4 colors
30     VDEPTH_4BIT, // 16 colors
31     VDEPTH_8BIT, // 256 colors
32     VDEPTH_16BIT, // "Thousands"
33     VDEPTH_32BIT // "Millions"
34 cebix 1.1 };
35    
36 cebix 1.6 inline bool IsDirectMode(video_depth depth)
37     {
38     return depth == VDEPTH_16BIT || depth == VDEPTH_32BIT;
39     }
40    
41     inline uint16 DepthToAppleMode(video_depth depth)
42     {
43     return depth + 0x80;
44     }
45 cebix 1.1
46 cebix 1.6 inline video_depth AppleModeToDepth(uint16 mode)
47     {
48     return video_depth(mode - 0x80);
49     }
50    
51     // Description of one video mode
52     struct video_mode {
53 cebix 1.1 uint32 x; // X size of screen (pixels)
54     uint32 y; // Y size of screen (pixels)
55 cebix 1.6 uint32 resolution_id; // Resolution ID (should be >= 0x80 and uniquely identify the sets of modes with the same X/Y size)
56     uint32 bytes_per_row; // Bytes per row of frame buffer
57     video_depth depth; // Color depth (see definitions above)
58     };
59    
60     inline bool IsDirectMode(const video_mode &mode)
61     {
62     return IsDirectMode(mode.depth);
63     }
64    
65     // List of all supported video modes
66     extern vector<video_mode> VideoModes;
67    
68     // Description for one (possibly virtual) monitor
69     struct monitor_desc {
70     uint32 mac_frame_base; // Mac frame buffer address
71     video_mode mode; // Currently selected video mode description
72 cebix 1.1 };
73    
74 cebix 1.6 extern monitor_desc VideoMonitor; // Description of the main monitor, set by VideoInit()
75 cebix 1.1
76 cebix 1.2 extern int16 VideoDriverOpen(uint32 pb, uint32 dce);
77     extern int16 VideoDriverControl(uint32 pb, uint32 dce);
78     extern int16 VideoDriverStatus(uint32 pb, uint32 dce);
79 cebix 1.1
80     // System specific and internal functions/data
81     extern bool VideoInit(bool classic);
82     extern void VideoExit(void);
83    
84     extern void VideoQuitFullScreen(void);
85    
86     extern void VideoInterrupt(void);
87 cebix 1.4 extern void VideoRefresh(void);
88 cebix 1.1
89     extern void video_set_palette(uint8 *pal);
90    
91     #endif