
JOY_RIGHT_MASK  = %00000001
JOY_LEFT_MASK   = %00000010
JOY_DOWN_MASK   = %00000100
JOY_UP_MASK     = %00001000
JOY_START_MASK  = %00010000
JOY_SELECT_MASK = %00100000
JOY_B_MASK      = %01000000
JOY_A_MASK      = %10000000

zp_res JOYTEMP
; Reads joy_stick 1 into a (and JOYTEMP)
read_joy1:
        ; Init joysticks for reading
	lda #$01
	sta JOY1
	lda #$00
	sta JOY1

        ; Read JOY1
.repeat 8
        asl A
        sta JOYTEMP
        lda JOY1
	and #$01
        ora JOYTEMP
.endrepeat
        sta JOYTEMP
        rts

