OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 3:09 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: WLINK segments offset
PostPosted: Mon Apr 10, 2017 3:52 pm 
Offline

Joined: Sun Apr 09, 2017 11:21 am
Posts: 2
Hello.

I try to make my bootloader, but have trouble with data address offset after linking.
Here my wlink config:
Code:
FILE MBR.asm.obj
FILE MBR.c.obj
NAME MBR.bin
OUTPUT raw
OPTION nodefaultlibs, quiet, start=_start
DISABLE 1014
ORDER
        clname CODE
        clname DATA
FORMAT dos

If use it, as a result all data addresses in program calculated as offsets from 0000.
If use next:
Code:
FILE MBR.asm.obj
FILE MBR.c.obj
NAME MBR.bin
OUTPUT raw
        offset = 0x7c00
OPTION nodefaultlibs, quiet, start=_start
DISABLE 1014
ORDER
        clname CODE offset = 0x7c00
        clname DATA
FORMAT dos

It only use offset from 0x7c00 for code, but still use offset from 0000 for data.

If use next:
Code:
FILE MBR.asm.obj
FILE MBR.c.obj
NAME MBR.bin
OUTPUT raw
        offset = 0x7c00
OPTION nodefaultlibs, quiet, start=_start
DISABLE 1014
ORDER
        clname CODE offset = 0x7c00
        clname DATA offset = 0x7d00
FORMAT dos

It generates valid program, puts data at offset 0x7d00 and use valid offset, but this version work only if my code < 0x100 byte and use hardcoded offset for data, so that is not good idea.

How I can set wlink to place DATA right after CODE and use global offset 0x7c00?


Top
 Profile  
 
 Post subject: Re: WLINK segments offset
PostPosted: Tue Apr 11, 2017 9:36 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
Far be it from me to discourage you from using your favourite compiler, but Open Watcom is not widely used for OS development, which means that it can be a little difficult - compared to the more popular toolsets - to obtain the relevant information. A starting point is http://wiki.osdev.org/Watcom , but you may need to do further research.


Top
 Profile  
 
 Post subject: Re: WLINK segments offset
PostPosted: Tue Apr 11, 2017 11:19 am 
Offline

Joined: Sun Apr 09, 2017 11:21 am
Posts: 2
iansjack wrote:
Far be it from me to discourage you from using your favourite compiler, but Open Watcom is not widely used for OS development, which means that it can be a little difficult - compared to the more popular toolsets - to obtain the relevant information. A starting point is http://wiki.osdev.org/Watcom , but you may need to do further research.

Can you help me find more suitable compiler and linker for this?
I use Watcom because it can without troubles link C with ASM, generate small code and support very old processors as 8086.


Top
 Profile  
 
 Post subject: Re: WLINK segments offset
PostPosted: Tue Apr 11, 2017 1:09 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
I'm afraid I can't make any suggestions as to a good toolkit for 8086 programming. I haven't written anything for it in decades.

Have you tried the Open Watcom forums? You are more likely to find someon who can help you there. (Although I believe that rdos - a user here - is a Watcom fan. Hopefully he will see your post and reply.)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], Google [Bot], JustVic and 156 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group