Advertisement
Zeda

sqrA

Apr 13th, 2016
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sqrA:
  2. ;;A*A->A
  3. ;;Destroys: HL
  4. ;;76cc or 79cc or 82cc
  5. ;;Avg: 79cc
  6. ;;51 bytes
  7.     add a,a
  8.     add a,a
  9.     jr nc,$+4
  10.     neg
  11.     rrca
  12.     rrca
  13.     ld l,a
  14.     srl l
  15.     ld h,sqrLUT/256
  16.     jr c,$+4
  17.     neg
  18.     add a,(hl)
  19.     ret
  20. sqrLUT:
  21. ;;MUST BE ALIGNED to a 256-byte boundary.
  22. ;;Can use:
  23. ;;  #if 0!=$&255
  24. ;;  .fill 256-($&255),0
  25. ;;  #endif
  26. .db $00,$06,$14,$2A,$48,$6E,$9C,$D2
  27. .db $10,$56,$A4,$FA,$58,$BE,$2C,$A2
  28. .db $20,$A6,$34,$CA,$68,$0E,$BC,$72
  29. .db $30,$F6,$C4,$9A,$78,$5E,$4C,$42
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement