Mercurial > sdl-ios-xcode
comparison src/video/xbios/SDL_xbiosmodes.c @ 2120:2c835d58faad
make indent
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 14 Jun 2007 13:21:29 +0000 |
parents | 790726541708 |
children | e1da92da346c |
comparison
equal
deleted
inserted
replaced
2119:9341a884a4d9 | 2120:2c835d58faad |
---|---|
26 #include "SDL_config.h" | 26 #include "SDL_config.h" |
27 #include "SDL_xbios.h" | 27 #include "SDL_xbios.h" |
28 #include "SDL_xbiosmodes.h" | 28 #include "SDL_xbiosmodes.h" |
29 | 29 |
30 | 30 |
31 typedef struct { | 31 typedef struct |
32 int width,height,bpp; | 32 { |
33 int width, height, bpp; | |
33 int modecode; | 34 int modecode; |
34 int doubleline; | 35 int doubleline; |
35 } xbios_mode_t; | 36 } xbios_mode_t; |
36 | 37 |
37 static xbios_mode_t falcon_rgb_modes[]={ | 38 static xbios_mode_t falcon_rgb_modes[] = { |
38 {768, 480, 16, BPS16 | COL80 | OVERSCAN | VERTFLAG}, | 39 {768, 480, 16, BPS16 | COL80 | OVERSCAN | VERTFLAG}, |
39 {768, 240, 16, BPS16 | COL80 | OVERSCAN}, | 40 {768, 240, 16, BPS16 | COL80 | OVERSCAN}, |
40 {640, 400, 16, BPS16 | COL80 | VERTFLAG}, | 41 {640, 400, 16, BPS16 | COL80 | VERTFLAG}, |
41 {640, 200, 16, BPS16 | COL80}, | 42 {640, 200, 16, BPS16 | COL80}, |
42 {384, 480, 16, BPS16 | OVERSCAN | VERTFLAG}, | 43 {384, 480, 16, BPS16 | OVERSCAN | VERTFLAG}, |
50 {384, 480, 8, BPS8 | OVERSCAN | VERTFLAG}, | 51 {384, 480, 8, BPS8 | OVERSCAN | VERTFLAG}, |
51 {384, 240, 8, BPS8 | OVERSCAN}, | 52 {384, 240, 8, BPS8 | OVERSCAN}, |
52 {320, 400, 8, BPS8 | VERTFLAG}, | 53 {320, 400, 8, BPS8 | VERTFLAG}, |
53 {320, 200, 8, BPS8} | 54 {320, 200, 8, BPS8} |
54 }; | 55 }; |
55 | 56 |
56 static xbios_mode_t falcon_vga_modes[]={ | 57 static xbios_mode_t falcon_vga_modes[] = { |
57 {320, 480, 16, BPS16 }, | 58 {320, 480, 16, BPS16}, |
58 {320, 240, 16, BPS16 | VERTFLAG}, | 59 {320, 240, 16, BPS16 | VERTFLAG}, |
59 {640, 480, 8, BPS8 | COL80}, | 60 {640, 480, 8, BPS8 | COL80}, |
60 {640, 240, 8, BPS8 | COL80 | VERTFLAG}, | 61 {640, 240, 8, BPS8 | COL80 | VERTFLAG}, |
61 {320, 480, 8, BPS8 }, | 62 {320, 480, 8, BPS8}, |
62 {320, 240, 8, BPS8 | VERTFLAG} | 63 {320, 240, 8, BPS8 | VERTFLAG} |
63 }; | 64 }; |
64 | 65 |
65 static void | 66 static void |
66 SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode, | 67 SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode, |
67 SDL_bool doubleline) | 68 SDL_bool doubleline) |
68 { | 69 { |
69 SDL_VideoDisplay display; | 70 SDL_VideoDisplay display; |
70 SDL_DisplayData *displaydata; | 71 SDL_DisplayData *displaydata; |
71 SDL_DisplayMode mode; | 72 SDL_DisplayMode mode; |
72 Uint32 Rmask, Gmask, Bmask, Amask; | 73 Uint32 Rmask, Gmask, Bmask, Amask; |
73 int orig_bpp; | 74 int orig_bpp; |
74 | 75 |
75 Rmask = Gmask = Bmask = Amask = 0; | 76 Rmask = Gmask = Bmask = Amask = 0; |
76 if (bpp == 16) { | 77 if (bpp == 16) { |
77 Rmask = 31<<11; | 78 Rmask = 31 << 11; |
78 Gmask = 63<<5; | 79 Gmask = 63 << 5; |
79 Bmask = 31; | 80 Bmask = 31; |
80 } | 81 } |
81 /* Memorize for c2p4 operation */ | 82 /* Memorize for c2p4 operation */ |
82 orig_bpp = bpp; | 83 orig_bpp = bpp; |
83 if (bpp == 4) { | 84 if (bpp == 4) { |
84 bpp = 8; | 85 bpp = 8; |
90 mode.refresh_rate = 0; | 91 mode.refresh_rate = 0; |
91 mode.driverdata = NULL; | 92 mode.driverdata = NULL; |
92 | 93 |
93 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); | 94 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); |
94 if (!displaydata) { | 95 if (!displaydata) { |
95 return; | 96 return; |
96 } | 97 } |
97 displaydata->modecode = modecode; | 98 displaydata->modecode = modecode; |
98 displaydata->doubleline = doubleline; | 99 displaydata->doubleline = doubleline; |
99 displaydata->c2p4 = (orig_bpp == 4); | 100 displaydata->c2p4 = (orig_bpp == 4); |
100 | 101 |
138 case VDO_STE: | 139 case VDO_STE: |
139 Setscreen(-1, data->old_vbase, data->old_modecode); | 140 Setscreen(-1, data->old_vbase, data->old_modecode); |
140 break; | 141 break; |
141 case VDO_TT: | 142 case VDO_TT: |
142 Setscreen(-1, data->old_vbase, -1); | 143 Setscreen(-1, data->old_vbase, -1); |
143 EsetShift(data->old_modecode); | 144 EsetShift(data->old_modecode); |
144 break; | 145 break; |
145 case VDO_F30: | 146 case VDO_F30: |
146 Setscreen(-1, data->old_vbase, -1); | 147 Setscreen(-1, data->old_vbase, -1); |
147 VsetMode(data->old_modecode); | 148 VsetMode(data->old_modecode); |
148 break; | 149 break; |
202 } | 203 } |
203 break; | 204 break; |
204 case VDO_F30: | 205 case VDO_F30: |
205 data->old_numcol = 1 << (1 << (data->old_modecode & NUMCOLS)); | 206 data->old_numcol = 1 << (1 << (data->old_modecode & NUMCOLS)); |
206 if (data->old_numcol > 256) { | 207 if (data->old_numcol > 256) { |
207 data->old_numcol = 0; | 208 data->old_numcol = 0; |
208 } else { | 209 } else { |
209 VgetRGB(0, data->old_numcol, data->old_palette); | 210 VgetRGB(0, data->old_numcol, data->old_palette); |
210 } | 211 } |
211 break; | 212 break; |
212 } | 213 } |
213 } | 214 } |
259 SDL_XBIOS_AddMode(_this, 320, 240, 8, TT_LOW, SDL_TRUE); | 260 SDL_XBIOS_AddMode(_this, 320, 240, 8, TT_LOW, SDL_TRUE); |
260 } | 261 } |
261 break; | 262 break; |
262 case VDO_F30: | 263 case VDO_F30: |
263 { | 264 { |
264 Uint16 modecodemask = data->old_modecode & (VGA | PAL); | 265 Uint16 modecodemask = data->old_modecode & (VGA | PAL); |
265 int i; | 266 int i; |
266 | 267 |
267 switch (VgetMonitor()) { | 268 switch (VgetMonitor()) { |
268 case MONITOR_MONO: | 269 case MONITOR_MONO: |
269 /* Not usable */ | 270 /* Not usable */ |
270 break; | 271 break; |
271 case MONITOR_RGB: | 272 case MONITOR_RGB: |
272 case MONITOR_TV: | 273 case MONITOR_TV: |
273 for (i=0; i<sizeof(falcon_rgb_modes)/sizeof(xbios_mode_t); i++) { | 274 for (i = 0; |
274 SDL_XBIOS_AddMode(_this, falcon_rgb_modes[i].width, | 275 i < sizeof(falcon_rgb_modes) / sizeof(xbios_mode_t); |
275 falcon_rgb_modes[i].height, falcon_rgb_modes[i].bpp, | 276 i++) { |
276 falcon_rgb_modes[i].modecode & modecodemask, SDL_FALSE); | 277 SDL_XBIOS_AddMode(_this, falcon_rgb_modes[i].width, |
277 } | 278 falcon_rgb_modes[i].height, |
278 break; | 279 falcon_rgb_modes[i].bpp, |
280 falcon_rgb_modes[i]. | |
281 modecode & modecodemask, SDL_FALSE); | |
282 } | |
283 break; | |
279 case MONITOR_VGA: | 284 case MONITOR_VGA: |
280 for (i=0; i<sizeof(falcon_vga_modes)/sizeof(xbios_mode_t); i++) { | 285 for (i = 0; |
281 SDL_XBIOS_AddMode(_this, falcon_vga_modes[i].width, | 286 i < sizeof(falcon_vga_modes) / sizeof(xbios_mode_t); |
282 falcon_vga_modes[i].height, falcon_vga_modes[i].bpp, | 287 i++) { |
283 falcon_vga_modes[i].modecode & modecodemask, SDL_FALSE); | 288 SDL_XBIOS_AddMode(_this, falcon_vga_modes[i].width, |
284 } | 289 falcon_vga_modes[i].height, |
285 break; | 290 falcon_vga_modes[i].bpp, |
291 falcon_vga_modes[i]. | |
292 modecode & modecodemask, SDL_FALSE); | |
293 } | |
294 break; | |
286 } | 295 } |
287 } | 296 } |
288 break; | 297 break; |
289 } | 298 } |
290 } | 299 } |