[stella] How to detect that joystick button is pressed

Subject: [stella] How to detect that joystick button is pressed
From: "Eric BACHER" <ebacher@xxxxxxxxxxx>
Date: Mon, 27 Oct 1997 23:05:27 PST
Hello,

I am new to this list and I am trying to program the 2600 just for fun. 
I have a problem detecting that the joystick button is pressed. I read 
INPT4 but it always returns the same value !!!

So I made a small example program just to understand this point. I used 
Nick S. Bensema "How to draw a playfield" and I removed all comments to 
have a short listing that fit in this message.

Could someone tell me why this program does not work ? The background 
color should change when the fire button is pressed.

BTW: It works with PCAE but not with the real VCS !

Are there any register initializations to do or something like that.

Thank you very much for your help !

Eric.

----- start of listing -----

    include vcs2600.h
       
    org $F000
Start
    SEI
    CLD
    LDX #$FF
    TXS
    LDA #0
B1  STA 0,X
    DEX
    BNE B1

MainLoop
    JSR VerticalBlank
    JSR GameCalc
    JSR DrawScreen
    JSR OverScan
    JMP MainLoop

VerticalBlank
    LDA #2
    STA WSYNC  
    STA WSYNC
    STA WSYNC
    STA VSYNC
    STA WSYNC
    STA WSYNC
    LDA #44
    STA TIM64T
    LDA #0
    STA WSYNC
    STA VSYNC
    RTS

GameCalc
    LDA #0
    STA COLUBK

    LDA INPT4    ; It always returns
    BNE NoButton ; the same value !!

    LDA #$88
    STA COLUBK
NoButton
    LDA #$55
    STA PF0
    STA PF2
    ASL
    STA PF1
    LDA #1
    STA CTRLPF
    RTS

DrawScreen
    LDA INTIM
    BNE DrawScreen
    STA WSYNC
    STA VBLANK
    LDY #192
ScanLoop
    STY COLUPF
    STA WSYNC
    DEY
    BNE ScanLoop
    RTS

OverScan
    LDX #30
KillLines
    STA WSYNC
    DEX
    BNE KillLines
    RTS

    org $FFFC
    .word Start
    .word Start

----- end of listing -----


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

--
Archives updated once/day at http://www.biglist.com/lists/stella/archives/
Unsubscribing and other info at http://www.biglist.com/lists/stella/stella.html

Current Thread