changed the scroll repeat window to a power of two (25 -> 32 lines)
[3sys] / sys1 / kern / src / vga.c
index ae7c049..c1edd9a 100644 (file)
@@ -30,7 +30,7 @@ void vga_setcursor(int x, int y)
 
 void vga_scroll(int s)
 {
-       yoffs = s % 25;
+       yoffs = s & 0x1f;
        s = yoffs * 80;
        crtc_write(CRTC_START_H, s >> 8);
        crtc_write(CRTC_START_L, s);
@@ -53,9 +53,9 @@ void vga_clearline(int row)
        ptr = (uint16_t*)0xb8000 + row * 80;
        memset16(ptr, attr, 80);
 
-       if(row - 25 >= 0) {
+       if(row - 32 >= 0) {
                /* write a copy to wrap-around future scrolling */
-               ptr -= 80 * 25;
+               ptr -= 80 * 32;
                memset16(ptr, attr, 80);
        }
 }
@@ -69,9 +69,9 @@ void vga_drawchar(int x, int y, int c)
        ptr = (uint16_t*)0xb8000 + y * 80 + x;
        *ptr = val;
 
-       if(y - 25 >= 0) {
+       if(y - 32 >= 0) {
                /* write a copy to wrap-around future scrolling */
-               ptr -= 80 * 25;
+               ptr -= 80 * 32;
                *ptr = val;
        }
 }