Re: Unexpected IRQ behaviour on a VIC-20

From: Spiro Trikaliotis <ml-cbmhackers_at_trikaliotis.net>
Date: Fri, 28 Jul 2017 22:27:01 +0200
Message-ID: <20170728202701.GA30655@hermes.local.trikaliotis.net>
Hello Ruud,

can you give a complete example?

* On Fri, Jul 28, 2017 at 09:04:43AM +0200 Ruud@Baltissen.org wrote:
 
 
> Original IRQ routine:
> 
> IRQroutine:  
> 	pla
> 	pla
> 	pla

Why do you pop the status and the return address from the stack? Do you
want to return to the calling routine of your program above?

If yes, the RTI is wrong, because it expects status + return address on
the stack, but (most probably), you do not have the status, do you?


> NMIroutine:  
> 	lda	#$33
> 	sta	IrqNmiCheck
> 
> 	sei				; disable interrupts

Why do you want to disable the interrupts? If my assumption above is
correct and you want to return to the caller of your code, then your
intention might be that you want to enable interrupts, don't you? In
this case, cli might be more appropriate (and that would make sense in
an interrupt routine, at least sometimes).

> 	rti

As said above, depending upon how you called your program and when the
IRQ is triggered, this will crash your machine as you do not have the
status register on the stack anymore.

At least, this will happen with your IRQRoutine.


As said, it would be best if you could give a complete, but as small as
possible, program code so we can see what you are doing, and tell us
what you are expecting.


Regards,
Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/

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

Archive generated by hypermail 2.2.0.