🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #7226

Re: Scrolling lines in C

#7226
From: sorrow
Date: Fri, 21 Jun 1991 18:46
65 lines
3134 bytes
In article <1991Jun21.032331.11458@cs.mcgill.ca>, storm@cs.mcgill.ca (Marc WANDSCHNEIDER) writes:
|>Is there a way to scroll through lines on a screen while keeping a few lines
|>on the screen intact...?
|>
|>Ie, If I have a  25 line screen, and want to keep 2 lines intact on the bottom
|>while scrolling three lines up above those two lines (somewhat akin to a text
|>editor)
|>
|>By the same token is there a way to scroll three lines at the top of the screen
|>and have the rest scroll down the screen while keeping those two lines at the
|>bottom intact...?
|>
|>I seem to recall something about a BIOS routine about this, but I was wondering
|>if I could do this in MS C, or Turbo C, or perhaps in a non-system specific
|>version of C (ANSI C).

Well, an ANSI supported method?  NO.  If you are using the Borland language 
products, the only way to do it would be to use the window() command, move
the cursor to the bottom of the window, then cputs("\n");  That would handle
the scrolling for you.

Those routines are defined in CONIO.H.

In ASM or using C (int86 call), you could easily do it.  As a matter of fact,
here are two code fragments to just do that:

/* Note that the filler attribute uses a standard attribute byte that you */
/* will have to determine.  The byte is formatted as : */
/* bit 7 = intensity/blinking bit
   bit 4-6 = background color
   bit 0-3 = foreground color
*/

#include <dos.h>
#include <bios.h>

void ScrollWindowUp ( int lx, int ly, int rx, int ry )
{
union REGS regs;

   regs.h.ah=0x06;      /* Scroll window up function; AH=0x07 for down */
   regs.h.al=0x01;      /* Number of lines to scroll */
   regs.h.bh=[Insert Value] /* This is the filler attribute for the blanks */
   regs.h.ch=(unsigned char)ly; /* You can pass the coordinates as chars */
   regs.h.cl=(unsigned char)lx;
   regs.h.dh=(unsigned char)ry;
   regs.h.dl=(unsigned char)rx;
   int86(0x10,&regs,&regs);     /* 0x10 == video interrupt */
}

You could use inline ASM also, and you could also use the pseudo registers
and geninterrupt().

Hope this helps,

Brian

/*
Brian Hook -- MS-DOS Programmer for Contract
-----------------------------------------------------------------
"Seamus, that's my dog...I saw her today at the reception...sorry, sixTEEN
inches....better save the women and children first...but this one goes to 11!
..anymore of that plutonium nyborg?....there can be only ONE!....like a 
finger pointing to the moon....ease the seat back...one day closer to death
*/
Technical Details
Message-ID: <0094A75F.2C649CA0@MAPLE.CIRCA.UFL.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ncar!gatech!mailer.cc.fsu.edu!uflorida!SORROW@MAPLE.CIRCA.UFL.EDU
References: <1991Jun21.030948.10951@cs.mcgill.ca>,<1991Jun21.032331.11458@cs.mcgill.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ncar!gatech!mailer.cc.fsu.edu!uflorida!SORROW@MAPLE.CIRCA.UFL.EDU
From: sorrow@oak.circa.ufl.edu
Newsgroups: comp.os.msdos.programmer
Subject: Re: Scrolling lines in C
Message-ID: <0094A75F.2C649CA0@MAPLE.CIRCA.UFL.EDU>
Date: 21 Jun 91 18:46:16 GMT
References: <1991Jun21.030948.10951@cs.mcgill.ca>,<1991Jun21.032331.11458@cs.mcgill.ca>
Sender: news@uflorida.cis.ufl.EDU
Reply-To: sorrow@oak.circa.ufl.edu
Organization: University of Florida CIRCA VAX Cluster
Lines: 65