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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:12:14+00:00 2026-05-30T23:12:14+00:00

I am attempting to make a program that will input numbers into an array

  • 0

I am attempting to make a program that will input numbers into an array then be able to search the array for one of the numbers.I can get it to read and search alright to find the number but the user is supposed to be able to search again, where I have to compare their input to “n” and “N”. I can’t seem to get it to work correctly. I am not sure if using atow is the correct input or not, but here is the code.

number1         WORD        ?
anArray         WORD        100 DUP (?)
count           WORD        ?
search          WORD        ?
searchn         BYTE        "n",0
searchNo            BYTE        "N",0
prompt1         BYTE        "Enter a number or -1 to quit.", 0
prompt2         BYTE        "Enter a number to search for", 0
prompt3         BYTE        "Search for another number Y/N",0
inString        BYTE        40 DUP (?)
outMsgLabel     BYTE        "Search Result", 0
frontOut1       BYTE        6 DUP (?)
outMsg1         BYTE        " is element"
rearOut1        BYTE        6 DUP (?),0
frontOut2       BYTE        6 DUP (?)
outMsg2         BYTE        " is not in array",0

searchAgain:    input       prompt3, inString, 40
                atow        inString
                mov         dx,ax
                atow        searchn
                mov         ax,"n"
                cmp         ax,dx
                je          end1
                atow        searchNo
                mov         ax,"N"
                cmp         ax,dx
                je          end1
                jmp         next

I have only included the snippets of the code that doesn’t work and my .DATA section.

  • 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-30T23:12:15+00:00Added an answer on May 30, 2026 at 11:12 pm

    Why does everyone say write it in a HLL first?

    Why are you using WORD sizes? Use the natural size of the processor 32 bit.

    What Assembler is this? If it is MASM or any other, are input, atow macros or functions? Well either way, you are trying to convert the address of inString to a word not its contents

    Try this:

    prompt3         BYTE    "Search for another number Y/N ? >"
    PROMPT3_SIZE    equ     $ - prompt3
    
    
    
     SearchAgain:
        push    PROMPT3_SIZE
        push    offset prompt3
        call    WriteToConsole
    
        call    GetKeyCode
        cmp     eax, 78         ; N
        je      end1
        cmp     eax, 110        ; n
        je      end1
        cmp     eax, 65         ; Y
        je      Continue        
        cmp     eax, 97         ; y
        je      Continue
    
        ; invalid char was entered, do whatever here
        jmp     SearchAgain     
    
    end1:
        ; don't want to search again
    Continue:
        ; search for character
    
    ; ...
    ; ...
    ; ...
        push    0
        call    ExitProcess
    WriteToConsole:
        enter   0, 0
    
        push    STD_OUTPUT_HANDLE
        call    GetStdHandle
    
        push    0
        push    0
        push    [ebp + 12]
        push    [ebp + 8]
        push    eax
        call    WriteConsole
    
        leave
        ret     4 *2
    
    GetKeyCode:
        push    STD_INPUT_HANDLE
        call    GetStdHandle
    
        push    eax
        call    FlushConsoleInputBuffer
    
        call    crt__getch
        xor     ecx, ecx        ; zero ecx for non extended key return value
        test    eax, eax
        jz      @F
        cmp     eax, 0E0h
        jnz     quit
    @@:
        call    crt__getch
        mov     ecx, 1          ; return 1 in ECX if an extended key is pressed
    quit:
        ret
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to make a program that will pull data such as OS,
Attempting to make a NSObject called 'Person' that will hold the login details for
I am attempting to make a program for a local bagel shop that sells
I am attempting to make an updater program, that when updates it writes a
I'm attempting to make a small program that processes INI files, for use in
I am attempting to make a program in C which presents a GUI and
You can see my project here - http://www.inluxphoto.com/custom/jsgallery/index.php I am attempting to make the
Im attempting to make a little app that lets you add text boxes to
I am attempting to install libxml2 so that I can setup the python bindings
I am attempting to make a dynamic image with PHP, and I can't find

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.