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 119795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:42:34+00:00 2026-05-11T03:42:34+00:00

The program needs to take in a simple string from the user and display

  • 0

The program needs to take in a simple string from the user and display it back. I have gotten the program to take input from the user but I can’t seem to store it. Here is what I have so far:

BITS 32 global _main section .data  prompt db 'Enter a string: ', 13, 10, '$' input resd 1 ; something I can using to store the users input.  name db 'Name: ******', 13, 10,'$' StudentID db '********', 13, 10, '$' InBoxID db '*************', 13, 10, '$' Assignment db '************', 13, 10, '$' version db '***************', 13, 10, '$'  section .text _main:  mov ah, 9 mov edx, prompt int 21h mov ah, 08h while:     int 21h             ; some code that should store the input.     mov [input], al     cmp al, 13     jz endwhile     jmp while endwhile:  mov ah, 9     ; displaying the input.  mov edx, name int 21h mov edx, StudentID int 21h mov edx, InBoxID int 21h mov edx, Assignment int 21h mov edx, version int 21h ret 

I am assembling this using NASM.

  • 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. 2026-05-11T03:42:35+00:00Added an answer on May 11, 2026 at 3:42 am

    You’re only reading the characters without storing them. Instead of storing into that ‘input’, you should store AL either directly into StudentID/InBoxID/Assignment/Version. You could take advantage of their relative positions in memory and write a single loop to fill all of them, as in a contiguous space.

    It could go like this:

    ; For each string already padded with 13, 10, $ ; at the end, use the following: mov ah, 08h mov edi, string mov ecx, max_chars cld while:         int 21h         stosb         ; store the character and increment edi         cmp ecx, 1    ; have we exhausted the space?         jz out         dec ecx         cmp al, 13         jz terminate  ; pad the end         jmp while terminate:         mov al, 10         stosb         mov al, '$'         stosb out:         ; you can ret here if you wish 

    I didn’t test, so it might have mistakes in it.

    Or you could use other DOS functions, specifically INT21h/0Ah. It could be more optimal and/or easier.

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

Sidebar

Ask A Question

Stats

  • Questions 139k
  • Answers 139k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer No, definitely not return "object" ! WCF should make use… May 12, 2026 at 7:39 am
  • Editorial Team
    Editorial Team added an answer If you're looking to make some changes to your application,… May 12, 2026 at 7:39 am
  • Editorial Team
    Editorial Team added an answer OS X and Linux have completely different binary formats (Mach-O/Universal… May 12, 2026 at 7:39 am

Related Questions

C# question here.. I have a UTF-8 string that is being interpreted by a
I'm in the process of embedding a small web server into my program. It's
I am working on a program in C# that needs to load some JavaScript
There is simple cipher that translates number to series of . ( ) In

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.