From 8f15d4da77dde4c6dd0d1f371ee2a86892440b1f Mon Sep 17 00:00:00 2001 From: Jonathan Campbell Date: Thu, 9 Oct 2025 17:48:41 -0700 Subject: [PATCH] INT 21h AH=4Bh (EXEC) on return, put a nonzero value in AX (and AL) for a buggy version of Magic Pockets so the INTRO proceeds to the GAME properly --- CHANGELOG | 5 +++++ src/dos/dos.cpp | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 9c775f6b9..f2fb1522c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,9 @@ NEXT VERSION + - INT 21h AH=4Bh EXEC: Real MS-DOS returns a nonzero value like 0x3E01. + A buggy version of Magic Pockets fails to call INT 21 AH=4Dh to read + the INTRO.EXE exit code and expects AL to just be nonzero to continue + to the game. So to make it work properly (kind of), return a nonzero + value. (joncampbell123). - Tandy machine type: Many registers are WRITE ONLY according to SX documentation, yet "Troubadours" likes to read/modify/write those registers in what appears to be hand-rolled manual modesetting code diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index 6585ddfba..80e83200c 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -2352,6 +2352,13 @@ static Bitu DOS_21Handler(void) { dos_program_running = false; *appname=0; *appargs=0; + /* Magic Pockets (slightly buggy version on the Internet Archive) expects AL + * to be nonzero to continue from INTRO.EXE to the game. The buggy version + * expects AL to be the INTRO.EXE error code but apparently they forgot to + * call INT 21h AH=4Dh to read it. Real MS-DOS appears to return something + * like AX=0x3E01 on return from INT 21h AH=4Bh. There is a non-buggy + * version on various abandonware sites that do not have this bug. */ + reg_ax=0x3E01; break; case 0x4d: /* Get Return code */ reg_al=dos.return_code;/* Officially read from SDA and clear when read */