Alternate register set?

Other misc things
Post Reply
WORP3
Member
Posts: 26
Joined: Thu Dec 29, 2022 12:51 pm

Alternate register set?

Post by WORP3 »

Is it a good or safe idea to use the alternate register set during interrupts when using the new CLIB library?
If i'm not mistaken z88dk isn't using the alternate registers but I read somewhere that it can happen that the CLIB is using one or more alternate registers, is it somewhere known if the new CLIB is really using alternate registers and if so in which functions?

I really want to use a quicker storage of the register set during C calls from an interrupt source ;)
User avatar
jorgegv
Well known member
Posts: 287
Joined: Wed Nov 18, 2020 5:08 pm

Re: Alternate register set?

Post by jorgegv »

At least in some of the SP1 C stubs for Classic I used BC' in some places, so I guess you should save it if you are using it in your interrupt routine. But anyway, this "save whatever you modify" is standard recomendation when writing ISRs...
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: Alternate register set?

Post by stefano »

Sometimes we find target systems using the special registers in the interrupts, so the collisions with the libraries (mostly graphics and FP maths) are SORT OF managed by providing alternate libraries or workarounds (even z80asm can directly help a little bit!).

By the way, if you have the possibility to limit the complexity, why not doing so?
A faster interrupt routine might, in example, schedule part of its activity at a lower rate by keeping a local counter.
WORP3
Member
Posts: 26
Joined: Thu Dec 29, 2022 12:51 pm

Re: Alternate register set?

Post by WORP3 »

I'm not using any graphical or floating point libraries, also am I building al of my peripheral/target libraries myself. My only concerns are going out to the standard integer like math/compare stuff that is default inside the compiler.
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Re: Alternate register set?

Post by Timmy »

If you've followed our discussion about z88dk on the CPC (which is happening right now in the CPC thread), then you'll see that z88dk is using a lot of workarounds because the CPC firmware is using a lot of alternative registers. This basically made every single z88dk application or game run on it slower by 20%-50% compared to the programs that are avoiding the CPC firmware altogether.

By using the alternate register set yourself, the complexities have not really gone away, but they have shifted to everyone else building programs on top of it. It's probably not a big deal if you're not expecting anyone else building programs for it.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: Alternate register set?

Post by dom »

As a general rule if it involves 32bit or longer values then the alternate register set is likely to be used.
WORP3
Member
Posts: 26
Joined: Thu Dec 29, 2022 12:51 pm

Re: Alternate register set?

Post by WORP3 »

Thanks for the reply, I guess for now I just dischard the idea of using the alternate registers as temporary storage.
Post Reply