Advertisement
Zeda

DEHL_Times_A

Jan 4th, 2012
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;===============================================================
  2. DEHL_Times_A:
  3. ;===============================================================
  4. ;Inputs:
  5. ;     DEHL is a 32 bit factor
  6. ;     A is an 8 bit factor
  7. ;Outputs:
  8. ;     interrupts disabled
  9. ;     BC is not changed
  10. ;     AHLDE is the 40-bit result
  11. ;     D'E' is the lower 16 bits of the input
  12. ;     H'L' is the lower 16 bits of the output
  13. ;     B' is 0
  14. ;     C' is not changed
  15. ;     A' is not changed
  16. ;===============================================================
  17.      di
  18.      push hl
  19.      or a
  20.      sbc hl,hl
  21.      exx
  22.      pop de
  23.      sbc hl,hl
  24.      ld b,8
  25. mul32Loop:
  26.        add hl,hl
  27.        rl e \ rl d
  28.        add a,a
  29.        jr nc,$+8
  30.          add hl,de
  31.          exx
  32.          adc hl,de
  33.          inc a
  34.          exx
  35.        djnz mul32Loop
  36.        push hl
  37.        exx
  38.        pop de
  39.        ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement