⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cons_svga.cxx

📁 C++ 编写的EROS RTOS
💻 CXX
字号:
/* * Copyright (C) 2001, Jonathan S. Shapiro. * * This file is part of the EROS Operating System. * * 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; either version 2, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* Implementation of the kernel frame buffer console logic. We make * the simplifying assumption here that the console is a VGA * (640x480x256) display. If the machine-specific initialization code * has somehow placed the display buffer in some other state (e.g. we * have a large VESA display or some such), then it is the * responsibility of the machine-specific code to suitably place a * 640x480 bitmap somewhere on the tube.  Remember that this console * isn't going to get used for very long -- only until the user-mode * console driver takes over the world. */#include <kerninc/kernel.hxx>#include <kerninc/Console.hxx>#include <kerninc/MsgLog.hxx>static uint8_t *screen = (uint8_t *) PTOV(0xA0000u);/* The implementation of the console frame buffer is inherently * video card specific... */struct ConsSVGA: public Console {  void Clear();  void Put(uint8_t c);  void SetFrameBuffer(kva_t);};ConsSVGA TheConsSVGA;boolConsole::InitSVGA(){#if 0  TheConsSVGA.offset = 0;  /* Do something here to set the video mode?... */  TheConsSVGA.Clear();    MsgLog::RegisterSink(&TheConsSVGA);  return true;#else  return false;#endif}/* FIX: This is NOT RIGHT!! */voidConsSVGA::Put(uint8_t c){  unsigned i;  unsigned long line = offset / 80;  unsigned long col = offset % 80;  uint8_t *where = screen + (line * 16) + col;  for (i = 0; i < 16; i++) {    /* FIX: set the color to write! */    *where = console_font[c * 16 + i];    where += 80;  }}voidConsSVGA::Clear(){  unsigned i;  /* This is screamingly inefficient... */  unsigned long old_offset = offset;  offset = 0;  for (i = 0; i < (30 * 80); i++) {    Put(' ');    offset ++;  }  offset = old_offset;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -