Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Khaos

Executable format output

This topic is 6114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings. I am at a stage of my custom BASIC compiler creation, where I want to move from generating (NASM compatible) assembly code, to generating a pure binary executable format. I am going to be shooting for this to be compiled into a .COM file. I really only have one basic question. How could I get my compiler to generate the code, put it into a file in the correct format, and be able to select and run the file like any other .COM file? I might keep my compiler as is, generating assembly code, and then make my own linker like program to turn that into a .COM file, or I might change my compiler to simply output my executable file. So how can I do this? What is the file format for a .COM file, and how can I create this file? Any ideas, links, etc. is appreciated. Thanks guys! ===== Khaos =====

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Ok, I have a (sorta) related (and totally irrelevant) question:
What exactly is the difference between a COM executable and an EXE one? I remember something about COM ones having a size limit, but that''s all I can recall from the MS-DOS days.

Share this post


Link to post
Share on other sites
.COM is a nice, simple file format. Get the specs here. What you''ll want to do is essentially translate your assembly language to the corresponding opcodes, and write them to a file with the correct .COM header information. If you are looking for inspiration, I would suggest that you check out NASM, which is open source, and can output flat binary (e.g. .COM) files.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
True *.com files are limited to 64 kb - the *.com files that ship with non-DOS based windows aren''t true com files but are either NE or LE format files - leftovers from the early days of NT. A 32 bit windows executable format is PE - "portable executable" - portable in that it will run on different versions of windows - not portable in that it won''t run on *nix or mac. Bear in mind that *.com files are obsolete - but if you are looking to get your feet wet building a ''compiler'' I suppose there''s no harm there, eh? For format info check out wotsits.com - and maybe programmersheaven.com too. For info on PE files - start at google - search on Pietrek. Also check out Elicz''s site - don''t expect much source in basic - mostly asm and C or C++. Best of luck.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!