A few things you need to look at.
As per Ralf Brown's excellent interrupt list, deleting a file is done with int21/ah=41. By setting ax
to 0041
, you're setting ah
to zero which is the "terminate program" function. You need:
mov ah, 41h
Secondly, the filename is meant to be an ASCIZ, meaning it should be terminated by a zero byte:
filename db "my_file.txt", 0
Thirdly, you appear to have some unneeded indirection in there (a la point_fname
). The ds:dx
register pair should point directly at the file name and you should be able to do that without the extra data item.
You're stretching my memory here but I think you would ditch the point_fname
and lds
call and instead just load the offset of the filename directly into dx
with something like:
mov dx, offset filename
The indirection-with-lds method will probably work, but it seems an unnecessary complication.
You may also want to be careful that this sort of stuff still works in modern versions of Windows (it may, or it may not).
Microsoft is a big believer in backward compatibility but this stuff was introduced in MSDOS 2 and may not support such wondrous new thing as filenames beyond the 8.3 limit, or NTFS :-)
If you're running in DosBox or under a VM running Windows 98 or lesser, you should be fine, but I'd be at least a little circumspect about functionality beyond that.