参照《linux完全剖析》一文中的程序自己写了
如下两个简单的程序:
boot.s
;这个程序将软驱的第二个扇区中的内容(kernel)读到 ;内存0x1000:0000的位置然后跳转到该处执行 ; ; ; org 07c00h jmp start msg: db "Now,begin to load kernel....",0ah msgLen equ $-msg start: mov ax,cs mov ds,ax mov es,ax mov ax,msg mov bp,ax mov cx,msgLen mov ax,01301h mov bx,000ch mov dl,0 int 10h load: mov dx,0x0000 ;dh->磁头号,dl->驱动器号 mov ax,0x1000 mov es,ax xor bx,bx ;es:bx->the data 0x1000:0000 mov ch,0 ;ch->磁道号 mov cl,2 ;cl->起始扇区号 mov ah,02h ;param mov al,01h ;how many blocks to read int 13h sys: ;jmp to the kernel jmp 0x1000:0 times 510 -($-$$) db 0 dw 0xaa55 |