changed the scroll repeat window to a power of two (25 -> 32 lines)
authorJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 9 Jun 2021 15:24:22 +0000 (18:24 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 9 Jun 2021 15:24:22 +0000 (18:24 +0300)
sys1/kern/src/main.c
sys1/kern/src/vga.c

index 44acf3c..2e7a280 100644 (file)
@@ -31,7 +31,7 @@ void kmain(void)
                vga_setcolor(VGA_YELLOW | VGA_BRIGHT, VGA_BLACK);
                drawtext(line & 7, row, buf);
 
-               for(i=0; i<65536 * 4; i++) {
+               for(i=0; i<65536 * 16; i++) {
                        buf[0] = twirl[(i >> 15) & 3];
                        buf[1] = 0;
                        vga_setcolor(VGA_WHITE, VGA_BLACK);
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;
        }
 }