Skip to content

Instantly share code, notes, and snippets.

@tomaes
Last active May 9, 2020 08:39
Show Gist options
  • Save tomaes/9343651 to your computer and use it in GitHub Desktop.
Save tomaes/9343651 to your computer and use it in GitHub Desktop.
another joystick test, bitwise, looped, with comments too (c64)
; minimal joystick test #3, 21 bytes loop version; @ = not set, A = set
* = $1000
INIT LDY #8 ; init loop for checking all joystick port bits
LDA $DC00 ; load joystick port byte
LOOP PHA ; make a copy and put it on the stack
AND #1 ; least significant bit set?
STA $0400,Y ; put either 0 or 1 (poke code) on screen
PLA ; get joystick byte back from stack
LSR ; shift right to get next bit
DEY ; y = y - 1
CPY #0 ; explicit test to have a correctly set zeroflag
BNE LOOP ; finished inner loop?
JMP INIT ; all bits checked. get a fresh load.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment