cfenollosa_os-tutorial/17-video-scroll
Carlos Fenollosa c8db77fea9 Lesson 18
2015-02-03 19:13:13 +01:00
..
boot Lesson 18 2015-02-03 19:13:13 +01:00
drivers Lesson 18 2015-02-03 19:12:51 +01:00
kernel lesson 17, video scroll 2014-10-28 10:36:53 +01:00
Makefile Lesson 18 2015-02-03 19:12:51 +01:00
README.md lesson 17, video scroll 2014-10-28 10:39:58 +01:00

Concepts you may want to Google beforehand: scroll

Goal: Scroll the screen when the text reaches the bottom

For this short lesson, open drivers/screen.c and note that at the bottom of print_char there is a new section (line 84) which checks if the current offset is over the screen size and scrolls the text.

The actual scrolling is handled by a new function, memory_copy. It is a simpler version of the standard memcpy but we named it differently to avoid namespace collisions, at least for now. Open kernel/util.c to see its implementation.

To help visualize scrolling, we will also implement a function to convert integers to text, int_to_ascii. Again, it is a quick implementation of the standard itoa. Notice that for integers which have double digits or more, they are printed in reverse. This is intended. On future lessons we will extend our helper functions, but that is not the point for now.

Finally, open kernel/kernel.c. Initially, each line displays its line number. You can set a breakpoint on line 14 to confirm this. Then, the following kprints force the kernel to scroll down.

This lesson ends the coverage for the os-dev.pdf document. From now on, we'll follow the OSDev wiki and other sources and examples. Thanks Prof. Blundell for that great document!