Atari ST series Technical Reference Manual page 78

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

from one physical screen to another, unless you call Vsync()
before Setscreen(). Some users report that these glitches may
be eliminated by making sure the high-order word of the
start address is the same for both screens (both screens are in
the same, even 64K block of memory).
The following sample program (Program 4-1) gives a
simple demonstration of page flipping. It sets up a second
block of screen memory, writes a screenful of one character
to that memory block, and then writes a screenful of a sec­
ond character to the default screen memory area. When the
user presses the space bar, the program toggles the display
between the two screen areas. The program terminates when
the user presses the q key.
Program 4-1. XSCREEN.C
/**********************************************/
/*
/*
XSCREEN.C —
/ *
the XBIOS screen functions for "page
/*
flipping".
/*
/**********************************************/
#include <osbind.h>
#define CON 2
main()
{
long block, altscr, oldscr, screen;
0
char ch=
;
block = Malloc(0x7E00L);
altscr = (block+256)SOxOOFFFFOO;
oldscr = Physbase();
Setscreen(altscr,-1L,-1L); /* set 2nd logical screen */
fill('X');
Setscreen(oldscr,-1L,-1L); /* change back to 1st logical screen */
fill('+');
while(ch != 'q')
(
ch = Bconin(CON);
if (ch==' ')
{
if (altscr == P hy sb a s e O )
screen - oldscr;
else screen = altscr;
V s ync();
Setscreen(-1L,screen,-1L);
)
)
Setscreen(oldscr,oldscr,-1L); /* at end, restore screens
Mfree(block);
70
CHAPTER 4
Demonstrates use of the
/* For macro definitions */
/* device number of console keyboard */
/* allocate a second screen buffer
/* find 1st (default) screen addr */
/* fill it with X's */
/* fill it with +'s */
/* until 'q' is pressed
/ *
/* if it's the space bar */
/* and de-allocate memory */
*/
* /
*/
*/
*/
/ *
align to page boundary */
wait for a key */
/* toggle physical screen */
* /
* /
* /

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents