Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
177 lines (155 loc) · 4.93 KB

SDL_xbiosmodes.c

File metadata and controls

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