2
我写了一个16位的.com文件,它创建了一个文件dos程序集不能写入文件
但它没有创建任何文件。
我试过在Windows 7 32位。和dosbox里面。
源代码在这里
如何写入文件?
org 100h
call open_new_file
mov ah, 40h;write
mov bx, [new_file_handle]
mov cx,2;write 2 bytes
mov dx, temp
int 21h
mov ah, 3eh;close file
mov bx, [new_file_handle]
int 21h
mov ah, 00
int 16h;wait key
mov ax, 4c00h
int 21h;exit
open_new_file:
push bp
mov bp, sp
mov ah, 3dh;open file
mov al, 02h;write only
mov dx, new_file_name ;out.kty
int 21h
mov [new_file_handle], ax
leave
ret
temp:
dw 0xffaa
new_file_handle:
dw 0
new_file_name:
db "out.bin", 0
谢谢!
谢谢我忘了创建一个文件。 –