Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NT_INTERRUPT issues #369

Open
Bearsoft749 opened this issue Dec 16, 2023 · 2 comments
Open

NT_INTERRUPT issues #369

Bearsoft749 opened this issue Dec 16, 2023 · 2 comments

Comments

@Bearsoft749
Copy link

This code works in GCC 6.5 but does not work in GCC 13.1.
I must use "m68k-amigaos-strip" to get it to be executable in GCC 13.1.

#include <stdio.h>
#include <unistd.h>
#include <proto/exec.h>
#include <exec/execbase.h>
#include <hardware/intbits.h>

struct Interrupt *vbint2;
int counter;
int quit;
int value=0;
int valueEnd=60;

void startInterrupt(void *interruptFuncton)
{
vbint2=NULL;

if (vbint2 = (struct Interrupt *)AllocMem(sizeof(struct Interrupt), MEMF_PUBLIC|MEMF_CLEAR))
{
    vbint2->is_Node.ln_Type = NT_INTERRUPT;

    vbint2->is_Node.ln_Pri = -60;	//-60
    vbint2->is_Node.ln_Name = "VertB";
    vbint2->is_Data = (APTR)&counter;
    vbint2->is_Code = (void (*)())interruptFuncton;

    AddIntServer(INTB_VERTB, vbint2); 
}
else 
{
	printf("Can't allocate memory for interrupt node\n");	
}

}

void endInterrupt()
{
quit=1;

 if (vbint2 != NULL)
 {
    RemIntServer(INTB_VERTB, vbint2);
    FreeMem(vbint2, sizeof(struct Interrupt));

// printf("%ld vertical blanks occurred\nRemoving server\n", counter);
}
}

int waitInterrupt()
{
if (quit==2)
{
quit=0;
}

int tempQuit=quit;
quit++;

return tempQuit;

}

int interruptLoop()
{
while(!waitInterrupt())
{
value++;

	if (value>=valueEnd)
	{
		value=valueEnd;
	}
}

}

int main()
{
startInterrupt((void*)interruptLoop);

while(value<valueEnd)
{
	sleep(3);
}

endInterrupt();

printf("value %d\n", value);

return 0;

}

@Bearsoft749
Copy link
Author

I forgot...
m68k-amigaos-g++ -w -O3 -mno-align-int -funsafe-math-optimizations -ffast-math -mhard-float -fomit-frame-pointer -m68060 -noixemul -o main main.cpp

@bebbo
Copy link
Owner

bebbo commented Oct 11, 2024

please check again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants