VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I'm trying to implement a simple hook for the BIOS using an Option ROM which implements a INT 19h hook, which executes once the first INT 19 (Start of the boot sequence) is executed. It tries to keep all variables used by the caller intact (by pushing and restoring them to/from the stack instead of the caller).

This is what I've gotten so far:
https://bitbucket.org/superfury/unipcemu_pcxt … S.ASM?at=master

I've tried to make a small ROM (it's supposed to be 64k, with the final byte at address 0xFFFF being the checksum byte). The init function is called when the BIOS adds the ROM. This installs the INT19 interrupt handler and clears the first time flag in the BDA's specified area.

The INT19 interrupt handler saves it's registers to the stack, calls the first time INT19 initialization handler, finally restores the registers and calls the original BIOS handler itself. Finally, it tries to restore the state of the caller with the returned flags, then restores it's own saved data and returns to the caller normally, with the flags restored as the BIOS might expect it. The return address itself is unmodified by the INT19 interrupt handler. Any modifications made to the return address by the INT19 handler of the original BIOS will cause the BIOS ROM to abort it's restoring operation(since it won't be executing anymore).

Anyone can see if this is correct?

Edit: I've improved it a bit with interrupt 15h hooks (unused atm) and interrupt 1Ah hooks for adding either Timer V2.0(on a XT) or CMOS time support(on an AT) support to the XT BIOS. Also implemented the success handle to return with cleared carry flag when time/date is correctly set or retrieved for the extended interrupt to use. Currently the handlers still execute the original BIOS instead, because it's functionality itself is not implemented itself yet.
https://bitbucket.org/superfury/unipcemu_pcxt … S.ASM?at=master

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io