Official Name: DivHLByA
BCALL Address: 4012
Divides the value in HL by the value in A.
- HL: integer
- A: integer
- HL = HL / A
- A = HL mod A
Simple enough to implement if speed is important. However, it may return invalid results if A is larger than 127 since the routine does not correctly handle overflows.
ld hl,13 ld a,5 B_CALL DivHLByA ;should return HL=2, A=3