Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Opening a file

Hi! I`m having a problem opening a file in 16 bit assembly. Here`s part of program which prompts user to input filename and using it should open the file but instead it just gives error message. I made a mistake somewhere I think..
Thanks in advance for your help! :)

.model small
.stack 100h

iveskite db 'Type your filename.$'
klaid db 'Error reading file.$'
endln db 13, 10, "$"
filename db 20,0,20 dup(?),0
handle dw ?


mov ax, @data
mov ds, ax

mov ah, 09h
mov dx, offset iveskite
int 21h

mov ah, 09h
mov dx, offset endln
int 21h

mov ah, 0ah ;filename input
mov dx, offset filename
int 21h

mov ax, 3d00h
mov dx, offset filename ;open file
int 21h
jc klaida

mov handle, ax
jmp quit


mov ah, 09h
mov dx, offset endln
int 21h

mov ah, 09h ;output error message
mov dx, offset klaid
int 21h

mov ax,04C00h ;close program
int 21h

end main
Sign In or Register to comment.