Hi,
Neolander wrote:Interested in the answer too. I can't figure out what's wrong about reading the display memory right now.
Reading from display memory is painfully slow; and in some cases the video card has different read modes and different write modes, where what you read isn't what you write.
WildN00b wrote:how should i do then?
Simplest way is to have a buffer in RAM, do the scrolling on the buffer in RAM, then copy the buffer to display memory.
For the boot log, I keep a big zero terminated string in RAM. Someone can add six lines of text to the end of the boot log and then ask the video handling code to update. The video handling code determines how many lines to scroll (6 in this case), does the scrolling in the buffer once, adds the new text to the buffer, then copies the buffer to display memory once. If someone adds 200 lines to the boot log and then asks the video handling code to update, then video handling code discards the previous buffer, finds the first piece of text that would become visible and generates the new buffer from there - no scrolling at all (and definitely no need to do "scroll()" 200 times).
Of course eventually the "big zero terminated string in RAM" would be saved in the file system or something, so the user can still see what happened long after it scrolled off the top of the screen.
Cheers,
Brendan