MASM32 の動作

  It is designed to plug into a computer that has other programming environments set up on it and this places some restrictions on the format. To avoid the problems associated with picking up the wrong link versions and wrong library directory, MASM32 works with specified paths to all of the binary files it needs to build the files.

   MASM32は様々なコンピュータに組み込まれるので、環境によりいくつかの制限が発生してしまう。 作成されたバージョンの異なったライブラリを使おうとしてしまったことによる問題を回避するため、 MASM32は、ビルドする際に必要となるバイナリファイルは全てパスを記述することになっている。

  In the source code, the paths to the library files are specified and in the batch files that are used by the editor to drive the build options, the paths of each binary file is specified as well.

   ソースコードにライブラリファイルへのパスは記述することになっており、 ビルドオプションを有効にするためにエディタで編集したバッチファイルで、 それぞれのバイナリファイルへのパスも記述される

  Files from other sources usually do not build from MASM32 without some modification, usually placing the following MASM specific directives at the beginning of the source file will solve most of the problems. The other is to use the "include" & "includelib" syntax for the INCLUDE file and LIBRARIES so that their paths can be found.

   他の環境で動作していたソースファイルは、そのまま何もせずにMASM32でビルドすることは、 おそらくできないが、以下に示すような、MASM固有の命令をソースファイルの 先頭に記述することによりほとんどの問題は解決するだろう。 修正するところは、インクルードファイルを見つけるため、 "include" もしくは "includelib" 構文で指定しているパス名だ。


    .386                     ; forces 32 bit assembly
                             ; 32bit
    .modelflat, stdcall      ; memory model and callingconvention
                             ; メモリモデル、関数呼び出し規則
    optioncasemap :none      ; case sensitive code
                             ; 大文字小文字の区別

  MASM32 uses its own version of "windows.inc". It is a file over 800k in size and has a very large set of equates and structures in it for 32 bit windows programming. It should always be put before the system include files and libraries.

   MASM32には自分のバージョンの windows.inc を使用することになっている。 そのファイルは 800kb以上ものサイズとなっており、 32bit Windows アプリケーションのために必要な宣言、定義が延々と記述されている。 そして、このファイルは以下の例のように、他のシステムインクルードファイルや、 ライブラリより先に書かなければならない。

EXAMPLE


    include\masm32\include\windows.inc   ; always first
    include\masm32\include\user32.inc    ; system include
    include\masm32\include\kernel32.inc  ; file next
    include\masm32\include\gdi32.inc
    includelib\masm32\lib\user32.lib     ; matching system
    includelib\masm32\lib\kernel32.lib   ; libraries after that
    includelib\masm32\lib\gdi32.lib

  MASM32 version 8 starts with a set of prebuilt include files that are used to build matching libraries at installation so for each library, you use the include file that matches it. To find a function that you need depending on the reference material you are using, look in the system include file to see which file has the prototype for the function and include the file and the matching library.

   MASM32 Ver8 は、あらかじめビルドされたインクルードファイルで始まることになっており、 そのインクルードファイルは、インストール時の環境と一致したライブラリをビルドするために使用される。 なので、それぞれのライブラリに対応したインクルードファイルを使う必要がある。 あなたが使っている参考資料で出てくる関数を見つけるために、 システムインクルードファイルを調べなければならない。 システムインクルードファイルには、その必要となった関数のプロトタイプ宣言、 どのファイルをインクルードしているか、対応したライブラリは何か、が記述されている。

  Most of the common functions are in the three big system DLLs so if you look in,

   ほとんどの共通関数は3つの大きなDLLにある。


    GDI32.INC      ; graphics related functions
                   ; 描画関係の関数郡
    KERNEL32.INC   ; operating system kernel functions
                   ; システムコール関数郡
    USER32.INC     ; various user interface & other functions
                   ; ユーザーインターフェイス関係と & その他の関数

    you will find most of the common functions.

    これらのファイルに、ほとんどの共通関数がある。

  For functions that are not in the main libraries, usually the Microsoft reference material specifies which library the function is in so if you look in the include file for that library, you will find the prototype for it. MASM32 also comes with a dedicated function to library tool called liblist.exe to help locate the function you require in the appropriate library.

   メインライブラリにない関数のために、Microsoftの参考資料には、 その関数がどのライブラリに含まれているかたいてい記述されている。 そのため、そのライブラリに必要となるインクルードファイル中に、 その関数のプロトタイプ宣言を見つけることができるだろう。 MASM32にはそのような(特殊な)関数のためにliblist.exe というライブラリツールが付属している(come with)。 liblist.exe は、あなたが必要とする関数がどのライブラリにあるか探す際に役立つだろう。

  There are two main reference sources for writing 32 bit assembler in Windows, for the assembler instructions and the general architecture of x86 series processors, the three (3) volume set of PDF files from Intel are the best available and are exhaustively documented in the PIII manual set. There is also a set of manuals for the PIV series of Intel processors.

   32bit Windows アプリケーションを書くのに、2つの主な参考資料がある。 1つは、インテルが提供するPDFファイルで、 アセンブラの命令体系、x86CPUのアーキテクチャについての解説されており、非常に役に立つ。 しかも、PentiumIIIシリーズの詳細にも触れらており、 PentiumIVシリーズのマニュアルも揃っている。

  The other is Microsoft reference material. The most common is a help file called "WIN32.HLP" which is now a little out of date but still useful. It is a help file of about 12 meg in size. Later information for Win98/se winME, win2k and XP are available in the PlatformSDK that can be obtained from Microsoft for the cost of the shipping.

   もうひとつは、マイクロソフトの参考資料だ。 一般的なものはほとんど Win32.hlp というヘルプファイルにある、 今となっては少々旧くなってしまったが、十分役に立つ。 ただ、ヘルプファイルのサイズは約12Mbもある。 Win98/se、WinME、Win2k、XPのWin32SDKに関する最近の情報は、 送料はかかるが入手できる。

  The MSDN CD set are also useful if you have them available.

   もし利用できる状況であれば、 MSDN(MicroSoftDeveloperNetwork)も非常に役に立つ