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

  • SEARCH
  • Home
  • 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 6731551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:32:33+00:00 2026-05-26T10:32:33+00:00

I need to prompt to user a msg that tells him to write a

  • 0

I need to prompt to user a msg that tells him to write a number , then I store this number and do some operation on it
After searching in INT 21h I found this :

INT 21h / AH=1 - read character from standard input, with echo, result is stored in AL.
if there is no character in the keyboard buffer, the function waits until any key is pressed. 

example:

    mov ah, 1
    int 21h

The main problem that this only reads one character and represent it as ASCII
so If I need to write the number “357”
I will read it as 3 , 5 , 7

and this is not my goal .
any ideas ?

  • 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-05-26T10:32:33+00:00Added an answer on May 26, 2026 at 10:32 am

    When you managed to get the user input, put the its pointer in ESI (ESI = address to the string)

    .DATA
    myNumber BYTE "12345",0        ;for test purpose I declare a string '12345'
    
    Main Proc
        xor ebx,ebx                ;EBX = 0
        mov  esi,offset myNumber   ;ESI points to '12345'
    
    loopme:
    
        lodsb                      ;load the first byte pointed by ESI in al
    
        cmp al,'0'                 ;check if it's an ascii number [0-9]
        jb noascii                 ;not ascii, exit
        cmp al,'9'                 ;check the if it's an ascii number [0-9]
        ja noascii                 ;not ascii, exit
    
        sub al,30h                 ;ascii '0' = 30h, ascii '1' = 31h ...etc.
        cbw                        ;byte to word
        cwd                        ;word to dword
        push eax
        mov eax,ebx                ;EBX will contain '12345' in hexadecimal
        mov ecx,10
        mul ecx                    ;AX=AX*10
        mov ebx,eax
        pop eax
        add ebx,eax
        jmp loopme                 ;continue until ESI points to a non-ascii [0-9] character
        noascii:
        ret                        ;EBX = 0x00003039 = 12345
    Main EndP
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have encrypted documents. After unarchiving each document, I need to prompt the user
I have created an android application where user need to login to store some
I'm trying to write a script that will prompt a user for an answer
I need to prompt an alert message when a user selects a particular option
for e.g from command prompt I need to launch the exe with some switch
What I need to do is to prompt the user with a username and
I'm writing a bookmarklet and I need to be able to prompt the user
I need a button that can be fully customised via css to prompt the
I need to prompt a user to save their work when they leave a
I would like to prompt the user for some input on a webpage. I

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.