你好bobo98:
请问你说的格式是怎样的,我要将最终的二进制文件烧录到程序片ROM中,供仪器使用。不是要烧录到光盘。我知道转换格式前的EXE文件大小不能超过74KB ,而且,其中不能有堆栈段。但源程序应该是没问题的,所以,想弄明白用什么软件可以将源程序转换成64KB大小的BIN文件。谢谢指教!作者: bobo98 时间: 2008-1-17 19:11 如果你的程序确定没有问题,刚才看了你另开的一个贴子,提到程序由多个文件构成,
如果这些文件的结构同要求的格式没有出入的话,编译连接应该挺容易的,没有什么
大的问题.对了,你要生成了BIN文件,就是不能重载的文件.启动地址是,硬件上电时
行的那个位置.作者: everdos 时间: 2008-1-17 22:19 这是微软网站上的一段,说明了MASM如何生成.COM文件而不是.EXE文件:
MASM version 6.0 is the first version of the assembler to support the tiny model. Use the following steps the produce a .com file in MASM 6.0. 1. Use .model tiny. Declare logical segments using the simplified segment directives or full segment declarations.
-or-
Do not use the .model directive and assemble with /AT. Use full segment declarations.
2. Make sure that the first statement in the the code segment is ORG 100h.
3. Build the .com file.
Compiling and linking in one step: If .model tiny was used, no options are needed. The linker will automatically receive the /TINY switch, the file extension on the file produced will be .com, and the executable is indeed a .com file.
-or-
Performing a separate link: Specify the /TINY option on the link command line. The linker will issue the following harmless warning
L4045: name of output file is 'filename'
where 'filename' will have a .com extension.
这是有人解决类似问题的方法:
1. Generate the needed EXE (for example, BIOS.EXE)
2. load it into debug: DEBUG BIOS.EXE
3. first of all, rename the file: N BIOS.BIN
4. set the length of the file to save into the BX:CX register pair:
r bx
0 (<--- HIGH word; I assume it is not bigger than 64 KB, is it?)
r cx
xxxx (<--- LOW word)
5. Now, save the file to disc:
W CS:0000 ---->要用r先看一下程序入口确实是cs:0才行