home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------- */
- /* scr.c */
- /* setzt Bildschirmattribute */
- /* (c) 1988 by B.Eichinger-Wieschmann & PASCAL Int. */
- /* erfordert angabe von ANSI.SYS in CONFIG.SYS */
- /* ------------------------------------------------- */
-
- #include <stdio.h>
- #include <dos.h>
-
- void clr( void );
- void save( void );
- void restore( void );
-
- main( int argc, char *argv[] )
- {
- if( argc > 1 )
- {
- switch( *(argv[1]+1) )
- {
- case 'c' :
- case 'C' : clr();
- break;
- case 'h' :
- case 'H' : fprintf( stdout,"\033[1m\n");
- break;
- case 'n' :
- case 'N' : fprintf( stdout,"\033[0m\n");
- break;
- case 'i' :
- case 'I' : fprintf( stdout,"\033[7m\n");
- break;
- }
- }
- }
-
- void clr( void )
- {
- save();
- clrscr();
- getch();
- restore();
- }
-
- static unsigned scrbuf[25 * 80 * 2];
- /* Bildschirmpuffer */
- union REGS ri,ro;
- static unsigned oldcur; /* Cursor-Form */
- static unsigned oldpos; /* Cursorposition */
-
- void save( void )
- {
- gettext( 0,0,80,25, scrbuf );
- /* Bildschirm sichern */
- ri.h.ah = 3; /* Cursor holen */
- ri.h.bh = 0;
- int86(0x10,&ri,&ro);
- oldcur = ro.x.cx; /* Cursor sichern */
- oldpos = ro.x.dx; /* Position sichern */
-
- ri.h.ah = 1;
- ri.x.cx = 0x2020; /* Cursor verstecken */
- /* nicht bei jedem Video-Adapter möglich */
- int86(0x10,&ri,&ro);
- }
-
- void restore( void )
- {
- puttext( 0,0,80,25, scrbuf );
- /* Bildschirm wiederherstellen */
- ri.h.ah = 1;
- ri.x.cx = oldcur;
- int86(0x10,&ri,&ro); /* alten Cursor setzen */
-
- ri.h.ah = 2;
- ri.h.bh = 0;
- ri.x.dx = oldpos;
- int86(0x10,&ri,&ro); /* auf alte Position */
- }
-