Posted By
Mad on 2018-11-14 00:57:30
| Re: How to read joystick?
That's the routine I gathered from the sparse information I found.. Just as a actually working scribble.. I think everyone at plus4world has it's own routines. And maybe all of them are better (and optimized) .. The thing with disabling left if you move right is just for the emulator it can not happen in real life as far as I know..
;------------------------------------------------------------- ;-- gathers the joystick -- ;------------------------------------------------------------- ; 7 Joystick 2 Fire (0=Pressed, 1=Released) ; 6 Joystick 1 Fire (0=Pressed, 1=Released) ; 3 Joystick 1/2 Right (0=Moved, 1=Released) ; 2 Joystick 1/2 Left (0=Moved, 1=Released) ; 1 Joystick 1/2 Down (0=Moved, 1=Released) ; 0 Joystick 1/2 Up (0=Moved, 1=Released) JOYSTICKSELECT1 = %00000010 JOYSTICKSELECT2 = %00000100 SUBROUTINE .temp dc.b $00 gatherJoystick1 lda #$ff sta $fd30 lda #JOYSTICKSELECT1 sta $ff08 lda $ff08 eor #$ff sta .temp and #$02 sta joyMoveDown1 beq .notdown lda #$00 sta joyMoveUp1 .notdown lda .temp and #$01 sta joyMoveUp1 beq .notup lda #$00 sta joyMoveDown1 .notup lda .temp and #$04 sta joyMoveLeft1 beq .notleft lda #$00 sta joyMoveRight1 .notleft lda .temp and #$08 sta joyMoveRight1 beq .notright lda #$00 sta joyMoveLeft1 .notright lda .temp and #$40 sta joyPressed1 rts
|