[hatari-devel] 8-bit VDI mode support |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: Hatari Development <hatari-devel@xxxxxxxxxxxxxxxxxxx>
- Subject: [hatari-devel] 8-bit VDI mode support
- From: Eero Tamminen <oak@xxxxxxxxxxxxxx>
- Date: Wed, 20 Aug 2025 01:14:37 +0300
- Dkim-filter: OpenDKIM Filter v2.11.0 smtp.dnamail.fi 098F420B3B1B
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=helsinkinet.fi; s=2025-03; t=1755641678; bh=yPm7VxmmOtcghUOxdc6injEf+TBCNz7R+cF+WuEHh/M=; h=Date:To:From:Subject:From; b=aM58WazrOp2GkNTVPjyElGFdV7uzS8wP3J+8dMKbOBjwt1MrvdNpuk4WFYtJnepjY PxvyOdeSBOLLKgzFhF6E0x6lH3zUtTqi1lxrxtFtrSjSgwlcYNQjHvKjlViWjLkMgq jOK44nIgU9YkZrFq18WSqCgKhMofY+PGt7pdOxj5ONCln4JavHznAfI55EpiQaVDlY 8UV8Tb7WGtqiFIBYi6+WO3PnDwGENk4zuWweD2KvDkgRosJUHGwFyRera//M0ys0Ah goA8CWPVVj7STum/uVxKa4miEUavl6AdU2WJUmZdv5/3WOEHt16BYqiGMg6UvCEQbm ojXnUB1zlePdA==
Hi,
Besides the virtual INF file improvements I mailed about yesterday (but
did not receive myself from list), attached is 8-bit support for VDI mode.
I'm not sure how useful it's though, because it naturally works only on
TT and Falcon, and one can create larger modes e.g. with Videl Inside.
Comments? (on its usefulness vs. changes needed)
- Eero
From 53c6cb45c50fa1e0f89548679b190cf309b5efa3 Mon Sep 17 00:00:00 2001
From: Eero Tamminen <oak@xxxxxxxxxxxxxx>
Date: Wed, 20 Aug 2025 01:08:03 +0300
Subject: [PATCH] Support for 8-bit VDI mode (on Falcon + TT)
---
doc/release-notes.txt | 2 ++
src/gui-sdl/dlgScreen.c | 25 +++++++++++++++----------
src/includes/vdi.h | 7 ++++---
src/inffile.c | 19 +++++++++++++++----
src/options.c | 5 ++++-
src/tos.c | 13 +++++++++++--
src/vdi.c | 6 +++++-
7 files changed, 56 insertions(+), 21 deletions(-)
diff --git a/doc/release-notes.txt b/doc/release-notes.txt
index bba486ed..297e347a 100644
--- a/doc/release-notes.txt
+++ b/doc/release-notes.txt
@@ -23,6 +23,8 @@ Following features are deprecated and will be removed in a future release:
Emulation improvements:
Emulator improvements:
+- VDI mode:
+ - Support 8-bit mode (up to 640x480@256) on TT & Falcon
- Virtual INF file (used with autostart/TOS-resolution options):
- Fix: resolution setting for EmuTOS with saved Falcon EMUDESK.INF
- Fix: Boot drive window specified in the virtual INF file when
diff --git a/src/gui-sdl/dlgScreen.c b/src/gui-sdl/dlgScreen.c
index 08113a8f..d4f4851e 100644
--- a/src/gui-sdl/dlgScreen.c
+++ b/src/gui-sdl/dlgScreen.c
@@ -47,7 +47,8 @@ const char DlgScreen_fileid[] = "Hatari dlgScreen.c";
#define DLGSCRN_BPP1 18
#define DLGSCRN_BPP2 19
#define DLGSCRN_BPP4 20
-#define DLGSCRN_EXIT_MONITOR 21
+#define DLGSCRN_BPP8 21
+#define DLGSCRN_EXIT_MONITOR 22
/* Strings for VDI resolution width and height */
static char sVdiWidth[5];
@@ -55,7 +56,7 @@ static char sVdiHeight[5];
static SGOBJ monitordlg[] =
{
- { SGBOX, 0, 0, 0,0, 34,18, NULL },
+ { SGBOX, 0, 0, 0,0, 34,19, NULL },
{ SGBOX, 0, 0, 1,1, 32,6, NULL },
{ SGTEXT, 0, 0, 10,1, 14,1, "Atari monitor" },
@@ -65,7 +66,7 @@ static SGOBJ monitordlg[] =
{ SGRADIOBUT, 0, 0, 26,3, 4,1, "_TV" },
{ SGCHECKBOX, 0, 0, 12,5, 14,1, "Show _borders" },
- { SGBOX, 0, 0, 1,8, 32,7, NULL },
+ { SGBOX, 0, 0, 1,8, 32,8, NULL },
{ SGCHECKBOX, 0, 0, 4,9, 25,1, "Use _extended VDI screen" },
{ SGTEXT, 0, 0, 4,11, 5,1, "Size:" },
{ SGBUTTON, 0, 0, 6,12, 1,1, "\x04", SG_SHORTCUT_LEFT },
@@ -76,11 +77,12 @@ static SGOBJ monitordlg[] =
{ SGTEXT, 0, 0, 8,13, 4,1, sVdiHeight },
{ SGBUTTON, 0, 0, 13,13, 1,1, "\x03", SG_SHORTCUT_DOWN },
- { SGRADIOBUT, SG_EXIT, 0, 18,11, 11,1, " _2 colors" },
- { SGRADIOBUT, SG_EXIT, 0, 18,12, 11,1, " _4 colors" },
- { SGRADIOBUT, SG_EXIT, 0, 18,13, 11,1, "1_6 colors" },
+ { SGRADIOBUT, SG_EXIT, 0, 18,11, 11,1, " _2 colors" },
+ { SGRADIOBUT, SG_EXIT, 0, 18,12, 11,1, " _4 colors" },
+ { SGRADIOBUT, SG_EXIT, 0, 18,13, 11,1, " 1_6 colors" },
+ { SGRADIOBUT, SG_EXIT, 0, 18,14, 11,1, "2_56 colors" },
- { SGBUTTON, SG_DEFAULT, 0, 7,16, 20,1, "Back to main menu" },
+ { SGBUTTON, SG_DEFAULT, 0, 7,17, 20,1, "Back to main menu" },
{ SGSTOP, 0, 0, 0,0, 0,0, NULL }
};
@@ -195,8 +197,10 @@ static int DlgMonitor_SetVdiStepping(int *stepx, int *stepy)
planes = 1;
else if (monitordlg[DLGSCRN_BPP2].state & SG_SELECTED)
planes = 2;
- else
+ else if (monitordlg[DLGSCRN_BPP4].state & SG_SELECTED)
planes = 4;
+ else
+ planes = 8;
*stepx = VDI_ALIGN_WIDTH;
*stepy = VDI_ALIGN_HEIGHT;
return planes;
@@ -231,7 +235,7 @@ void Dialog_MonitorDlg(void)
monitordlg[DLGSCRN_USEVDIRES].state |= SG_SELECTED;
else
monitordlg[DLGSCRN_USEVDIRES].state &= ~SG_SELECTED;
- for (i=0; i<3; i++)
+ for (i=0; i < 4; i++)
monitordlg[DLGSCRN_BPP1 + i].state &= ~SG_SELECTED;
monitordlg[DLGSCRN_BPP1 + ConfigureParams.Screen.nVdiColors - GEMCOLOR_2].state |= SG_SELECTED;
@@ -266,6 +270,7 @@ void Dialog_MonitorDlg(void)
case DLGSCRN_BPP1:
case DLGSCRN_BPP2:
case DLGSCRN_BPP4:
+ case DLGSCRN_BPP8:
planes = DlgMonitor_SetVdiStepping(&stepx, &stepy);
break;
@@ -301,7 +306,7 @@ void Dialog_MonitorDlg(void)
ConfigureParams.Screen.nVdiHeight = vdih;
ConfigureParams.Screen.bUseExtVdiResolutions = (monitordlg[DLGSCRN_USEVDIRES].state & SG_SELECTED);
- for (i=0; i<3; i++)
+ for (i=0; i < 4; i++)
{
if (monitordlg[DLGSCRN_BPP1 + i].state & SG_SELECTED)
ConfigureParams.Screen.nVdiColors = GEMCOLOR_2 + i;
diff --git a/src/includes/vdi.h b/src/includes/vdi.h
index 5cb0fdb3..9c758dcb 100644
--- a/src/includes/vdi.h
+++ b/src/includes/vdi.h
@@ -42,9 +42,10 @@
enum
{
- GEMCOLOR_2,
- GEMCOLOR_4,
- GEMCOLOR_16
+ GEMCOLOR_2,
+ GEMCOLOR_4,
+ GEMCOLOR_16,
+ GEMCOLOR_256,
};
extern uint32_t VDI_OldPC;
diff --git a/src/inffile.c b/src/inffile.c
index 64d54447..994e3225 100644
--- a/src/inffile.c
+++ b/src/inffile.c
@@ -489,13 +489,26 @@ static int INF_ValidateResolution(int *set_res, const char **val, const char **e
{
#define MONO_WARN_STR "Correcting virtual INF file resolution to mono on mono monitor\n"
int res = TosOverride.reso;
+ *val = TosOverride.reso_str;
*set_res = 0;
- /* VDI resolution overrides TOS resolution setting */
if (bUseVDIRes)
{
- Log_Printf(LOG_WARN, "Specified VDI resolution overrides specified TOS resolution\n");
+ /* VDI resolution overrides any TOS resolution setting */
res = vdi2inf(VDIRes);
+
+ switch(ConfigureParams.System.nMachineType)
+ {
+ case MACHINE_TT:
+ case MACHINE_FALCON:
+ break;
+ default:
+ if (res >= TT_LOW_RES)
+ {
+ *err = "Invalid VDI mode, only TT + Falcon support more than 4-plane modes";
+ return TosOverride.reso_id;
+ }
+ }
}
else
{
@@ -505,8 +518,6 @@ static int INF_ValidateResolution(int *set_res, const char **val, const char **e
if (!res)
return 0;
- *val = TosOverride.reso_str;
-
switch(ConfigureParams.System.nMachineType)
{
case MACHINE_STE:
diff --git a/src/options.c b/src/options.c
index c36cca9f..89f3a863 100644
--- a/src/options.c
+++ b/src/options.c
@@ -313,7 +313,7 @@ static const opt_t HatariOptions[] = {
{ OPT_VDI, NULL, "--vdi",
"<bool>", "Whether to use VDI screen mode" },
{ OPT_VDI_PLANES,NULL, "--vdi-planes",
- "<x>", "VDI mode bit-depth (x = 1/2/4)" },
+ "<x>", "VDI mode bit-depth (x = 1/2/4/8)" },
{ OPT_VDI_WIDTH, NULL, "--vdi-width",
"<w>", "VDI mode width (320 < w <= 2048)" },
{ OPT_VDI_HEIGHT, NULL, "--vdi-height",
@@ -1441,6 +1441,9 @@ bool Opt_ParseParameters(int argc, const char * const argv[])
case 4:
ConfigureParams.Screen.nVdiColors = GEMCOLOR_16;
break;
+ case 8:
+ ConfigureParams.Screen.nVdiColors = GEMCOLOR_256;
+ break;
default:
return Opt_ShowError(OPT_VDI_PLANES, argv[i], "Unsupported VDI bit-depth");
}
diff --git a/src/tos.c b/src/tos.c
index d12a51a7..21dca904 100644
--- a/src/tos.c
+++ b/src/tos.c
@@ -961,8 +961,9 @@ static void TOS_CheckSysConfig(void)
}
if (Config_IsMachineFalcon() && bUseVDIRes && !bIsEmuTOS)
{
- Log_AlertDlg(LOG_ERROR, "TOS v4 does not work with the VDI mode.\n"
- "Please use 512k/1024k EmuTOS for that on Falcon.");
+ Log_AlertDlg(LOG_ERROR, "VDI mode does not work with TOS v4 => disabled.\n"
+ "Use 512k/1024k EmuTOS for VDI mode on Falcon.");
+ bUseVDIRes = false;
}
}
@@ -1197,6 +1198,14 @@ int TOS_InitImage(void)
}
else
{
+ /* use VDI type supported by current machine */
+ if (ConfigureParams.Screen.nVdiColors > GEMCOLOR_16 &&
+ !(Config_IsMachineFalcon() || Config_IsMachineTT()))
+ {
+ Log_AlertDlg(LOG_ERROR, "Only Falcon + TT support better than 16-color modes."
+ " Switching to 16-color VDI mode.");
+ ConfigureParams.Screen.nVdiColors = GEMCOLOR_16;
+ }
/* needs to be called after TosVersion is set, but
* before STMemory_SetDefaultConfig() is called
*/
diff --git a/src/vdi.c b/src/vdi.c
index b62ccaa3..99f03b37 100644
--- a/src/vdi.c
+++ b/src/vdi.c
@@ -130,8 +130,12 @@ void VDI_SetResolution(int GEMColor, int WidthRequest, int HeightRequest)
VDIRes = ST_LOW_RES;
VDIPlanes = 4;
break;
+ case GEMCOLOR_256:
+ VDIRes = TT_LOW_RES;
+ VDIPlanes = 8;
+ break;
default:
- Main_ErrorExit("Invalid VDI planes mode request (not 2/4/16)", NULL, 1);
+ Main_ErrorExit("Invalid VDI planes mode request (not 1/2/4/8)", NULL, 1);
}
#if DEBUG
printf("%s v0x%04x, RAM=%dkB\n", bIsEmuTOS ? "EmuTOS" : "TOS", TosVersion, ConfigureParams.Memory.STRamSize_KB);
--
2.39.5