Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm writing my own operating system, and I want to cheat by avoiding writing my own floppy drive (at least for now). So would this work?
1. Before entering protected mode I save the IDT pointer somewhere, and use it to find the address of int 13.
2. I enter protected mode, and set up my new idt, with faults and everything set up.
3. I add a new interrupt somewhere where it won't get in the way and point it to the old int 13 routine.
4. I then call my new interrupt like I used to call int 13 in real mode.Will this work? Or does the int 13 code call other interrupts or anything that can't make the switch to protected mode?
Any information is appreciated.

Answer: NO. That will not work.
INT 13h code is BIOS code that is written for REAL mode. It is using the Segment Registers in their normal REAL mode usage and loading them with fixed values, not as Segment Selectors (protected mode). The INT 13h code will also call other INT xxh routines that do the same, and it access area's of real mode memory directly.
The only way to make that work is to create a Virtual Machine (DOS) and switch control to it and have code in it call the INT 13h in VM Real mode. This is basically what Windows has to do when it is running the disk/diskette drivers in Compatibility mode (using the BIOS). But that is a lot of code. It has to be able to trap out many I/O address and handle all the I/O and DMA in protected mode drivers. Sort of defeats the purpose of why you want it to work.
I once wrote a version of BIOS long ago that would allow you to do the type of thing you want to do with ease (only had to setup a few "special" selectors), but the project was killed before I had the problems with DMA devices (like a NIC card) worked out (had the rest working in PIO mode). It was to be a full dual mode BIOS. That is what all PC systems would have today, if it were not for the fact that some people could only see "their version" of the future coming and nothing else. So Microsoft took over.

Thanks for the help JackG, I guess I'll have to bite the bullet and write the DMA and fdc code. *sigh*. Do you know any sites for good info on such topics? I'm finding it kind of hard to get any real information for this kind of stuff.
Thanks again

There's another way to use BIOS in protected mode, but it's very hard to do.
In the GDT:
- Create a descriptor appropriate for Real Mode;In the IDT:
- Create a descriptor for PMODE Int 13h;In the PMODE Int 13h handler:
- Save registers;
- Switch to Real Mode;
- Set segment registers
- Set registers;
- Call the interrupt;
- Switch to Protected Mode
- Set Segment Regs.
- Restore registers.
- Make an IRET.
If you don't want to write a V86 monitor, or write the drivers, this is the only way to use BIOS in Protected Mode.I'm using this in my OS, so it may work.

![]() |
VB Application Wizard
|
FTP C/C++ library
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |