我跟随brokenthorn operating development series来学习引导程序。在this page,是三个行的代码:关于引导程序的问题
bits 16 ; We are still in 16 bit Real Mode
org 0x7c00 ; We are loaded by BIOS at 0x7C00
start: jmp loader ; jump over OEM block
在第二行他软盘加载BIOS的7c00。为什么不在0000?我检查了Where to store the bootloader on a floppy image?。 这里也给出了同样的事情。但原因没有解释。有人可以向我解释这个吗?提前致谢。
编辑:我感到困惑,因为在同一个站点在以后的教程中的代码是:
bits 16 ; we are in 16 bit real mode
org 0 ; we will set regisers later
start: jmp main ; jump to start of bootloader
,然后在主
main:
;----------------------------------------------------
; code located at 0000:7C00, adjust segment registers
;----------------------------------------------------
cli ; disable interrupts
mov ax, 0x07C0 ; setup registers to point to our segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
现在,这里为什么他用组织0?那么他为什么将地址复制到所有寄存器? 对不起,这是一个愚蠢的问题。我对汇编编程非常陌生,刚开始阅读有关引导加载程序。
顺便说一句,从你的措辞来看,你不清楚你是否理解:BIOS将bootloader *复制到内存中的0x7C00地址。 – AndreKR 2010-11-09 15:46:17
已编辑的问题。好心检查。 – narayanpatra 2010-11-09 16:33:47