活动介绍
file-type

BIOS开发参考:开源BIOS源代码包解析

RAR文件

4星 · 超过85%的资源 | 下载需积分: 43 | 175KB | 更新于2025-07-21 | 107 浏览量 | 319 下载量 举报 12 收藏
download 立即下载
BIOS(基本输入输出系统)是计算机启动时加载的第一个软件,负责计算机硬件的初始化,以及引导操作系统的启动过程。BIOS源代码是用以展示和实现BIOS功能的一系列编程指令。源代码通常使用C语言编写,有时也会包含汇编语言,因为汇编语言能直接控制硬件。 从提供的信息来看,该压缩包文件列表揭示了BIOS源代码结构的几个关键部分: 1. bios.bin:这是一个二进制文件,很可能是编译好的BIOS代码。在某些情况下,它可能是一个完整的BIOS镜像文件,可以被烧录到计算机主板的ROM中,或者用于模拟器。 2. bios:这个文件可能是编译过程中生成的一个中间文件,或者是用于维护不同版本BIOS的配置文件。 3. biosapi.c:这应该是实现BIOS API(应用编程接口)的部分。API是程序能够调用的一组预定义功能,BIOS API允许操作系统和软件在启动时与硬件通信。例如,BIOS API可能包括中断处理程序,用于初始化和管理硬件资源。 4. gunzip.c:这个文件名暗示了它包含解压缩算法的源代码,可能用于在系统启动时解压某些压缩过的数据或代码模块。一些BIOS或固件可能会包含压缩后的组件,以节省空间,gunzip.c可能就是用来在引导时进行解压缩的。 5. sysinit.c:这个文件很可能包含系统初始化代码,这是在BIOS代码中执行的一个关键阶段。在此阶段,硬件组件如处理器、内存、存储设备等被初始化。sysinit.c中的代码将负责这些初始化过程的大部分工作。 6. bioscall.c:BIOS调用(bioscall)通常是指在操作系统运行时,软件对硬件进行操作所调用的服务。在BIOS开发中,可能有一些专门的函数接口允许操作系统向BIOS发出请求,以执行某些硬件相关的操作。 7. bios.c:这可能是包含BIOS主要功能的主文件。它可能包含了调用其他文件中函数和模块的入口点,例如,硬件检测、启动菜单、外设初始化等。 8. console.c:此文件可能包含管理控制台I/O的代码,如串口、键盘、VGA显示器等。控制台是计算机启动早期与用户交互的主要方式。 9. bios.h:这是一个头文件,通常包含了定义整个BIOS功能所需的宏、类型定义、全局变量、函数原型等。 10. board.h:这个头文件可能包含了特定主板相关的配置信息和硬件定义,比如I/O端口地址、中断号、内存布局等。对于不同的主板,BIOS程序中会包含不同的board.h文件。 BIOS源代码文件的扩展名通常以.c结尾,表示这些是编译器需要的源代码文件;而扩展名以.bin结尾的文件则是编译器输出的二进制文件,它们被直接用来在硬件上运行。 源代码对于BIOS开发人员来说是极其重要的,因为它允许他们理解和修改BIOS的行为。对现有的BIOS源代码进行参考可以学习和掌握底层硬件编程,以及如何在计算机启动阶段与硬件进行交互。对于BIOS开发人员而言,了解这些源代码的结构和功能是必不可少的技能,因为BIOS是操作系统和硬件之间的桥梁。此外,修改BIOS源代码允许开发人员添加新的特性,修复缺陷,或者为特定硬件实现定制化功能。

相关推荐

filetype
代码部分来自Google的重建IBMPC BIOS项目(https://sites.google.com/site/pcdosretro/ibmpcbios),其中的BIOS镜像(*.rom)可用于各种IBM PC模拟器,可按情况使用。源代码可以用masm编译,站内英文说明文件如下: IBM PC BIOS source code reconstruction This is a reconstruction of the IBM PC, PC XT, PC AT and PC XT 286 BIOS source code using scanning and transcription of the BIOS listings found in the IBM Technical Reference manuals. This historically relevant source code is presented here for software preservation. The following BIOS source code has been reconstructed: IBM PC version 1 04/21/81 IBM PC version 2 10/19/81 IBM PC version 3 10/27/82 IBM PC XT version 1 11/08/82 (also used on the Portable PC) IBM PC XT version 2 01/10/86 IBM PC XT version 3 05/09/86 IBM PC AT version 1 01/10/84 IBM PC AT version 2 06/10/85 IBM PC AT version 3 11/15/85 (used on the PC AT models 319 and 339) IBM PC XT 286 04/21/86 Notes: • All 3 versions of the IBM PC BIOS and the first version of the IBM PC XT BIOS were built using Intel ASM86 on an Intel development system. In each case the BIOS source code is a single large file and the BIOS code is 8KB which resides at F000:E000 • The IBM PC AT version 1 BIOS was built using IBM MASM 1.0 on DOS. This is the first IBM BIOS which uses multiple source files. Since IBM MASM 1.0 did not support the 80286 there is a macro file (IAPX286.MAC) which is used to generate the necessary opcodes. This is also the first BIOS to be split into two parts: the main BIOS code resides at F000:0000 and the compatibility section (ORGS.ASM) resides at F000:E000. An additional file FILL.ASM has been added to define the area between the end of the main BIOS code and the compatibility section to allow the BIOS to be linked properly. It is currently unknown how this was originally handled. • The IBM PC AT version 2 and 3 BIOS and the IBM PC XT 286 BIOS were built using IBM MASM 2.0 on DOS. These are similar to the PC AT version 1 BIOS but there are fewer source files as some files were combined and a bit of cleanup was done. IAPX286.INC is used to generate the protected-mode 80286 opcodes which IBM MASM 2.0 did not support. FILL.ASM serves the same purpose as it does for the PC AT version 1 BIOS though in each case the file is specific to the particular BIOS being built. • The IBM PC XT version 2 and 3 BIOS were built using IBM MASM 2.0 on DOS. The later PC XT BIOS code was restructured to be similar to the PC AT BIOS code so there are multiple source files. Like the PC AT BIOS the code is split into two parts though the compatibility section is in the file POST.ASM. Again the additional file FILL.ASM is used to define the area between the end of the main BIOS code and the compatibility section. • The following code is present in all versions of the PC AT BIOS and the PC XT 286 BIOS but does not appear in the published listings. It is inferred from the public symbols in ORGS.ASM and code disassembly. It is unknown what purpose this code serves. .XLIST ;;- ORG 0FF5AH ORG 01F5AH HRD PROC FAR CALL DISK_SETUP RET HRD ENDP FLOPPY PROC FAR CALL DSKETTE_SETUP RET FLOPPY ENDP SEEKS_1 PROC FAR CALL SEEK RET SEEKS_1 ENDP TUTOR: JMP K16 .LIST • In all cases the 32KB ROM BASIC code which resides at F6000 is not available as its source code was never published. • Versions of MASM later than 4.0 cannot be used to build the IBM BIOS source code since older constructs and macros are used. More information about functionality changes in the IBM PC BIOS code is listed here: IBM PC BIOS version history