日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

BIOS中断相关资料和应用

發布時間:2025/4/14 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 BIOS中断相关资料和应用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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設置預防電腦病毒

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的BIOS中断相关资料和应用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。