I'm confused :(

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
MeNguyen
Posts:1
Joined:Mon Mar 08, 2010 8:59 pm
I'm confused :(

Post by MeNguyen » Mon Mar 08, 2010 9:05 pm

Hi,

I find this in tutorial 4
msg db "Welcome to My Operating System!", 0

;*************************************************;
; Bootloader Entry Point
;*************************************************;

loader:

; Error Fix 1 ------------------------------------------

xor ax, ax ; Setup segments to insure they are 0. Remember that
mov ds, ax ; we have ORG 0x7c00. This means all addresses are based
mov es, ax ; from 0x7c00:0. Because the data segments are within the same
; code segment, null em.


mov si, msg
call Print

cli ; Clear all Interrupts
hlt ; halt the system

Why is it you say "Setup segments to insure they are 0. Remember that we have ORG 0x7c00. This means all addresses are based from 0x7c00:0. Because the data segments are within the same code segment, null em.

why all addresses are based from 0x7c00:0? I thought we loaded our bootloader at 0x7c00

Thanks in advance

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Re: I'm confused :(

Post by Mike » Mon Mar 08, 2010 10:48 pm

Hello,

That tutorial is planned for an update. The 0x7c00:0 should actually be 0x0:0x7c00 but that doesnt matter; Because the bootloader uses ORG 0x7c00, the segments must be 0 as the assembler will add 0x7c00 offset to all addresses. So, if ds=0, ds:0 + 0x7c00 = 0x7c00 = 0x7c0:0.

We are at 0x7c00 (ie 0x7c0:0). I apologize for the confusion.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

Post Reply