【发布时间】:2014-03-19 05:54:11
【问题描述】:
这是我正在学习的引导加载程序的一部分
`[ORG 0x00]
[BITS 16]
SECTION .text
jmp 0x07c0:START ; set CS(segment register) to 0x07C0 and jump to START label.
TOTALSECTORCOUNT:
dw 0x02
KERNEL32SECTORCOUNT:
dw 0x02
START:
mov ax, 0x07c0
mov ds, ax ; set DS(segment register) to the address of the bootloader.
mov ax, 0xb800
mov es, ax ; set ES(segment register) to the address of the video memory starting address.
; stack initialization
mov ax, 0x0000
mov ss, ax
mov sp, 0xfffe
mov bp, 0xfffe
; clear the screen
mov si, 0
CLEARSCREEN:
mov byte[es:si], 0
mov byte[es:si + 1], 0x0a
add si, 2
cmp si, 80 * 25 * 2
jl CLEARSCREEN
; print welcome message`
开头没看懂:jmp 0x07C0:STARTCS寄存器怎么设置?
TOTALSECTORCOUNT 和 KERNEL32SECTORCOUNT 这两个变量是什么?它们不会出现在引导扇区文件中的任何位置,如果我删除它们,引导加载程序将无法加载欢迎消息。
移除部件会导致操作系统无法加载。那么那个jmp语句和这两个变量有什么意义呢?
``[ORG 0x00]
[BITS 16]
jmp START
START:
mov ax, 0x07c0
mov ds, ax ; set DS(segment register) to the address of the bootloader.
mov ax, 0xb800
mov es, ax ; set ES(segment register) to the address of the video memory starting address.
; stack initialization
mov ax, 0x0000
mov ss, ax
mov sp, 0xfffe
mov bp, 0xfffe
`
【问题讨论】:
-
我不知道这两个变量没有看到整个代码。
标签: bootloader osdev