From computer architecture to assembly
Write a program which can be run without OS via binary
1 | % copy helloos.img ..\z_tools\qemu\fdimage0.bin # copy image file to qemu folder and rename it to fdimage0.bin |
Rewrite the program with (author modified) assembly language
1 | ; source of helloos.nas |
db
for define byte, resb
for reserve bytes
1 | % cat .\asm.bat |
Go further
1 | ; hello-os |
Why 0x55 0xaa ?
因为计算机首先从最初一个扇区开始读软盘,然后去检查这个扇区最后2个字节的
内容。如果这最后2个字节不是0x55 AA,计算机会认为这张盘上没有所需的启
动程序,就会报一个不能启动的错误。
1 | twobytes = get_last_2_bytes_of_first_sector() |
The process is call bootstrap