flat assembler
Message board for the users of flat assembler.

Index > DOS > initial segment registers in DOS vs bootcode

Author
Thread Post new topic Reply to topic
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1
I've been echoing the values of segment registers,
both for DOS (XP shell) and bootcode, Laughing

for DOS with "org 100h", the initial values are:

cs = ds = es = ss = df7
gs = fs = 0

and for bootcode with "org 7c00h" I get:

cs = ds = es = ss = fs = 0,
gs = f000

can someone explain why the value of df7 for DOS and
why f000 for bootcode? Razz

I expected all segment registers in both cases to be 0, Rolling Eyes
Post 05 Feb 2006, 17:26
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
segment register in virtual-real mode (DOS under win32) cannot be 0, because then code would be placed 0:100h, eg. in place where interrupt vector table should be placed...

bootup register values may differ by BIOSes i think
Post 06 Feb 2006, 10:02
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
cs = ds = es = ss = df7 means that your program loaded into segment 0DF7. this segment vary from current os status and may vary on: amount of loaded resident programs and drivers, current os version etc.: to be simple: the first empty memory block is used to load com-file, and first instruction will start from cs:100h, in this case: 0DF7:0100. boot code may think it is started from 0000:7C00. i did not know about gs=f000, but it can be usefull on 386+ systems as ready bios segment: then reboot code should be at gs:fff0h
Post 06 Feb 2006, 11:41
View user's profile Send private message Visit poster's website Reply with quote
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1
shoorick wrote:
cs = ds = es = ss = df7 means that your program loaded into segment 0DF7. this segment vary from current os status and may vary on: amount of loaded resident programs and drivers, current os version etc.: to be simple: the first empty memory block is used to load com-file, and first instruction will start from cs:100h, in this case: 0DF7:0100. boot code may think it is started from 0000:7C00. i did not know about gs=f000, but it can be usefull on 386+ systems as ready bios segment: then reboot code should be at gs:fff0h


ok, I think I understand, Shocked

"org 100h" just means the offset, I thought it meant flat address 100h
but now I see it means flat address ????0100 Sad

whereas "org 7c00h" boot code really is at flat address 00007c00h
Post 06 Feb 2006, 14:24
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
well, model is never really "flat", you are always relative to some segment. But these segments can be all set to 0 (like in bootup code), or to something else (like in DOS progs).
Post 06 Feb 2006, 14:39
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.