Fixed VESA scrolling bug
[tpg/acess2.git] / Modules / Display / VESA / main.c
index f24b405..e625c57 100644 (file)
@@ -224,6 +224,12 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
                x = Offset % widthInChars;\r
                y = Offset / widthInChars;\r
                LOG("(x,y) = (%i,%i) = [%i,%i]", x, y, x * giVT_CharWidth, y * giVT_CharHeight * pitch);\r
+               LOG("(w,h) = (%i,%i) = [%i,%i]",\r
+                       (int)(Length % widthInChars),\r
+                       (int)(Length / widthInChars),\r
+                       (int)((Length % widthInChars) * giVT_CharWidth),\r
+                       (int)((Length / widthInChars) * giVT_CharHeight * pitch)\r
+                       );\r
                \r
                // Sanity Check\r
                if(y > gVesa_Modes[giVesaCurrentMode].height/giVT_CharHeight) {\r
@@ -240,19 +246,18 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
                {\r
                        VT_Font_Render(\r
                                chars->Ch,\r
-                               dest, pitch,\r
+                               dest + x*giVT_CharWidth, pitch,\r
                                VT_Colour12to24(chars->BGCol),\r
                                VT_Colour12to24(chars->FGCol)\r
                                );\r
                        \r
-                       dest += giVT_CharWidth;\r
                        \r
                        chars ++;\r
                        x ++;\r
-                       if( x >= pitch ) {\r
+                       if( x >= widthInChars ) {\r
                                x = 0;\r
-                               y ++ ;\r
-                               dest += pitch*(giVT_CharHeight-1);\r
+                               y ++;\r
+                               dest += pitch*giVT_CharHeight;\r
                        }\r
                }\r
                Length *= sizeof(tVT_Char);\r

UCC git Repository :: git.ucc.asn.au