Table of content【目錄】
1. Who may be interested【誰可能會感興趣】
2. What is Boot Loader 【Bootloader是什麼】
3. Be ready to go deeper 【深刻探究前的準備】
3.1. So what language you should know to develop Boot Loader 【開發Bootloader須要掌握哪些語言】
3.2. What compiler you need 【須要哪些編譯器】
3.3. How system boots 【系統如何啓動】
4. Let’s code 【代碼實現】
4.1 Program architecture 【編程架構】
4.2 Development environment 【開發環境】
4.3 BIOS interrupts and screen clearing 【BIOS的中斷和清屏】
4.4 «Mixed code» 【混合編程】
4.5 CString implementation 【類CString實現】
4.6 CDisplay implementation 【類CDisplay實現】
4.7 Types.h implementation 【Types.h實現】html
4.8 BootMain.cpp implementation 【BootMain.cpp實現】
4.9 StartPoint.asm implementation 【StartPoint.asm實現】
5. Let’s assemble everything 【讓我來組裝它們】
5.1 Creation of COM file 【COM文件的建立】
5.2 Assembly automation 【自動組合】
6. Testing and Demonstration 【測試和示範】
6.1 How to test boot loader. 【怎麼測試bootloader】
6.2 Testing with the virtual machine VmWare 【使用VmWare進行測試】
6.2.1 Creation of the virtual machine 【建立虛擬機】
6.2.2 Working with Disk Explorer for NTFS 【NTFS資源管理器運行】
6.3 Testing on the real hardware 【在真實機器上測試】
6.4 Debug 【調試】
7. Information Sources 【拓展】
8. Conclusion 【總結】git
Who may be interested【誰可能會感興趣】
Most of all I’ve written this article for those who have been always interested in the way the different things work. It is for those developers who usually create their applications in high-level languages such as C, C++ or Java, but faced with the necessity to develop something at low-level. We will consider low-level programming on the example of working at system loading.程序員
我寫這篇文章的主要面向那些對於不一樣事物能一塊兒運轉持濃厚興趣的人。是那些程序員,常用高級語言例如 C, C++或者Java來開發應用,但又得作底層開發。咱們將會系統加載啓動爲例來講下底層編程。編程
We will describe what is going after you turn on a computer; how the system is loading. As the practical example we will consider how you can develop your own boot loader which is actually the first point of the system booting process.c#
咱們將會描述當你開啓電腦以後都會發生什麼,系統是如何啓動的。做爲一個實例,咱們將會教你怎麼樣開發你本身的bootloader,它是系統啓動處理的第一步。windows
What is Boot Loader【Bootloader是什麼】
Boot loader is a program situated at the first sector of the hard drive; and it is the sector where the boot starts from. BIOS automatically reads all content of the first sector to the memory just after the power is turned on, and jump to it. The first sector is also called Master Boot Record. Actually it is not obligatory for the first sector of the hard drive to boot something. This name has been formed historically because developers used to boot their operating systems with such mechanism.架構
Boot loader是位於磁盤第一扇區的一段程序,它是boot開始執行的扇區。在機器上電後,BIOS自動讀取存儲器上第一扇區的全部內容,並跳轉過去。第一扇區也叫做主動引導程序(Master Boot Record,MBR)。事實上磁盤上第一扇區沒有義務去啓動系統。這個名字由來已久,由於程序員使用這樣的機制去啓動他們的系統。app
Be ready to go deeper【深刻探究前的準備】
In this section I will tell about knowledge and tools you need to develop your own boot loader and also remind some useful information about system boot.dom
本節會告訴你要開發本身的bootloader須要哪些知識和工具,也會講解關於系統啓動的一些有用信息。ide
So what language you should know to develop Boot Loader【開發Bootloader須要掌握哪些語言】
On the first stage on the computer work the control of hardware is performed mainly by means of BIOS functions known as interrupts. The implementation of interrupts is given only in Assembler – so it is great if you know it at least a little bit. But it’s not the necessary condition. Why? We will use the technology of 「mixed code」 where it is possible to combine high-level constructions with low-level commands. It makes our task a little simpler.
在電腦工做的第一個階段上對於硬件控制執行主要是被稱爲中斷的BIOS功能。中斷的實現主要是經過彙編語言——因此你要是懂一些彙編會很好。可是這並非必要條件。爲何呢?咱們將會使用混合編程,以連接上層架構和底層命令。這會使咱們的任務能更簡單些。
In this article the main development languages is C++. But if you have brilliant knowledge of C then it will be easy to learn required C++ elements. In general even the C knowledge will be enough but then you will have to modify the source code of the examples that I will descried here.
在這篇文章中主要的開發語言是C++。可是若是你精通C語言的話,將會很容易的學到這裏所需的C++元素。通常來講C語言已經足夠了,甚至你不得不修改在接下來要講解的示例源碼的狀況下。
If you know Java or C# well unfortunately it won’t help for our task. The matter is that the code of Java and C# languages that is produced after compilation is intermediate. The special virtual machine is used to process it (Java Machine for Java, and .NET for C#) which transform intermediate code into processor instructions. After that transformation it can be executed. Such architecture makes it impossible to use mixed code technology – and we are going to use it to make our life easier, so Java and C# don’t work here.
若是你只懂Java或C#,不幸的是這對咱們的任務沒有任何幫助。Java和c#語言的代碼編譯後產生的中間體。須要特定的虛擬機來處理它(Java Machine和.NET),虛擬機用於把中間體轉換成處理器指令。轉化後指令能夠執行。這樣的架構使混合編程稱爲可能——咱們可使用這些讓咱們的編程容易些,所以Java和C#在這裏不適用。
So to develop the simple boot loader you need to know C or C++ and also it would be good if you know something about Assembler – language into which all high-level code is transformed it the end.
所以開發簡單的bootloader須要你懂得C或者C++,若是你懂些彙編語言(高級語言最終都要轉化爲彙編語言)將會更好。
What compiler you need【須要哪些編譯器】
To use mixed code technology you need at least two compilers: for Assembler and C/C++, and also the linker to join object files (.obj) into the one executable.
使用混合編程須要你至少懂得兩種編譯器,彙編語言和C/C++編譯器,和把對象文件連接爲可執行文件的連接器。
Now let’s talk about some special moments. There are two modes of processor functioning: real mode and protected mode. Real mode is 16-bit and has some limitations. Protected mode is 32-bit and is fully used in OS work. When it starts processor works in 16-bit mode. So to build the program and obtain executable file you will need the compiler and linker of Assembler for 16-bit mode. For C/C++ you will need only the compiler that can create object files for 16-bit mode.
如今讓咱們來說下一些主要的知識點。處理器功能有兩種模式:真實模式和保護模式。真實模式是16位的而且帶有一些侷限性。保護模式是32位的,可被操做系統充分利用。處理器開始運行時處於16位模式。所以爲構建程序和生成可執行文件須要16位模式下的編譯器和彙編連接器。使用C/C++,你只須要編譯器,它能夠建立16位模式的目標文件。
The modern compilers are made for 32-bit applications only so we won’t able to use them.
如今編譯器只面向於32位程序,由於咱們不可以使用它。
I tried a number of free and commercial compilers for 16-bit mode and choose Microsoft product. Compiler along with the linker for Assembler, C, C++ are included into the Microsoft Visual Studio 1.52 package and also can be downloaded from the official site of the company. Some details about compilers we need are given below.
我嘗試了不少的免費和商業的16位編譯器,最終選擇了Microsoft的產品。Microsoft Visual Studio 1.52軟件包集成了彙編語言,C/C++的編譯器和連接器,能夠從官方網點下載。編譯器的一些細節以下:
ML 6.15 – Assembler compiler by Microsoft for 16-bit mode;
LINK 5.16 – the linker that can create .com files for 16-bit mode;
CL – С, С++ compiler for 16-bit mode.
You can also use some alternative variants:
DMC – free compile for Assembler, C, C++ for 16 and 32-bit mode by Digital Mars;
LINK – free linker for DMC compiler;
There are also some products by Borland:
BCC 3.5 – С, С++ compiler that can create files for 16-bit mode;
TASM - Assembler compiler for 16-bit mode;
TLINK – linker that can create .com files for 16-bit mode.
All code examples in this article were built with the Microsoft tools.
How system boots【系統如何啓動】
In order to solve our task we should recall how the system is booting.
爲了編輯磁盤,咱們講解下系統是怎麼樣啓動的。
Let’s consider briefly how the system components are interacting when the system is booting (see Fig.1).
讓我簡單的看下當系統啓動時系統組件是怎麼樣相互做用的(see Fig.1)。

Fig.1 – 「How it boots」
After the control has been passed to the address 0000:7C00, Master Boot Record (MBR) starts its work and triggers the Operating System boot. You can learn more about MBR structure for example here.
跳轉到控制地址0000:7C00後,MBR開始執行並觸發操做系統啓動。爲了本實例,你能夠多學些MBR的結構。
Let’s code【代碼實現】
In the next sections we will be directly occupied with the low-level programming – we will develop our own boot loader.
在下一節,咱們直接開始底層編程——開發咱們本身的bootloader。
Program architecture【編程架構】
Boot loader that we are developing is for the training only. Its tasks are just the following:
咱們要開發的bootloader只是爲了練習。其目標以下:
一、Correct loading to the memory by 0000:7C00 address.【從地址0000:7C00處正確加載存儲器】
二、Calling the
BootMain
function that is developed in the high-level language.【高級語言開發調用BootMain函數】
三、Show 「」Hello, world…」, from low-level」 message on the display.【在顯示器上顯示字符串 「」Hello, world…」, from low-level」
】
Program architecture is described on the Fig.2 that is followed by the text description.
編程架構描述以下。

Fig.2. – Program architecture description
The first entity is StartPoint
that is developed purely in Assembler as far as high-level languages don’t have the necessary instructions. It tells compiler what memory model should be used, and what address the loading to the RAM should be performed by after the reading from the disk. It also corrects processor registers and passes control to the BootMain
that is written in high-level language.
第一入口點是StartPoint,純粹使用匯編語言開發,直到能夠達到使用高級語言爲止。它告訴編譯器存儲模塊能夠被使用,讀取磁盤後獲取可執行的RAM地址。糾正處理器的寄存器並把控制權傳遞給給使用高級語言開發的BootMain。
Next entity– BootMain
– is an analogue of main
that is in its turn the main function where all program functioning is concentrated.
第二個入口點——BootMain——和main函數相似,在main函數裏能夠把程序的功能連接起來。
CDisplay
and CString
classes take care of functional part of the program and show message on the screen. As you can see from the Fig.2 CDisplay
class uses CString
class in its work.
類CDisplay和CString做爲程序的一部分主要是在屏幕上顯示信息。經過圖2可知類CDisplay調用了CString類。
Development environment【開發環境】
Here I use the standard development environment Microsoft Visual Studio 2005 or 2008. You can use any other tools but I made sure that these two with some settings made the compiling and work easy and handy.
這裏我使用標準的開發環境Microsoft Visual Studio 2005 或者 2008。你也可使用其餘的工具,可是我認爲這兩個工具裏的一些配置可使編譯簡單和便利。
First we should create the project of Makefile Project type where the main work will be performed (see Fig.3).
第一步咱們建立可執行main函數的Makefile Project工程。
File->New\Project->General\Makefile Project

Fig.3 – Create the project of Makefile type
BIOS interrupts and screen clearing【BIOS的中斷和清屏】
To show our message on the screen we should clear it first. We will use special BIOS interrupt for this purpose.
在屏幕上顯示咱們的信息以前須要先清屏。咱們使用特定的BIOS中斷實現。
BIOS proposes a number of interrupts for the work with computer hardware such as video adapter, keyboard, disk system. Each interrupt has the following structure:
BIOS使用一系列的中斷保證電腦的正常工做,例如:視頻適配器,鍵盤,磁盤系統。每個中斷結構以下:
Hide
Copy Code
int [number_of_interrupt]
where number_of_interrupt is the number of interrupt
number_of_interrupt 是中斷號
Each interrupt has the certain number of parameters that should be set before calling it. The ah
processor register is always responsible for the number of function for the current interrupt, and the other registers are usually used for the other parameters of the current operation. Let’s see how the work of int 10h
interrupt is performed in Assembler. We will use the 00 function that changes the video mode and clears screen:
每個中斷在調用前都有一個惟一的序號與之對應。AH(cpu寄存器)存儲當前中斷的中斷函數標號,其餘的寄存器常常被用做存儲當前操做的其餘參數。咱們來看下中斷10h在彙編語言中的實現。
Hide
Copy Code
mov al, 02h mov ah, 00h int 10h
We will consider only those interrupts and functions that will be used in our application. We will need:
咱們只關心在程序中將要被用到的中斷和函數。
int10h, function 00h– performs changing of video mode and clears screen;
int10h, function 01h– sets the cursor type;
int10h, function 13h– shows the string on the screen;
«Mixed code»【混合編程】
Compiler for C++ supports the inbuilt Assembler i.e. when writing code in Hig-level language you can use also low level language. Assembler Instructions that are used in the high level code are also called asm insertions. They consist of the key word __asm
and the block of the Assembler instructions in braces:
C++編譯器支持內嵌彙編,當編寫高級語言代碼時也可使用底層語言。彙編指令被用在高級語言中稱爲內嵌彙編。使用關鍵字__asm和一對大括號標示彙編語言代碼塊。
Hide
Copy Code
__asm ; key word that shows the beginning of the asm insertion
{ ; block beginning
… ; some asm code
} ; end of the block
To demonstrate mixed code let’s use the previously mentioned Assembler code that performed the screen clearing and combine it with C++ code.
爲展現混合編程,咱們使用上述的彙編代碼來執行清屏操做,並嵌入到C++代碼中。
Hide
Copy Code
void ClearScreen()
{
__asm
{
mov al, 02h ; setting the graphical mode 80x25(text)
mov ah, 00h ; code of function of changing video mode
int 10h ; call interrupt
}
}
CString
implementation【類CString實現】
CString
class is designed to work with strings. It includes Strlen()
method that obtains pointer to the string as the parameter and returns the number of symbols in that string.
類CString主要做用於字符串。它包括Strlen()函數,以字符串指針做爲參數,返回字符串長度。
// CString.h
#ifndef __CSTRING__
#define __CSTRING__
#include"Types.h"
classCString
{
public:
static byte Strlen(constchar far* inStrSource );
};
#endif// __CSTRING__
// CString.cpp
#include"CString.h"
byte CString::Strlen(constchar far* inStrSource )
{
byte lenghtOfString =0;
while(*inStrSource++!='\0')
{
++lenghtOfString;
}
return lenghtOfString;
}
CDisplay
implementation【類CDisplay實現】
CDisplay
class is designed for the work with the screen. It includes several methods:
類CDisplay主要做用於屏幕。包括如下幾個函數:
1)
TextOut()
– it prints the string on the screen. 【在屏幕上打印字符串】
2)
ShowCursor()
– it manages the cursor representation on the screen: show, hide.【控制屏幕上光標的顯示、隱藏】
3)
ClearScreen()
– it changes the video mode and thus clears screen.【切換視頻模式並清除屏幕】
Types.h
is the header file that includes definitions of the data types and macros.
Types.h是包含數據類型定義和宏的頭文件。
Hide
Copy Code
#ifndef __TYPES__
#define __TYPES__
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long dword;
typedef char bool;
#define true 0x1
#define false 0x0
#endif // __TYPES__
BootMain.cpp
implementation【BootMain.cpp實現】
BootMain()
is the main function of the program that is the first entry point (analogue of main()
). Main work is performed here.
BootMain()是程序的主函數,第一個入口點(相似於main()函數)。主要的工做在這裏實現。
// BootMain.cpp
#include"CDisplay.h"
#define HELLO_STR "\"Hello, world…\", from low-level..."
extern"C"
voidBootMain()
{
CDisplay::ClearScreen();
CDisplay::ShowCursor(false);
CDisplay::TextOut(
HELLO_STR,
0,
0,
BLACK,
WHITE,
false
);
return;
}
StartPoint.asm
implementation
【StartPoint.asm
實現】
Hide
Shrink
Copy Code
.286 .model TINY extrn _BootMain:near .code
org 07c00h ; for BootSector
main:
jmp short start nopstart:
cli
mov ax,cs mov ds,ax mov es,ax mov ss,ax mov bp,7c00h
mov sp,7c00h sti
call _BootMain
ret
END main
Let’s assemble everything【讓我來組裝它們】
Creation of COM file【COM文件的建立】
Now when the code is developed we need to transform it to the file for the 16-bit OS. Such files are .com files. We can start each of compilers (for Assembler and C, C++) from the command line, transmit necessary parameters to them and obtain several object files as the result. Next we start linker to transform all .obj files to the one executable file with .com extension. It is working way but it’s not very easy.
如今代碼咱們寫好了,須要把它轉成16位操做系統文件。例如文件以.com結尾。咱們能夠經過命令行啓動每個編譯器,傳輸必要的參數給它們,並輸出一些目標文件。下一步,咱們連接器把全部的.obj文件連接到一個可執行文件中。工做原理是這樣的,可是卻不簡單。
Let’s automate the process. In order to do it we create .bat file and put commands with necessary parameters there. Fig.4 represents the full process of application assembling.
讓咱們來自動進行上述處理。咱們建立.bat文件來實現它,並把命令和必要的參數寫入其中。下圖展現了處理的過程。
Fig.4 – Process of program compilation
Build.bat
Let’s put compilers and linker to the project directory. In the same directory we create .bat file and fill it accordingly to the example (you can use any directory name instead of VC152 where compilers and linker are situated):
咱們把編譯器和連接器放到工程目錄中。在該目錄中建立.bat文件並根據實例須要填充它(你可使用任何的目錄名稱代替VC152,這是編譯器和連接器的存放目錄)。
.\VC152\CL.EXE /AT /G2 /Gs /Gx /c /Zl *.cpp
.\VC152\ML.EXE /AT /c *.asm
.\VC152\LINK.EXE /T /NOD StartPoint.obj bootmain.obj cdisplay.obj cstring.obj
del *.obj
Assembly automation【自動組合】
As the final stage in this section we will describe the way how to turn Microsoft Visual Studio 2005, 2008 into the development environment with any compiler support. Go to the Project Properties: Project->Properties->Configuration Properties\General->Configuration Type.
做爲本節的最後階段,咱們描述怎麼配置Microsoft Visual Studio 2005, 2008包含全部編譯器的開發環境。
Configuration Properties tab includes three items: General, Debugging, NMake. Go to NMake and set the path to the build.bat in the Build Command Line and Rebuild Command Line fields – Fig.5.

Fig.5 –NMake project settings
If everything is correct then you can compile in the common way pressing F7 or Ctrl + F7. At that all attendant information will be shown in the Output window. The main advantage here is not only the assembly automation but also navigation thru the code errors if they happen.
若是配置好了,你能夠直接使用F7 或 Ctrl + F7 來直接編譯。全部的必要信息都會在輸出窗口中打印出來。這裏的主要優點是不只裝配自動化,並且在錯誤發生時,能夠快速定位代碼。
Testing and Demonstration【測試和示範】
This section will tell how to see the created boot loader in action, perform testing and debug.
這一節將會演示怎麼建立bootloader,執行測試和調試。
How to test boot loader【怎麼測試bootloader】
You can test boot loader on the real hardware or using specially designed for such purposes virtual machine – VmWare. Testing on the real hardware gives you more confidence that it works while testing on the virtual machine makes you confident that it just can work. Surely we can say that VmWare is great method for testing and debug. We will consider both methods.
你可使用真實電腦測試bootloader或者使用VmWare來測試。在真實電腦上測試會給你更放心的感受,相比在VmWare運行時,你只會認爲程序只是能夠工做。無疑咱們會說使用VMWare測試和調試程序是一個很好的方法。這兩種方式,咱們都會考慮。
First of all we need a tool to write our boot loader to the virtual or physical disk. As far as I know there a number of free and commercial, console and GUI applications. I used Disk Explorer for NTFS 3.66 (version for FAT that is named Disk Explorer for FAT) for work in Windows and Norton Disk Editor 2002 for work in MS-DOS.
I will describe only Disk Explorer for NTFS 3.66 because it is the simplest method and suits our purposes the most.
首先咱們須要一個工具把咱們的bootloader寫入到虛擬的或真實的磁盤中。正好我知道一些免費的、商業的、命令行的、GUI的工具。使用Disk Explorer for NTFS 3.66在windows上運行,使用Norton Disk Editor 2002在MS-DOS上運行。這裏我僅僅使用Disk Explorer for NTFS 3.66,由於它使用簡單並符合咱們的要求。
Testing with the virtual machine VmWare【使用VmWare進行測試】
Creation of the virtual machine【建立虛擬機】
We will need VmWare program version 5.0, 6.0 or higher. To test boot loader we will create the new virtual machine with minimal disk size for example 1 Gb. We format it for NTFS file system. Now we need to map the formatted hard drive to VmWare as the virtual drive. To do it:
咱們使用VmWare5.0或更高版本。爲測試bootloader,咱們建立一個虛擬機,磁盤至少1Gb。咱們把它格式化爲NTFS文件系統。
File->Map or Disconnect Virtual Disks...
After that the window appears. There you should click Map button. In the next appeared window you should set the path to the disk. Now you can also chose the letter for the disk- see Fig.6.

Fig.6 – Parameters of virtual disk mapping
Don’t forget to uncheck the 「Open file in read-only mode (recommended)」 checkbox. When checked it indicates that the disk should be opened in read-only mode and prevent all recording attempts to avoid data corruption.
After that we can work with the disk of virtual machine as with the usual Windows logical disk. Now we should use Disk Explorer for NTFS 3.66 and record boot loader by the physical offset 0.
Working with Disk Explorer for NTFS【NTFS資源管理器運行】
After program starts we go to our disk (File->Drive). In the window appeared we go to the Logical Drivessection and chose disk with the specified letter (in my case it is Z) – see Fig.7.

Fig.7 – choosing disk in Disk Explorer for NTFS
Now we use menu item View and As Hex command. It the appeared window we can see the information on the disk represented in the 16-bit view, divided by sectors and offsets. There are only 0s as soon as the disk is empty at the moment. You can see the first sector on the Fig.8.

Fig.8 – Sector 1 of the disk
Now we should write our boot loader program to this first sector. We set the marker to position 00 as it is shown on the Fig.8. To copy boot loader we use Edit menu item, Paste from file command. In the opened window we specify the path to the file and click Open. After that the content of the first sector should change and look like it’s shown on the Fig.9 – if you haven’t changed anything in the example code, of course.
You should also write signature 55AAh by the 1FE offset from the sector beginning. If you don’t do it BIOS will check the last two bytes, won’t find the mentioned signature and will consider this sector as not the boot one and won’t read it to the memory.
To switch to the edit mode press F2 and write the necessary numbers –55AAh signature. To leave edit mode press Esc.
Now we need to confirm data writing.
Fig.9 – Boot Sector appearance
To apply writing we go to Tools->Options. Window will appear; we go to the Mode item and chose the method of writing - Virtual Write and click Write button – Fig.10.
Fig.10 – Choosing writing method in Disk Explorer for NTFS
A great number of routine actions are finished at last and now you can see what we have been developing from the very beginning of this article. Let’s return to the VwWare to disconnect the virtual disk (File->Map or Disconnect Virtual Disks… and click Disconnect).
Let’s execute the virtual machine. We can see now how from the some depth, from the kingdom of machine codes and electrics the familiar string appears 「「Hello, world…」, from low-level…」 – see Fig.11.
Fig.11 – 「Hello world…」
Testing on the real hardware【在真實機器上測試】
Testing on the real hardware is almost the same as on the virtual machine except the fact that if something doesn’t work you will need much more time to repair it than to create the new virtual machine. To test boot loader without the threat of existent data corruption (everything can happen), I propose to use flash drive, but first you should reboot your PC, enter BIOS and check if it supports boot from the flash drive. If it does than everything is ok. If it does not than you have to limit your testing to virtual machine test only.
The writing of boot loader to the flash disk in Disk Explorer for NTFS 3.66 is the same to the process for virtual machine. You just should choose the hard drive itself instead of its logical section to perform writing by the correct offset – see Fig.12.

Fig.12 – Choosing physical disk as the device
Debug【調試】
If something went wrong – and it usually happens – you need some tools to debug your boot loader. I should say at once that it is very complicated, tiring and time-eating process. You will have to grasp in the Assembler machine codes – so good knowledge of this language is required. Any way I give a list of tools for this purpose:
TD (Turbo Debugger) – great debugger for 16-bit real mode by Borland.
CodeView – good debugger for 16-bit mode by Microsoft.
D86 – good debugger for 16-bit real mode developed by Eric Isaacson – honored veteran of development for Intel processor in Assembler.
Bocsh – program-emulator of virtual machine that includes debugger of machine commands.
Information Sources【拓展】
「Assembly Language for Intel-Based Computers」 by Kip R. Irvine is the great book that gives good knowledge of inner structure of the computer and development in Assembler. You ca also find information about installation, configuration and work with the MASM 6.15 compiler.
This link will guide you to the BIOS interrupt list: http://en.wikipedia.org/wiki/BIOS_interrupt_call
Conclusion【總結】
In this article we have considered what is boot loader, how BIOS works, and how system components interact when system boots. Practical part gave the information about how to develop your own simple boot loader. We demonstrated the mixed code technology and process of automation of assembly with Microsoft Visual Studio 2005, 2008.
Of course it is just a small piece comparing with the huge theme of low-level programming, but if you get interested of this article – it’s great.
See more case studies and research results at Apriorit site.