30 September 2019, 18:30 | #1 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
BLIT interrupts being triggered, even when disabled?
I've not enabled BLIT interrupts, only PORTS and VERTB:
Code:
custom->intena = INTF_INTEN | INTF_ALL; // disable all interrupts custom->intreq = INTF_INTEN | INTF_ALL; // clear any interrupts that were pending ... custom->intena = INTF_SETCLR | INTF_INTEN | mask; custom->intreq = mask; My main loop does four blits, calling WaitBlt before each one. I get the occasional BLIT interrupt triggered. About once for each four blits. I can't understand this. If I enable BLIT interrupts, I get an interrupt for each blit, as you would expect. What on earth could I be doing wrong? |
30 September 2019, 18:38 | #2 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Does it still occur if you don't enable INTF_VERTB ?
|
30 September 2019, 18:52 | #3 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
Maybe you are enabling them elsewhere in your code, or you are not properly preventing the OS from using the blitter (e.g. OwnBlitter)...
|
30 September 2019, 18:59 | #4 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
|
30 September 2019, 19:00 | #5 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
|
30 September 2019, 19:10 | #6 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Code:
void _InterruptHandler_enableInterrupts(UWORD mask) { if (DEBUG) KPrintF("In _InterruptHandler_enableInterrupts.\n"); KPrintF("In _InterruptHandler_enableInterrupts - intena = 0x%04lx.\n", INTF_SETCLR | INTF_INTEN | mask); custom->intena = INTF_SETCLR | INTF_INTEN | mask; custom->intreq = mask; UWORD intenar = custom->intenar; KPrintF("In _InterruptHandler_enableInterrupts - intenar = 0x%04lx.\n", intenar); } Code:
In _InterruptHandler_enableInterrupts. In _InterruptHandler_enableInterrupts - intena = 0xC008. In _InterruptHandler_enableInterrupts - intenar = 0x4028. |
30 September 2019, 19:18 | #7 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
Read the interrupt register at start of the function and you will see this. |
|
30 September 2019, 19:27 | #8 | |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Quote:
Code:
In _InterruptHandler_enableInterrupts - intenar = 0x0020. In _InterruptHandler_enableInterrupts - intena = 0xC008. In _InterruptHandler_enableInterrupts - intenar = 0x4028. |
|
30 September 2019, 19:43 | #9 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
In my system takeover function I do this:
Code:
KPrintF("In TakeSystem - intenar = 0x%04lx.\n", custom->intenar); custom->intena = INTF_INTEN | INTF_ALL; // disable all interrupts custom->intreq = INTF_INTEN | INTF_ALL; // clear any interrupts that were pending KPrintF("In TakeSystem - intenar = 0x%04lx.\n", custom->intenar); Code:
In TakeSystem - intenar = 0x202C. In TakeSystem - intenar = 0x0000. |
30 September 2019, 19:49 | #10 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
So, my startup code calls LoadView(NULL). This seems to have a side effect of enabling VERTB. So I need to find a better example to copy my startup code from. In the meantime I'll disable interrupts again after that call, and see if I can get back to the original problem.
|
30 September 2019, 20:12 | #11 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I'm only getting the BLIT interrupts if I have VERTB interrupts enabled. I do not have BLIT interrupts enabled.
Code:
In _InterruptHandler_handleLevel2Interrupt. In _GameInterruptHandler_processPORTS. Key pressed: 0x22 In _InterruptHandler_handleLevel2Interrupt. In _GameInterruptHandler_processPORTS. In Tick. In _TripleBufferedDisplay_getScreenBuffer. In _SplitDisplay_getScreenBuffer. In _SplitDisplay_getPrimaryScreenBuffer. In SetOrClearBitPlane - intenar = 0x4028. Blitter started! In SetOrClearBitPlane - intenar = 0x4028. Blitter started! In SetOrClearBitPlane - intenar = 0x4028. Blitter started! In _InterruptHandler_handleLevel3Interrupt (BLIT). In _InterruptHandler_processUnimplementedInterrupt. In SetOrClearBitPlane - intenar = 0x4028. Blitter started! In __TripleBufferedDisplay_flipDisplay. Code:
static __attribute__((interrupt)) void _InterruptHandler_handleLevel3Interrupt(void) { // if (DEBUG) KPrintF("In _InterruptHandler_handleLevel3Interrupt.\n"); UWORD intreqr = custom->intreqr; if (intreqr & INTF_COPER) { // if (DEBUG) KPrintF("In _InterruptHandler_handleLevel3Interrupt (COPER).\n"); interruptHandler->_processInterrupt(interruptHandler, INTB_COPER); custom->intreq = (UWORD) INTF_COPER; custom->intreq = (UWORD) INTF_COPER; } if (intreqr & INTF_VERTB) { // if (DEBUG) KPrintF("In _InterruptHandler_handleLevel3Interrupt (VERTB).\n"); interruptHandler->_processInterrupt(interruptHandler, INTB_VERTB); custom->intreq = (UWORD) INTF_VERTB; custom->intreq = (UWORD) INTF_VERTB; } if (intreqr & INTF_BLIT) { if (DEBUG) KPrintF("In _InterruptHandler_handleLevel3Interrupt (BLIT).\n"); interruptHandler->_processInterrupt(interruptHandler, INTB_BLIT); custom->intreq = (UWORD) INTF_BLIT; custom->intreq = (UWORD) INTF_BLIT; } } |
30 September 2019, 20:20 | #12 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
INTREQR is updated when the source trigger an IRQ, even if it is not enabled in INTENA.
Obviously the IRQ code handler does not start. This is a normal behavior. If another IRQ of the same level trigger then you need to check if enabled (INTENAR). You can also optionally clean it (INTREQ), if you intend to use it in any way. Last edited by ross; 30 September 2019 at 20:28. Reason: better explained |
30 September 2019, 20:30 | #13 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I'm not sure I understand - I need to check both INTENAR and INTREQR and ignore anything where the correct INTENAR bits aren't set (but still clear the INTREQ bit)?
|
30 September 2019, 20:36 | #14 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
Quote:
Of course you need to exclude the related INTREQR read in code. |
|
30 September 2019, 20:44 | #15 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Yeah, I'm still not getting it. I don't have BLIT interrupts enabled (INTENAR = 0x4028), but they're still happening. Is this what I should expect?
|
30 September 2019, 20:56 | #16 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
Quote:
But IRQ3 do not trigger if you not enable it in INTENA. Is up to you to ignore it during the IRQ routine. If you are unsure if you need it (cause a generic IRQ3 routine), then you have to also check INTENAR. Example: Code:
move.w #$7fff,(INTENA) move.w #$7fff,(INTREQ) move.w #$c030,(INTENA) ... IRQ3: moveq #$VERTB,d1 and.w (INTREQR),d1 ;a VERT request? and.w (INTENAR),d1 ;is the IRQ enabled? beq.b .cop ;no, skip ;handle VERTB ;clean VERTB in INTREQ ; bra.b .exit .cop moveq #$COPER,d1 and.w (INTREQR),d1 ;a COPER request? and.w (INTENAR),d1 ;is the IRQ enabled? beq.b .bli ;no, skip ;handle COPER ;clean COPER in INTREQ ; bra.b .exit .bli moveq #$BLIT,d1 and.w (INTREQR),d1 ;a BLIT request? and.w (INTENAR),d1 ;is the IRQ enabled? beq.b .exit ;no, skip ;handle BLIT ;clean BLIT in INTREQ .exit Last edited by ross; 30 September 2019 at 21:18. Reason: added more pseudocode :) it is voluntarily bloated |
|
30 September 2019, 20:58 | #17 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
|
30 September 2019, 21:08 | #18 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
|
30 September 2019, 21:16 | #19 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Yes. And another impact of this is that if I'm enabling interrupts at specific points in my code I also need to clear the matching bits in intreq as I don't know what might be in there.
|
30 September 2019, 21:17 | #20 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
Quote:
EDIT: ah, clear before enable it, this avoid potential immediate trigger Last edited by ross; 30 September 2019 at 21:23. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to calculate possible blit times? | Tigerskunk | Coders. Asm / Hardware | 32 | 11 January 2022 08:24 |
Blitz- cannot blit a shape | peceha | Coders. Blitz Basic | 8 | 10 April 2021 23:56 |
Copper Interrupts and Blit Performance | mcgeezer | Coders. Asm / Hardware | 14 | 04 May 2019 02:15 |
Damn Interrupts | mcgeezer | Coders. Asm / Hardware | 10 | 24 March 2019 16:50 |
CIA interrupts... | bloodline | Coders. System | 6 | 18 January 2018 10:33 |
|
|