From d7f4049849e14bfe244c040e97126afb234378c5 Mon Sep 17 00:00:00 2001 From: crazii Date: Mon, 18 May 2026 13:19:13 +0800 Subject: [PATCH] fix int08 stack for DPMI mode. --- iss_tim.pas | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/iss_tim.pas b/iss_tim.pas index 1d7ac8e..40bd993 100644 --- a/iss_tim.pas +++ b/iss_tim.pas @@ -61,6 +61,8 @@ Implementation +Var IntStack : array[0..4095] of byte; + Var TimerSpeed : DWord; OldTimer : TSegInfo; OldTimerCnt : DWord; @@ -96,7 +98,16 @@ PUSH FS PUSH GS PUSHAD + + { with DPMI, the stack is not DS/ES, but a minimal 4K locked pm stack dedicated for interrupts, switch to DS } + MOV CX, SS + MOV EDX, ESP MOV AX,CS:[BackupDS] + MOV SS, AX + LEA ESP, IntStack+4096 + PUSH CX + PUSH EDX + MOV DS,AX MOV ES,AX MOV AX,DosMemSelector @@ -129,6 +140,13 @@ MOV DX,$20 { þ Interrupt request acknowledge þ } MOV AL,$20 OUT DX,AL + + {restore old stack} + POP EDX + POP CX + MOV SS, CX + MOV ESP, EDX + POPAD POP GS POP FS