Contributing - Zeda/z80float GitHub Wiki
Feel free to go through and optimize routines! If you want to use the shadow registers, be sure to make a call to diRestore
at the start of your routine. It disables interrupts and then sets up the stack so that when your routine exits, interrupts are restored to their previous state.
I haven't seen a need for this in the single-precision floats, so the routine isn't included (yet).
If you want to add your own floating point routine, the conventions are as follows:
- HL points to the first operand (if needed)
- DE points to the second operand (if needed)
- BC points to where the result is output (if needed)
- names should be functionSingle for the single precision routines, and xfunction for the extended precision routines. For example, the
add
operation, respectively:addSingle
andxadd
- Registers and interrupt status must be preserved.
- The subroutines can do whatever they like, but the user-facing routines should preserve the register values. Usually, this start with a sequence of
push
at the start of your routine andpop
at the end.
- The subroutines can do whatever they like, but the user-facing routines should preserve the register values. Usually, this start with a sequence of