Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.msdos.programmer > #4311
| 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 16:56 +0200 |
| Organization | ... |
| Message-ID | <20230804165638.7a6ec341@mateusz> (permalink) |
| References | (1 earlier) <uafp57$m0mf$1@dont-email.me> <20230803120734.34e59904@mateusz> <uai619$161tu$1@dont-email.me> <20230804140324.0ae56909@mateusz> <uaj216$1a8bc$1@dont-email.me> |
dn. Fri, 4 Aug 2023 16:29:24 +0200, R.Wieser napisaĆ:
> I noticed that you are compiling with the "-ms" switch
> (small memory model), which is incompatible with a COM style
> executable. Try "-mt" (tiny memory model) instead.
"-ms" is the proper switch for compiling object files for COM
executables. In fact, the wcc compiler doesn't even understand -mt.
"-mt" is only a convenience switch for wcl (Watcom's "compile & link"
tool) so it knows that after executing wcc -ms it has to pass the
"SYSTEM COM" option to wlink.
Building a COM itself is well documented and hence easy to achieve. The
problem here is that I was trying to make Open Watcom build a tiny (as
in "very small") COM file by avoiding Watcom's libc and startup code,
ie. passing "OPTION NODEFAULTLIBS" to wlink. Then the COM file indeed
becomes very small, but it also ceases working, as the generated code
seems to expect to be executed within an environment prepared by
Watcom's startup routines.
Most probably my expectations towards Open Watcom were too high. It is
an awesome tool, but it's simply not designed to build minimalist COM
files without major hackery.
Such hackery have been done by Peter Szabo (aka pts). I tested just now
his DOSMC tool, and it compiled this program:
void main(void) {
static char *hello = "Hello$";
_asm {
lea ax, main
mov ah, 9
mov dx, hello
int 0x21
}
}
Into this:
00000000 E80400 call word 0x7
00000003 B44C mov ah,0x4c
00000005 CD21 int 0x21
00000007 53 push bx
00000008 51 push cx
00000009 52 push dx
0000000A 56 push si
0000000B 57 push di
0000000C 8D060701 lea ax,[0x107]
00000010 B409 mov ah,0x9
00000012 8B162501 mov dx,[0x125]
00000016 CD21 int 0x21
00000018 5F pop di
00000019 5E pop si
0000001A 5A pop dx
0000001B 59 pop cx
0000001C 5B pop bx
0000001D C3 ret
0000001E 48 dec ax
0000001F 656C gs insb
00000021 6C insb
00000022 6F outsw
00000023 2400 and al,0x0
00000025 1E push ds
00000026 01 db 0x01
Works perfectly, at least on this simple test example.
Too bad DOSMC is a perl Linux-only tool.
https://github.com/pts/dosmc
Mateusz
Back to comp.os.msdos.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
[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