Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!imagen!atari!apratt From: apratt@atari.UUCP (Allan Pratt) Newsgroups: comp.sys.atari.st.tech Subject: Re: Can't get Setpallete() to work. Message-ID: <2919@atari.UUCP> Date: 29 Apr 91 17:27:48 GMT References: Organization: Atari Corp., Sunnyvale CA Lines: 44 marco@sys6626.bison.mb.ca (Marco) writes: >Here's the code I've been trying to use to blank (black) my screen: >---------------------------------------------------------------------- >#include >#include >main() >{ >int i, pal; >for (i=0;i<16;i++) > pal = i; >Setpallete(pal); >} This won't work because Setpallete (sic) takes a LONG argument which is a POINTER to an ARRAY of 16 INT's. Check those types in the documentation! If you look at your code again I think you'll realize that it doesn't make any sense at all. main() { int i, pal[16]; for (i=0; i<16; i++) pal[i] = 0; Setpallete(pal); } Setpallete is a misspelling of Setpallete, and is that way because Atari's original docs and include files spelled it wrong in the first place. As has been pointed out, this is now retained by most compilers. A caveat for Setpallete users: the above program is unreliable because Setpallete copies its argument to a variable, and the palette registers are loaded from the 16 int's found there AT THE NEXT VBLANK. Since the above program has terminated by the time the next VBLANK rolls around, that means this memory is not owned by anybody, violating the commandment "Thou shalt not mess with memory thou ownest not." I know the "program" is just an example of this poor slob's problem, but it bears repeating that Setpallete is a delayed-action call. ============================================ Opinions expressed above do not necessarily -- Allan Pratt, Atari Corp. reflect those of Atari Corp. or anyone else. ...ames!atari!apratt