I am working on a program in 16b assembly that simply creates a file with a filename that I type myself in runtime and then closes it. The problem is - the file isn't created. Here is my code:
org 100h
mov ah, 9
mov dx, prompt
int 21h
mov ah, 0ah
mov dx, filename
int 21h
mov ah, 3ch
mov cx, 0000h
mov dx, filename+2
int 21h
mov word [filehandle], ax
mov bx, [filehandle]
mov ah, 3eh
int 21h
mov ah, 4ch
int 21h
prompt db "Filename:",10,13,"$"
filename db 10
db 0
times 11 db "$"
filehandle dw 0
As you can see I am using buffered input to read the filename. Unfortunately the file is not created. It works well if I hardcode the filename, like this:
...
mov ah, 3ch
mov dx, filename
int 21h
...
filename db "test.txt"
but that's not what I want to achieve. What is the reason behind this code not working? I am using NASM.
EDIT: The problem is solved, @rkhb 's solution worked.