I am trying to create new file using assembler language in MASM 6.11 and DOSBox on Windows 7. I have mount drive C, D, E as folders BIN, BINR and palce where are my programs. When I try to run my program in console it get stuck but when I am debbuging it, using CV command process terminated normally. Here is my code:
.model small
.stack 100h
.data
NazwaPliku db "dane.txt", 0
UchwytPliku dw ?
Napis db "ASSEMBLER"
.code
ASSUME cs: @code, ds: @data
mov ax, @data
mov ds, ax
main PROC
MOV AH,3CH
MOV CX,0
MOV DX,OFFSET NazwaPliku
INT 21H
MOV AH, 3DH
MOV AL, 0
MOV DX, OFFSET NazwaPliku
INT 21H
mov UchwytPliku, ax
MOV AH,40H
MOV BX, UchwytPliku
MOV DX,OFFSET Napis
MOV CX, 5
INT 21H
mov ah, 4Ch
mov al, 0
int 21h
main ENDP
END main
I know that it is very simple program, but I can't get it to work...
This is your program with corrections
It would be best to display a message whenever the operation failed.
If you really need to open the file explicitely then first close it after it was created.