To compliment the zero flag, try the following...
ComplimentZ:
ld a, f
xor %01000000
ld f, a
another thought...
If you are signaling an error, why not just set it or reset it before you
return?...(depending on the outcome of the operation.)
-Michael
Engineer79@aol.com