在 DOSBox 中打开文件句柄会清除文件的数据

Opening a file handle in DOSBox clears the file's data

在 DOSBox 0.74 中,当我尝试使用 int 21h 的函数 3ch 打开任何文件的文件句柄时,文件的数据被清除,大小永久减小为 0 字节。

我测试过的文件都在Windows10的文档目录下,在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

this:

ah = 0x3c 是 "Create File." 你想要 0x3d(打开文件)。