BIOS中断相关资料和应用

来源:互联网 发布:免费com域名 编辑:程序博客网 时间:2024/05/17 02:26

debug命令直接修改彩色显示器的显示缓冲区

http://blog.chinaunix.net/uid-20423564-id-1949376.html

本文演示如何用debug命令直接修改彩色显示器的显示缓冲区,显示彩色字符。本文输出背景属性为0000,前景属性为0010,十六进制02h, 即黑底绿字,相关命令mov al,02
说明:
B800:0000—— 2000H字 彩色显示器的显示缓冲区, 每个字中的低字节是字符的ASCII码,高字节是其属性.
背景属性:高四位 7 6 5 4
前景属性:低四位 3 2 1 0 
7     6   5     4    3      2   1     0 
Blink Red Green Blue Bright Red Green Blue
以下是1.txt内容:
a100
mov ax,b800
mov es,ax
mov si,122
mov di,0f00
mov cx,22
mov al,[si]
es:
mov [di],al
inc si
inc di
mov al,02
es:
mov [di],al
inc di
loop 10e
mov ax,4c00
int 21
db 'Hello World from The Video Memory!'
g
输出结果:
========

用C写的一个读取BIOS时间的程序

http://blog.chinaunix.net/uid-9816449-id-1997106.html


    前段时间接到一个客户的电话,说操作系统中的时间比实际的时间要慢一些。在Windows里面修改过来以后,过一段时间又会慢一些。而且刁蛮的认为一定是服务器硬件的问题。
    实在没有办法,后来和这个客户达成一个协议:调用BIOS的时间——毕竟服务器的时间,也就是靠晶振来提供频率,而我们所知道的,也只是BIOS时间来提供硬件的时间。因此,如果BIOS时间是正常的,而Windows里面的时间不正常,那么就是系统的问题,和硬件没有关系。而如果两者一样,则说明是硬件,这样可以更换一个主板来解决这样的问题。
 
    于是用C写了以下程序:
/*
FileName: TIMEBIOS.C
Author  : Crystal.Chen
E-Mail  : crystal.chen.cc@gmail.com
Descrip : Get the BIOS time.
Version : 0.1
*/


#include <STDIO.H>
#include <BIOS.H>
#include <TIME.H>
#include <CONIO.H>


int main(void)
{
        long int bios_time;


        /* Clear screen at the beginning of program. */
        clrscr();


        cprintf("The number of clock ticks since midnight is:\r\n");
        cprintf("The number of seconds since midnight is:\r\n");
        cprintf("The number of minutes since midnight is:\r\n");
        cprintf("The number of hours since midnight is:\r\n");
        textcolor(9);
        cprintf("\r\nPress any key to quit:");


        textcolor(12);


        while(!kbhit()) {
                bios_time = biostime(0, 0L);


                gotoxy(50, 1);
                cprintf("%lu", bios_time);


                gotoxy(50, 2);
                cprintf("%.4f", bios_time / CLK_TCK);


                gotoxy(50, 3);
                cprintf("%.4f", bios_time / CLK_TCK / 60);


                gotoxy(50, 4);
                cprintf("%.4f", bios_time / CLK_TCK / 3600);
        }


        return 0;
}
========

读取或者设置BIOS时间biostime()



《脑动力:C语言函数速查效率手册》第12章接口函数,本章主要是整理dos.h头文件中的函数,内容包括文件与地址操作,对磁盘的读/写也是很重要的部分,包括磁盘扇区信息、文件分配表信息等。本节为大家介绍读取或者设置BIOS时间biostime()。


12.3.12  读取或者设置BIOS时间biostime()


【函数原型】long biostime(int cmd,long newtime)


【功能讲解】读取或设置BIOS时间。


【参数说明】cmd为命令号,newtime为新时间值。当cmd为0时,返回时钟值;当cmd为1时,设置时钟值,newtime只有在cmd为1时生效。


【程序示例】显示时钟实时时间。


/*函数biostime()示例*/  
#include <stdio.h> 
#include <conio.h> 
#include <bios.h> 
#include <time.h> 
int main()  
{  
    long bios_time;  
    clrscr();  
    printf("The number of clock ticks since midnight is:\n");  
    printf("The number of seconds since midnight is:\n");  
    printf("The number of minutes since midnight is:\n");  
    printf("The number of hours since midnight is:\n");  
    printf("ress any key to quit:");  
    while(!kbhit())             /*按任意键退出*/  
    {  
       /*显示各时间信息*/  
        bios_time=biostime(0,0L);  
        gotoxy(50,1);           /*调整显示位置*/  
        cprintf("%lu",bios_time);  
        gotoxy(50,2);           /*调整显示位置*/  
        cprintf("%.4f",bios_time/CLK_TCK);  
        gotoxy(50,3);           /*调整显示位置*/  
        cprintf("%.4f",bios_time/CLK_TCK/60);  
        gotoxy(50,4);           /*调整显示位置*/  
        cprintf("%.4f",bios_time/CLK_TCK/3600);  
    }  
    return 0;  
}  
【运行结果】
The number of clock ticks since midnight is:863809  
The number of seconds since midnight is:47462.0330  
The number of minutes since midnight is:791.0339  
The number of hours since midnight is:13.1839  
ress any key to quit:  
【实例讲解】示例先输出要显示内容的名称,然后使用循环不停地在指定的位置输出最新的时钟数值,直到用户按下任意键退出。
========

资源链接



http://www.bios.net.cn/BIOSJS/
BIOS之家


http://blog.chinaunix.net/uid-27033491-id-3239348.html
BIOS中断大全


http://blog.csdn.net/jxfgh/article/details/5519525
Dos引导程序 反编译


http://blog.csdn.net/regionyu/article/details/1708084
[OS] BIOS中断 (附详表)


http://book.51cto.com/art/201306/398626.htm
启动BIOS,准备实模式下的中断向量表和中断服务程序


http://www.zhishizhan.net/newarc-130192141226.html
Win7系统如何修改BIOS设置预防电脑病毒

0 0
原创粉丝点击