参考
MASM32のインストール
どのサイトからでも同じ内容(のはず)
16bitリンカは link16.exe として用意されている
C:\Users\lance>fc /b C:\Users\lance\Downloads\masm32v11r.zip "C:\Users\lance\Downloads\masm32v11r (1).zip"
ファイル C:\USERS\LANCE\DOWNLOADS\masm32v11r.zip と C:\USERS\LANCE\DOWNLOADS\MASM32V11R (1).ZIP を比較しています
FC: 相違点は検出されませんでした
プロジェクトの作成
プロジェクトのディレクトリを用意する(例 C:\Projects\masm32\hello)
hello.asm ファイルを記述する
hello.asm
comment *
hello. asm for MASM32
path % path% ;c:\masm32\bin
ml / c / AT / Fl hello. asm
link16 / t hello;
*
. model tiny
stdout equ 1
lf equ 0ah
cr equ 0dh
. code
org 100h
start :
mov dx , offset outdata
mov cx , outdata_len
mov bx , stdout
mov ah , 40h
int 21h
mov ax , 4c00h
int 21h
outdata db 'hello, world' , cr, lf
outdata_len equ $ - outdata
end start
別バージョン
+
...
; hello.asm
; for MASM32 SDK
; >path %path%;c:\masm32\bin
; >ml /c /Fl hello.asm
; >link16 /t hello.obj;
. model tiny
stdout equ 1
lf equ 0ah
cr equ 0dh
.data
outdata db 'hello, world' , cr, lf
outdata_len equ $ - outdata
. code
org 100h
start :
mov dx , offset outdata
mov cx , outdata_len
mov bx , stdout
mov ah , 40h
int 21h
mov ax , 4c00h
int 21h
end start
コマンドプロンプトを起動する(エクスプローラーのアドレスに cmd と入力するのが手っ取り早い)
path %path%;C:\masm32\bin
パスを通す
ml /c /AT /Fl hello.asm
/AT Enable tiny model (.COM file)
/c Assemble without linking
/Fl[file] Generate listing
link16 /t hello;
obj から com ファイルを作る
C:\Projects\masm32\hello>path %path%;c:\masm32\bin
C:\Projects\masm32\hello>ml /c /AT /Fl hello.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: hello.asm
C:\Projects\masm32\hello>link16 /t hello;
Microsoft (R) Segmented Executable Linker Version 5.60.339 Dec 5 1994
Copyright (C) Microsoft Corp 1984-1993. All rights reserved.
LINK : warning L4045: name of output file is 'hello.com'
hello.lst(抜粋)
.
comment *
hello.asm for MASM32
path %path%;c:\masm32\bin
ml /c /AT /Fl hello.asm
link16 /t hello;
*
.model tiny
= 0001 stdout equ 1
= 000A lf equ 0ah
= 000D cr equ 0dh
0000 .code
org 100h
0100 start:
0100 BA 0112 R mov dx, offset outdata
0103 B9 000E mov cx, outdata_len
0106 BB 0001 mov bx, stdout
0109 B4 40 mov ah, 40h
010B CD 21 int 21h
010D B8 4C00 mov ax, 4c00h
0110 CD 21 int 21h
0112 68 65 6C 6C 6F 2C outdata db 'hello, world', cr, lf
20 77 6F 72 6C 64
0D 0A
0120 = 000E outdata_len equ $ - outdata
end start
hello.com(16進ダンプ)
ADDRESS 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF
------------------------------------------------------------------------------
00000000 BA 12 01 B9 0E 00 BB 01 00 B4 40 CD 21 B8 00 4C コ..ケ..サ..エ@ヘ!ク.L
00000010 CD 21 68 65 6C 6C 6F 2C 20 77 6F 72 6C 64 0D 0A ヘ!hello, world..
DOSBoxのインストール
※32bit版Windowsの場合、NTVDMをインストールすればコマンドプロンプトで16bitアプリが動く
DOSBox用ディレクトリを用意する(例 C:\tmp\DOSBox)
DOSBoxを起動する。
106キーボードには対応してないので[¥]は[/]で代用、[:]はShift+[;]で入力可。
>mount c c:/tmp/dosbox
>c:
或いは、スタートメニュー/DOSBox-0.74/DOSBox 0.74 Optionsでdosbox-0.74.confが編集できるので、最後に以下の様に記述する。
[autoexec]
mount c c:\tmp\dosbox
c:
先ほど作ったhello.comをC:\tmp\DOSBoxにコピーする。
Ctrl+F4でディスクキャッシュをリセット。
>hello
最終更新:2017年11月01日 10:40