linker in FreeDOS
-
- Member
- Posts: 59
- Joined: Tue May 23, 2006 11:00 pm
linker in FreeDOS
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 ?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: linker in FreeDOS
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
Code: Select all
org 0100h
start:
<your code here>
nasm myapp.asm -f bin -o myapp.com
-
- Member
- Posts: 59
- Joined: Tue May 23, 2006 11:00 pm
Re: linker in FreeDOS
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 "
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
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.
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.
-
- Member
- Posts: 134
- Joined: Thu Aug 18, 2005 11:00 pm
- Location: Sol. Earth. Europe. Romania. Bucuresti
- Contact:
Re: linker in FreeDOS
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.
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.
Ambition is a lame excuse for the ones not brave enough to be lazy; Solar_OS http://www.oby.ro/os/
Re: linker in FreeDOS
You could try Alink http://www.asm32.motion-bg.com/asm.html
-
- Member
- Posts: 59
- Joined: Tue May 23, 2006 11:00 pm
Re: linker in FreeDOS
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 ...
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 ...
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: linker in FreeDOS
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.extremecoder wrote:I want to practice assembly by having multiple segments inside the asm code ...
-
- Member
- Posts: 134
- Joined: Thu Aug 18, 2005 11:00 pm
- Location: Sol. Earth. Europe. Romania. Bucuresti
- Contact:
Re: linker in FreeDOS
What I usually do in Virtual PC: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 ..
...
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.
Ambition is a lame excuse for the ones not brave enough to be lazy; Solar_OS http://www.oby.ro/os/
-
- Member
- Posts: 59
- Joined: Tue May 23, 2006 11:00 pm
Re: linker in FreeDOS
thank you very much ...