Skip to content

Instantly share code, notes, and snippets.

@tomaes tomaes/joyloop.asm
Last active Aug 29, 2015

What would you like to do?
another joystick test, bitwise, looped, with comments too (c64)
; minimal joystick test #3, 21 byte 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--
CPY #0 ; explicit test to have a correctly set ZF
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
You can’t perform that action at this time.