From 9b54f7a87aee04d8d03660ac2c165078b249877c Mon Sep 17 00:00:00 2001
From: Miro Kropacek <[EMAIL REDACTED]>
Date: Thu, 8 Oct 2026 14:48:45 +1000
Subject: [PATCH] atari:video:gem: use xbios events driver by default
Most SDL ports are 020+ / ColdFire only, so they run on TOS >= 2.x
anyway; TOS 1.x still falls back to the AES.
Any pretension of cleanliness is a bit hypocritical, as mouse and
joystick are read from XBIOS even with GEM video.
---
README.MiNT | 15 +++++----------
src/video/ataricommon/SDL_atarievents.c | 6 +++---
src/video/gem/SDL_gemvideo.c | 4 ++--
3 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/README.MiNT b/README.MiNT
index b30c0fd2..2e735196 100644
--- a/README.MiNT
+++ b/README.MiNT
@@ -185,18 +185,13 @@ Gem video:
Only the current resolution, if 8 bits or higher depth.
Keyboard, mouse and joystick driver:
- When unset, XBIOS video uses XBIOS where available (TOS >= 2.x and/or in
- MagiC) and IKBD otherwise, GEM video uses GEM.
+ When unset, both video drivers use XBIOS where available (TOS >= 2.x
+ and/or in MagiC); otherwise XBIOS video uses IKBD and GEM video uses GEM.
The IKBD driver hooks the ikbdsys vector from Kbdvbase() instead of the
ACIA interrupt vector at 0x118, so MIDI interrupts keep being serviced.
It is not available on FireTOS, whose ACIA handler never calls ikbdsys.
- In ideal circumstances, XBIOS video supports selection of XBIOS and IKBD
- events while GEM video supports selection of XBIOS and GEM events.
- Otherwise XBIOS video is stuck with IKBD events and GEM video with GEM
- events.
-
With GEM video the choice only decides where keyboard events come from:
AES message loop or XBIOS keyboard vector (which reports key
press/release events). Mouse buttons, relative motion and the joystick
@@ -205,9 +200,9 @@ Keyboard, mouse and joystick driver:
The AES reports key presses and their repeats but no releases, so the
GEM driver considers a key released once its next repeat is overdue,
- using the delay and rate set in the Control Panel. Only the last
- pressed key repeats, so keys held together are released early; use
- SDL_ATARI_EVENTSDRIVER=xbios where available.
+ using the delay and rate set in the Control Panel. A short tap is
+ therefore held for at least that delay, and only the last pressed key
+ repeats, so keys held together are released early.
Joypad driver:
Available if _MCH cookie is STE or Falcon. Supports teamtap.
diff --git a/src/video/ataricommon/SDL_atarievents.c b/src/video/ataricommon/SDL_atarievents.c
index f39bbd06..e326dfae 100644
--- a/src/video/ataricommon/SDL_atarievents.c
+++ b/src/video/ataricommon/SDL_atarievents.c
@@ -134,12 +134,12 @@ SDL_AtariEventsDriver SDL_Atari_GetEventsDriver(SDL_bool gemVideo)
const char *envr = SDL_getenv("SDL_ATARI_EVENTSDRIVER");
if (!envr) {
- if (gemVideo) {
- return ATARI_EVENTS_GEM;
- }
if (SDL_AtariXbios_IsKeyboardVectorSupported()) {
return ATARI_EVENTS_XBIOS;
}
+ if (gemVideo) {
+ return ATARI_EVENTS_GEM;
+ }
if (IsIkbdSupported()) {
/* TOS 1.x */
return ATARI_EVENTS_IKBD;
diff --git a/src/video/gem/SDL_gemvideo.c b/src/video/gem/SDL_gemvideo.c
index b478be24..0b7f647a 100644
--- a/src/video/gem/SDL_gemvideo.c
+++ b/src/video/gem/SDL_gemvideo.c
@@ -448,8 +448,8 @@ static int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
VDI_handle = internal_vdi_handle;
VDI_pixelsize = internal_pixelsize;
- /* Events: mouse and joystick from the XBIOS vectors, keyboard from the
- AES unless asked otherwise */
+ /* Events: mouse and joystick from the XBIOS vectors, keyboard too
+ where the machine provides its vector, else from the AES */
events_driver = SDL_Atari_GetEventsDriver(SDL_TRUE);
if (events_driver == ATARI_EVENTS_INVALID) {
return -1;