SDL-1.2: atari:events: remove bios events driver

From b7be93f38f61ff13fc0045ade5460f609d7b0415 Mon Sep 17 00:00:00 2001
From: Miro Kropacek <[EMAIL REDACTED]>
Date: Thu, 27 Jun 2024 22:04:57 +0200
Subject: [PATCH] atari:events: remove bios events driver

It's basically a 1:1 copy of "gemdos" driver and mouse and joysticks are
queried by XBIOS anyway.
---
 README.MiNT                              |   8 +-
 src/video/ataricommon/SDL_atarievents.c  |   8 --
 src/video/ataricommon/SDL_biosevents.c   | 136 -----------------------
 src/video/ataricommon/SDL_biosevents_c.h |  42 -------
 4 files changed, 3 insertions(+), 191 deletions(-)
 delete mode 100644 src/video/ataricommon/SDL_biosevents.c
 delete mode 100644 src/video/ataricommon/SDL_biosevents_c.h

diff --git a/README.MiNT b/README.MiNT
index 29194cd3a..a10486bd8 100644
--- a/README.MiNT
+++ b/README.MiNT
@@ -49,7 +49,7 @@ III.  Enjoy! :)
 ==============================================================================
 IV.  What is supported:
 
-Keyboard (GEMDOS, BIOS, GEM, Ikbd)
+Keyboard (GEMDOS, GEM, Ikbd)
 Mouse (XBIOS, GEM, Ikbd)
 Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
 Timer (Timer C interrupt, GNU pth library)
@@ -64,7 +64,6 @@ OpenGL (using Mesa offscreen rendering driver)
 Video   Kbd     Mouse   Joysticks
 xbios   ikbd    ikbd    ikbd
 xbios   gemdos  xbios   xbios
-xbios   bios    xbios   xbios
 gem     gem     gem(1)  xbios
 
 Audio   O/S     Misc
@@ -110,7 +109,6 @@ SDL_AUDIODRIVER:
 SDL_ATARI_EVENTSDRIVER
 	Set to 'ikbd' to force IKBD 6301 keyboard driver
 	Set to 'gemdos' to force gemdos keyboard driver
-	Set to 'bios' to force bios keyboard driver
 
 SDL_JOYSTICK_ATARI:
 	Use any of these strings in the environment variable to enable or
@@ -130,7 +128,7 @@ SDL_JOYSTICK_ATARI:
 
 	Default configuration is:
 		'ikbd-joy1-on' (if IKBD events driver enabled)
-		'xbios-joy1-on' (if gemdos/bios/gem events driver enabled)
+		'xbios-joy1-on' (if gemdos/gem events driver enabled)
 		'porta-pad-on portb-pad-on' (if available on the machine)
 
 	port[a|b]-[pad|joy?|lp|anpad]-* strings are mutually exclusives.
@@ -206,7 +204,7 @@ IKBD keyboard, mouse and joystick driver:
 	Hades has an IKBD, but xbios is not available for video, so IKBD driver is
 	disabled.
 
-Gemdos and bios keyboard driver:
+Gemdos keyboard driver:
 	Available on all machines. Gemdos driver is default for non-Atari machines.
 
 Mouse and joystick xbios driver:
diff --git a/src/video/ataricommon/SDL_atarievents.c b/src/video/ataricommon/SDL_atarievents.c
index d913f0bc0..738c81600 100644
--- a/src/video/ataricommon/SDL_atarievents.c
+++ b/src/video/ataricommon/SDL_atarievents.c
@@ -38,7 +38,6 @@
 
 #include "SDL_atarikeys.h"
 #include "SDL_atarievents_c.h"
-#include "SDL_biosevents_c.h"
 #include "SDL_xbiosevents_c.h"
 #include "SDL_gemdosevents_c.h"
 #include "SDL_ikbdevents_c.h"
@@ -113,18 +112,11 @@ static void Atari_InitializeEvents(_THIS)
 		Atari_ShutdownEvents=AtariGemdos_ShutdownEvents;
 	}
 
-	if (SDL_strcmp(envr, "bios") == 0) {
-		this->InitOSKeymap=AtariBios_InitOSKeymap;
-		this->PumpEvents=AtariBios_PumpEvents;
-		Atari_ShutdownEvents=AtariBios_ShutdownEvents;
-	}
-
 	if (SDL_strcmp(envr, "xbios") == 0) {
 		this->InitOSKeymap=AtariXbios_InitOSKeymap;
 		this->PumpEvents=AtariXbios_PumpEvents;
 		Atari_ShutdownEvents=AtariXbios_ShutdownEvents;
 	}
-
 }
 
 void Atari_InitOSKeymap(_THIS)
diff --git a/src/video/ataricommon/SDL_biosevents.c b/src/video/ataricommon/SDL_biosevents.c
deleted file mode 100644
index 7cfcb6b29..000000000
--- a/src/video/ataricommon/SDL_biosevents.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2012 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 "SDL_config.h"
-
-/*
- *	Atari keyboard events manager, using BIOS
- *
- *	Patrice Mandin
- */
-
-/* Mint includes */
-#include <mint/osbind.h>
-#include <mint/cookie.h>
-
-#include "../../events/SDL_sysevents.h"
-#include "../../events/SDL_events_c.h"
-
-#include "SDL_atarikeys.h"
-#include "SDL_atarievents_c.h"
-#include "SDL_xbiosevents_c.h"
-
-static unsigned char bios_currentkeyboard[ATARIBIOS_MAXKEYS];
-static unsigned char bios_previouskeyboard[ATARIBIOS_MAXKEYS];
-
-static void UpdateSpecialKeys(int special_keys_state);
-
-void AtariBios_InitOSKeymap(_THIS)
-{
-	int vectors_mask;
-/*	unsigned long dummy;*/
-
-	SDL_memset(bios_currentkeyboard, 0, sizeof(bios_currentkeyboard));
-	SDL_memset(bios_previouskeyboard, 0, sizeof(bios_previouskeyboard));
-
-	vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS;	/* XBIOS joystick events */
-	vectors_mask |= ATARI_XBIOS_MOUSEEVENTS;	/* XBIOS mouse events */
-
-	SDL_AtariXbios_InstallVectors(vectors_mask);
-}
-
-void AtariBios_PumpEvents(_THIS)
-{
-	int i;
-	SDL_keysym keysym;
-	short kstate;
-
-	SDL_AtariMint_BackgroundTasks();
-
-	/* Update pressed keys */
-	SDL_memset(bios_currentkeyboard, 0, ATARIBIOS_MAXKEYS);
-
-	while (Bconstat(_CON)) {
-		unsigned long key_pressed;
-		key_pressed=Bconin(_CON);
-		bios_currentkeyboard[(key_pressed>>16)&(ATARIBIOS_MAXKEYS-1)]=0xFF;
-	}
-
-	/* Read special keys */
-	kstate = Kbshift(-1);
-	UpdateSpecialKeys(kstate);
-
-	/* Now generate events */
-	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
-		/* Key pressed ? */
-		if (bios_currentkeyboard[i] && !bios_previouskeyboard[i]) {
-			SDL_PrivateKeyboard(SDL_PRESSED,
-				SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE, kstate));
-			if (i == SCANCODE_CAPSLOCK) {
-				/* Pressed capslock: generate a release event, too because this
-				 * is what SDL expects; it handles locking by itself.
-				 */
-				SDL_PrivateKeyboard(SDL_RELEASED,
-					SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE, kstate & ~K_CAPSLOCK));
-			}
-		}
-
-		/* Key unpressed ? */
-		if (bios_previouskeyboard[i] && !bios_currentkeyboard[i]) {
-			if (i == SCANCODE_CAPSLOCK) {
-				/* Released capslock: generate a pressed event, too because this
-				 * is what SDL expects; it handles locking by itself.
-				 */
-				SDL_PrivateKeyboard(SDL_PRESSED,
-					SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE, kstate | K_CAPSLOCK));
-			}
-			SDL_PrivateKeyboard(SDL_RELEASED,
-				SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE, kstate));
-		}
-	}
-
-	SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
-
-	/* Will be previous table */
-	SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard, sizeof(bios_previouskeyboard));
-}
-
-static void UpdateSpecialKeys(int special_keys_state)
-{
-#define UPDATE_SPECIAL_KEYS(mask,scancode) \
-	{	\
-		if (special_keys_state & mask) { \
-			bios_currentkeyboard[scancode]=0xFF; \
-		}	\
-	}
-
-	UPDATE_SPECIAL_KEYS(K_RSHIFT, SCANCODE_RIGHTSHIFT);
-	UPDATE_SPECIAL_KEYS(K_LSHIFT, SCANCODE_LEFTSHIFT);
-	UPDATE_SPECIAL_KEYS(K_CTRL, SCANCODE_LEFTCONTROL);
-	UPDATE_SPECIAL_KEYS(K_ALT, SCANCODE_LEFTALT);
-	UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
-	UPDATE_SPECIAL_KEYS(0x80, SCANCODE_ALTGR);
-}
-
-void AtariBios_ShutdownEvents(void)
-{
-	SDL_AtariXbios_RestoreVectors();
-}
diff --git a/src/video/ataricommon/SDL_biosevents_c.h b/src/video/ataricommon/SDL_biosevents_c.h
deleted file mode 100644
index f016e6a65..000000000
--- a/src/video/ataricommon/SDL_biosevents_c.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-    SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2012 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 "SDL_config.h"
-
-/*
- *	Atari keyboard events manager, using BIOS
- *
- *	Patrice Mandin
- */
-
-#ifndef _SDL_ATARI_BIOSEVENTS_H_
-#define _SDL_ATARI_BIOSEVENTS_H_
-
-#include "../SDL_sysvideo.h"
-
-/* Hidden "this" pointer for the video functions */
-#define _THIS	SDL_VideoDevice *this
-
-extern void AtariBios_InitOSKeymap(_THIS);
-extern void AtariBios_PumpEvents(_THIS);
-extern void AtariBios_ShutdownEvents(void);
-
-#endif /* _SDL_ATARI_BIOSEVENTS_H_ */