0
我編寫了以下引導加載程序,但存在問題。Linux中的引導加載程序
;===================================================================
;Following is an incomplete code of a boot-loader with blanks(.....)
;Replace each blank with appropriate word, words or character
;===================================================================
[ORG 0x7C00]
;==============================================================
;MSG2, MSG3 and MSG4 should describe the right order of typical
;boot-loading functionality (i.e. What basially a boot-loader does?)
MSG1 dd '1. Boot Loader starts ', 0
MSG2 dq '2. Initialize Hardware', 0
MSG3 dq '3. Pass an abstraction of Initialize Hardware', 0
MSG4 dq '4. Execute Kernel', 0
MSG5 dq '5. Boot Loader exits ', 0
;==============================================================
;==============================================================
;Printing the messages (MSG1, MSG2, .....)
MOV SI, MSG1
CALL PrintString ;Call print string procedure
MOV SI, MSG1
CALL PrintString ;Call print string procedure
MOV SI, MSG2
CALL PrintString ;Call print string procedure
MOV SI , MSG3
CALL PrintString ;Call print string procedure
MOV SI , MSG4
CALL PrintString ;Call print string procedure
MOV SI, MSG5
CALL PrintString ;Call print string procedure
JMP $ ;infinite loop here
;===============================================================
;===============================================================
PrintCharacter: ;Procedure to print character on screen
MOV AH, 0x0E
MOV BH, 0x00
MOV BL, 0x07
INT 0x10
RET
;===============================================================
;===============================================================
PrintString: ;Procedure to print string on screen
MOV AL , [SI]
CALL PrintCharacter
NextChar:
INC SI
MOV AL , [SI]
CMP AL , 0
JZ exit_function
CALL PrintCharacter
JMP NextChar
exit_function:
RET
;===============================================================
;===============================================================
times (495) - ($ - $$) db 0
db 0
dw 0xAA52
dd 0xAA53
dq 0xAA54
dw 0xAA55 ;End of Boot-loader
;===
它不輸出第一條消息。我該如何糾正它?。謝謝。
可能還想確保'ds'爲零。它可能是,當BIOS將控制權轉移到我們的引導加載程序,但它不能保證! – 2013-05-03 09:21:11