正邦科技增发:请问如何编写COM文件

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 17:15:06
我知道如何用masm写*.exe程序,
但不知道如何写出*.com程序。求教

1. org 100h
如:
code segment
assume cs:code,ds:code,ss:code
org 100h ;因为所有的COM程序都会被加载到CS:100处。
start:
jmp code1
data db 0
...
code1:
int 20h
code ends
end start
2、编译成exe后,用exe2bin a.exe a.com。
或用debug手动制作:
debug a.exe
n a.com
rcx ;这时将原cx值减去100H后,填入。
w
q
---------------------------------------------------------------

对于com注意以下几个问题:
1.com没有header
2.com程序不分段
3.com入口点必须是100h
4.com不必设置stack,sp=段尾
5.com的过程为near
然后用exe2bin把exe变成com

..