Page 1 of 1
scroll screen
Posted: Tue Apr 01, 2003 6:51 pm
by Tom le
Helo guys,
I want to have soft scroll in my os. I think i know how to do it, but i want somewhere i can get some code that shows me the way to implement it.
any one can heko me please??
Re:scroll screen
Posted: Tue Apr 01, 2003 8:14 pm
by Curufir
If you're doing it in software then quite simply this isn't rocket science or anything.
All scrolling actually involves is copying the entire page into video memory only shifted up one row (Or as many as are requested). The principle is exactly the same whether you are scrolling in text mode or graphics mode.
The only nuances involved are whether you are maintaining a history larger than a single page, whether you want to allow scrolling of more than one line (In a graphics mode you might want to scroll by more than one pixel at a time), how many degrees of freedom you want to allow scrolling for (This is reliant on maintaining screen history of course). None of which change the principle, just implementation of it.
Basic outline of a scroll would be something like this:
- Find out where the new top of page starts in memory (Ie one complete line from the current top).
- Copy everything from that point to the bottom of the page into screen memory (Or a buffer if you're not writing directly to screen).
- Add a blank line at the bottom and start any further output at the start of it.
You can do this in assembler in a very very small amount of instructions. Should also be exceedingly straightforward to implement in C/Whatever you are using.
Hope that helps, it's probably just confirmation of what you were already thinking.
Hardware scrolling involves changing the base address of the text page, an interesting problem, but not particularily worth the effort IMO.
Re:scroll screen
Posted: Tue Apr 01, 2003 9:46 pm
by Mastermind
(sorry) Reading this, I think I'll post my question.
I would like to save several screen-fulls of text and be able to recall them at will, sort of like a text buffer. I am thinking of using two dimentional arrays for the characters and the attributes. However, is the max number of elements 999? If so, how can I store 80x25 chars in a var (not a file)?
Re:scroll screen
Posted: Wed Apr 02, 2003 2:38 am
by Pype.Clicker
Mastermind wrote:
(sorry) Reading this, I think I'll post my question.
However, is the max number of elements 999?
What would it be so ?
What kind of magic do you see in 999 ? (except it's 666 if you look it upside-down ?)
If so, how can I store 80x25 chars in a var (not a file)?
char screen[80][25] should do it.
However, on a screen, you have 80x25x2 = 4000 characters, not 80x25 ...
so you're likely to prefer