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

My *_*ug. 3 assembly dosbox x86-16

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

我测试过的文件都位于Windows 10的文档目录中,该目录在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
Run Code Online (Sandbox Code Playgroud)

Dav*_*erd 5

每本:

啊= 0x3c是"创建文件".你想要0x3d(打开文件).