@@ -295,7 +295,7 @@ static void __console_clear_line(int line, int from, int to )
295295 if ( !(con = currentConsole ) ) return ;
296296
297297 // Each character is FONT_XSIZE * VI_DISPLAY_PIX_SZ wide
298- const u32 line_width = (to - from + 1 ) * ( FONT_XSIZE * VI_DISPLAY_PIX_SZ ) ;
298+ const u32 line_width = (to - from + 1 ) * FONT_XSIZE * VI_DISPLAY_PIX_SZ ;
299299
300300 unsigned int bgcolor = con -> bg ;
301301
@@ -306,15 +306,15 @@ static void __console_clear_line(int line, int from, int to )
306306 //add the given row & column to the offset & assign the pointer
307307 const u32 offset = __console_get_offset () \
308308 + ((line - 1 + con -> windowY - 1 ) * con -> con_stride * FONT_YSIZE ) \
309- + (( from - 1 + con -> windowX - 1 ) * FONT_XSIZE * VI_DISPLAY_PIX_SZ ) ;
309+ + (from - 1 + con -> windowX - 1 ) * FONT_XSIZE * VI_DISPLAY_PIX_SZ ;
310310
311- p = (u8 * )((u32 )con -> destbuffer + offset );
311+ p = (u8 * )((uintptr_t )con -> destbuffer + offset );
312312
313313 // Clears 1 line of pixels at a time
314314 for (u16 ycnt = 0 ; ycnt < FONT_YSIZE ; ycnt ++ )
315315 {
316316 for (u32 xcnt = 0 ; xcnt < line_width ; xcnt += 4 )
317- * (u32 * )((u32 )p + xcnt ) = bgcolor ;
317+ * (u32 * )((uintptr_t )p + xcnt ) = bgcolor ;
318318
319319 p += con -> con_stride ;
320320 }
@@ -333,13 +333,14 @@ static void __console_clear(void)
333333 }
334334
335335 //get console pointer
336- p = (u8 * )((u32 )con -> destbuffer + __console_get_offset ()) + ((con -> windowY - 1 ) * con -> con_stride * FONT_YSIZE );
336+ p = (u8 * )((uintptr_t )con -> destbuffer + __console_get_offset ()) \
337+ + ((con -> windowY - 1 ) * con -> con_stride * FONT_YSIZE );
337338
338339 // Clears 1 line of pixels at a time
339- for (u16 ycnt = con -> windowY * 16 ; ycnt < ( con -> windowHeight + con -> windowY ) * 16 ; ycnt ++ )
340+ for (u16 ycnt = 0 ; ycnt < con -> windowHeight * 16 ; ycnt ++ )
340341 {
341342 for (u32 xcnt = (con -> windowX - 1 ) * 8 * VI_DISPLAY_PIX_SZ ; xcnt < (con -> windowWidth + con -> windowX - 1 ) * 8 * VI_DISPLAY_PIX_SZ ; xcnt += 4 )
342- * (u32 * )((u32 )p + xcnt ) = bgcolor ;
343+ * (u32 * )((uintptr_t )p + xcnt ) = bgcolor ;
343344
344345 p += con -> con_stride ;
345346 }
@@ -406,7 +407,7 @@ static void __set_default_console(void *destbuffer,int xstart,int ystart, int tg
406407 con -> bg = CONSOLE_COLOR_BLACK ;
407408
408409 con -> flags = 0 ;
409- con -> tabSize = 4 ;
410+ con -> tabSize = 3 ;
410411
411412 currentConsole = con ;
412413
@@ -749,11 +750,10 @@ void newRow()
749750 /* if bottom border reached, scroll */
750751 if ( currentConsole -> cursorY > currentConsole -> windowHeight )
751752 {
752- const u8 * console = (u8 * )((u32 )currentConsole -> destbuffer + __console_get_offset ()) \
753+ u8 * ptr = (u8 * )((u32 )currentConsole -> destbuffer + __console_get_offset ()) \
754+ + (currentConsole -> windowX - 1 ) * FONT_XSIZE * VI_DISPLAY_PIX_SZ \
753755 + ((currentConsole -> windowY - 1 ) * currentConsole -> con_stride * FONT_YSIZE );
754756
755- //copy lines upwards
756- u8 * ptr = (u8 * )console ;
757757 for (u32 ycnt = 0 ; ycnt < ((currentConsole -> windowHeight - 1 ) * FONT_YSIZE ); ycnt ++ )
758758 {
759759 memmove (ptr , ptr + currentConsole -> con_stride * FONT_YSIZE , currentConsole -> windowWidth * FONT_XSIZE * VI_DISPLAY_PIX_SZ );
0 commit comments