[atari7800] Reading both fire buttons ?
- From: "Andy Mucho" <m00@xxxxxxxxxxxxxxxxxxx>
- To: <atari7800@xxxxxxxxxxxxx>
- Date: Tue, 28 Sep 2004 14:17:18 +0100
Erm, okay :) I can't seem to read the joystick buttons independently in
Mess, well I can if I remove support for single button devices, but the
problem seems to be that Mess pretends that any button press from the two
button device is also a fire input on the single input device, erm I think..
I gave up, and just borrowed the ReadJoystick function from Falcon, and this
seems to confirm this..
Any press from a dual button pad, also triggers the single button ?
Which in this code, will stop the dual mode ever trying to read again ?
I wouldn't normally worry about this, I'd just go off and code it up for 2
buttons only, but it'd be nice to be able to discern the joystick type
currently plugged in, and this comment worry me.. A lot :\
lda ONEBUT ;SET ONE-BUTTON MODE IMMEDIATELY
ora .jbits,X ; TO AVOID DESTROYING HARDWARE!
Which makes it seem important, that if we've a one button joystick we stop
buggering about with the 2 button ports..
Anyone tell me what's going on here ? Is it Mess ?
I've initialised the ports for the paddle inputs as in the docs, yet
lda #$14 ;IO HARDWARE
sta SWBCNT
lda #0 ;SELECT TWO BUTTON MODE
sta SWCHB
There's definitely 2 button input happening, but it's masked by the single
button input occurring as well ?
I'm puzzled.. (again)
I can see the simple solution, just to read the triggers independently, but
I don't like that, at all, because that's not going to tell me why this
doesn't work as expected ?
Btw: Is anybody else actually doing anything on the 7800 at the moment ? I'm
currently mucking about with some 3D filled polygon stuff, which is actually
really nice and fast on the 7800, of which I'll post a little demo to the
list in a day or so, well as soon as I can get the bloody fire button inputs
to work on one button and two button devices >:(
Andym00
; * READJOY: READ JOYSTICK/BUTTONS. ON ENTRY X = PLAYER. Y GETS
TRASHED
ReadJoystick: subroutine
ldy INPT4,X
bpl .gotone ; IF BIT 7 IS LO, OLD-STYLE BUTTON
HIT
lda ONEBUT ; ARE WE ALREADY IN OLD-STYLE MODE?
and .jbits,X
bne .gotone2 ; YES. GO RIGHT TO ONE-BUTTON HANDLER.
txa ; OTHERWISE, COMPUTE INDEX INTO
asl ; PADDLE PORTS, FOR PLAYER X,
tay ; IN Y (X * 2)
lda INPT4L,Y ;READ LEFT BUTTON
eor #$FF ; INVERT SENSE
sta LeftButton,X
lda INPT4R,Y ; RIGHT BUTTON
eor #$FF ; INVERT SENSE
sta RightButton,X
rts
;HERE ON OLD-STYLE SINGLE BUTTON JOYSTICK PRESS.
.gotone
lda ONEBUT ;SET ONE-BUTTON MODE IMMEDIATELY
ora .jbits,X ; TO AVOID DESTROYING HARDWARE!
sta SWCHB
sta ONEBUT ;UPDATE ONE BUTTON FLAG BYTE
;HERE ON ANY OLD-STYLE JOYSTICK, WHETHER PRESSED OR NOT
.gotone2:
tya
sta LeftButton,X ; (Y CONTAINS CURRENT VALUE OF INPT4)
sta RightButton,X ;CLEAR RIGHT BUTTON COPY
rts
.jbits BYTE $04,$10 ;MASK OF "ONE-BUTTON" BITS PER PLAYER
- Follow-Ups:
- [atari7800] Re: Reading both fire buttons ?
- From: Eckhard Stolberg
Other related posts:
- » [atari7800] Reading both fire buttons ?
- » [atari7800] Re: Reading both fire buttons ?
- » [atari7800] Re: Reading both fire buttons ?
- [atari7800] Re: Reading both fire buttons ?
- From: Eckhard Stolberg