neowert wrote:
thats just great. one more thing t learn. How is that done? Does that mean there are 2 vector tables in memory, one for PM and one for RM. If so, what are the addresses. I would assume you can set the PM addresses with the IDTR.
Yes, there's two.
Firstly there's the IVT (Interrupt vector table) which operates in real mode and is setup by the BIOS initially (You can change it to your heart's desire if you want to operate in Real Mode though). The IVT occupies the first 512 bytes in memory starting at 0:0.
Secondly is the IDT (Interrupt descriptor table) which is used when operating in PMode. This can be located anywhere you like and consists of up to 256 8 byte entries.
Both are effectively lookup tables for the processor. It gets an interrupt, looks up the address of the code for the interrupt and jumps to it (With a few extra steps in PMode). You can be using one or the other, but never both at the same time. BIOS interrupt code (In general) is written in 16-bit instructions, therefore you
cannot use the BIOS interrupts in pure pmode because pmode operates in 32-bit instructions. This means just jumping to the address in the IVT won't work if you're in PMode because the code is in 16-bit instructions (Someone is bound to try it
). There are rare (Almost mythical some would say) 32-bit BIOS interrupts that you can use in PMode, but starting out I'd say just be aware of their existence and ignore them.
In order to use the BIOS interrupts you have to put the processor back into real mode,
or put it into virtual 8086 mode. In either of these modes you can use the IVT instead of the IDT, which comes in especially handy for things like the BIOS Vesa functions. This is one of the reasons you should
never overwrite the IVT with your own data, if in doubt work above 0x600 in memory (That will avoid writing in the BIOS data area as well, another useful thing to have around). If you do overwrite the IVT then you're stuck writing everything yourself, and that's a whole bunch of driver writing when you're just starting out. As should now be obvious, if you're determined to just operate in pmode, and never return to real mode or use the IVT then you can reclaim those 512 bytes for yourself (But it's not a hugely good idea).
Hope that makes it clearer, or at least a little bit clearer ;D.
Curufir