[英]How do I test my bootloader on a floppy disk
這是我的代碼: http : //pastebin.com/pSncVNPK
[BITS 16] ;Tells the assembler that its a 16 bit code
[ORG 0x7C00] ;Origin, tell the assembler that where the code will
;be in memory after it is been loaded
MOV SI, HelloString ;Store string pointer to SI
CALL PrintString ;Call print string procedure
JMP $ ;Infinite loop, hang it here.
PrintCharacter: ;Procedure to print character on screen
;Assume that ASCII value is in register
AL MOV AH, 0x0E ;Tell BIOS that we need to print one charater on screen.
MOV BH, 0x00 ;Page no.
MOV BL, 0x07 ;Text attribute 0x07 is lightgrey font on black background
INT 0x10 ;Call video interrupt RET ;Return to calling procedure
PrintString: ;Procedure to print string on screen
;Assume that string starting pointer is in register SI
next_character: ;Label to fetch next character from string
MOV AL, [SI] ;Get a byte from string and store in AL register
INC SI ;Increment SI pointer
OR AL, AL ;Check if value in AL is zero (end of string)
JZ exit_function ;If end then return
CALL PrintCharacter ;Else print the character which is in AL register
JMP next_character ;Fetch next character from string
exit_function: ;End label
RET ;Return from procedure
;Data
HelloString db 'Hello World', 0 ;HelloWorld string ending with 0
TIMES 510 - ($ - $$) db 0 ;Fill the rest of sector with 0
DW 0xAA55 ;Add boot signature at the end of bootloader
如您所見,語法似乎是正確的,將其編譯為.bin文件,但我試圖弄清楚如何對其進行測試。 請把我當做我有點慢,因為我花了HOURS來搜索這個主題,而且似乎沒有任何效果,我甚至按照某些教程嘗試使用了十六進制編輯器,但沒有用。 這似乎是我使用這些說明最接近的方法: http : //puu.sh/6KzUo.png
從此鏈接: 如何制作可引導的iso(非cd或閃存驅動器)以測試您自己的引導加載程序?
除非我不太了解步驟6,否則因為VM框不允許我選擇img文件作為可引導磁盤。
謝謝!
如果您只需要在磁盤控制器中添加軟盤,這是這樣做的方法:
單擊軟盤控制器。 選擇的左側應該出現帶有綠色加號的軟盤圖標。 單擊此小圖標。
現在應該出現一個對話框:
選擇“選擇磁盤”
將出現文件選擇框-此時,從文件選擇框中選擇您的.img
文件。
從這一點開始,您應該能夠從軟盤引導虛擬機並測試引導程序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.