English Amiga Board

Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

Thread Tools
Old 19 November 2020, 19:52   #1
Ernst Blofeld
Registered User

Join Date: Sep 2020
Location: France
Posts: 56
Enabling interrupts -> lockup?

So, I have this code, which is intended to enable copper interrupts:
KPrintF("a, %08lx 0x%04lx", custom, mask);
    custom->intreq = mask;
    custom->intena = INTF_SETCLR | INTF_INTEN | mask;
It outputs:
a, 00DFF000 0x0010
i.e. it never gets the the

Interrupts are happening, I can see them if I add KPrintFs to my level 3 interrupt handler, but my mainline code seems to have stalled.

I think I've taken over the system correctly.

I'm stumped at how to debug this. Any hints?


The interrupts that are happening are not mine, as I don't yet trigger any interrupts in my copper list...

Edit 2:

So, the interrupts I'm getting are VBLANKs,

static __attribute__((interrupt)) void HandleLevel3Interrupt(void) {
    KPrintF("L3 0x%04lx", custom->intreqr & custom->intenar);
Is outputting

L3 0x0020
But those interrupts should be disabled, my system takeover code includes:

    custom->intena = INTF_INTEN | INTF_ALL; // disable all interrupts
    custom->intreq = INTF_INTEN | INTF_ALL; // clear any interrupts that were pending
and I've just checked, that's putting 0x7FFF into both addresses.

Last edited by Ernst Blofeld; 19 November 2020 at 20:31.
Ernst Blofeld is online now  
Old 19 November 2020, 20:39   #2
Total Chaos forever!

Samurai_Crow's Avatar
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 46
Posts: 1,587
Send a message via Yahoo to Samurai_Crow
The blitter generates thw same interrupt as the copper. I hope that helps your diagnostics.
Samurai_Crow is offline  
Old 19 November 2020, 22:54   #3
Registered User

Join Date: Jun 2016
Location: europe
Posts: 228
1. order of operations matters
2. maybe the 3rd print is happening but it gets "interrupted" before it's finished (I don't know how exactly kprintf works)
3. clear corresponding intreq bit(s) in your interrupt handler, otherwise it will be perpetually called and lock up your main
a/b is offline  
Old 20 November 2020, 09:54   #4
Ernst Blofeld
Registered User

Join Date: Sep 2020
Location: France
Posts: 56
Ok, I now know that I'm getting VERTB interrupts even though I've disabled them.

My interrupt handler looks like this:

static __attribute__((interrupt)) void HandleLevel3Interrupt(void) {
    if (custom->intreqr & custom->intenar & INTF_COPER) {

        custom->intreq = (UWORD) INTF_COPER; custom->intreq = (UWORD) INTF_COPER;

    if (custom->intreqr & custom->intenar & INTF_VERTB) {

        custom->intreq = (UWORD) INTF_VERTB; custom->intreq = (UWORD) INTF_VERTB;
And the output I'm seeing is:
The disassembled code for my interrupt disabling is:

move.w  #32767,dff09a
move.w  #32767,dff09c
(32767 is 0x7fff)

Last edited by Ernst Blofeld; 20 November 2020 at 10:12.
Ernst Blofeld is online now  
Old 20 November 2020, 10:22   #5
Ernst Blofeld
Registered User

Join Date: Sep 2020
Location: France
Posts: 56
Ok, I understand now. My startup code calls LoadView(NULL), which re-enables the VERTB interrupt.

Last edited by Ernst Blofeld; 20 November 2020 at 12:38.
Ernst Blofeld is online now  
Old 20 November 2020, 10:30   #6
This cat is no more
jotd's Avatar
Join Date: Dec 2004
Location: FRANCE
Age: 49
Posts: 4,603
mixing the OS with hardware banging is tricky

my code (in Bagman) calls LoadView/OwnBlitter then takes over the copperlist and all and never calls any OS routine ever...
jotd is online now  
Old 20 November 2020, 12:28   #7
ex. demoscener "Bigmama"

Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,164
Originally Posted by Ernst Blofeld View Post
Ok, I understand now. My startup code calls LoadView, which re-enables the VERTB interrupt.
Perform your hardware-banging *after* doing OS stuff in startup, and the reverse when restoring
hooverphonique 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
Keyboard, lockup nikosidis support.Hardware 0 18 September 2020 09:34
Enabling Firecracker 24? StrangeVoyager support.WinUAE 2 23 May 2019 22:24
Crash on enabling 68030 MMU with 3.0.0 mark_k support.WinUAE 14 25 January 2015 15:09
A500 lockup - please help Exi support.Hardware 7 29 July 2003 15:49

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 22:12.

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