请教实模式下段的问题
看操作系统入门书籍都有这样一个bootloader的例子,注意两个程序的起始地址不同。为什么第二个将es的值设置为0x7c00之后就可以运行正确了呢?谢谢大家~~
;loader1.asm
org 0x7c00
bits 16
Start:
mov ax, cs
mov ds, ax
mov es, ax
call DispStr
jmp $
DispStr:
mov ax, Msg
mov bp, ax ; ES:BP string address
mov cx, 16
mov ax, 01301h
mov bx, 000ch
mov dl, 0
int 10h
ret
Msg:
db "Hello, world!"
times 510 - ($-$$) db 0
dw 0xAA55
;loader2.asm
org 0 ; We are loaded at 0, not at 0x7C00!
bits 16
Start:
mov ax, 0x7c0
; mov cs, ax
; mov ds, ax
mov es, ax
call DispStr
jmp $
DispStr:
mov ax, Msg
mov bp, ax ; ES:BP string address
mov cx, 36
mov ax, 01301h
mov bx, 000ch
mov dl, 0
int 10h
ret
Msg:
db "Hello, world, in 0!"
times 510 - ($-$$) db 0
dw 0xAA55