1

I am quite new to assembly and recently I have been struggling to make INT 21,43 (changing file attribute to read-only) work. I am using Windows 10, DOSBox x86, and Turbo Assembler/Linker/Debugger if that makes any difference. As far as I can tell using the debugger, it should work (CF is NOT set and I am not getting error code as I should, according to documentation). Also, if I use the same INT 21,43 to GET (setting al to 0) file attribute of a file, that was already set to read-only manually, CX is set to 20, which as far as I know does not make sense, but CF is not set as well, so it says it worked. I hope you can help me fix it, thanks in advance.

.model small
.stack 100h

.data
    filename db "temp.txt",0 ; my file name 

.code

start:

    mov dx, @data
    mov ds, dx
    
    mov ah, 43h
    mov al, 01h ; Set file attribute
    mov cx, 01h ; 1 = read-only
    lea dx, filename ; Set pointer to filename
    int 21h
    
    mov ah, 4ch ; Return to DOS       
    mov al, 0               
    int 21h  


end start

This is what debugger shows after INT 21,43 interrupt has been called

1 Answers1

6

I just tried setting the ReadOnly attribute from a program running in DOSBox and it didn't work.

DOSBox's help via help /all, reports that the ATTRIB command does nothing and that it's provided for compatibility only. Therefore it stands to reason that the DOS.function 43h (Get/Set File Attributes) will not have been implemented.

Since DOSBox is primarily meant to emulate old DOS games, there's perhaps little reason to want to change attributes.

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
  • 2
    [Indeed](https://sourceforge.net/p/dosbox/code-0/HEAD/tree/dosbox/branches/0_74_3/src/dos/dos_files.cpp#l643): "this function does not change the file attributs" – Nate Eldredge Oct 30 '21 at 21:37
  • Alright, that makes more sense. However, one of the tasks I can choose is to set the file to read-only if it meets the requirements and my professor suggested us to use DOSBox, so is there a way to do it that I am not aware? – Vytenis Kajackas Oct 31 '21 at 07:59