在dosbox 0.74中,当我试图使用int 21h的函数3ch打开任何文件的文件句柄时,该文件的数据将被清除,其大小将永久地减少到0字节。
我测试过的文件都位于windows 10的documents目录中,该目录在dosbox中安装为驱动器e。
这是导致问题的代码。它应该打开,然后关闭一个文件句柄。CF从未设置,因此没有错误代码。ax中的文件句柄设置为5。
mov ax, varData
mov ds, ax ;Load the variable segment into ds
;word variable handle is defined here
;string fname is defined here
mov ah, 3ch ;select open file handle function
lea dx, fname ;dx points to file's name ("TESTFILE")
mov cl, 1 ;read only
int 21h ;open the file handle
mov handle, ax ;copy handle into variable
mov ah, 3eh ;close handle function
mov bx, handle ;closing previously opened file handle
int 21h ;close handle