Path: chuka.playstation.co.uk!chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: "Wayne K. Werner" Newsgroups: scea.yaroze.beginners,scea.yaroze.programming.codewarrior Subject: Re: survival demo and code warrior (mac) Date: 1 Oct 1997 20:25:22 GMT Organization: WermX Software Lines: 93 Message-ID: <01bccea7$d85a7b40$8fbf43ce@wkwerner> References: <3430A13B.7179@bod.net> NNTP-Posting-Host: port43.con2.com X-Newsreader: Microsoft Internet News 4.70.1161 Xref: chuka.playstation.co.uk scea.yaroze.beginners:103 scea.yaroze.programming.codewarrior:210 Spencer Newland wrote: > > Warning : possible unwanted ';' > LIBPAD.C line 89 while(!PadRead()); > Just a warning about the null line on the pad read. Ignore it. > Warning : variable 'i' is not initialized before being used > MAIN_new.C line 1805 short i, slabid, ballid, enmyid, roboid; > This is a real problem. i is used without initialization, because it is just plain wrong. Earlier in this group, Pradip posted the correction. I'll include it here for your convienence: >> Wayne K. Werner wrote: >> >> In converting the survival demo over to CW, I go a warning that the local >> variable short i is used before it is initialized. This is indeed the >> case, in the function HandleEnmyCollision() at line 1814 of main.c: >> >> static short HandleEnmyCollision(OBJECT *objc, short *dx, short *dy, short >> *dz) >> { >> short i, slabid, ballid, enmyid, roboid; >> short where_onwall, where_onslab, where_onball, where_onenmy, >> where_onrobo; >> short state = objc->State; >> >> /* Check the collision of the object with robot */ >> roboid = -1; >> where_onrobo = HandleObjcCollision(objc, &Robo, dx, dy, dz); >> if (where_onrobo & COLLISION_XYZ) { >> if ((Robo.Pos.coord.t[1] - Robo.DifY) <= >> this is the offending line: >> (Enmy[i].Pos.coord.t[1] - Enmy[i].DifY + (*dy))) >> roboid = 0; >> else >> roboid = 1; >> } >> >> What is the legitamate initialization value? >> >> Thanks, >> Wayne K. Werner >> wkwerner@con2.com >> >>Yes, that is a mistake. Instead of "Enmy[i]." I should be using >>"objc->". So the line will look like the following >> >>(objc->Pos.coord.t[1] - objc->DifY + (*dy))) instead of >>(Enmy[i].Pos.coord.t[1] - Enmy[i].DifY + (*dy))) >> >>I will try to make the change soon and post it back. >>Pradip K Fatehpuria > > > After choosing the file called "AUTO", all of the file seem to download > with no errors. > > When I hit the play button I get a popup which has the following text in > it.... "Illegal (reserved) Instruction Error". Nothing happen on the NY > display making me believe that the illegal instruction error is a CW > debugger error? That's because you are not downloading the executable! To tell the truth, I don't know what address you are jumping to if the executable is not loaded, but, whatever it is, it isn't likely to contain a legal opcode! BTW, you must make sure that the program is compiled to start at address 0x80100000. This is vitally important. CW defautlts to 0x8009000. This load address will overwrite your data. Good luck, -- Wayne K. Werner wkwerner@con2.com