SDL-1.2: atari:video:xbios: offer only "official" XBIOS modes

From cf849a79ae34412d4f80a608cb7a88f2a85cce24 Mon Sep 17 00:00:00 2001
From: Miro Kropacek <[EMAIL REDACTED]>
Date: Tue, 12 Dec 2023 17:36:15 +0100
Subject: [PATCH] atari:video:xbios: offer only "official" XBIOS modes

CTPCI XBIOS offers countless of modes at various frequencies but let's stick to the basics: 60 Hz and the ones directly supported/handled in VsetScreen() without the DEVID set.
---
 src/video/xbios/SDL_xbios_ctpci.c | 14 ++++++--------
 src/video/xbios/SDL_xbios_milan.h | 13 +++++++++++++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/video/xbios/SDL_xbios_ctpci.c b/src/video/xbios/SDL_xbios_ctpci.c
index 07fab127..4f4ad567 100644
--- a/src/video/xbios/SDL_xbios_ctpci.c
+++ b/src/video/xbios/SDL_xbios_ctpci.c
@@ -48,14 +48,12 @@ typedef struct {
 } predefined_mode_t;
 
 static const predefined_mode_t mode_list[]={
-	{0x4260,320,200},
-	{0x4270,320,240},
-	{0x4138,640,480},
-	{0x4160,800,600},
-	{0x4188,1024,768},
-	{0x42c8,1280,800},
-	{0x41e0,1280,1024},
-	{0x4210,1600,1200}
+	/*{VERTFLAG|PAL|VGA,320,240},*/	/* falls back to 640x480 */
+	{PAL|VGA|COL80,640,480},
+	{VESA_600|HORFLAG2|PAL|VGA|COL80,800,600},
+	{VESA_768|HORFLAG2|PAL|VGA|COL80,1024,768},
+	{VERTFLAG2|HORFLAG|PAL|VGA|COL80,1280,960},
+	{VERTFLAG2|VESA_600|HORFLAG2|HORFLAG|PAL|VGA|COL80,1600,1200}
 };
 
 static const Uint8 mode_bpp[]={
diff --git a/src/video/xbios/SDL_xbios_milan.h b/src/video/xbios/SDL_xbios_milan.h
index c1a38382..0e8e225d 100644
--- a/src/video/xbios/SDL_xbios_milan.h
+++ b/src/video/xbios/SDL_xbios_milan.h
@@ -39,6 +39,19 @@
 #define MI_MAGIC	0x4D49	/* Milan */
 #define VN_MAGIC	0x564E	/* CTPCI */
 
+/* Vsetscreen() modecode extended flags */
+
+#define HORFLAG		0x200	/* double width */
+#define HORFLAG2	0x400	/* width increased */
+#define VESA_600	0x800	/* SVGA 600 lines */
+#define VESA_768	0x1000	/* SVGA 768 lines */
+#define VERTFLAG2	0x2000	/* double height */
+#define DEVID		0x4000	/* bits 11-3 used for devID */
+#define VIRTUAL_SCREEN	0x8000	/* width * 2 and height * 2, 2048 x 2048 max */
+
+#define GET_DEVID(x) (((x) & DEVID) ? (((x) & 0x3FF8) >> 3) : -1)
+#define SET_DEVID(x) ((((x) << 3) & 0x3FF8) | DEVID)
+
 enum {
 	/* Milan/CTPCI */
 	CMD_GETMODE=0,