Prev: 42089 Up: Map Next: 42112
42102: Divide By Repeated Subtraction
Used by the routines at ShiftTextPointer and PrintOneDecimalDigit.
Counts how many times DE can be subtracted from HL. Returns the count in A and the remainder in HL.
DivideBySubtraction 42102 LD A,255 Start the count at 255 so the first pass makes it zero.
DivideBySubtraction_0 42104 INC A Count in A how many times DE can be subtracted from HL, and repeat until HL goes below DE.
42105 AND A
42106 SBC HL,DE
42108 JR NC,DivideBySubtraction_0
42110 ADD HL,DE Add DE back to leave the remainder in HL.
42111 RET Return.
Prev: 42089 Up: Map Next: 42112