reactos操作系统实现(144)
来源:互联网 发布:mmm金融互助源码 编辑:程序博客网 时间:2024/06/05 16:38
当操作系统引导过程中,需要输出一些信息给用户来查看,那么就需要这个简单的VGA驱动程序,可以输出字符串显示,实现这个功能的函数就是VidDisplayString函数,具体实现的代码如下:
#001 VOID
#002 NTAPI
#003 VidDisplayString(PUCHARString)
#004 {
#005 ULONG TopDelta = 14;
#006
开始循环显示所有字符。
#007 /* Start looping thestring */
#008 while (*String)
#009 {
如果遇到换行字符,就进入下面处理。
#010 /* Treat new-lineseparately */
#011 if (*String == '/n')
#012 {
修改显示向下移动一行。
#013 /* Modify Yposition */
#014 curr_y +=TopDelta;
判断是否需要滚动显示。
#015 if (curr_y >=ScrollRegion[3])
#016 {
#017 /* Scrollthe view */
#018 VgaScroll(TopDelta);
#019 curr_y -=TopDelta;
#020
#021 /* Preserverow */
#022 PreserveRow(curr_y, TopDelta, TRUE);
#023 }
#024
向下移动一行后,需要把X轴坐标清空为起始坐标,以便显示字符。
#025 /* Updatecurrent X */
#026 curr_x =ScrollRegion[0];
#027
#028 /* Preseve thecurrent row */
#029 PreserveRow(curr_y, TopDelta, FALSE);
#030 }
如果遇到回车字符处理。
#031 else if (*String =='/r')
#032 {
回车的意思,就是把行坐标清空为0,从起点开始显示。
#033 /* Updatecurrent X */
#034 curr_x =ScrollRegion[0];
#035
如果下一个字符没有换行符,也认为换行了。
#036 /* Check ifwe're being followed by a new line */
#037 if (String[1] !='/n') NextLine = TRUE;
#038 }
#039 else
#040 {
检查是否要换到下一行输出。
#041 /* Check if wehad a /n/r last time */
#042 if (NextLine)
#043 {
#044 /* We did,preserve the current row */
#045 PreserveRow(curr_y, TopDelta, TRUE);
#046 NextLine =FALSE;
#047 }
#048
在当前的位置显示一个字符。
#049 /* Display thischaracter */
#050 DisplayCharacter(*String, curr_x, curr_y, TextColor, 16);
每个字符的宽度是8个像素。
#051 curr_x += 8;
#052
检查是否到了一行结尾,如果到了就需要换到下一行显示。
#053 /* Check if weshould scroll */
#054 if (curr_x >ScrollRegion[2])
#055 {
#056 /* Update Yposition and check if we should scroll it */
#057 curr_y +=TopDelta;
#058 if (curr_y> ScrollRegion[3])
#059 {
#060 /* Dothe scroll */
#061 VgaScroll(TopDelta);
#062 curr_y-= TopDelta;
#063
#064 /* Savethe row */
#065 PreserveRow(curr_y, TopDelta, TRUE);
#066 }
#067
#068 /* Update X*/
#069 curr_x =ScrollRegion[0];
#070 }
#071 }
#072
处理下一个字符。
#073 /* Get the nextcharacter */
#074 String++;
#075 }
#076 }
- reactos操作系统实现(144)
- reactos操作系统实现(1)
- reactos操作系统实现(2)
- reactos操作系统实现(3)
- reactos操作系统实现(4)
- reactos操作系统实现(5)
- reactos操作系统实现(6)
- reactos操作系统实现(7)
- reactos操作系统实现(8)
- reactos操作系统实现(9)
- reactos操作系统实现(10)
- reactos操作系统实现(11)
- reactos操作系统实现(12)
- reactos操作系统实现(13)
- reactos操作系统实现(14)
- reactos操作系统实现(15)
- reactos操作系统实现(16)
- reactos操作系统实现(17)
- 好纠结的一天
- 在Fedora 12上安装WAS 7(Websphere Application Server 7)
- extern "C" 详解
- 总结一下应用层上对注册表的操作
- kkjjjhjh
- reactos操作系统实现(144)
- 多用户共享VitualBox虚拟机
- cellular genetic algorithm:my first algorithm creation
- 我的第一篇博客
- IT吉祥三宝
- 管理文化:西方不亮,东方亮?
- Draw in MFC
- C#基础知识(2)
- 使用SAX解析XML