XBIOS Graphics and Sound Functions
fill(ch)
char ch;
{
int x;
Bconout(CON,27); /* home cursor */
Bconout(CON,'E ');
Bconout(CON,27); /* turn on 'line wrap' */
Bconout(CON,'v'); /* for console device output */
for (x=0;x<1999;x++) /* fill screen with character x * /
Bconout(CON,ch);
)
/******** end of XSCREEN.C *****/
In Program 4-1, the GEMDOS Malloc() function was
used to allocate memory for the second screen, and Mfree()
was used to free up that memory when we finished. These
functions will be explained more fully in Chapter 5. We also
used one of the VT-52 escape codes to turn on the console
screen's line wrap feature. This feature is explained in Appenî™…
dix E.
Program 4-2 demonstrates how the preceding example
might be translated into machine language.
Program 4-2. XSCREEN.S
XSCREEN.S — Demonstrates the use of the XBIOS
Setscreen() function from assembly language, as
well as the BIOS Conin() and Conout() routines.
***
***
***
***
***
***
***
Register usage:
a4 = pointer to 1st screen
a5 = pointer to 2nd screen
d4 = fill parameter for conout:
d5 - fill loop counter
d6 = toggle flag
d7 = fill character
*** Program starts here
.text
*** Make room for a 2nd screen, put screen pointer in a5
sub.l #32260,sp * move stack down to make room for screen
move.l sp,d0 * copy stack pointer
add.l #258,do * round up to next page
and.l #$FFFFFF00,do * and down to even page boundary
move.l d0,a5 * place 2nd screen ptr in a5
71