English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 11 April 2022, 10:11   #21
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,636
Quote:
Originally Posted by ross View Post
But this usually works properly (every other CIA IRQ6 that doesn't matter is cleaned up and so for PAULA):
Code:
 btst #0,ICR(ciab)
 beq.b .x
...

.x
 move.w #$2000,INTREQ
 rte
That example still loses other cia int flags - I think you should do this if you care about multiple flags:
Code:
 move.b ICR(ciab),d0
 btst #0,d0
 beq .x
...
 btst #1,d0
 beq .x
...
.x
 move.w #$2000,INTREQ
 rte
hooverphonique is offline  
Old 11 April 2022, 10:40   #22
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
Quote:
Originally Posted by hooverphonique View Post
That example still loses other cia int flags
That's right, that's exactly the purpose in the case of testing a single CIA source and ignoring all the others.
It's the only case where the direct register test makes sense and that's why I put it

Quote:
I think you should do this if you care about multiple flags
Not fully right, you need a sequential test
ross is offline  
Old 11 April 2022, 15:01   #23
Jobbo
Registered User
 
Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 389
Most code I've seen will acknowledge the intreq as soon as possible. It's clear thought that it needs to be after the cia acknowledgement.

However, in your example if the code in the handler takes some significant amount of time what is the consequence of waiting until the end to clear intreq?

In more general cases I would have thought there is some chance you will miss an interrupt or handle it incorrectly?

I'm fuzzy on what happens when an interrupt happens during handling of an existing interrupt of the same level.
Jobbo is offline  
Old 11 April 2022, 15:13   #24
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
Quote:
Originally Posted by Jobbo View Post
Most code I've seen will acknowledge the intreq as soon as possible. It's clear thought that it needs to be after the cia acknowledgement.

However, in your example if the code in the handler takes some significant amount of time what is the consequence of waiting until the end to clear intreq?

In more general cases I would have thought there is some chance you will miss an interrupt or handle it incorrectly?

I'm fuzzy on what happens when an interrupt happens during handling of an existing interrupt of the same level.
Usually nothing changes because it is almost impossible for the same IRQ to arrive before you have finished the management code (if this happens it means that higher level IRQs have taken control and are executing code that lasts really long..., the same for the code of your own routine; in case it would go completely rethought the IRQ scheduler..).

Also in the case of the CIA you need double acknoledment (ICR re-set itself) so the problem never arises.
But take for example a VBI IRQ3 running code for more than 20ms and you write INTREQ at the end of the routine.
What's up? You simply missed an IRQ, but maybe it was just what you wanted
ross is offline  
Old 11 April 2022, 16:00   #25
Jobbo
Registered User
 
Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 389
Thanks Ross

That makes sense and I think my understanding is accurate.

It's really great to have you and others on here to answer questions about these details!
Jobbo is offline  
Old 11 April 2022, 22:37   #26
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 873
Quote:
Originally Posted by ross View Post
Code:
 btst #0,ICR(ciab)
 beq.b .x
...

.x
 move.w #$2000,INTREQ
 rte
For the 68040/68060 there has to be at least one additional cia/custom access between clearing intreq and rte!
Otherwise the IPL lines may still be unchanged and the same interrupt is triggered again.
Wepl is offline  
Old 11 April 2022, 22:56   #27
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
Quote:
Originally Posted by Wepl View Post
For the 68040/68060 there has to be at least one additional cia/custom access between clearing intreq and rte!
Otherwise the IPL lines may still be unchanged and the same interrupt is triggered again.
Of course, I just put simplified code to give the idea of the procedure
ross is offline  
Old 12 April 2022, 04:04   #28
mc6809e
Registered User
 
Join Date: Jan 2012
Location: USA
Posts: 372
Quote:
Originally Posted by Wepl View Post
For the 68040/68060 there has to be at least one additional cia/custom access between clearing intreq and rte!
Otherwise the IPL lines may still be unchanged and the same interrupt is triggered again.
Pointless microoptimization:

move.l #$02000000, INTREQ
mc6809e is offline  
Old 12 April 2022, 09:45   #29
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
Quote:
Originally Posted by mc6809e View Post
Pointless microoptimization:

move.l #$20000000, INTREQ
Nice
ross is offline  
Old 12 April 2022, 22:47   #30
leonard
Registered User
 
leonard's Avatar
 
Join Date: Apr 2013
Location: paris
Posts: 133
just read this interesting thread. I'm a bit surprised. does it mean LSP (the cia versionĂ  is entering the CIA interrupt code two times instead of 1? Or is it potentially happening on specific amiga configuration? ( CPU, memory etc). I never noticed entering CIA handler two times instead of one when using winuae debugger. ( but maybe I miss something )
leonard is offline  
Old 12 April 2022, 23:03   #31
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,182
Quote:
Originally Posted by leonard View Post
just read this interesting thread. I'm a bit surprised. does it mean LSP (the cia versionĂ  is entering the CIA interrupt code two times instead of 1? Or is it potentially happening on specific amiga configuration? ( CPU, memory etc). I never noticed entering CIA handler two times instead of one when using winuae debugger. ( but maybe I miss something )
The interrupt handler will run twice, but the second time it'll notice that no CIA IRQ has actually been triggered, so depending on what you mean by "CIA handler" that won't be called twice. I.e.
Code:
InterruptHandler:
    move.w    #$2000,$dff09c  ; runs twice
    btst.b    #0,$bfdd00 ; so does this 
    beq.s    .skipa  ; and this 
 ; but not this part
.skipa:
    rte ; runs twice
paraj is offline  
Old 12 April 2022, 23:38   #32
leonard
Registered User
 
leonard's Avatar
 
Join Date: Apr 2013
Location: paris
Posts: 133
Quote:
Originally Posted by paraj View Post
The interrupt handler will run twice
Damn I just checked and you're right interrupt occurs as soon as RTE exits. ( of course the btst/beq early out but still interrupts occurs two times!

Thanks for heads up, I'll fix the CIA version of LSP
leonard is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blitter interrupt during VERTB interrupt phx Coders. Asm / Hardware 38 01 October 2021 19:54
timer interrupt to emulate 60Hz jotd Coders. Asm / Hardware 3 14 August 2021 21:25
Timer instantly causes interrupt TCH Coders. Asm / Hardware 8 20 July 2021 15:48
example of a CIA timer interrupt in assembler using cia.resource Apollo Coders. Asm / Hardware 3 05 July 2013 08:40
CIA timer interrupt handler called twice during mod playback absence Coders. General 5 16 March 2009 18:55

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:41.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09681 seconds with 14 queries