Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8935651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:02:21+00:00 2026-06-15T10:02:21+00:00

Lately I’ve been wanting to get into assembly coding, just to have some experience

  • 0

Lately I’ve been wanting to get into assembly coding, just to have some experience under my belt. I decided to look into it and was getting some good results(though its simple asm), however everything is still blurry, and I would much appreciate some input from others on how to correctly build multiple .asm files into .. &.. &.. to finish with a .vfd or a .img file for Oracle VM.

So over the past few weeks in my spare time, I’ve been researching around the web trying to find a working method that will enable me to:

1. Compile my .asm files into individual .obj files
2. Link these multiple files into one .bin
3. Place this .bin into a .vfd or .img
4. Finally ran on the Oracle VM.

The programs i am currently using on my windows 7 64bit system are:

(all through MinGW)

1. nasm   - to compile the asm to .obj / .bin files
2. ld     - to link .obj files into a .bin (I think)
3. dd     - to create a .img file from a .bin file

After some time of messing about I’ve been able to compile a single .asm file into a .bin file, and then placed it into a .img using dd (the below was from tutorials online):

(a bat file which executes these commands in the order below)

1. nasm -f bin -o bootloader.bin bootloader.asm  
2. dd if=bootloader.bin of=output.img count=1440

and then I just ran the Oracle VM which reads the output.img and displays it correctly. YAY.

Now. I’ve coded in Visual c++ for some years now, and i typically use many files in single solution. I feel that when coding in asm, I should also be able to have multiple files. So I’ve read around and many use ‘ld’ – a linker which ‘joins‘ .obj files into .bin files?

So I edited the above bat file to the following:

1a. nasm -f bin -o bootloader.bin bootloader.asm 
1b. nasm -f bin -o kernel.bin     kernel.asm 
2.  ld -o link.bin bootloader.obj kernel.obj 
3.  dd if=link.bin of=output.img  count=1440

The first error i got was: “cannot perform PE operations on non PE output file”. After
I Googled.. and Googled… and Googled…. and Googled….. (one link to the next) and I couldn’t find any other methods that worked – I just got more errors! I’m honestly lost. – I tried several different programs (eg objcopy), lots of different parameters, etc.. and I haven’t made too much progress. I need guidance. 🙂

And here is my final questions. Will ”linking” these files together with ld give me the desired results I seek? (multiple files in one final binary file) and how can I do it correctly on my windows system?

I’m not all to in-depth with asm or these programs so I’ve tried to read up as much as I could before i got here. So please if you could keep the explanations nice and clear. Im sorry if its a lot to ask for, and please no grilling. 🙂

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:02:23+00:00Added an answer on June 15, 2026 at 10:02 am

    I don’t think there’s any way to “link” multiple flat binary files (Nasm’s -f bin output). If we were forced to use (G)as, there’s no -f bin output. ld will create a flat binary from an ELF linkable object. I think the command line is something like ld -oformat binary -T.text=0x7C00 -o boot.bin boot.o. I don’t know if MinGW’s ld will do it, and I don’t know if it will handle multiple files. Something to try, at least…

    Linking won’t do you any good with your bootsector, in any case. When your computer (or VM?) boots, only the first sector is loaded – 512 bytes exactly. You’ll have to provide code to load your “kernel.bin” (or “stage2.bin” from disk (or .vfd?) to a known location in memory. In order to easily find this further code, it is convenient to have it located immediately after the boot sector. You can use cat or copy (I think you’ll want the /b option) to combine “boot.bin” and “kernel.bin” to a single file – then dd it to floppy (or .vfd?).

    “kernel.bin” is more flexible. It can be larger than 512 bytes, and could be built from multiple object files. You’ll want a flat binary, or you could provide a loader for some executable format – probably MZ, since you’re still in 16-bit mode. Once you’ve switched to 32- (or 64-) bit Pmode, you’ll probably want to arrange to load PE or ELF or whatever executable format…

    Best source of information I know for this kind of thing is http://www.osdev.org – check it out, if you haven’t. Happy bootin’!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lately I have been experiencing Eclipse Galileo (3.5) slowing down under Java 1.5b12 OR
Lately I've been running into some subtle layout issues in my iOS app. For
Lately my site has been getting hit by some people who have bots which
Lately I have been trying my hands on Eclipse IDE for java development. I
Lately, I've often found myself wanting to run some command on the output of
Lately, I've gotten some weird linker errors. I've been taught that there's two ways
Lately I have been reading about the Rack architecture in Passenger/Rails, and how it
Lately I have started to put more and more functions into header files, mostly
Lately I have been seeing an increasing number of design articles encouraging the use
Lately, I've been reading some code that has if (! (a == b) )

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.