『转』BIOS 中断呼叫

BIOS 中断呼叫

维基百科,自由的百科全书

跳转至: 导航 搜索

BIOS 中断呼叫是一组功能,提供DOS程式与一些软件(例如启动程式)去使用IBM_PC兼容机BIOS的功能。一些操作系统系统引导的时候也使用BIOS以检测并初始化硬件资源。

目录

 [隐藏

[编辑]中断调用

若要调用中断,可以使用X86汇编语言INT指令。 例如,如下的x86汇编语言指令可以使用BIOS的0x10中断向屏幕打印一个字符。

mov ah, 0x0e
mov al, '!'
int 0x10

[编辑]BIOS中断向量表

中断 描述
INT 00h CPU: 除零错,或商不合法时触发
INT 01h CPU: 单步陷阱,TF标记为打开状态时,每条指令执行后触发
INT 02h CPU: 非可屏蔽中断, 如 系统自举 时发生内存错误触发。
INT 03h CPU: 第一个未定义的中断向量, 约定俗成仅用于调试程序
INT 04h CPU: 算数溢出。通常由INTO指令在置溢出位时触发。
INT 05h 在按下Shift-PrintScreen或BOUND指令检测到范围异常时触发。
INT 06h CPU: Called when the Undefined Opcode (invalid instruction) exception occurs. Usually installed by the operating system.
INT 07h CPU: Called when an attempt was made to execute a floating-point instruction and no numeric coprocessor was available.
INT 08h IRQ0: Implemented by the system timing component; called 18.2 times per second (once every 55 ms) by thePIC
INT 09h IRQ1: Called after every key press and release (as well as during the time when a key is being held)
INT 0Ah IRQ2:
INT 0Bh IRQ3: Called by serial ports 2 and 4 (COM2/4) when in need of attention
INT 0Ch IRQ4: Called by serial ports 1 and 3 (COM1/3) when in need of attention
INT 0Dh IRQ5: Called by hard disk controller (PC/XT) or 2nd parallel port LPT2 (AT) when in need of attention
INT 0Eh IRQ6: Called by floppy disk controller when in need of attention
INT 0Fh IRQ7: Called by 1st parallel port LPT1 (printer) when in need of attention
INT 10h 显示服务 - 由BIOS或操作系统设定以供软件调用
AH=00h 设定显示模式
AH=01h 设定游标形态
AH=02h 设定游标位置
AH=03h 获取游标位置与形态
AH=04h 获取光笔位置
AH=05h 设定显示页
AH=06h 清除或卷轴画面(上)
AH=07h 清除或卷轴画面(下)
AH=08h 读取游标处字符与属性
AH=09h 更改游标处字符与属性
AH=0Ah 更改游标处字符
AH=0Bh 设定边界颜色
AH=0Eh 在TTY模式下写字符
AH=0Fh 取得目前显示模式
AH=13h 写字符串
INT 11h Installed by the BIOS; returns equipment list
INT 12h Installed by the BIOS or operating system; returns Conventional Memory Size
INT 13h 低阶磁盘服务; installed by the BIOS or operating system; called by software programs
AH=00h Reset Disk Drives
AH=01h Check Drive Status
AH=02h Read Sectors From Drive
AH=03h Write Sectors To Drive
AH=04h Verifies Sectors On Drive
AH=05h Format Track On Drive
AH=08h Get Drive Parameters
AH=09h Init Fixed Drive Parameters
AH=0Ch Seek To Specified Track
AH=0Dh Reset Fixed Disk Controller
AH=15h Get Drive Type
AH=16h Get Floppy Drive Media Change Status
INT 14h Routines for communicating via the serial port. Used by software programs.
AH=00h Serial Port Initialization
AH=01h Transmit Character
AH=02h Receive Character
AH=03h Status
INT 15h Miscellaneous (System services support routines)
AH=4FH Keyboard Intercept
AH=83H Event Wait
AH=84H Read Joystick
AH=85H Sysreq Key Callout
AH=86H Wait
AH=87H Move Block
AH=88H Get Extended Memory Size
AH=C0H Get System Parameters
AH=C1H Get Extended BIOS Data Area Segment
AH=C2H Pointing Device Functions
AH=E8h, AL=01h (AX = E801h) Get Extended Memory Size(Newer function, since 1994). Gives results for memory size above 64 Mb.
AH=E8h, AL=20h (AX = E820h) Query System Address Map. The information returned from e820 supersedes what is returned from the older AX=E801h and AH=88h interfaces.
INT 16h Implemented by the BIOS or operating system. Provides routines to be called by software programs which communicate with the keyboard.
AH=00h Read Character
AH=01h Read Input Status
AH=02h Read Keyboard Shift Status
AH=10h Read Character Extended
AH=11h Read Input Status Extended
AH=12h Read Keyboard Shift Status Extended
INT 17h Print Services - used by software programs to communicate with the printer
AH=00h Print Character to Printer
AH=01h Initialize Printer
AH=02h Check Printer Status
INT 18h Execute Cassette BASIC: True IBM computers contain BASIC in the ROM to be interpreted and executed by this routine in the event of a boot failure (called by the BIOS)
INT 19h After POST this interrupt is used by BIOS to load the operating system.
INT 1Ah 即时的时钟(RTC)服务 - called by software programs to communicate with the RTC
AH=00h 读取 RTC
AH=01h 设定 RTC
AH=02h 读取 RTC 时间
AH=03h 设定 RTC 时间
AH=04h 读取 RTC 日期
AH=05h 设定 RTC 日期
AH=06h 设定 RTC Alarm
AH=07h Reset RTC Alarm
INT 1Bh Installed by the operating system; automatically called by INT 9 when Ctrl-Break has been pressed
INT 1Ch Called automatically by INT 08; available for use by software programs when a routine needs to be executed regularly
INT 1Dh Not to be called; simply a pointer to the VPT (Video Parameter Table), which contains data on video modes
INT 1Eh Not to be called; simply a pointer to the DPT (Diskette Parameter Table), containing a variety of information concerning the diskette drives
INT 1Fh Not to be called; simply a pointer to the VGCT (Video Graphics Character Table), which contains the data for ASCII characters 80h to FFh
INT 41h Address pointer: FDPT = Fixed Disk Parameter Table (1st hard drive)
INT 46h Address pointer: FDPT = Fixed Disk Parameter Table (2nd hard drive)
INT 4Ah Called by RTC for alarm
INT 70h IRQ8: 由 RTC 呼叫
INT 74h IRQ12: 由鼠标呼叫
INT 75h IRQ13: Called by math coprocessor
INT 76h IRQ14: 由第一个 IDE 控制器所呼叫
INT 77h IRQ15: 由第二个 IDE 控制器所呼叫

[编辑]相关

[编辑]外部链接

本文章迁移自http://blog.csdn.net/timberwolf_2012/article/details/8869964

/** * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS. * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/ /* var disqus_config = function () { this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable }; */ (function() { // DON'T EDIT BELOW THIS LINE var d = document, s = d.createElement('script'); s.src = 'https://chenzz.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })();