3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MS-Windows 3.1のアプリを開発

Last updated at Posted at 2021-09-12

Open WatcomでWindows 3.1アプリを作ってみました。Windows 3.1は16Bitのアプリケーションでした。95以降は32Bitになっています。

いろいろ検索してみたところ、

が見つかり以下のページにたどりつきました。

githubにソースがあります。

forkしてOpen Watcomのwmake用のファイルを用意しました。

いつものようにOpen Watcom V2のLinuxのELFバイナリーをFreeBSDのLinuxエミュレーションで使います。パスを通してWATCOM環境変数を設定するだけでOK牧場です。(後日追記:procfsも必要でした)

% wmake
Open Watcom Make Version 2.0 beta Jun  1 2021 00:24:31 (64-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 -zW -I"/usr/home/hiroki/watcom/h" -I"/usr/home/hiroki/watcom/h/win" -zq -oaxt -d2 -w8 -fo=.obj AboutDlg
AboutDlg.c(6): Warning! W303: Parameter 'lParam' has been defined, but not referenced
        wcc -zW -I"/usr/home/hiroki/watcom/h" -I"/usr/home/hiroki/watcom/h/win" -zq -oaxt -d2 -w8 -fo=.obj MainWnd
        wcc -zW -I"/usr/home/hiroki/watcom/h" -I"/usr/home/hiroki/watcom/h/win" -zq -oaxt -d2 -w8 -fo=.obj WinMain
WinMain.c(10): Warning! W303: Parameter 'lpCmdLine' has been defined, but not referenced
        %create Win16App.lnk
        wlink @Win16App.lnk
        wrc -I"/usr/home/hiroki/watcom/h/win" Resource.rc Win16App.exe
Open Watcom Windows and OS/2 Resource Compiler
Version 2.0 beta Jun  1 2021 00:34:51 (64-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1993-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.

最初自力でmakefileを作ろうとしたのですが、オプションとかいろいろわからなかったので、Open Watcomのディレクトリにあるsamples/win/alartのwin16のビルドを参考にしました。

出来上がったEXEはPC-9801FA2のMS-Windows 3.1で動きました。

WIN16APP (2).jpg

Windows 7にもある画面キャプチャ機能のプリントスクリーンはWindows 3.1にもあってPC-9801のPrt ScキーはCOPYキーでAltはGRPHキーです。コピーしたものをペイントブラシにはって、サイズを調整してWindows 7にもってきて、JPEGで保存しなおしました。

Open Watcomすんばらしいです。

こちらにもWin16のプログラムを作られた方がいました。

MSVCよりOpen Watcomの方が簡単に使えると思います。

ちなみにWindows 3.0Aで試したら動きませんでした。

30.png

もちろんWindows 3.1(Win16)のバイナリはWindows 95(Win32)では動きません。ソースコードレベルでは互換があるようですが、今となって考えるとよくやったもんだと思います。ただWindows 95のバイナリはWindows 7の32Bit環境までだいたい動いていたわけでそこはすごいと思います。

3
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?