汇编代码帮助(创建新文件)
我是装配新手。我必须编写一个程序,将输入文件的数据复制到输出文件。但必须创建此输出文件。
问题是我无法创建这个看起来如此简单的文件。
我使用的代码是
.model tiny
.data
outputfile db "newfile.txt",0
outhandle dw ?
.code
.stack
cseg segment 'code'
assume cs:cseg, ds:cseg
org 100h
start:
create_a_file:
mov dx, offset outputfile
mov cx, 0
mov ah, 3Ch
int 21h
mov outhandle, ax
jc error_routine
mov ah, 3Eh
mov bx, outhandle
int 21h
error_routine:
mov ax, 4c00h
int 21h
cseg ends
end start
我在任何地方都看不到新文件。即使我指定了确切的根文件夹,例如“c:...” 我不知道出了什么问题。 如有任何帮助,谢谢 PS:我使用的是 Windows XP 32 位。和 TASM(便携式)
I'm new in assembly. I have to do a program that copies the data of an input file to an out put file. but this output file has to be created.
The problem is that I cannot create this file which seems to be so straight forward.
the Code i am using is
.model tiny
.data
outputfile db "newfile.txt",0
outhandle dw ?
.code
.stack
cseg segment 'code'
assume cs:cseg, ds:cseg
org 100h
start:
create_a_file:
mov dx, offset outputfile
mov cx, 0
mov ah, 3Ch
int 21h
mov outhandle, ax
jc error_routine
mov ah, 3Eh
mov bx, outhandle
int 21h
error_routine:
mov ax, 4c00h
int 21h
cseg ends
end start
I see the new file nowhere.Even when I specify the exact root folder like "c:..."
I cant figure out what is going wrong.
Any help is appriciated, Thanx
PS: Im using windows XP 32-bit. and TASM (portable)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的目的是创建 .COM 程序,请将源代码简化为:
将程序编译为
tasm.exe myprog.asm
并将其链接为tlink.exe /t myprog.obj
。您应该获得myprog.com
并且它应该可以很好地创建NEWFILE.TXT
。If your intention is to create a .COM program, simplify the source code to this:
Compile the program as
tasm.exe myprog.asm
and link it astlink.exe /t myprog.obj
. You should getmyprog.com
and it should createNEWFILE.TXT
just fine.检查您的 tasm/bin 文件夹。您的“newfile.txt”可能在那里
Check your tasm/bin folder. Your "newfile.txt" may be there