Re: [stella] Reflex: Paddle woes

Subject: Re: [stella] Reflex: Paddle woes
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Fri, 02 Apr 2004 18:05:52 -0500
>No, it is completely different but still simple. Check the archives,
>we had a longer thread ("reading the driving controllers, generic
>thoughts") about this one or two years ago.

The driving controller is really nice, I used it in one of my Vectrex games (Tsunami).

The input is a quadrature... A 2 bit sequence that proceeds 00, 01, 11, 10, you read the current value and compare it to the previous value to determine if there's been movement. You need to poll the controller often enough that you don't miss any movement (once per frame  should be enough)

This is the code from Tsunami, it's in 6809. $C816 and $C817 are two of the regular controller buttons and represent each of the 2 bits. The driving controller inputs just happen to map to those Vectrex ports. Just substitute the TIA inputs (I believe). The 6809 has some extra registers, of which B is the only one used here. Just think of it as identical to A, except to and extra register so LDB=LDA except the value goes into the B register instead of A. Otherwise this should be perfectly readable:

player_plus and player_minus are the routines to handle movement in the appropriate direction and are not included.


read_spinner:
;00
;01
;11
;10
;                 *     console 2, button 1:    C816
;                 *                button 2:    C817
          lda #$00
          ldb $c816
          beq not_a2
          lda #$02
not_a2:
          ldb $c817
          beq not_b2
          inca
not_b2:
          cmpa old_spinner
          beq no_spinner_move

          ldb old_spinner          
          sta old_spinner
          cmpa #$00
          bne not_spin1
          cmpb #$01
          beq player_plus
not_spin1:
          cmpa #$01
          bne not_spin2
          cmpb #$03
          beq player_plus
not_spin2:
          cmpa #$03
          bne not_spin3
          cmpb #$02
          beq player_plus
not_spin3:
          cmpa #$02
          bne not_spin4
          cmpb #$00
          beq player_plus
not_spin4:

          cmpa #$00
          bne not_spin5
          cmpb #$02
          beq player_minus
not_spin5:
          cmpa #$02
          bne not_spin6
          cmpb #$03
          beq player_minus
not_spin6:
          cmpa #$03
          bne not_spin7
          cmpb #$01
          beq player_minus
not_spin7:
          cmpa #$01
          bne not_spin8
          cmpb #$00
          beq player_minus
not_spin8:

no_spinner_move:

          rts



----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread