Proper way to call redirected bios ISRs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Erukaron
Posts: 13
Joined: Sat Feb 22, 2020 3:24 am
Libera.chat IRC: Erukaron
Location: Germany

Proper way to call redirected bios ISRs

Post by Erukaron »

Hello,

i have a question regarding the redirection of bios ISR. As it is good practice to call the bios ISR before leaving the custom ISR, i wonder what is the correct way of doing so? Is there a nice and tidy way to do so? I was using the following code, but i think this is not the proper way.

Code: Select all

    ; custom interrupt code



    ; Bios interrupt
    pushf
    push cs
    push .next_inst_after_int
    ; Load interrupt location into the stack
    push word [cs:bios_int_segment]
    push word [cs:bios_int_offset]
    ; Jump to bios interrupt location via stack
    retf ; simulate interrupt 

    .next_inst_after_int:

    iret
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: Proper way to call redirected bios ISRs

Post by Octocontrabass »

If the only instruction you want to put after the BIOS call is IRET, why not use a tail call and have the BIOS do the IRET for you?

Code: Select all

jmp far [cs:bios_int_offset_and_segment]
If you want to have other code besides just IRET, you'd do something like this instead:

Code: Select all

pushf
call far [cs:bios_int_offset_and_segment]
; more code here
Post Reply