2011-01-19 58 views
0

我試圖勾搭一些組件不顯示,創建操作系統。當該代碼被加載進入bootloader,它是假設輸出「這是我很酷的新的操作系統!哇噢!ChigginsOS」但現在它說,減去「Chiggins」結尾。我哪裏錯了?字符串在裝配

BITS 16 

start: 
    mov ax, 07C0h 
    add ax, 288 
    mov ss, ax 
    mov sp, 4096 

    mov ax, 07C0h 
    mov ds, ax 

    mov si, text_string 
    call print_string 

    mov si, name_string 
    call print_string 

    jmp $ 

    text_string db 'This is my cool new OS! Woohoo!',0 
    name_string db 'ChigginsOS',0 

;--------------------------------------------------------------------------------------- 

exit: 
    ret 

;--------------------------------------------------------------------------------------- 

print_string: 
    mov ah, 0Eh 

.repeat: 
    lodsb 
    cmp al, 0 
    je .done 
    int 10h 
    jmp .repeat 

.done: 
    call exit 

;--------------------------------------------------------------------------------------- 

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

回答

6

你不退出print_string子程序:當你執行「調用exit」,你正在開始一個新的子程序,所以「RET」將將「呼叫退出」的位置後返回,並開始執行print_string之後的填充。

替換「調用exit」以純「漚」,它應該工作。