/* * * * Simple text console * * Copyright (C) 2002, 2003 Samuel Rydh (samuel@ibrium.se) * Copyright (C) 2005 Stefan Reinauer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation * */ #include "openbios/config.h" #include "openbios/bindings.h" #include "font_8x8.c" #define FONT_ADJ_HEIGHT (FONT_HEIGHT + 2) #define NCOLS 80 #define NROWS 48 static struct { int inited; int physw, physh; int w,h; int x,y; char *buf; int cursor_on; } cons; static int get_conschar( int x, int y ) { if( (uint)x < cons.w && (uint)y < cons.h ) return cons.buf[y*cons.w + x]; return ' '; } static void draw_char( uint h, uint v ) { char *c = fontdata; int x, y, xx, rskip, m; int invert = (h==cons.x && v==cons.y && cons.cursor_on); int ch = get_conschar( h, v ); while( h >= cons.w || v >= cons.h ) return; h *= FONT_WIDTH; v *= FONT_ADJ_HEIGHT; rskip = (FONT_WIDTH > 8)? 2 : 1; c += rskip * (unsigned int)(ch & 0xff) * FONT_HEIGHT; for( x=0; x= cons.h || n < 0 ) return; for( i=0; i= cons.w ) { cons.x=0, cons.y++; continue; } if( cons.y >= cons.h ) { for( y=0; y