Page 1 of 1

Proper way to call redirected bios ISRs

Posted: Sun Dec 13, 2020 3:55 pm
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

Re: Proper way to call redirected bios ISRs

Posted: Sun Dec 13, 2020 4:51 pm
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