2013-05-01 58 views
1

我已經在輸出「Hello World」的Assembly中創建了引導裝載程序。我想插入一個背景圖片到這個啓動加載器。那麼如何修改此代碼?非常感謝你。將背景圖像插入引導程序

bits 16 ; 
org 0x7c00 ; 

jmp main ; 



Message db "Welcome Home, booting from low-level 16-bit...", 0x0 
MessageB db "Chaturaka's own bootloader program written in x86 assembly language.", 0x0 
AnyKey db "Press any key to reboot...", 0x0 

; 
Println: 
    lodsb ; 
    or al, al 
    jz complete 
    mov ah, 0x0e  
    int 0x10 ; 
    jmp Println ; 
complete: 
    call PrintNwL 

; 
PrintNwL: 
    mov al, 0 ; 
    stosb  ; 


    mov ah, 0x0E 
    mov al, 0x0D 
    int 0x10 
    mov al, 0x0A 
    int 0x10 
    ret 

; 
Reboot: 
    mov si, AnyKey 
    call Println 
    call GetPressedKey 

    ; 

    db 0x0ea 
    dw 0x0000 
    dw 0xffff 

; 
GetPressedKey: 
    mov ah, 0 
    int 0x16 ; 
    ret 

; 
main: 
    cli ; 

    mov ax,cs    
    mov ds,ax 
    mov es,ax    
    mov ss,ax     
    sti ; 

    mov si, Message 
    call Println 

    mov si, MessageB 
    call Println 

    call PrintNwL 
    call PrintNwL 

    call Reboot 

    times 510 - ($-$$) db 0 ; 
    dw 0xAA55 ; 

希望你能回答這個問題。

回答

0

這些是需要執行以下步驟:

  • Set a graphics mode(例如模式0DH或13h模式)。
  • (可選)如果圖像不使用默認調色板,請設置調色板。
  • 從磁盤加載圖像數據並將其寫入視頻內存,通常從段0A000h開始。
+0

從光盤中加載圖像數據所需的文件系統支持,這並不流行(猜爲什麼)。圖像應在代碼段(或數據段) – stdcall 2013-05-01 07:56:16

+0

_「[它]需要文件系統支持」_中進行硬編碼。如果圖像作爲原始扇區存儲在磁盤上,則不適用。 – Michael 2013-05-01 08:25:47

0

結帳osdev WIKI,有關操作系統和bootloader開發的大量有用信息。 here你可以在保護模式下找到關於屏幕繪圖的有價值的信息。