Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: darkcoder on June 11, 2004, 03:14:15 PM

Title: double INTREQ write?
Post by: darkcoder on June 11, 2004, 03:14:15 PM
Hello

 From time to time I see someone reporting that the interrupt handler routines, before exiting,
 should write TWICE the register INTREQ to clear the interrupt request. Otherwise with 040/060 system
 interrupts are executed twice.

Example

InterruptLevel3

  move.l xxx,BPL1PT

  ...

  move #$0020,INTREQ
  move #$0020,INTREQ
  rte

 This solution of does work, but on my 040 other, more elegant solutions work too: for example it is enough
to execute a NOP before the RTE, since the NOP force the CPU to actually perform the write to the register
before executing the RTE (040 and 060 can defer the actual write to memory after performing other instructions
in the pipeline). Onother solution that work is to simply read a value from memory after the write to INTREQ.

So, in my programs I always use:

InterruptLevel3

  move.l xxx,BPL1PT

  ...

  move #$0020,INTREQ
  NOP
  rte

However recently I saw the source code for "The Player" P6.1.3 use BOTH the double write to INTENA AND the NOP.

So I wonder, is there some strange configuration where the double INTENA write is really needed?
And if yes, can you explain me why?

The Dark Coder
Title: Re: double INTREQ write?
Post by: Piru on June 11, 2004, 03:48:28 PM
Quote
So I wonder, is there some strange configuration where the double INTENA write is really needed?

I would say no.

Probably this is just coder paranoia, to make absolutely sure it works. :-)
Title: Re: double INTREQ write?
Post by: bloodline on June 11, 2004, 03:53:02 PM
Didn't Dave Haynie say something about the 040 holds the bus longer than it says it does and so weird things happen... Ok my mind is fuzzy... Please ignore me :-(
Title: Re: double INTREQ write?
Post by: xeron on June 11, 2004, 06:34:15 PM
Writing it twice is a proven, definate, 100% working solution. Why change something that works?
Title: Re: double INTREQ write?
Post by: darkcoder on June 14, 2004, 04:23:21 PM
because the aim is the knowledge and to have fun developing!
;-)

Please don't accept the evil (M$) logic to care only about being productive: that's a philosophy that brings you to the Gates!!
:-)

The Dark Coder
Title: Re: double INTREQ write?
Post by: JKD on June 14, 2004, 05:23:54 PM
Because it's entirely bizarre behaviour.

An Interrupt register should generate an interrupt every time it's written no? (Well, according to the pattern of bits of course..)

Very odd, sounds like a bug to me :D