| 
 
xiaohanchou 
社区乞丐
 
 
  
  
积分 -16 
发帖 5 
注册 2008-1-14 
状态 离线
 | 
『楼 主』:
 8088 汇编语言编写的程序
 
使用 LLM 解释/回答一下
  
我这有一个用汇编语言写的程序,用批处理将各.ASM文件链接处理后生成的.exe文件,却不知道怎样将其生成.bin文件,以用于烧录到程序片中。用exe2bin.exe时提示内存不够,生成的.exe文件大小为74KB左右。 
急切求购相应软件!谢谢! 
 
    
 
  
 |   
 | 
  2008-1-14 10:28 | 
  
 | 
 | 
 
bobo98 
初级用户
 
  
 
  
  
积分 43 
发帖 20 
注册 2007-12-25 
状态 离线
 | 
 | 
  2008-1-16 17:05 | 
  
 | 
 | 
 
bobo98 
初级用户
 
  
 
  
  
积分 43 
发帖 20 
注册 2007-12-25 
状态 离线
 | 
 | 
  2008-1-16 17:06 | 
  
 | 
 | 
 
xiaohanchou 
社区乞丐
 
 
  
  
积分 -16 
发帖 5 
注册 2008-1-14 
状态 离线
 | 
『第 4 楼』:
 关于格式
 
使用 LLM 解释/回答一下
  
你好bobo98: 
                   请问你说的格式是怎样的,我要将最终的二进制文件烧录到程序片ROM中,供仪器使用。不是要烧录到光盘。我知道转换格式前的EXE文件大小不能超过74KB ,而且,其中不能有堆栈段。但源程序应该是没问题的,所以,想弄明白用什么软件可以将源程序转换成64KB大小的BIN文件。谢谢指教! 
 
    
 
  
 |   
 | 
  2008-1-17 14:54 | 
  
 | 
 | 
 
bobo98 
初级用户
 
  
 
  
  
积分 43 
发帖 20 
注册 2007-12-25 
状态 离线
 | 
『第 5 楼』:
 
 
使用 LLM 解释/回答一下
  
如果你的程序确定没有问题,刚才看了你另开的一个贴子,提到程序由多个文件构成, 
如果这些文件的结构同要求的格式没有出入的话,编译连接应该挺容易的,没有什么 
大的问题.对了,你要生成了BIN文件,就是不能重载的文件.启动地址是,硬件上电时 
行的那个位置. 
 
    
 
  
 |   
 | 
  2008-1-17 19:11 | 
  
 | 
 | 
 
everdos 
初级用户
 
  
 
  
  
积分 52 
发帖 21 
注册 2008-1-1 
状态 离线
 | 
『第 6 楼』:
 
 
使用 LLM 解释/回答一下
  
这是微软网站上的一段,说明了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才行 
 
如果你的代码确实大于64K,第一种方法显示是不行了。 
第二种方法可以写出大于64k的代码: 
(1)必须确保程序入口是cs:0 
(2)第四步不要修改bx和cx。如果纯粹为了得到小于64k的代码而将bx置零,是没有意义的,得到的代码估计不能正确执行。 
 
如果你的代码确实大于64k,而你的片子不能超过64k,那就没有办法了。 
 
    
 
  
 |   
 | 
  2008-1-17 22:19 | 
  
 | 
 | 
 
xiaohanchou 
社区乞丐
 
 
  
  
积分 -16 
发帖 5 
注册 2008-1-14 
状态 离线
 | 
『第 7 楼』:
 非常感谢
 
使用 LLM 解释/回答一下
  
非常感谢二位的回帖,这两天一直在忙,没时间上来看看。所以回帖慢了点,还望二位见谅。对于二位的帮助,十分感激与感谢。谢谢! 
 
    
 
  
 |   
 | 
  2008-1-21 15:32 | 
  
 | 
 | 
 
kawaguchi 
初级用户
 
  
 
  
 
积分 67 
发帖 32 
注册 2007-1-25 来自 日本の江户 
状态 离线
 | 
『第 8 楼』:
 
 
使用 LLM 解释/回答一下
  
用NASM可以生成Bin文件,命令格式: 
NASM XXXX.ASM -O XXXX.BIN 
 
    
 
  
  |  
                  
  
                    打尽天下不平事,为抱国家尽我心! |   
 | 
  2008-2-13 12:48 | 
  
 |