3

In DOSBox 0.74, when I attempt to open a file handle on any file using function 3ch of int 21h the file's data is cleared, being permanently reduced to 0 bytes in size.

The files i've tested have all been located in Windows 10's documents directory which is mounted as drive E in DOSBox.

Here's the code that causes the issue. It's supposed to open, then close a file handle. CF is never set, so no error code. The file handle in AX is set to 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
bad
  • 939
  • 6
  • 18

1 Answers1

5

Per this:

ah = 0x3c is "Create File." You want 0x3d (Open File).

David Wohlferd
  • 7,110
  • 2
  • 29
  • 56