Commit d5cf1663 authored by Patrice Mandin's avatar Patrice Mandin

xbios: preliminary video mode init

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402232
parent a39f5c21
This diff is collapsed.
...@@ -27,28 +27,11 @@ ...@@ -27,28 +27,11 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
/* TT video modes: 2
Falcon RVB: 16 (could be *2 by adding PAL/NTSC modes)
Falcon VGA: 6
ST low: 1
*/
#define SDL_NUMMODES 16
typedef struct
{
Uint16 number; /* Video mode number */
Uint16 width; /* Size */
Uint16 height;
Uint16 depth; /* bits per plane */
SDL_bool doubleline; /* Double the lines ? */
} xbiosmode_t;
/* Private display data */
#define NUM_MODELISTS 2 /* 8 and 16 bits-per-pixel */
typedef struct SDL_VideoData typedef struct SDL_VideoData
{ {
long cookie_vdo; long cookie_vdo;
#if 0
int old_video_mode; /* Old video mode before entering SDL */ int old_video_mode; /* Old video mode before entering SDL */
void *old_video_base; /* Old pointer to screen buffer */ void *old_video_base; /* Old pointer to screen buffer */
void *old_palette; /* Old palette */ void *old_palette; /* Old palette */
...@@ -68,6 +51,7 @@ typedef struct SDL_VideoData ...@@ -68,6 +51,7 @@ typedef struct SDL_VideoData
SDL_Rect *SDL_modelist[NUM_MODELISTS][SDL_NUMMODES + 1]; SDL_Rect *SDL_modelist[NUM_MODELISTS][SDL_NUMMODES + 1];
xbiosmode_t *videomodes[NUM_MODELISTS][SDL_NUMMODES + 1]; xbiosmode_t *videomodes[NUM_MODELISTS][SDL_NUMMODES + 1];
#endif
} SDL_VideoData; } SDL_VideoData;
/* _VDO cookie values */ /* _VDO cookie values */
...@@ -102,31 +86,5 @@ enum ...@@ -102,31 +86,5 @@ enum
#define TT_MED 0x0300 #define TT_MED 0x0300
#define TT_HIGH 0x0600 #define TT_HIGH 0x0600
/* Hidden structure -> variables names */
#define SDL_modelist (_this->driverdata->SDL_modelist)
#define XBIOS_mutex (_this->driverdata->mutex)
#define XBIOS_cvdo (_this->driverdata->cookie_vdo)
#define XBIOS_oldpalette (_this->driverdata->old_palette)
#define XBIOS_oldnumcol (_this->driverdata->old_num_colors)
#define XBIOS_oldvbase (_this->driverdata->old_video_base)
#define XBIOS_oldvmode (_this->driverdata->old_video_mode)
#define XBIOS_nummodes (_this->driverdata->num_modes)
#define XBIOS_modelist (_this->driverdata->mode_list)
#define XBIOS_screens (_this->driverdata->screens)
#define XBIOS_screensmem (_this->driverdata->screensmem)
#define XBIOS_shadowscreen (_this->driverdata->shadowscreen)
#define XBIOS_videomodes (_this->driverdata->videomodes)
#define XBIOS_doubleline (_this->driverdata->doubleline)
#define XBIOS_fbnum (_this->driverdata->frame_number)
#define XBIOS_pitch (_this->driverdata->pitch)
#define XBIOS_width (_this->driverdata->width)
#define XBIOS_height (_this->driverdata->height)
#define XBIOS_centscreen (_this->driverdata->centscreen)
/*--- Functions prototypes ---*/
void SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height,
Uint16 depth, SDL_bool flags);
#endif /* _SDL_xbios_h */ #endif /* _SDL_xbios_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
/*
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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment