1. 程式人生 > >linux0.11 執行環境搭建以及調式--bochs (上)

linux0.11 執行環境搭建以及調式--bochs (上)

.globl begtext, begdata, begbss, endtext, enddata, endbss
.text
begtext:
.data
begdata:
.bss
begbss:
/* 這段程式碼主要是使用了bios設定的idr中斷處理來完成的螢幕輸出字串.. */
.text
BOOTSEG = 0x07c0                /* bios最終會把執行全交給這個地址開始執行 */

entry start
start:
    go, BOOTSEG                 /* 通過jmpi設定段暫存器cs */
go: mov     ax, cs              /* 將ds,es都設為cs指向的段地址 */
    mov     ds, ax
    mov     es, ax
    mov     [msg1+17],ah
    mov     cx, #20             /* 共顯示20個字元 */
    mov     dx, #0x1004         /* 螢幕第17行,第5列 */
    mov     bx, #0x000c         /* 字元顯示為紅色 */
    mov     bp, #msg1           /* 指定字串的地址 */
    mov     ax, #0x1301         
    int     0x10                /* bios中斷呼叫,功能號0x13,子功能0x01 */
loop1:      jmp loop1

msg1:        .ascii "Loading System ..."
            .byte    13,10

.org    510
            .word    0xAA55     /* 引導標誌位 */

.text
endtext:
.data
enddata:
.bss
endbss: