Re: A89: Keypresses slow down programs
[Prev][Next][Index][Thread]
Re: A89: Keypresses slow down programs
Hi!
| My tip is to always disable all interrupts that you don't use.
| If you don't use any, just disable them all with trap #1, if you use some,
like
| with grayscale or something, change all the rest to a dummy interrupt
which just
| rte:s
| Then you are always shure that the OS doesn't steal valuable cycles at any
time.
OK; I changed interrupt 2 (0x68) to rte. It gives me an ILLEGAL INSTRUCTION
error every time I press a key other than ON (which triggers the interrupt).
What am I doing wrong? My C code for Interrupts.h is this:
// Interrupt Handling
void *IntGetFunctionAddress (void **IntAddress);
void IntSetFunctionAddress (void **IntAddress, void *FunctionAddress);
void *IntDisable (void **IntAddress);
void IntEnable (void **IntAddress, void *DisableResult);
extern void *__dint;
asm(" xdef __dint
__dint: rte ");
void *IntGetFunctionAddress (void **IntAddress)
{
return (*IntAddress);
}
void IntSetFunctionAddress (void **IntAddress, void *FunctionAddress)
{
unsigned char Protection;
Protection = *((unsigned char*)(0x600001));
*((unsigned char*)(0x600001)) = Protection & (~(0x04)); // reset bit 2
*IntAddress = FunctionAddress;
*((unsigned char*)(0x600001)) = Protection;
}
void *IntDisable (void **IntAddress)
{
void *Addr;
Addr = IntGetFunctionAddress (IntAddress);
IntSetFunctionAddress (IntAddress, __dint);
return Addr;
}
void IntEnable (void **IntAddress, void *DisableResult)
{
IntSetFunctionAddress (IntAddress, DisableResult);
}
// end of file
I would greatly appreciate any help from anybody. Those two lines are my
first code segment in ASM. :-) BTW: If I insert NOP before RTE, I get an
address error instead. Maybe that helps. I also tried declaring '__dint'
as a void function, but then the program displayed an address error every
time I ran it.
I call IntDisable ((void*)(0x68)) at the beginning, after initializing
grayscale. At the end I call IntEnable, to which I have to pass the result
of IntDisable. I think you should be able to figure out the rest.
When I run my program with disabled auto-int 2, grayscale (which uses
auto-int 1) gets messed up pretty badly. Maybe that's another hint.
Bye,
Sebastian
References: