From 144175640d070e26aa6a661a3a0014fa69e604dd Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 22 Apr 2010 08:18:25 +0800 Subject: [PATCH] Fixed VESA scrolling bug --- Kernel/Makefile.BuildNum | 2 +- Kernel/drv/vterm.c | 3 ++- Modules/Display/VESA/main.c | 15 ++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index 4674272b..620c1bbd 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 1975 +BUILD_NUM = 1982 diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index 14339646..aa2b8f33 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -211,9 +211,10 @@ void VT_InitOutput() giVT_OutputDevHandle = VFS_Open(gsVT_OutputDevice, VFS_OPENFLAG_WRITE); if(giVT_InputDevHandle == -1) { Log_Warning("VTerm", "Oh F**k, I can't open the video device '%s'", gsVT_OutputDevice); + return ; } VT_SetTerminal( 0 ); - VT_SetResolution(1, 640, 480); + VT_SetResolution(1, 640, 400); } /** diff --git a/Modules/Display/VESA/main.c b/Modules/Display/VESA/main.c index f24b405d..e625c577 100644 --- a/Modules/Display/VESA/main.c +++ b/Modules/Display/VESA/main.c @@ -224,6 +224,12 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) x = Offset % widthInChars; y = Offset / widthInChars; LOG("(x,y) = (%i,%i) = [%i,%i]", x, y, x * giVT_CharWidth, y * giVT_CharHeight * pitch); + LOG("(w,h) = (%i,%i) = [%i,%i]", + (int)(Length % widthInChars), + (int)(Length / widthInChars), + (int)((Length % widthInChars) * giVT_CharWidth), + (int)((Length / widthInChars) * giVT_CharHeight * pitch) + ); // Sanity Check if(y > gVesa_Modes[giVesaCurrentMode].height/giVT_CharHeight) { @@ -240,19 +246,18 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) { VT_Font_Render( chars->Ch, - dest, pitch, + dest + x*giVT_CharWidth, pitch, VT_Colour12to24(chars->BGCol), VT_Colour12to24(chars->FGCol) ); - dest += giVT_CharWidth; chars ++; x ++; - if( x >= pitch ) { + if( x >= widthInChars ) { x = 0; - y ++ ; - dest += pitch*(giVT_CharHeight-1); + y ++; + dest += pitch*giVT_CharHeight; } } Length *= sizeof(tVT_Char); -- 2.20.1