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


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

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

Newsgroups comp.os.msdos.programmer
Date 2023-08-03 19:41 -0700
References <20230731172858.11ce54d9@mateusz> <94cc74f4-c979-4637-a149-b02ec221c1c5n@googlegroups.com> <20230803102132.66863caa@mateusz>
Message-ID <b9c3cd0a-d693-4ad4-ab5d-fb2bf165b409n@googlegroups.com> (permalink)
Subject Re: [OpenWatcom] building a COM file without pulling in the Watcom standard library
From "Alexei A. Frounze" <alexfrunews@gmail.com>

Show all headers | View raw


On Thursday, August 3, 2023 at 1:21:35 AM UTC-7, Mateusz Viste wrote:
> dn. Wed, 2 Aug 2023 20:28:34 -0700 (PDT), Alexei A. Frounze napisał: 
> > If you make your own startup code with proper 
> > ----8<---- 
> > org 100h 
> > _cstart_: 
> > ... 
> > end _cstart_ 
> > ----8<---- 
> > It may just work.
> 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 tried nonetheless, but nasm does not understand the "org" directive 
> when using the -f obj target. It's apparently only valid for -f bin. 

Why not just use WASM if you're already using WCC/WCL/WLINK/etc?

Anyhow, if you dig your beloved NASM's nasmdoc.txt, you'll find this:
----8<----
 8.2.2 Using the `obj' Format To Generate `.COM' Files

       If you are writing a `.COM' program as more than one module, you may
       wish to assemble several `.OBJ' files and link them together into a
       `.COM' program. You can do this, provided you have a linker capable
       of outputting `.COM' files directly (TLINK does this), or
       alternatively a converter program such as `EXE2BIN' to transform the
       `.EXE' file output from the linker into a `.COM' file.

       If you do this, you need to take care of several things:

       (*) 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 when
           generating the `.COM' file. Other assemblers use an `ORG'
           directive for this purpose, but `ORG' in NASM is a format-
           specific directive to the `bin' output format, and does not mean
           the same thing as it does in MASM-compatible assemblers.
----8<----

HTH,
Alex

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