Re: How interrupts work (x86 vs. C64)



MJ wrote:
Hi,

Some time ago I used interrupts at Commodore C-64. When I preset address
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. The actual calling of interrupt routines is also a little more complicated in protected mode, but it's all covered by the manuals. Maybe someone in the group with the knowledge fresh in his memory can help you there. There are more than 1 interrupt (but didn't the C64 have two? one IRQ and one NMI?), tied to different events such as external interrupts, segment violation faults, traps, etc.

What exactly do you mean by "emulating the C64"? Do you want to get timer interrupts? In that case, how to do it depends on what kind of timer you have. Is this a PC? An old PC or a new one?


Bjarni
--

INFORMATION WANTS TO BE FREE

.



Relevant Pages

  • please help with 32bit flat protected mode code questions
    ... I have some questions about pmode 2.51 ... This program sets up a simple little protected mode handler for the timer ... lastkey db 16 dup;Last key caught by keyboard interrupt ... This code should set the real mode callback for a protected mode irq?. ...
    (comp.lang.asm.x86)
  • Re: Is it possible to use the value of the PROGRAM ID within the source code?
    ... >> Thank you for providing such a good example in support of my point. ... the hardware generated an interrupt 0. ... I previously showed how it could switch to real mode with a single instruction. ... it could switch back to protected mode and have ...
    (comp.lang.cobol)
  • Re: Assembly on Linux
    ... To be in protected mode, one of the bits in cr0 needs to be set. ... That's grossly oversimplified, but that's why you can't use bios interrupts in Linux. ... *might* be a way to execute a bios interrupt ... The bios interrupt allows you to select colors. ...
    (comp.lang.asm.x86)
  • Re: interrupts
    ... in my PM application that it should just hand off the interrupt to RM. ... > That I have compiled in djgpp 2.0 protected mode. ... > Then my protected mode application, my real-mode interrupt 0x16 handler is ...
    (comp.os.msdos.djgpp)
  • Question on The Timer Interrupt Dispatch
    ... For my understanding, in i386 architecture, the timer interrupts are ... initialized and a secondary CPU has enabled its local IRQ. ... I tried to confirm my guess by tracing the initialization code ... CPU 0 has handled about 70 ticks (i.e. timer interrupt) and CPU ...
    (Linux-Kernel)