Header executable - OS2

This is a discussion on Header executable - OS2 ; I'ld like to change a simple programming language. An interpreter is already working, and the interpreter now can produce a copied&pasted Linux-executable (ELF?) version of the code. Not being sure I'm capable of completing this, but is there perhaps any ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Header executable

  1. Header executable


    I'ld like to change a simple programming language. An interpreter is
    already working, and the interpreter now can produce a copied&pasted
    Linux-executable (ELF?) version of the code.

    Not being sure I'm capable of completing this, but is there perhaps any
    documentation of the OS/2 *.EXE-file format? Can I add some *.ASM'ed
    bytes to that? Is ALPREF.INF good enough to learn some basic assembly
    skills (*)? If not, what is? And can I use a near-empty *.EXE as my
    starting point instead of a constructed header?

    * = Made-up example:

    mov ay,41 // byte to print
    mov ax,5 // let int21 print to stdout
    int 21 // prints ay
    add ay,0d // adds 0x0d to ay
    mov ax,5 // let int21 print to stdout
    int 21 // prints ay

    So no "string[2]=0x41,0x4f" nor optimization (e.g. print the same
    byte 80 times). It's still simple.



    ---

  2. Re: Header executable

    ML schrieb:
    > I'ld like to change a simple programming language. An interpreter is
    > already working, and the interpreter now can produce a copied&pasted
    > Linux-executable (ELF?) version of the code.
    >
    > Not being sure I'm capable of completing this, but is there perhaps any
    > documentation of the OS/2 *.EXE-file format?


    If you have the OS/2 toolkit:
    OS2TK45\exe.h
    OS2TK45\exe386.h
    OS2TK45\newexe.h
    These cover the various executable formats: the DOS stub header
    contained in any OS/2 executable, the old 16-bit NE format, the new
    32-bit LX format etc.

    Also, the toolkit that comes with eCS contains:
    OS2TK45\book\lxref.htm
    OS2TK45\book\omfref.htm
    (but you can also get these from the internet, also in .INF format)

    That should cover everything you need to know to create a proper OS/2
    executable.


    Lars

  3. Re: Header executable

    Lars Erdmann schrieb:
    > ML schrieb:
    >> I'ld like to change a simple programming language. An interpreter is
    >> already working, and the interpreter now can produce a copied&pasted
    >> Linux-executable (ELF?) version of the code.
    >>
    >> Not being sure I'm capable of completing this, but is there perhaps any
    >> documentation of the OS/2 *.EXE-file format?

    >
    > If you have the OS/2 toolkit:
    > OS2TK45\exe.h
    > OS2TK45\exe386.h
    > OS2TK45\newexe.h
    > These cover the various executable formats: the DOS stub header
    > contained in any OS/2 executable, the old 16-bit NE format, the new
    > 32-bit LX format etc.
    >
    > Also, the toolkit that comes with eCS contains:
    > OS2TK45\book\lxref.htm
    > OS2TK45\book\omfref.htm
    > (but you can also get these from the internet, also in .INF format)


    By the way: OS2TK45\book\omfref.htm is meant for people writing a linker
    for OS/2 as it describes the format for .OBJ files.
    I guess this is not what you need.
    OSTK45\book\lxref.htm describes the 32-bit LX executable format.

    Lars

  4. Re: Header executable

    On 09/30/08 03:55 pm, Lars Erdmann wrote:
    > ML schrieb:
    >> I'ld like to change a simple programming language. An interpreter is
    >> already working, and the interpreter now can produce a copied&pasted
    >> Linux-executable (ELF?) version of the code.
    >>
    >> Not being sure I'm capable of completing this, but is there perhaps any
    >> documentation of the OS/2 *.EXE-file format?

    >
    > If you have the OS/2 toolkit:
    > OS2TK45\exe.h
    > OS2TK45\exe386.h
    > OS2TK45\newexe.h
    > These cover the various executable formats: the DOS stub header
    > contained in any OS/2 executable, the old 16-bit NE format, the new
    > 32-bit LX format etc.
    >
    > Also, the toolkit that comes with eCS contains:
    > OS2TK45\book\lxref.htm
    > OS2TK45\book\omfref.htm
    > (but you can also get these from the internet, also in .INF format)
    >
    > That should cover everything you need to know to create a proper OS/2
    > executable.
    >
    >
    > Lars


    Also I'd guess that the source for EMXBIND (should be available at
    netlabs in the libc svn repositry) shows a working example of how to
    change an AOUT binary into an OS/2 executable. Wonder if the interpreter
    you're working with can produce a working Linux AOUT file?
    Dave

  5. Re: Header executable


    >>> Not being sure I'm capable of completing this, but is there perhaps
    >>> any documentation of the OS/2 *.EXE-file format?


    >> If you have the OS/2 toolkit:


    Danke! Not installed, and I never thought it now would contain this
    kind of information.

    > By the way: OS2TK45\book\omfref.htm is meant for people writing a
    > linker for OS/2 as it describes the format for .OBJ files.
    > I guess this is not what you need.
    > OSTK45\book\lxref.htm describes the 32-bit LX executable format.


    Good guess, at least based on the existing situation. That's just a
    stepping stone, reaching the top may fail, but step #834 can reveil
    a need for more advanced features.



    ---

  6. Re: Header executable


    > Also I'd guess that the source for EMXBIND (should be available
    > at netlabs in the libc svn repositry) shows a working example of
    > how to change an AOUT binary into an OS/2 executable.


    I'll look at that too, it's more or less a learning project anyhow.

    BTW, in the world of simple languages it seems to be "fun" to create
    extremely small files. I haven't addressed that, but I really don't
    care about that. Size nor speed are important.

    > Wonder if the interpreter you're working with can produce a working
    > Linux AOUT file?


    Me too! :-)

    I don't think so, but that's just based on comments. I don't have any
    *ix installed, for one because it is overcomplicated (referring to the
    troubles w.r.t. installing GCC, even with usefull help :-)). So of
    course the compiler is written in the language itself, e.g.:

    EC.EXE Compiler.EC < Source.EC > Target.EXE

    Many moons ago I once used in a real assembly-part of an app "inx",
    register x=x+1, and if I compile the equivalent of 3 times "inx" in a
    row (here: 3 times "FE 01") it looks like this. Working OS/2 interpreter
    with a Compiler.EC producing a Linux *.EXE, AFAICT:


    00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    +----------------+ +-----------------------------------------------+
    0000 |ELF | |7F 45 4C 46 01 01 01 00 00 00 00 00 00 00 00 00|
    0010 |   T4 | |02 00 03 00 01 00 00 00 54 80 04 08 34 00 00 00|
    0020 | 4  ( | |00 00 00 00 00 00 00 00 34 00 20 00 01 00 28 00|
    0030 |  | |00 00 00 00 01 00 00 00 00 00 00 00 00 80 04 08|
    0040 | l u  | |00 80 04 08 6C 00 00 00 9C 75 00 00 06 00 00 00|
    0050 |  1+1#+l1B| |00 10 00 00 31 C0 31 DB B9 6C 80 04 08 31 D2 42|
    0060 |#| - | |FE 01 FE 01 FE 01 B0 01 B3 00 CD 80 |


    That's all, folks! ;-)

    Not having a Linux-clue of what I'm actually talking about: ELF instead
    of AOUT? There are no switches w.r.t. the *.EXE file format, or there
    must be some generic ELF2AOUT-converter I'm not aware of.

    FTR: I'ld like this to be an OS/2 *.EXE. That's my first priority. So
    using "FE 03" instead of "FE 01 FE 01 FE 01" isn't important (yet).
    This is just a simple stepping stone, it's not a main goal on its own.



    ---

  7. Re: Header executable

    On Wed, 1 Oct 2008 19:53:35 UTC spamgate@hotmai1.com (ML) wrote:

    >
    > Many moons ago I once used in a real assembly-part of an app "inx",
    > register x=x+1, and if I compile the equivalent of 3 times "inx" in a
    > row (here: 3 times "FE 01") it looks like this. Working OS/2 interpreter
    > with a Compiler.EC producing a Linux *.EXE, AFAICT:
    >
    >
    > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    > +----------------+ +-----------------------------------------------+
    > 0000 |ELF | |7F 45 4C 46 01 01 01 00 00 00 00 00 00 00 00 00|
    > 0010 |   T4 | |02 00 03 00 01 00 00 00 54 80 04 08 34 00 00 00|
    > 0020 | 4  ( | |00 00 00 00 00 00 00 00 34 00 20 00 01 00 28 00|
    > 0030 |  | |00 00 00 00 01 00 00 00 00 00 00 00 00 80 04 08|
    > 0040 | l u  | |00 80 04 08 6C 00 00 00 9C 75 00 00 06 00 00 00|
    > 0050 |  1+1#+l1B| |00 10 00 00 31 C0 31 DB B9 6C 80 04 08 31 D2 42|
    > 0060 |#| - | |FE 01 FE 01 FE 01 B0 01 B3 00 CD 80 |
    >
    >
    > That's all, folks! ;-)
    >
    > Not having a Linux-clue of what I'm actually talking about: ELF instead
    > of AOUT? There are no switches w.r.t. the *.EXE file format, or there
    > must be some generic ELF2AOUT-converter I'm not aware of.
    >
    > FTR: I'ld like this to be an OS/2 *.EXE. That's my first priority. So
    > using "FE 03" instead of "FE 01 FE 01 FE 01" isn't important (yet).
    > This is just a simple stepping stone, it's not a main goal on its own.


    Perhaps of interest are

    http://pages.prodigy.net/michaln/os2/os2mini.html
    and
    http://lafaix.online.fr/os2/contest.html

    CU/2
    --
    Frank Beythien fBeythien AT gmx.de

+ Reply to Thread