From 6ccd3a47d05be145256a79a1de100f01ebd16a79 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Wed, 9 Jun 2021 18:24:22 +0300 Subject: [PATCH] changed the scroll repeat window to a power of two (25 -> 32 lines) --- sys1/kern/src/main.c | 2 +- sys1/kern/src/vga.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys1/kern/src/main.c b/sys1/kern/src/main.c index 44acf3c..2e7a280 100644 --- a/sys1/kern/src/main.c +++ b/sys1/kern/src/main.c @@ -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); diff --git a/sys1/kern/src/vga.c b/sys1/kern/src/vga.c index ae7c049..c1edd9a 100644 --- a/sys1/kern/src/vga.c +++ b/sys1/kern/src/vga.c @@ -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; } } -- 1.7.10.4