Prevent SLTWRK math every interrupt

Door S0urceror

Master (191)

afbeelding van S0urceror

14-08-2021, 07:03

Okay, I am developing a ROM that reserves some memory while booting. Standard stuff acting on H.STKE or H.CLEA. I initially stored the 16-bit pointer to this memory in the corresponding SLTWRK area. This depends on the slot, subslot and page the ROM is in.

And now comes the issue. I have also hooked H.TIMI which fires every interrupt. The idea is to check data that a worker process has put in this memory address and then do something with it. For this to work I have to do the SLTWRK math at every interrupt which is just a waste of CPU cycles. To get an idea what needs to be done every interrupt check here.

The question is, are there more standard compliant ways to do this? I can of course hardcode the expected SLTWRK address. I can store the pointer to my work area somewhere else with the risk it to be overwritten. Or do something non-standard and use a fixed non-used area above F380.

Any ideas? Let me know.

Aangemeld of registreer om reacties te plaatsen

Van hit9918

Prophet (2905)

afbeelding van hit9918

14-08-2021, 22:56

allocate some more RAM and copy the interrupt code there. and code like LD HL,0 gets patched in RAM with values calculated at boot time. after the patch it is a superfast LD HL,myworkarea.
and then the interrupt handler is above &hc000 and the H.TIMI hook could go with a simple JP instruction instead an interslot call. this saves a similar amount of time. then it really goes fast.
the interrupt code needs to be written with relative jumps so it works at a random address. or patch some instructions.
and then full compatibility and full speed, hehehe!

Van S0urceror

Master (191)

afbeelding van S0urceror

15-08-2021, 05:20

hit9918 wrote:

and then full compatibility and full speed, hehehe!

That’s a smart idea. When using relative addressing vs absolute addressing I have the TSR code and data together. And I don’t have to look it up up every interrupt. Thanks hit9918.