BIOS中断相关资料和应用
生活随笔
收集整理的這篇文章主要介紹了
BIOS中断相关资料和应用
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
debug命令直接修改彩色顯示器的顯示緩沖區(qū)
http://blog.chinaunix.net/uid-20423564-id-1949376.html本文演示如何用debug命令直接修改彩色顯示器的顯示緩沖區(qū),顯示彩色字符。本文輸出背景屬性為0000,前景屬性為0010,十六進制02h, 即黑底綠字,相關命令mov al,02
說明:
B800:0000—— 2000H字 彩色顯示器的顯示緩沖區(qū), 每個字中的低字節(jié)是字符的ASCII碼,高字節(jié)是其屬性.
背景屬性:高四位 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內(nèi)容:
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? ? 前段時間接到一個客戶的電話,說操作系統(tǒng)中的時間比實際的時間要慢一些。在Windows里面修改過來以后,過一段時間又會慢一些。而且刁蠻的認為一定是服務器硬件的問題。
? ? 實在沒有辦法,后來和這個客戶達成一個協(xié)議:調(diào)用BIOS的時間——畢竟服務器的時間,也就是靠晶振來提供頻率,而我們所知道的,也只是BIOS時間來提供硬件的時間。因此,如果BIOS時間是正常的,而Windows里面的時間不正常,那么就是系統(tǒng)的問題,和硬件沒有關系。而如果兩者一樣,則說明是硬件,這樣可以更換一個主板來解決這樣的問題。
?
? ? 于是用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語言函數(shù)速查效率手冊》第12章接口函數(shù),本章主要是整理dos.h頭文件中的函數(shù),內(nèi)容包括文件與地址操作,對磁盤的讀/寫也是很重要的部分,包括磁盤扇區(qū)信息、文件分配表信息等。本節(jié)為大家介紹讀取或者設置BIOS時間biostime()。
12.3.12 ?讀取或者設置BIOS時間biostime()
【函數(shù)原型】long biostime(int cmd,long newtime)
【功能講解】讀取或設置BIOS時間。
【參數(shù)說明】cmd為命令號,newtime為新時間值。當cmd為0時,返回時鐘值;當cmd為1時,設置時鐘值,newtime只有在cmd為1時生效。
【程序示例】顯示時鐘實時時間。
/*函數(shù)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); ? ? ? ? ? /*調(diào)整顯示位置*/ ?
? ? ? ? cprintf("%lu",bios_time); ?
? ? ? ? gotoxy(50,2); ? ? ? ? ? /*調(diào)整顯示位置*/ ?
? ? ? ? cprintf("%.4f",bios_time/CLK_TCK); ?
? ? ? ? gotoxy(50,3); ? ? ? ? ? /*調(diào)整顯示位置*/ ?
? ? ? ? cprintf("%.4f",bios_time/CLK_TCK/60); ?
? ? ? ? gotoxy(50,4); ? ? ? ? ? /*調(diào)整顯示位置*/ ?
? ? ? ? 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: ?
【實例講解】示例先輸出要顯示內(nèi)容的名稱,然后使用循環(huán)不停地在指定的位置輸出最新的時鐘數(shù)值,直到用戶按下任意鍵退出。
========
資源鏈接
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系統(tǒng)如何修改BIOS設置預防電腦病毒
《新程序員》:云原生和全面數(shù)字化實踐50位技術專家共同創(chuàng)作,文字、視頻、音頻交互閱讀
總結
以上是生活随笔為你收集整理的BIOS中断相关资料和应用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux套接字聊天
- 下一篇: 图解Win7下安装Borland C++