Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: Michael Briere Newsgroups: scea.yaroze.beginners Subject: JOYSTICK FUNCTION Date: Fri, 17 Jul 1998 13:03:52 -0400 Organization: SCEA News Server Lines: 19 Message-ID: <35AF83F8.4DDB67D@accessv.com> NNTP-Posting-Host: 41.209.5.199.dialup.accessv.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; I) Hi! I need some explanation on how the joystick function u_long PadRead(void) works. Here's the complete function: u_long PadRead(void) { return(~(*(bb0+3) | *(bb0+2) <<8 | *(bb1 +3) << 16 | *(bb1+2) <<24)); } I understand that this reads the joystick and returns a value equal to the button that was pressed as shown in the yellow manual. However I'd love it if someone could show me the math behind this with an example. ie. if PADLstart (bit 11) is pressed on joystick #1 which should be put in the *bb0 pointer. I could spend hours trying to figure this out for myself, but I'd really appreciate your help. I know the function works, but I make it a habit of understanding the code I use in my programs. Thanks!