title: Get current directory name assembly 8086 tasm
body: <p>I don't know why function 47h returns an ASCIZ in buffer. How can I get the name of the current directory? Please help me, my code is below.</p>
  
  <pre><code>assume cs:code, ds:data
  data segment
  numed db "Directory name: $"
  msge db "Error!$" ;error if jc is set
  buffer db 200 dup("$") ;buffer for directory name
  data ends
  code segment
  start:
  mov ax, data
  mov ds, ax
  mov es, ax
  
  
  mov dl,0 ;default drive
  mov si,offset buffer ;si = buffer
  mov ah,47h
  int 21h
  jc errorr
  jmp final
  errorr:
      mov ah,09h
      mov dx,offset msge ;error message
      int 21h
  final:  
  mov ah,09h
  mov dx,offset buffer;print directory name
  int 21h
  mov ax, 4C00h
  int 21h
  code ends
  end start
  </code></pre>