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


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

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-03 12:07 +0200
Organization ...
Message-ID <20230803120734.34e59904@mateusz> (permalink)
References <20230731172858.11ce54d9@mateusz> <uafp57$m0mf$1@dont-email.me>

Show all headers | View raw


dn. Thu, 3 Aug 2023 10:39:49 +0200, R.Wieser napisaƂ:
> > OPTION START=main_  
> 
> A COM file *always* starts at 0x0100.  Maybe this directive
> interferes with it ?

Without "OPTION START" the result is exactly the same, with the only
difference that wlink complains about "no starting address found".

> > 00000007  8B160C00          mov dx,[0xc]    <-- this should be
> > 0x11C  
> 
> the 0xC is almost the offset from that commands address to the string
> (off by one).  IOW, it looks like the resolving (by "wlink") didn't
> quite kick in.  Maybe the linker needs to be told that it is
> converting a COM style program too ?

The only wlink options I found in this context are "FORMAT DOS COM" and
"SYSTEM COM". The former is not computing addresses properly (as
shown in this thread) and the latter forces watcom's startup code to be
pulled in, resulting in a kilobyte of bloat.

Looking at the DOSMC tool from Peter Szabo it looks like there is
quite some hoops to jump over: https://github.com/pts/dosmc
I was probably a bit naive to think that there would be a ready-to-go
wlink switch that would generate working COM files without the watcom
startup bloat.

> > 0000001B  0004              add [si],al   <-- this should be 0x114
> 
> AFAIKS everything from address 0x1A is beyond your code/program.
> IOW, no idea what the remark is about.

You are correct that 0x1B is beyond code, but it is not beyond data.
My understanding is that the "04 00" value starting at 1Ch is a near
pointer that is supposed to be loaded by mov dx,[0x0c] (ie. "load DX
with the value at memory location 0x0C"). Both the MOV and the pointer
are badly addressed though, that is why I needed to fix them both by
hand to get a working executable. How the values 0x000C and 0x0004
have been computed exactly, this I have no idea.

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