DEHL_Div_BC_special.z80 321 B

12345678910111213141516
  1. DEHL_Div_BC_special:
  2. ;DEHL/BC ==> DEHL
  3. ;Given that it should error if DE is non-zero and remainder is guaranteed 0.
  4. ;First, if DE>=BC, then the output will exceed 16 bits, so we should error
  5. ex de,hl
  6. xor a
  7. sbc hl,bc
  8. jr c,+_
  9. ld de,-1
  10. ret
  11. _:
  12. add hl,bc
  13. ;Now enter into a normal DE/BC
  14. jp DE_Div_BC_continue