Page 1 of 1
linker in FreeDOS
Posted: Sun Apr 12, 2009 11:46 pm
by extremecoder
I am writing some rmode assembly snippets in FreeDOS and using NASM for that. I am not able to find any linker for that. anybody developed a loader in the FreeDOS environment ?
Re: linker in FreeDOS
Posted: Mon Apr 13, 2009 2:36 am
by Combuster
You don't strictly need a linker to make DOS binaries. For example, .com files are flat binaries. And if you're just using assembly, that is probably sufficient.
then assemble with
nasm myapp.asm -f bin -o myapp.com
Re: linker in FreeDOS
Posted: Mon Apr 13, 2009 3:36 am
by extremecoder
sorry that i didn't post the question with fullest details ... I am right now anyway doing it with com only ...
but also I want to practice the assembly with segmentation ... i am not able to do with .com ... for example the following code throws an error when assembling using NASM
[org 16]
SEGMENT TEXT
mov ax, DATA
mov ds, ax
...
SEGMENT DATA
...
when assembling with NASM, i am getting " undefined reference DATA "
Re: linker in FreeDOS
Posted: Mon Apr 13, 2009 10:13 am
by frank
Maybe
this can help you some. It seems that NASM cannot generate .exe files directly. Maybe one of the linkers on that page will suit you.
If you aren't too attached to NASM then
FASM is capable of producing both DOS .exe files and WIN32 .exe files. The syntax for FASM is a little different and may take a bit of time to get used to.
Re: linker in FreeDOS
Posted: Mon Apr 13, 2009 10:29 am
by bontanu
You do need a linker even in ASM in order to link in multiple modules even for a COM file. You could insert all code into a single module BUT some people prefer to have multiple LIB's or OBJ's linked.
Linkers and Librarians existed for ASM long before they existed for C and other HLL languages.
The feature of modern assemblers that generates an executable format directly is usefully but one should not overlook the other more common development layout of using multiple OBJ's and linking them.
Re: linker in FreeDOS
Posted: Mon Apr 13, 2009 3:55 pm
by Dex
Re: linker in FreeDOS
Posted: Mon Apr 13, 2009 8:35 pm
by extremecoder
the problem is FreeDOS does not come with ALINK. also I am using FreeDOS as a VMWare guest. even though I download ALINK, I will not be able to mount USB drives in this DOS and use it ... I have something called WLINK, but that doesn't work ..
the main reason is, I am into developing my own boot loader .. I want to practice assembly by having multiple segments inside the asm code ...
Re: linker in FreeDOS
Posted: Tue Apr 14, 2009 12:41 am
by Combuster
extremecoder wrote:I want to practice assembly by having multiple segments inside the asm code ...
You don't need to practice segmentation by randomly allocating segments in your file - Instead, write a program that uses memory in a segmented fashion, like a graphics app with a backbuffer in system memory, or for the really good work, an audio player for screamtracker (S3M) files.
Re: linker in FreeDOS
Posted: Tue Apr 14, 2009 12:41 am
by bontanu
extremecoder wrote:the problem is FreeDOS does not come with ALINK. also I am using FreeDOS as a VMWare guest. even though I download ALINK, I will not be able to mount USB drives in this DOS and use it ... I have something called WLINK, but that doesn't work ..
...
What I usually do in Virtual PC:
1) Stop FreeDOS VM and make a note of the virtual HDD file it uses
2) Start another "simple" OS like Win98 that has additions installed after adding the FreeDOS virtual HDD to this machine.
3) Drag and drop the needed files from my host desktop to the guest desktop on a folder in the FreeDOS HDD.
4) Stop the "simple" Win98 OS.
5) Start FreeDOS VM and use the new files...
I guess that in VMWare you can do something similar.
Alink is usefully but it does have some quirks and errors.
Another option for creating multi segmented MZ EXE's would be to use the old 16 bits Microsoft LINK.EXE but in this case you would have to use MS-DOS in the VM and have a license for it in order to be correct.
Re: linker in FreeDOS
Posted: Tue Apr 14, 2009 1:22 am
by extremecoder
thank you very much ...