16-bit subtraction
1 2 3
| or a ;to make sure the c flag is reset. Not always necessary if you know the c flag will be reset sbc hl,bc ;you can do sbc hl,de also.
|
32-bit addition (you mean two 32-bit inputs?)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| ;Inputs: ; HLBC is one of the 32-bit inputs ; DE points to the other 32-bit input in RAM ;Outputs: ; HLBC is the 32-bit result ; DE is incremented 3 times ; A=H ; c flag is set if there is an overflow ld a,(de) \ inc de add a,c \ ld c,a ld a,(de) \ inc de adc a,b \ ld b,a ld a,(de) \ inc de adc a,l \ ld l,a ld a,(de) adc a,h \ ld h,a ret
|
Squaring and square rooting... I will think on it

Also, I am working on a mini math library that will include RAM based math (so all the values will be in RAM). It seems like a few of these commands will need to rely on some memory. If they do, I suggest using the OP registers (11 bytes of RAM each).