Path: chuka.playstation.co.uk!news From: "Mario Wynands" Newsgroups: scea.yaroze.programming.codewarrior,scee.yaroze.programming.codewarrior Subject: Re: Disappearing variables - a better example Date: Mon, 29 Dec 1997 00:09:10 +1300 Organization: PlayStation Net Yaroze (SCEE) Lines: 48 Message-ID: <685bje$9ij6@chuka.playstation.co.uk> References: <684q0b$9ij5@chuka.playstation.co.uk> NNTP-Posting-Host: p37-max8.well.ihug.co.nz X-Newsreader: Microsoft Outlook Express 4.72.2106.4 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Xref: chuka.playstation.co.uk scea.yaroze.programming.codewarrior:265 scee.yaroze.programming.codewarrior:125 OK, here is some more slightly less obscure source that we should all be familiar with. #include #include "pad.h" u_long pad_status; // Controller status bitfield u_long pad_type; volatile u_char *bb0, *bb1; // Low level buffers void InitialisePad (void) { pad_status = 0; pad_type = 0; GetPadBuf(&bb0, &bb1); } void UpdatePad(void) { pad_status = (~(*(bb0+3) | *(bb0+2) << 8 | *(bb1+3) << 16 | *(bb1+2) << 24)); pad_type = (~(*(bb0) | *(bb0+1) << 8 | *(bb1) << 16 | *(bb1+1) << 24)); } int PadStatus(void) { return pad_status; } int PadType(void) { return pad_type; } UpdatePad crashes on the first line with a "bus error on data load" error, which seems to indicate to me that something is seriously wrong. Any ideas as to why Codewarrior may be trashing my variables? Mario