Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.msdos.programmer > #4308

Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library

From Mateusz Viste <mateusz@x.invalid>
Newsgroups comp.os.msdos.programmer
Subject Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library
Date 2023-08-04 14:03 +0200
Organization ...
Message-ID <20230804140302.0a84f7fe@mateusz> (permalink)
References <20230731172858.11ce54d9@mateusz> <94cc74f4-c979-4637-a149-b02ec221c1c5n@googlegroups.com> <20230803102132.66863caa@mateusz> <b9c3cd0a-d693-4ad4-ab5d-fb2bf165b409n@googlegroups.com>

Show all headers | View raw


dn. Thu, 3 Aug 2023 19:41:07 -0700 (PDT), Alexei A. Frounze napisaƂ:
> > Is org 100h really required in this context? Isn't it the job of
> > the linker to compute proper addresses?   
> 
> Perhaps, but that's how the OBJ/OMF format has worked for years
> in TASM, MASM, WASM.

I didn't know that, I naively assumed the linker would recompute all
addresses.

> The first object file containing code should start its code
> segment with a line like `RESB 100h'. This is to ensure that
> the code begins at offset `100h' relative to the beginning
> of the code segment, so that the linker or converter program
> does not have to adjust address references within the file

Thanks for your research, it does explain quite some things. For
starters, it means that there is no chance to end up with working
machine code without inserting some kind of startup code that would
enforce the 0x100 address of the entry point (and probably perform some
other magic, like setting up segments to whatever expectations the C
compiler has...).

Before trying to (ab)use Open Watcom I shortly played with SmlrC. It
looked very promising, but its inline assembly wasn't resolving C
symbols (ie. asm "mov ax, myvar" was literally writing "mov ax,
myvar" into the resulting asm file instead of resolving the address of
the myvar short int).

I also glanced at Dave Dunfield's micro C, but found it even more
limited. And then there were a couple of other things I checked, but
they were mostly limited to a subset of K&R C.

Are there any alternative that would be able to generate a tiny (no
ugly startup code or libc calls) COM file based on ANSI C code with
inline assembly?

The only one I still have to check out is DOSMC by Peter Szabo,
but sadly it does not work in DOS.

Mateusz

Back to comp.os.msdos.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

[OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-07-31 17:28 +0200
  Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library JJ <jj4public@outlook.com> - 2023-08-01 18:38 +0700
    Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-08-01 14:50 +0200
      Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library T. Ment <t.ment@protocol.invalid> - 2023-08-01 15:23 +0100
  Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library "Alexei A. Frounze" <alexfrunews@gmail.com> - 2023-08-02 20:28 -0700
    Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-08-03 10:21 +0200
      Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library "Alexei A. Frounze" <alexfrunews@gmail.com> - 2023-08-03 19:41 -0700
        Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-08-04 14:03 +0200
  Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library "R.Wieser" <address@is.invalid> - 2023-08-03 10:39 +0200
    Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-08-03 12:07 +0200
      Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library "R.Wieser" <address@is.invalid> - 2023-08-03 14:35 +0200
      Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library "R.Wieser" <address@is.invalid> - 2023-08-04 08:31 +0200
        Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-08-04 14:03 +0200
          Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library "R.Wieser" <address@is.invalid> - 2023-08-04 16:29 +0200
            Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-08-04 16:56 +0200
              Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library "R.Wieser" <address@is.invalid> - 2023-08-04 19:02 +0200
                Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-08-04 21:18 +0200
  Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library Mateusz Viste <mateusz@x.invalid> - 2023-11-10 00:19 +0100

csiph-web