Re: How interrupts work (x86 vs. C64)
- From: "Rod Pemberton" <spamtrap@xxxxxxxxxx>
- Date: Tue, 24 Oct 2006 16:04:24 -0400
"João Jerónimo" <spamtrap@xxxxxxxxxx> wrote in message
news:453e3fca$0$49200$14726298@xxxxxxxxxxxxxxxxxx
Bjarni Juliusson wrote:address
Some time ago I used interrupts at Commodore C-64. When I preset
of system interrupt (as I know there was only one interrupt available)
to my code (which ended with jump to original address of interrupt) the
result was, that my code was repeated continuously (~60 times pre
second, in other 'thread'). The interrupts at x86 seem to work
differently. How do they work, and how to 'emulate' behavior of
interrupt from C64 ?
There is a table in memory with pointers to a number of interrupt
routines to be called when the different interrupts occur. In real mode,
this table is at address 0, but in protected mode it can be located
anywhere and you set a register pointing to it.
I've read that (but not tried to) even in real mode you can have the IVT
anywhere in memory by setting its address using LIDT, just as in PMode...
Yes. You can relocate the RM IVT or the PM IDT by copying the table
elsewhere and using the LIDT instruction to set the new location.
For RM, DOS and DOS programs, (and perhaps BIOS) don't check to see if the
location of the IVT has been moved from 0. What this means is that you can
lock the IVT, preventing any further changes. The BIOS, DOS, and DOS
programs will modify the old IVT at 0, instead of the current one used by
the CPU. This technique was used by a virus many years ago, and may be used
by certain debuggers such as 386SWAT. Under MS-DOS v7.10 (Win98 SE),
locking the IVT in this manner is humorous at best. It appears that just
about every DOS internal command, or DOS program changes at least one
interrupt. About the only use for this technique that I've found, is to
save your original BIOS vectors to the memory around 640k or 512k, using a
small custom bootloader, which boots DOS afterward. You can then save them
from memory after DOS boots.
Perhaps, someone else (perhaps Mark Larson) could suggest some other use for
relocating the RM IVT.
Rod Pemberton
.
- References:
- How interrupts work (x86 vs. C64)
- From: MJ
- Re: How interrupts work (x86 vs. C64)
- From: Bjarni Juliusson
- Re: How interrupts work (x86 vs. C64)
- From: João Jerónimo
- How interrupts work (x86 vs. C64)
- Prev by Date: Re: how to decide the value of SF
- Next by Date: Re: how to decide the value of SF
- Previous by thread: Re: How interrupts work (x86 vs. C64)
- Next by thread: Re: How interrupts work (x86 vs. C64)
- Index(es):
Relevant Pages
|