Advertisement
Zeda

H_Times_E

Jul 1st, 2013
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. H_Times_E:
  2. ;Inputs:
  3. ;     H,E
  4. ;Outputs:
  5. ;     HL is the product
  6. ;     D,B are 0
  7. ;     A,E,C are preserved
  8. ;Size:  12 bytes
  9. ;Speed: 311+6b, b is the number of bits set in the input HL
  10. ;   average is 335 cycles
  11. ;   max required is 359 cycles
  12.      ld d,0 ;1600   7   7
  13.      ld l,d ;6A 4   4
  14.      ld b,8 ;0608   7   7
  15.         ;      
  16.      add hl,hl  ;29 11*8    88
  17.      jr nc,$+3  ;3001   12*8-5b 96-5b
  18.      add hl,de  ;19 11*b    11b
  19.      djnz $-4   ;10FA   13*8-5  99
  20.         ;      
  21.      ret    ;C9 10  10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement