Umm, hello group. I'm trying to learn ASM on my own (still) and I have a problem with passing a filename to a filename openning interupt. The filename is supposed to be located in a DS:DX buffer, I guessed that this means I have to move a program offset into DS and DX would be the lenght of the data located at that offset. The problem appears to be that the data isn't correctly located for a reason unknown to me. Here is the source code with my comments in it. The program reports errors when it is run and requires at least DOS 3 to run. Can you please help me with what is wrong with the code? Most ways to do things I've guessed, so they might not be appropriate. Note that there also appears to be unexplained interference between INT 10h (display) and INT 21h (file writing) procedures. Help me with explaining that as well please. ; Read data and store to file .model tiny .code .186 org 100h Begining mov ah,0Fh ;innit display (BH = active page) int 10h ;do it (VIDEO) mov si,offset MyFilename ;Read filename XLoop mov al,FileNLen ;for each time you read, increase counter add al,1 mov FileNLen,al lodsb ;display filename or al,al ;nonsense operation to provide result for the jump jz short DXLoop ;if no more data, end program; call DisplayC jmps XLoop ;next char DXLoop mov al,FileNLen ;calculate actual lenght add al,-1 mov FileNLen,al mov si,offset CRLF call DisplayS mov si,offset CRLF call DisplayS mov si,offset MyString ;set data offset "MyString" call Create ;create the file mov al,Err ;see if there was an error or al,al ;nonsense operation to provide result for the jump jnz ErrorCreat ;on error skip write code mov si,offset CRLF call DisplayS DLoop lodsb ;read from offset (to AL) or al,al ;nonsense operation to provide result for the jump jz short DDone ;if no more data, end program mov DataBuffer,al ;move char into write buffer call DisplayC call Write ;write char to file jmps DLoop ;next char DDone call Close ;close the file .exit ErrorCreat mov al,'!' ;display a ! call DisplayC ;do it jmps DDone ;end program Create mov al,'C' ;display that we are creating call DisplayC mov ah, 3Ch ;create file xor cx,cx ;erase attributes mov si,offset MyFilename ;set offset mov ds,si ;additional nonsense mov dx,FileNLen ;Filename lenght int 21h ;do it (DOS 3+) mov FileHandle,ax ;store FileHandle call GetErr ;get any error information ret ;return control Open mov al,'O' ;display that we are opening call DisplayC mov ah,3Dh ;open file xor al,al ;erase access modes mov si,offset MyFilename ;set offset mov ds,si ;additional nonsense mov dx,FileNLen ;Filename lenght int 21h ;do it (DOS 3+) mov FileHandle,ax ;store FileHandle call GetErr ;get any error information ret ;return control Close mov al,'X' ;display that we are closing call DisplayC mov ah,3Eh ;close file mov bx,FileHandle ;recall FileHandle int 21h ;do it (DOS 3+) call GetErr ;get any error information ret ;return control Read mov al,'R' ;display that we are reading call DisplayC mov ah,3Fh ;read mov bx,FileHandle ;recall FileHandle mov cx,1 ;read one byte mov si,offset DataBuffer ;set DataBuffer offset mov ds,si ;additional nonsense mov dx,1 ;buffer lenght is one byte int 21h ;do it (DOS 3+) call GetErr ;get any error information ret ;return control Write mov al,'W' ;display that we are writing call DisplayC mov ah,40h ;write mov bx,FileHandle ;recall FileHandle mov cx,1 ;write one byte mov si,offset DataBuffer ;set DataBuffer offset mov ds,si ;additional nonsense mov dx,1 ;buffer lenght is one byte int 21h ;do it (DOS 3+) call GetErr ;get any error information ret ;return control GetErr mov ah,59h ;retrieve error details mov bx,0000h int 21h ;do it (DOS 3+) mov Err,ax ;store proof of error existance mov al,ax ;display extended error code call Display mov al,bh ;display error class code call Display mov al,bl ;display recomended action code call Display mov al,ch ;display error locus code call Display ret DisplayS FLoop lodsb ;display filename or al,al ;nonsense operation to provide result for the jump jz short DFLoop ;if no more data, end program; call DisplayC jmps FLoop ;next char DFLoop ret Display mov ah,0Eh ;set output type to DOS Teletype mov cx,1 ;type one character at a time add al,'0' ;numeric display int 10h ;do it (VIDEO) ret ;return control DisplayC mov ah,0Eh ;set output type to DOS Teletype mov cx,1 ;type one character at a time int 10h ;do it (VIDEO) ret ;return control FileNLen dw 0000h FileHandle dw 0000h DataBuffer dw 0000h Err dw 0000h MyString db 'Hello World!!!',0 MyFilename db 'c:\jure\test.txt',0 ;16 CRLF db 13,10,0 .end Thanx in advance. Observer aka DustWolf aka CyberLegend aka Jure Sah C'ya! -- Cellphone: +38640809676 (SMS enabled) Don't feel bad about asking/telling me anything, I will always gladly reply. Trst je naš, Dunaja ne damo; Solmuna pa tud ne. Za vstop v EU. ;] The future of AI is in technology integration, we have prepared everything for you: http://www.aimetasearch.com/ici/index.htm MesonAI -- If nobody else wants to do it, why shouldn't we?(TM)