LoginSignup
3
3

More than 3 years have passed since last update.

Open Watcom v2-Debian

Last updated at Posted at 2021-02-27

MS-DOSの開発環境を調べていたところopen-watcom-v2というプロジェクトが見つかりました。

Open Watcomは元々パッケージソフトのWatcomというCやFortranの開発環境がオープンソースになったものでした。このオープンソースはバージョン1.9まで開発され、v2はそれからフォークしたものです。

Watcomは80年代からあったようです。アメリカに出張した時に購入した1989/10月号のDr.Dobb's JOOUNALを見るとTurbo Cの様な広告はありませんが、Watcom C 7.0の小売店での定価が$395とありました。Turbo Cが$150でLattice C 6.0が$250なのでちょっと高めの製品だったようです。Watcomは日本でも代理店が販売していたようですが、Turbo CやLattice Cなどに比べると知名度が低かったと思われます。

githubのレポジトリをみるとかなり活発に開発が進んでいるようなのでDebian/i386なホストで試して見る事にしました。

リリースタグのAssetsにある以下のファイルをダウンロードします。

open-watcom-2_0-c-linux-x86

このファイルはインストーラーで、実行ビットを立てて実行すると/usr/bin/watcomにファイルがコピーされます。インストーラーには日本語のメッセージも入っているようです。

/usr/bin/watcom/binlの下にMS-DOS(16ビット)のコンパイラーがあるのでPATHを通します。またWATCOM環境変数を/usr/bin/watcomにしておきます。

a.c
#include <stdio.h>

int main()
{
    printf("MORIMORI");
    return 0;
}

をコンパイルしてみます。

$ wcl -I/usr/bin/watcom/h -l=com -fe=a.com a.c
Open Watcom C/C++ x86 16-bit Compile and Link Utility
Version 2.0 beta Feb 26 2021 00:37:46 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
        wcc a.c  -I/usr/bin/watcom/h
Open Watcom C x86 16-bit Optimizing Compiler
Version 2.0 beta Feb 26 2021 00:29:07 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
a.c: 8 lines, included 802, 0 warnings, 0 errors
Code size: 19
        wlink @__wcl__.lnk
Open Watcom Linker Version 2.0 beta Feb 26 2021 00:25:57 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
searching libraries
creating a DOS .COM executable

wclはコンパイラーのwccとリンカーのwlinkのラッパーになります。

a.comファイルをPC-9801FA2(MS=DOS 3.3D)に転送して実行します。

A>a
MORIMORI

COMで作りましたが、もちろんEXEも作れます。

c++も試してみました。

b.cpp
#include <iostream>

using namespace std;

int main(){
  cout << "MORIMORI" << endl;
  return 0;
}
$ wcl -I/usr/bin/watcom/h -l=com -fe=b.com b.cpp
Open Watcom C/C++ x86 16-bit Compile and Link Utility
Version 2.0 beta Feb 26 2021 09:16:07 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
        bwpp b.cpp  -I/usr/home/hiroki/ow/watcom/h
Open Watcom C++ x86 16-bit Optimizing Compiler
Version 2.0 beta Feb 26 2021 09:43:59 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1989-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
b.cpp: 104 lines, included 1755, no warnings, no errors
Code size: 26
        bwlink @__wcl__.lnk
Open Watcom Linker Version 2.0 beta Feb 26 2021 09:11:12 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
searching libraries
creating a DOS .COM executable

こちらもPC-9801FA2で動きました。

16ビット環境は8ビットや32ビットに比べめっきり陰が薄くなりましたが、昔取った杵柄を思い出してみませんか?

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3