title: Get Current Directory path or name Assembly 8086
body: <p>I've seen the AH=47h interrupt (int 21h) but I can't use it. My problem is display (print on screen) the name of the directory. Anyone can help me? Have you got a code? Thank you.</p>
  
  <p>I've tried so far, this code but obviously it doesn't work </p>
  
  <pre><code>.model tiny
  
  .data
  
  handle   dw ? 
  
  filename db  26        ;MAX NUMBER OF CHARACTERS ALLOWED (25).
           db  ?         ;LENGTH (NUMBER OF CHARACTERS ENTERED BY USER).
           db  26 dup(0) ;CHARACTERS ENTERED BY USER. END WITH CHR(13).
  
  msj      db 'ENTER FILE NAME HERE: $' 
  
  text     db 'text for file'  ;LENGTH = 13.
  
  .code
      org 100h
  
  inizio: 
  
  ;DISPLAY MESSAGE.
      mov dx, offset msj
      mov ah, 9
      int 21h      
  
  ;REATE FILE.
      mov ah, 47h
      mov dl, 03h
      mov dx, offset filename 
      int 21h
  
  ;CAPTURED STRING ENDS WITH CHR(13), BUT TO CREATE FILE WE NEED
  ;THE FILENAME TO END WITH CHR(0), SO LET'S CHANGE IT.
      mov si, offset filename + 1 ;NUMBER OF CHARACTERS ENTERED.
      mov cl, [ si ] ;MOVE LENGTH TO CL.
      mov ch, 0      ;CLEAR CH TO USE CX. 
      inc cx         ;TO REACH CHR(13).
      add si, cx     ;NOW SI POINTS TO CHR(13).
      mov al, 36d
      mov [ si ], al ;REPLACE CHR(13) BY 0.            
  
      mov ah,9
      lea dx,filename     ; DISPLAY NAME
      int 21h
  
  ;END PROGRAM.
      mov ah, 4ch
      int 21h
  
  end inizio
  </code></pre>