Advertisement
Runer112

Untitled

Sep 17th, 2011
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. ;===============================================================
  2. GetKey:
  3. ;===============================================================
  4. ;Outputs:
  5. ; bc is a value from 0 to 56 that is the keypress
  6. ; d has a bit reset, the rest are set (this is the last key group tested)
  7. ; e is a with a mask of %11111000
  8. ; hl is not modified
  9. ;===============================================================
  10. ld de,$7FF8 ;11F87F
  11. ld bc,0 ;010000
  12. KeyLoop:
  13. rlc d ;CB02
  14. ld a,d ;7A
  15. out (1),a ;D301
  16. ret p ;F0
  17. ld a,8 ;3E08
  18. add a,e ;83
  19. ld e,a ;5F
  20. in a,(1) ;DB01
  21. inc a ;3C
  22. jr z,KeyLoop ;28EC
  23. dec a ;3D
  24. inc c ;0C
  25. rra ;1F
  26. jr c,$-2 ;38FB
  27. ld a,e ;83
  28. add a,c ;81
  29. ld c,a ;4F
  30. ret ;C9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement