annotate src/video/xbios/SDL_xbios_milan.c @ 4367:2d00ed718720 SDL-1.2

Fixed compiler warnings
author Sam Lantinga <slouken@libsdl.org>
date Mon, 19 Oct 2009 10:09:58 +0000
parents 6405314a7c07
children
rev   line source
4195
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
1 /*
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
4
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
9
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
13 Library General Public License for more details.
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
14
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
18
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
19 Sam Lantinga
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
20 slouken@libsdl.org
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
21 */
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
22 #include "SDL_config.h"
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
23
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
24 /*
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
25 Milan Xbios video functions
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
26
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
27 Patrice Mandin
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
28 */
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
29
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
30 #include <mint/cookie.h>
4197
1bf6585720e9 Use loop to allocate needed buffers, instead of code duplication. Add missing header.
Patrice Mandin <patmandin@gmail.com>
parents: 4196
diff changeset
31 #include <mint/falcon.h>
4195
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
32
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
33 #include "SDL_xbios.h"
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
34 #include "SDL_xbios_milan.h"
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
35
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
36 #ifndef Validmode
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
37 #define Validmode(mode) \
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
38 (short)trap_14_ww((short)0x5f,(short)(mode))
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
39 #endif
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
40
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
41 #define NUM_PREDEFINED_MODES 7
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
42
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
43 typedef struct {
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
44 Uint16 width, height;
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
45 } predefined_mode_t;
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
46
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
47 static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
48 {640,400},
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
49 {640,480},
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
50 {800,608},
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
51 {1024,768},
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
52 {1152,864},
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
53 {1280,1024},
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
54 {1600,1200}
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
55 };
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
56
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
57 static const Uint8 mode_bpp[4]={
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
58 8, 15, 16, 32
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
59 };
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
60
4196
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
61 /*--- Variables ---*/
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
62
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
63 static int enum_actually_add;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
64 static SDL_VideoDevice *enum_this;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
65
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
66 /*--- Functions ---*/
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
67
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
68 static unsigned long /*cdecl*/ enumfunc(SCREENINFO *inf, unsigned long flag)
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
69 {
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
70 xbiosmode_t modeinfo;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
71
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
72 modeinfo.number = inf->devID;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
73 modeinfo.width = inf->scrWidth;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
74 modeinfo.height = inf->scrHeight;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
75 modeinfo.depth = inf->scrPlanes;
4198
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4197
diff changeset
76 modeinfo.flags = 0;
4196
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
77
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
78 SDL_XBIOS_AddMode(enum_this, enum_actually_add, &modeinfo);
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
79
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
80 return ENUMMODE_CONT;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
81 }
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
82
4195
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
83 void SDL_XBIOS_ListMilanModes(_THIS, int actually_add)
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
84 {
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
85 int i;
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
86
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
87 /* Read validated predefined modes */
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
88 for (i=0; i<NUM_PREDEFINED_MODES; i++) {
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
89 int j;
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
90 Uint16 deviceid = 0x1000 + (i<<4);
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
91
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
92 for (j=1; j<4; j++) {
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
93 if (Validmode(deviceid + j)) {
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
94 xbiosmode_t modeinfo;
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
95
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
96 modeinfo.number = deviceid + j;
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
97 modeinfo.width = mode_list[i].width;
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
98 modeinfo.height = mode_list[i].height;
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
99 modeinfo.depth = mode_bpp[j-1];
4198
6405314a7c07 Define flags for double line and c2p operations. More Milan video work.
Patrice Mandin <patmandin@gmail.com>
parents: 4197
diff changeset
100 modeinfo.flags = 0;
4195
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
101
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
102 SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
103 }
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
104 }
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
105 }
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
106
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
107 /* Read custom created modes */
4196
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
108 enum_this = this;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
109 enum_actually_add = actually_add;
89c7562eae9b Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents: 4195
diff changeset
110 VsetScreen(-1, &enumfunc, MI_MAGIC, CMD_ENUMMODES);
4195
13de8ea401db Start Milan video support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
111 }