Re: Unexpected IRQ behaviour on a VIC-20

From: Marko Mäkelä <msmakela_at_gmail.com>
Date: Fri, 28 Jul 2017 10:44:22 +0300
Message-ID: <20170728074422.p3utv2vcokixa2qa@hp>
Hallo Ruud,

On Fri, Jul 28, 2017 at 09:04:43AM +0200, Ruud@Baltissen.org wrote:
>	sei				; disable interrupts
>	rti
[snip]
>I understand that the looping is caused by not clearing the
>interrupt. But the idea was that 'sei' should have prevented that.
>
>My question: why didn't 'sei' prevent the looping?

The SEI instruction inside an IRQ handler makes little sense, because 
the interrupt flag would already be set upon entering the interrupt 
handler.

Similarly, the RTI instruction would pop the P register from the stack, 
which would clear the interrupt flag.

>PS: I realised that I have to change the code anyway because 'sei' 
>won't work with NMI.

NMI is triggered on a falling edge of the signal. NMI can be effectively 
disabled by letting the signal to be permanently pulled down, for 
example by triggering an NMI from the VIA and then not clearing the 
interrupt status.

	Marko

       Message was sent through the cbm-hackers mailing list
Received on 2017-07-28 08:01:21

Archive generated by hypermail 2.2.0.