Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

DPMI - how to chain user and original RM handler? (Developers)

posted by Laaca Homepage, Czech republic, 29.04.2023, 00:41

Hello!
I have a problem with my INT15h handler written in DPMI program.
I am able to redirect the realmode interrupt to my protected mode routine.
If I return back to real mode everything is fine.
The problem is when I want to call the original routine from the main.

I am trying to implement the INT 15h/AH=4Fh keyboard interrupt.
If I detect the 4Fh in the AH I can do what I want.
But if there is not the 4Fh (if there is f.e. AX=E820h) I have to put my hands off and just to call the original routine.
But I do not know how because my program crashes here....



procedure int15_handler; {$IFDEF NEWFPC}nostackframe;{$ENDIF}assembler;
{Handler for software interrupt 15h, installed by:
get_rm_callback(@int15_handler, int15_regs, newint15_handler);
Set_rm_interrupt($15, newint15_handler);}

{In Entrance:
 DS:ESI = real mode SS:SP
 ES:EDI = copied real mode registers to our protected mode segment
 disabled hardware interrupts}
 asm
 push ds
 push eax
 mov ax,es    {ES points to our protected mode segment}
 mov ds,ax    {Let also DS point to our segment to be FreePacal happy}


 pushad
 mov ax,DOSmemSelector
 mov fs,ax
 call Internal_Int15_Handler;  {written in pascal}

 popad


 pop eax
 pop ds       {restore DS}


 call es:[oldint15_handler]  {DOES NOT WORK !!! (Crashes here)}
{oldint15_handler is got from Get_rm_interrupt($15, oldint15_handler)}


 mov eax,ds:[esi+0]                         {restore return address (CS:IP)}
 mov es:[edi+2Ah],eax

 (*
 mov eax,ds:[esi+4]             {do we have to do anything with flags?}
 mov es:[edi+20h],ax
 *)

 add word ptr es:[edi+2Eh],6                {updates SP}
 iret
end;

---
DOS-u-akbar!

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 153 users online (0 registered, 153 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum