Mercurial > sdl-ios-xcode
comparison src/video/xbios/SDL_xbiosmodes.c @ 2072:4b3f98a9a2c1
xbios: preliminary video mode init
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Mon, 13 Nov 2006 19:59:28 +0000 |
parents | |
children | 790726541708 |
comparison
equal
deleted
inserted
replaced
2071:579abbb51f80 | 2072:4b3f98a9a2c1 |
---|---|
1 /* | |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2006 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Lesser General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2.1 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Lesser General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Lesser General Public | |
16 License along with this library; if not, write to the Free Software | |
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
22 | |
23 #include <mint/osbind.h> | |
24 #include <mint/falcon.h> | |
25 | |
26 #include "SDL_config.h" | |
27 #include "SDL_xbios.h" | |
28 #include "SDL_xbiosmodes.h" | |
29 | |
30 | |
31 typedef struct { | |
32 int width,height,bpp; | |
33 int modecode; | |
34 int doubleline; | |
35 } xbios_mode_t; | |
36 | |
37 static xbios_mode_t falcon_rgb_modes[]={ | |
38 {768, 480, 16, BPS16 | COL80 | OVERSCAN | VERTFLAG}, | |
39 {768, 240, 16, BPS16 | COL80 | OVERSCAN}, | |
40 {640, 400, 16, BPS16 | COL80 | VERTFLAG}, | |
41 {640, 200, 16, BPS16 | COL80}, | |
42 {384, 480, 16, BPS16 | OVERSCAN | VERTFLAG}, | |
43 {384, 240, 16, BPS16 | OVERSCAN}, | |
44 {320, 400, 16, BPS16 | VERTFLAG}, | |
45 {320, 200, 16, BPS16}, | |
46 {768, 480, 8, BPS8 | COL80 | OVERSCAN | VERTFLAG}, | |
47 {768, 240, 8, BPS8 | COL80 | OVERSCAN}, | |
48 {640, 400, 8, BPS8 | COL80 | VERTFLAG}, | |
49 {640, 200, 8, BPS8 | COL80}, | |
50 {384, 480, 8, BPS8 | OVERSCAN | VERTFLAG}, | |
51 {384, 240, 8, BPS8 | OVERSCAN}, | |
52 {320, 400, 8, BPS8 | VERTFLAG}, | |
53 {320, 200, 8, BPS8} | |
54 }; | |
55 | |
56 static xbios_mode_t falcon_vga_modes[]={ | |
57 {320, 480, 16, BPS16 }, | |
58 {320, 240, 16, BPS16 | VERTFLAG}, | |
59 {640, 480, 8, BPS8 | COL80}, | |
60 {640, 240, 8, BPS8 | COL80 | VERTFLAG}, | |
61 {320, 480, 8, BPS8 }, | |
62 {320, 240, 8, BPS8 | VERTFLAG} | |
63 }; | |
64 | |
65 static void | |
66 SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode, | |
67 SDL_bool doubleline) | |
68 { | |
69 SDL_VideoDisplay display; | |
70 SDL_DisplayData *displaydata; | |
71 SDL_DisplayMode mode; | |
72 Uint32 Rmask, Gmask, Bmask, Amask; | |
73 int orig_bpp; | |
74 | |
75 Rmask = Gmask = Bmask = Amask = 0; | |
76 if (bpp == 16) { | |
77 Rmask = 31<<11; | |
78 Gmask = 63<<5; | |
79 Bmask = 31; | |
80 } | |
81 /* Memorize for c2p4 operation */ | |
82 orig_bpp = bpp; | |
83 if (bpp == 4) { | |
84 bpp = 8; | |
85 } | |
86 | |
87 mode.format = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask); | |
88 mode.w = width; | |
89 mode.h = height; | |
90 mode.refresh_rate = 0; | |
91 mode.driverdata = NULL; | |
92 | |
93 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); | |
94 if (!displaydata) { | |
95 return; | |
96 } | |
97 displaydata->modecode = modecode; | |
98 displaydata->doubleline = doubleline; | |
99 displaydata->c2p4 = (orig_bpp == 4); | |
100 | |
101 SDL_zero(display); | |
102 display.desktop_mode = mode; | |
103 display.current_mode = mode; | |
104 display.driverdata = displaydata; | |
105 SDL_AddVideoDisplay(&display); | |
106 } | |
107 | |
108 void | |
109 SDL_XBIOS_InitModes(_THIS) | |
110 { | |
111 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; | |
112 | |
113 switch (data->cookie_vdo >> 16) { | |
114 case VDO_ST: | |
115 case VDO_STE: | |
116 { | |
117 SDL_XBIOS_AddMode(_this, 320, 200, 4, ST_LOW >> 8, SDL_FALSE); | |
118 } | |
119 break; | |
120 case VDO_TT: | |
121 { | |
122 SDL_XBIOS_AddMode(_this, 320, 480, 8, TT_LOW, SDL_FALSE); | |
123 /* Software double-lined mode */ | |
124 SDL_XBIOS_AddMode(_this, 320, 240, 8, TT_LOW, SDL_TRUE); | |
125 } | |
126 break; | |
127 case VDO_F30: | |
128 { | |
129 Uint16 modecodemask = VsetMode(-1) & (VGA | PAL); | |
130 int i; | |
131 | |
132 switch (VgetMonitor()) { | |
133 case MONITOR_MONO: | |
134 /* Not usable */ | |
135 break; | |
136 case MONITOR_RGB: | |
137 case MONITOR_TV: | |
138 for (i=0; i<sizeof(falcon_rgb_modes)/sizeof(xbios_mode_t); i++) { | |
139 SDL_XBIOS_AddMode(_this, falcon_rgb_modes[i].width, | |
140 falcon_rgb_modes[i].height, falcon_rgb_modes[i].bpp, | |
141 falcon_rgb_modes[i].modecode & modecodemask, SDL_FALSE); | |
142 } | |
143 break; | |
144 case MONITOR_VGA: | |
145 for (i=0; i<sizeof(falcon_vga_modes)/sizeof(xbios_mode_t); i++) { | |
146 SDL_XBIOS_AddMode(_this, falcon_vga_modes[i].width, | |
147 falcon_vga_modes[i].height, falcon_vga_modes[i].bpp, | |
148 falcon_vga_modes[i].modecode & modecodemask, SDL_FALSE); | |
149 } | |
150 break; | |
151 } | |
152 } | |
153 break; | |
154 } | |
155 } | |
156 | |
157 void | |
158 SDL_XBIOS_GetDisplayModes(_THIS) | |
159 { | |
160 SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; | |
161 SDL_DisplayMode mode; | |
162 //SDL_AddDisplayMode(_this->current_display, &mode); | |
163 } | |
164 | |
165 int | |
166 SDL_XBIOS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) | |
167 { | |
168 //SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; | |
169 return -1; | |
170 } | |
171 | |
172 void | |
173 SDL_XBIOS_QuitModes(_THIS) | |
174 { | |
175 } | |
176 | |
177 /* vi: set ts=4 sw=4 expandtab: */ |