Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!uvaarpa!murdoch!news From: mil@mendel.acc.Virginia.EDU (Maria I. Lasaga) Newsgroups: comp.sys.mac.programmer Subject: Help with ScrnBase Message-ID: <1990Aug23.171125.20436@murdoch.acc.Virginia.EDU> Date: 23 Aug 90 17:11:25 GMT Sender: news@murdoch.acc.Virginia.EDU Distribution: usa Organization: University of Virginia Lines: 60 Can anyone tell me why the following code bombs? Any clues would be appreciated. Essentially, I am trying to switch between the main and alternate video buffers of an SE. (I know that newer Mac models don't have this option, but I need to use it for a very specific application.) I am trying to get around using assembly language because I haven't used it in a while and am a bit rusty, and because I don't have the time to relearn it. (IM III-20 suggests how one might alternate between the main and alternate video buffers in assembly language, but I can't make sense of it.) So here's the code that bombs. The machine just freezes. I assume I am overwriting parts of memory I shouldn't, but I don't get how I am doing this: var offscreen: grafport; mypointer: ptr; mybitmap: bitmap; myaddress: longint; begin {--offscreen bitmap created here--} eraserect(theport^.portrect); { clearing the area of memory... } myaddress := $727; {starting location for alternate memory buffer on SE} mybitmap.baseaddr := @myaddresvkcPmybitmap.rowbytes := offscreen.portbits.rowbytes; mybitmap.bounds := offscreen.portbits.bounds; copybits(offscreen.portbits, mybitmap, offscreen.portrect, offscreen.portrect, srccopy, nil); {copies an image previously drawn in an offscreen portrect} myaddress := $824; {supposedly the location of the global variable,} {ScrnBase, that holds the address of the main screen } {buffer. } mypointer := @myaddress; mypointer^ := $727; {Attempt to set ScrnBase to the address of the } {alternate screen buffer.} end; ----------------------------------------------------------------------- Maria I. Lasaga Dept. of Psychology Gilmer Hall University of Virginia Charlottesville, Virginia 22903 mil@virginia.bitnet -----------------------------------------------------------------------