First of all, so far the issue of USB flash drive encountered, the first problem is "system Volume Information", not yet resolved, this problem may cause the USB drive failed to start, I guess it may be because each time the OS is written to the USB flash drive when the original information is not erased, This leads to the execution of information that has not been overwritten as an instruction. This problem I will continue to track down, and strive to find the real cause of this problem is what, if you have met the same problem of friends, can leave a message.
The following is the operation of the real machine (of course, is absolutely loaded, haha)
The following shows the Ipl10.nas code
; HARIBOTE-IPL; Tab=4Cyls EQUTen ; 10 CylindersORG0x7c00 ; MBR in memory position (DS=0,0X07C00=DS+0X7C00); system-related setup information JMPEntry DB0x90Db"HELLOIPL" ; Name of the boot sectorDw + ; size of SectorDb1 ; FDw1 ; FAT First SectorDb2 ; FAT NumberDw224 ; root dir sizeDw2880 ; disk size in SectorDb0xf0 ; disk TypeDw9 ; FAT lengthDw - ; sector each roadDw2 ; disk upDd0 ; no partitionDd2880 ; Reclaim the disk sizeDb0,0,0x29 ;Dd0xFFFFFFFF ; might be columnDb"Hello-os" ; disk nameDb"FAT12" ; disk FS TypeResb - ; reserve byte; Init program EntryEntry: MOVAx0 ; MOVSs,axMOVSp0x7c00 ; heap Stack init MOVDs,axinitialization code snippet base address in 0x00000read the disk to the memory 0x08200 location MOVAx0x0820 MOVEs,axMOVCh0 ; cylinder number MOVDh0 ; disk head number MOVCl2 ; sector numberReadloop: MOVSI,0 ; failed times; Retry to read disk if failed, read one sectorRetry: MOVAH,0x02 ; AH=0X02: Read Disk MOVAL,1 ; 1 Sectors MOVBx0 ; MOV dl,0x00; A drive MOVClass0x80 ; drive letter is criticalInt0x13 ; function routines that call the BIOSJNC NextADDSI,1CMP SI,5JAE ErrorMOVAH,0x00 ; MOV dl,0x00 MOVDl0x80 ; drive letter is criticalInt0x13 JMPRetryNext: MOVAx,esADDAx0x0020 each read a Sector memory backward offset (es+=0x0020) <<4 MOVEs,axADDCl1CMP CL, + ; 62 SectorsJbe ReadloopMOVCl1 ADDDh1CMP DH,4 ; 4 HeadJB ReadloopMOVDh0 ADDCh1CMP CH,4 ; 4 cylinder surfaceJB ReadloopMOV[0x0ff0],chJMP 0xc200 Error: MOVSi,msgJMPPutloopOK: MOVSi,msg1Putloop: MOVAL,[SI]ADDSI,1 ; Si set to 1CMP AL,0JE finMOVAH,0x0e ; display characters in teletype mode MOVBx the ; page bh=0x00, foreground color bl=0x0fInt0x10 ; BIOS Display Service JMPPutloopFin:HLT; Pause the processor JMPFinMSG1:Db0x0a,0x0a ; line breakDb"READ okkkk"Db0x0a ; line breakDb0msg:Db0x0a,0x0a ; line breakDb"Load Error"Db0x0a ; line breakDb0Resb0x7dfe-$; (0x7dfe-current position) is filled with 0x00Db0x55,0xaa
Learning this book so far, still learned a lot of things, including computer startup process, BIOS interrupt vector table, real mode, protection mode, IDT,GDT,LDT,TSS, memory management, timer management (this is mainly dependent on clock interrupt, clock interrupt is closely related to task scheduling, Requires special attention), system invoke API, various exception interrupt processing, executable application writing (which is very much associated with the protection mode), there is a profound experience of the various advantages of modular programming.
In the process of learning this book, encountered a lot of problems, so in this book learning process, but also learned a lot of relevant data, including "The design and implementation of the Linux kernel" (PS: The reason to study this book is because I choose the course is to teach the kernel of Linux, Of course, there is a lot of help in the study of this book, mainly conceptual understanding and operating system architecture understanding); The deep understanding of the Linux kernel is very thick, but the explanation is relatively thin, but if you do not understand the structure of the computer system, the previous and the hardware-related parts of the understanding is more difficult, This book for a certain foundation of people should be quiet to look at, certainly there is a great harvest, at the same time I think this book can also be used as a reference book of the kernel programming people, there is the "386intel" manual, for Learning "30 days homemade Operating System" , Intel386 's handbook should be read carefully in a quiet mind. Believe that if you can thoroughly understand these books, your foundation is really very solid, whether you are prepared to write applications, kernel programming, or embedded system design is not a problem.
Calm down, down to earth
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
"30 days Homemade operating system" USB flash drive, Real machine running (16 days)