Shannon Posted June 13, 2008 Share Posted June 13, 2008 Looking at the source Curt posted for Desert Falcon got me wondering. The code mentions changing to old-style/one button mode when a regular 2600 stick is hooked up. It implies that hardware damage can occur otherwise. So is it actually doing something to change the way the hardware reads the sticks? Or is it something else. I notice the value it sends to SWCHB uses bits that are designated as "not used". Is this true? Or is the 7800 documentation out there incorrect? Here is a snipit of the code that reads the joystick.. * DOALLIO MAPS HARDWARE FIREBUTTON INTO SOFTWARE REGS. SAME FOR * SWCHB. COMPLEMENTS OF ETHAN DOALLIO LDA SWCHA ;FOR TRIGGERING BREAKPOINTS. WILL BE ;MADE INTO MECHANISM TO STUFF SOFTWARE ;REGISTERS LDA SWCHB ;GET SWCHB FOR RESETS AND SUCH AND #$0B STA SWCHBIO CKJOY LDX #1 ;DO PLAYERS 1 AND 0 ZNXTRJ JSR READJOY ;READ HIS JOYSTICK DEX BPL ZNXTRJ RTS * READJOY: READ JOYSTICK/BUTTONS. ON ENTRY X = PLAYER. Y GETS TRASHED READJOY LDY INPT4,X BPL GOTONE ;IF BIT 7 IS LO, OLD-STYLE BUTTON HIT LDA ONEBUT ;ARE WE ALREADY IN OLD-STYLE MODE? AND RJBITS,X BNE GOTONE2 ;YES. GO RIGHT TO ONE-BUTTON HANDLER. TXA ;OTHERWISE, COMPUTE INDEX INTO ASL A ; PADDLE PORTS, FOR PLAYER X, TAY ; IN Y (X * 2) LDA INPT4L,Y ;READ LEFT BUTTON EOR #$FF ;INVERT SENSE STA LEFTBUT,X LDA INPT4R,Y ; RIGHT BUTTON EOR #$FF ;INVERT SENSE RJSTORE STA RIGHTBUT,X RJRTS RTS ;HERE ON OLD-STYLE SINGLE BUTTON JOYSTICK PRESS. GOTONE LDA ONEBUT ;SET ONE-BUTTON MODE IMMEDIATELY ORA RJBITS,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 LEFTBUT,X ; (Y CONTAINS CURRENT VALUE OF INPT4) STA RIGHTBUT,X ;CLEAR RIGHT BUTTON COPY RTS RJBITS DB $04,$10 ;MASK OF "ONE-BUTTON" BITS PER PLAYER RTS Just look at the routine DOALLIO I'm wondering why they do two LDA's in a row. Does that serve any purpose?? Any input is appreciated. Thanks.. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.