/* SG C Tools 1.1 (C) 1993 Steve Goldsmith All Rights Reserved Example scrolling regions of the screen. Compiled with HI-TECH C 3.09 (CP/M-80). To compile with HI-TECH C and SG C Tools source on same disk use: C SCROLL.C -LC128 */ #include #include #include #include #define appClrScrCh 32 void scrolltext(void); extern uchar vdcScrHorz; extern uchar vdcScrVert; char appScrlStr1[] = { "This is a string used to test scrolling VDC display memory." }; char appScrlStr2[] = { "You can scroll any region of the screen too!" }; main() { srand(99); savevdc(); /* save vdc regs and set global vars */ clrscrvdc(137); /* clear screen */ clrattrvdc(vdcAltChrSet); /* clear attributes */ setcursorvdc(0,0,vdcCurNone); /* turn cursor off */ outvdc(vdcFgBgColor,vdcDarkGreen); /* set new screen color */ printstrvdc(0,0,vdcAltChrSet, "VDC scrolling example. Press [RETURN] to start."); while (getch() != 0x0D); /* wait for return press */ scrolltext(); /* scrolling demo */ restorevdc(); /* restore registers saved by savevdc() */ clrscrvdc(appClrScrCh); clrattrvdc(vdcAltChrSet+vdcWhite); } /* scroll whole screen up and down then just a window region */ void scrolltext(void) { uchar I; printstrvdc(0,vdcScrVert-1,vdcAltChrSet,appScrlStr1); for (I = 1; I <= 23; I++) scrollupvdc(0,1,vdcScrHorz-1,vdcScrVert-1); for (I = 1; I <= 24; I++) scrolldownvdc(0,0,vdcScrHorz-1,vdcScrVert-2); printstrvdc(0,vdcScrVert-1,vdcAltChrSet,appScrlStr1); for (I = 1; I <= 24; I++) scrollupvdc(0,1,vdcScrHorz-1,vdcScrVert-1); clrscrvdc(137); clrwinvdc(17,7,60,18,appClrScrCh); for (I = 1; I <= 100; I++) { scrollupvdc(17,8,60,18); if (rand() > 16384) printstrvdc(17,17,vdcAltChrSet+(uchar) (rand() >> 11),appScrlStr2); } while (getch() != 0x0D); /* wait for return press */ }