SDL-1.2: atari:events:xbios: add check for unprocessed packets

From d5d4cba3c94d275356f026ef2ef35f3f9e61fdfb Mon Sep 17 00:00:00 2001
From: Miro Kropacek <[EMAIL REDACTED]>
Date: Sun, 7 Sep 2025 13:47:31 +0200
Subject: [PATCH] atari:events:xbios: add check for unprocessed packets

---
 src/video/ataricommon/SDL_xbiosinterrupt.S | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/video/ataricommon/SDL_xbiosinterrupt.S b/src/video/ataricommon/SDL_xbiosinterrupt.S
index d03073ea..59221b2f 100644
--- a/src/video/ataricommon/SDL_xbiosinterrupt.S
+++ b/src/video/ataricommon/SDL_xbiosinterrupt.S
@@ -66,6 +66,11 @@ SYM(SDL_AtariXbios_Install):
 #endif
 	movel	d0,a0
 
+	/* Test kbstate */
+processing_ikbd_packet_install:
+	tst.b	a0@(36)
+	bnes	processing_ikbd_packet_install
+
 	/* Stop interrupts */
 
 	movew	sr,d1
@@ -143,6 +148,11 @@ SYM(SDL_AtariXbios_Restore):
 #endif
 	movel	d0,a0
 
+	/* Test kbstate */
+processing_ikbd_packet_restore:
+	tst.b	a0@(36)
+	bnes	processing_ikbd_packet_restore
+
 	/* Stop interrupts */
 
 	movew	sr,d1