; http://z80-heaven.wikidot.com/math#toc25 H_Times_E: ;Inputs: ; H,E ;Outputs: ; HL is the product ; D,B are 0 ; A,E,C are preserved ;Size: 12 bytes ;Speed: 311+6b, b is the number of bits set in the input HL ; average is 335 cycles ; max required is 359 cycles LD H, 7 LD E, 8 ; Inputs to Ports 0 + 1 LD C, 0 OUT (C), H LD C, 1 OUT (C), E LD D, 0 ;1600 7 7 LD L, d ;6A 4 4 LD B, 8 ;0608 7 7 ; ADD HL, HL ;29 11*8 88 JR NC, $+3 ;3001 12*8-5b 96-5b ADD HL, DE ;19 11*b 11b DJNZ $-4 ;10FA 13*8-5 99 ; Result to Ports 2 + 3 LD C, 2 OUT (C), H LD C, 3 OUT (C), L