The coders of the CPC's firmware obviously have been 8080 coders (its not only me who told so), they haven't been acquainted to the additional commands of the Z80. This can be seen at many examples:
- The previously described LDIR case - imho a waste of space and totally needless
- No proper use of IM 2 which would have been really nice (ok, lack of proper daisy chain either)
- no usage of the 2nd register set at all (except ints)
- often: using routines clearly made for the 8080, a Z80 implementation would look different (shorter, more quick)
- Usage of the index registers (not per se, but the way how they use em)
- Waste of alternate registers for interrupt handling, which is the most stupid and sad problem:
Let me elaborate on this: An interrupt occurs every 1/300 seconds. This is once in 3330 us. To use EXX and EX AF,AF twice (save & restore) takes 4 us. PUSH and POP these registers would take 4 * (4+3) = 40 us.
So, using 2nd registers instead of PUSH/POP saves 36 us every interrupt!Now if we would be able to use the 2nd register set then we could perform two routines or more similar, have Z80 registers instead of RAM registers (access is four times more quick, example EX AF,AF' is 1 us, but LD (xxxx),A is 4 us). So being able to use the 2nd register set boosts processing power between 30% and 200%. Lets say we only get the small 30% out of it. 30% of 3330 us is 999 us.
So, using 2nd register set for code (not interrupts) saves 999 us between two interrupts!This is: 2775%Of course there are some people telling: Oh you can use the 2nd register set. Yes that's true! I can do this by:
- Switching off interrupts
- Saving 2nd reg. file to RAM
- call routine
- Restoring 2nd reg.set
- Enabling Interrupts again.
Of course this is totally senseless, because all the speed up the 2nd reg.file brings get lost by the need of saving them to RAM all time long, also I probably will miss some interrupts and screw something.
I don't want to offend somebody, but it was about time to talk about it.