Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!usc!ucsd!ucbvax!MECH.UBC.CA!latornell From: latornell@MECH.UBC.CA (Doug Latornell) Newsgroups: comp.sys.atari.st Subject: Physbase vs. Logbase Message-ID: <255*latornell@mech.ubc.ca> Date: 10 Jan 90 20:42:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 69 In response to the question by: John R. Dunning regarding: Physbase vs Logbase Physbase() is the XBIOS call to get the physical base address of the screen while Logbase() is the call (also XBIOS) to get the logical base address of the screen. Physbase() returns a long that is the screen's physical address in memory at te next vertical blank interupt after the call. Logbase() immediately returns a long that is the screen's logical address. To actually do anything with these call you need to know about Setscreen() too. Setscreen() has 3 arguments, log_base, phys_base and res. log_base points to the screen buffer on which writes operate, phys_base points to the buffer that is displayed. If they are the same then a write operation will appear on the screen as it is done. If they are different, you won't see the result of the write until you change the physical base to show that logical screen. res sets the resolution. A -1L for *_base or -1 for res leaves the current value unchanged. Perhaps an example will make things clearer. I've used this to do primitive animation, the sort where you flip back and forth between 2 screen buffers, displaying one while drawing the next frame on the other. An outline of the code goes something like: /* globals */ char *screen1, /* logical base of current screen */ *screen2; /* logical base of new screen */ set_bases() { long new_buffer; new_buffer = Malloc(32256L); /* some code to make sure new_buffer starts on a half page boundary */ screen1 = Logbase(); screen2 = (char *)new_buffer; } main() { set_bases(); while( /* not stop animation condition */ ) { /* show screen 1 while drawing on screen 2; leave res alone */ Setscreen(screen2, screen1, -1); /* draw next frame */ .... /* show screen 2 while drawing on screen 1 */ Setscreen(screen1, screen2, -1); /* draw next frame */ ... } /* put logical ad physical bases back to original values */ Setscreen(screen1, screen1, -1); /* release memory used for 2nd buffer */ Mfree(screen2); } Hope this helps. Check out Pollack and Weber, "Atari ST Application Programming", Bantam, 1987 for further details. Doug Latornell latornell@mech.ubc.ca (this address works for everybody I know!)