Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8957903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:06:02+00:00 2026-06-15T15:06:02+00:00

I want to print the current working directory and its content. The program will

  • 0

I want to print the current working directory and its content. The program will be done in x86, 16bit Intel syntax, DOS Assembly using interrupts. The assembler I will use will be Turbo assembler. Here is my code so far(not much):

ASSUME  cs:code,    ds:data
data segment
buffer  db  64  dup  (0) ; buffer for the current directory name
data ends
code segment
start:
mov     ax,     data ;
mov     ds,     ax   ; move data segment into ds, es registers
mov     es,     ax   ;

mov     dl,     0             ; default drive 
mov     si,     offset buffer ; put current directory in buffer
mov     ah,     47h  ; GET CURRENT DIRECTORY
int     21h                  

; appending '$' to buffer end
    ; search until 0 found
mov     cx,     64  ; search over all buffer 
cld                                 ; starting from the beginning  
    end_string:                         
lodsb                               ; get current byte in al register
cmp     al,     0   ; compare it with 0
jne     continue                    ; if not equal jump to continue label
mov     al,     36  ; if equal copy 36('$' - ASCII) in al
mov     di,     si  ; set destination index to source index
sub     di,     1           ; decrement di 
stosb                               ; store in es:di the value contained in al
mov     cx,     1   ; stop looping by setting cx to 1
    continue: 
    loop end_string
    ; print string obtained 
mov     dx,     offset buffer  ; ds:dx - string start
mov     ah,     09h            ; WRITE STRING TO STANDARD OUTPUT
int     21h

mov     ax,     4c00h          ; end program with exit code 0
int     21h
    code ends
    end start   

I managed to get it running and display the current working directory. But now I don’t know how to get his child directories and the files contained in the directory. So my question is : how do I get them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:06:03+00:00Added an answer on June 15, 2026 at 3:06 pm

    Use the DOS services FindFirst (0x4e) and FindNext (0x4f) to get a list of entries in the given directory. You can then differentiate subdirectories and files based on the returned attributes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an alias that will print out the current working directory
i have a list of posts. i want print some words of post content
I want to print an attribute value based on its name, take for example
I found the C snippet to get the current working directory from here .
I know that the system property user.dir returns the current working directory; the directory
I want change a working directory in an awk script: ... path=./some/path system(pwd) ;
I Want Print DataBase Schema in Microsoft Sql Server Compact Edition. Maybe Exist Some
I want to print applet. There are two ways: Signing applet Add permission java.lang.RuntimePermission
I want to print just the HTTP status code for a web page retrieved
I want to print an integer number in binary mode using following function: #include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.