;multiplicatiom program DADDY ;input multiplicand in DE and input multiplier in A ;output product in HL, carry set if overflow ;********************** Test for zero and leading zeroes, (8-bit ; factor already determined and placed in A) DADDY: lxi h,0 ;clear output product register mvi b,8+1 ;set bit counter ana a ;is multiplier in A sera? (carry cleared) rz ;yes, skip multiplication operation; 0 in HL skip: dcr b ;check multiplier bit ral ;leading zero? jnc skip ;yes, ignore it and check next bit dad d ;no, load HL with multiplicand in DE; carry ; cleared ;********************** Multiplication starts in earnest next: dcr b ;more multiplier bits? rz ;no, return with result in HL dad h ;yes, do a DAD H, doubling the multiplicand rc ;overflow, carry set on return ral ;is the multiplier bit a 1? jnc next ;no, check the next bit dad d ;yes, do a DAD D too, adding the initial jnc next ;check the next bit multiplicand ret ;overflow, carry set on return