Advertisement
Zeda

getKey (24 bytes, 370cc)

Oct 13th, 2015
604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. getkey:
  2. ;;Returns L,B,A=0, z flag set if no key is pressed
  3. ;;22cc+60G+24R
  4. ;;R is on [1,8]
  5. ;;G is on [1,7]
  6. ;;avg: 370cc
  7. ;;24 bytes
  8.     ld bc,$FE01
  9.     xor a
  10. loop:
  11.     out (c),b
  12.     add a,$20
  13.     sla b
  14.     ret nc
  15.     in l,(c)
  16.     inc l
  17.     jr z,loop
  18.     rrca
  19.     rrca
  20.     inc a
  21.     rr l
  22.     jr nc,$-3
  23.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement