Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!fauern!faui43.informatik.uni-erlangen.de!lsmichae From: lsmichae@immd4.informatik.uni-erlangen.de (Lars Michael) Newsgroups: comp.sys.atari.st Subject: Re: Reading a Lores Screen Message-ID: <1991Mar6.184558.29034@informatik.uni-erlangen.de> Date: 6 Mar 91 18:45:58 GMT References: <9103052219.aa11315@Bonnie.ics.uci.edu> Organization: CSD., University of Erlangen, Germany Lines: 31 bferrer@Bonnie.ICS.UCI.EDU writes: > Given a pointer to a lores screen, how can I read a pallete number >from the screen without using the linea routines but with pointer >manipulation? A C-routine to get the color index of point (x, y): int get_pix(int x, int y, char *Screen) { int Index; int mapnr; Screen += 160*y + ((x & 0xfff0) >> 1) + (x>7?:0:1); bitnr = 7 - x % 8; for (Index=0, mapnr=0; mapnr<4; mapnr+=1, Screen+=2) Index |= ((*Screen >> bitnr) & 1) << mapnr; return (Index); } Have fun !!! Lars +-----------------------------------+----------------------------------+ | Lars Michael | | | | | | lsmichae@faui43.uni-erlangen.de | | | | "Down with ATARI, | +-----------------------------------+ / | \ Long live the ST !" | | "May the Schwartz be with you!" | / | \ | +-----------------------------------+----------------------------------+