Looking for 16-bit x86 compiler

后端 未结 10 959
春和景丽
春和景丽 2020-11-29 05:52

I am working on an embedded systems project and have run into an issue of the compiler being programatically embedded in the Paradigm C++ IDE. I would like to be able to aut

相关标签:
10条回答
  • 2020-11-29 06:31

    I am currently using gnu as (part of binutils and the assembler used for gcc) and I have successfully been assembling 16bit assembly code with the following:

    as <file>
    ld --oformat binary -Ttext 0x0 -e start <file>
    

    with my assembly files starting out with:

    .code16
    .globl start
    .text
    start:
    

    since its plain binary omitting the lines,

    .globl start
    start:
    

    will simply yield an warning, even though flat binaries need no entry point.


    something I learned the hard way;

    -Ttext 0x0
    

    is critical, otherwise the .text segment is pushed outside of 16bit addressing range (don't ask me why)

    I am personally still learning assembly, so this is just my way, not necessarily the best way.


    EDIT: If you are writing boot code, you should change

    -Ttext 0x0
    

    to

    -Ttext 0x7c00
    

    this will offset your memory addresses by 0x7c00 since boot code is usually loaded at 0x7c00 by the BIOS.

    0 讨论(0)
  • 2020-11-29 06:31

    Doesn't your chip vendor (AMD, I guess) have any pointers to compilers for the chip?

    If not, you may be able to use some 16-bit DOS compilers - but you'll have several potential big problems:

    1. getting a library for the compiler that is not dependent on the BIOS or MS-DOS
    2. debugging
    3. linkers for embedded systems usually have specific support for locating code in specific memory regions. That's not usually included in compilers for DOS, but you may be able to find some sort of linker/locator that'll do the trick for you.

    A couple of compilers that are still supported and generate 16-bit code are:

    • Digital Mars
    • Open Watcom
    0 讨论(0)
  • 2020-11-29 06:34

    Take a look at bcc, which is a 16-bit x86 C compiler. For example, there are also Debian packages for it.

    0 讨论(0)
  • 2020-11-29 06:34

    It has been a long time since I've looked at Paradigm stuff (are they still around?) -- are you sure they don't have command-line equivalents for the compiler? My recollection is that they were built on top of Borland's compiler toolchain... So maybe an old copy of Borland compilers might do the trick?

    -- Ah, looking a little futher, I find that Paradigm is still around (www.devtools.com) selling X86 tools. (Must be a cash cow!)

    Their professional product includes scripting... Depending on the amount of work you plan to do, it just might be worth it to bite the bullet and buy their full offering...

    Good luck.

    0 讨论(0)
  • 2020-11-29 06:38

    The most recent as per 2014 is Dev86.

    0 讨论(0)
  • 2020-11-29 06:39

    Not sure but I think old version of borland c++ was able to do that. you can download version 5.5 t : here good luck

    0 讨论(0)
提交回复
热议问题