For msxgl this could be a very useful function. It would simplify the configuration of projects and allow optimal size for the generated asm
And it would save also a register, as it would use onl A instead of HL
Considering that n=5, you could also replace srl a by rra (saving 1 byte and some cycles). _gg:: ld b, #0x05 00103$: bit 0, a jr Z, 00102$ ld a, (de) ret 00102$: rra inc de djnz 00103$ ld a, b ret
Consiering that n=5, you culd also replace srl a by rra. _gg:: ld b, #0x05 00103$: bit 0, a jr Z, 00102$ ld a, (de) ret 00102$: rra inc de djnz 00103$ ld a, b ret
manually encoding the C function in the example leads to _calc_t: ; int tdx = gOffsetX >> 4; ld de, (_gOffsetX) sra d rr e sra d rr e sra d rr e sra d rr e ; tdx += i; add hl, de ; dx = tdx; ld (_calc_t_dx_10000_6), hl ; return tdx; ex de, hl ret Even when iy is not used, the compiler is ignoring the fact you can swap terms of an addition without changing the result
The generated code from v4.5 is very disappointing... I hope you have improved this issue in the current beta
This could improve a lot the efficiency of the z80 code during parameter exchange with existing routines
Any news about this feature?