で16ビットの実行可能BINARYRAW形式を生成したいWatcom C compiler
。リアルモードで実行されるヘッダーのないEXEファイルのようなもの。
私はLarge
メモリモデルを使用しているため、コードセグメントとデータセグメントが異なる可能性があり、64Kバイトを超える可能性があります。
私はこれが好きです:
// kernel.c
void kernel(void)
{
/* Print Hello! */
__asm
{
mov ah, 0x0E;
mov bl, 7
mov al, 'H'
int 0x10
mov al, 'e'
int 0x10
mov al, 'l'
int 0x10
mov al, 'l'
int 0x10
mov al, 'o'
int 0x10
mov al, '!'
int 0x10
}
return;
}
上記のコードをコンパイルするために、以下のバッチファイルを実行します。
@rem build.bat
@rem Cleaning.
del *.obj
del *.bin
cls
@rem Compiling.
@rem 0: 8088 and 8086 instructions.
@rem d0: No debugging information.
@rem ml: The "large" memory model (big code, big data) is selected.
@rem s: Remove stack overflow checks.
@rem wx: Set the warning level to its maximum setting.
@rem zl: Suppress generation of library file names and references in object file.
wcc -0 -d0 -ml -s -wx -zl kernel.c
@rem Linking.
@rem FILE: Specify the object files.
@rem FORMAT: Specify the format of the executable file.
@rem NAME: Name for the executable file.
@rem OPTION: Specify options.
@rem Note startup function (kernel_) implemented in kernel.c.
wlink FILE kernel.obj FORMAT RAW BIN NAME kernel.bin OPTION NODEFAULTLIBS, START=kernel_
del *.obj
build.bat
Watcomコンパイラとリンカによって生成された次のメッセージを実行した後:
D:\Amir-OS\ckernel>wcc -0 -d0 -ml -s -wx -zl kernel.c
Open Watcom C16 Optimizing Compiler Version 1.9
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.
kernel.c: 28 lines, included 35, 0 warnings, 0 errors
Code size: 39
D:\Amir-OS\ckernel>wlink FILE kernel.obj FORMAT RAW BIN NAME kernel.bin OPTION N
ODEFAULTLIBS, START=kernel_
Open Watcom Linker Version 1.9
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
Warning! W1014: stack segment not found
creating a RAW Binary Image executable
出力ファイルは正常に生成されました。
しかし、私の質問は次のとおりです。
W1014
警告を解決するにはどうすればよいですか?
また、初期CS値を指定する方法はありますか?