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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:18:00+00:00 2026-05-26T04:18:00+00:00

I am attempting to test if the random value generated in eax is the

  • 0

I am attempting to test if the random value generated in eax is the same as any value in an array I have allocated. The outer loop generates the array and writes it to the screen and in to the array, The inner loop is then supposed to test if the value exists in the array. I know i am not doing the inner loop correctly but I am not sure how to fix it.

It assembles just fine but when I try to run I only get a blank cmd window screen. Also I am using Irvine32 libraries. My code is below:

EDIT: I appreciate your guys help so far but now I Have two problems. The first is that when I try to evaluate the number in eax for uniqueness against my array I actually get an access violation error. My code for generating the array and testing it is below:

RandomArray PROC uses EAX

    call Randomize 
    mov esi, OFFSET arr
    mov edi, OFFSET arr
    mov ebx, TYPE arr 
    mov ecx, 15
    L1:
        mov eax, [79 - 19]
        push eax
        call RandomRange
        add eax, 19
        search1:
                 mov edx,[esi]
                 cmp eax,edx                 ; compares the values in the array and the random int
                 je L1                       ; jumps if the values are equal
                 add esi,4                   ; moves to next byte to check again
                 loop search1                ; repeats loop
        mov [esi],eax
        pop eax
        add esi, ebx
        loop L1
    ret
RandomArray ENDP
        pop ecx     
        loop OUTER_LOOP

    jmp FINISHED

    SWAP:
        mov bl, [esi]
        mov dl, [esi+1]
        xchg bl,dl 
        mov [esi],dl 
        mov [esi+1],bl
        jmp CONTINUE 

    FINISHED:
    ret

Thanks for your help in advance.

  • 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-26T04:18:00+00:00Added an answer on May 26, 2026 at 4:18 am

    I only get a blank cmd window screen

    search:
        mov ecx,elementcount
        cmp eax,[esi]
        je L1
        add esi,4
        loop search
    

    This is an infinite loop because you are resetting the counter ecx on each iteration. Move the ecx assignment outside the loop and you should be fine:

    mov ecx,elementcount
    
    search:
        cmp eax,[esi]
        je L1
        add esi,4
        loop search
    

    Btw, you could probably replace that loop with rep scasd, which I believe does the exact same thing. Not sure whether it is “better” in any way though.

    mov ecx,elementcount
    rep scasd
    je L1
    

    Disclaimer: code not tested, and it’s been a few years since I did x86 asm 🙂

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

Sidebar

Related Questions

Attempting to test whether a post has a 'main_slider', 'flickr-slider', or 'video-slider' value. 'main_slider'
I'm attempting to test a Flex application in which Objects do not have static
I'm attempting to unit test some code using NUnit. I have a method: public
I'm attempting to test that my service is calling Anemone.crawl correctly. I have the
I'm attempting to test a website I have running in a local IISExpress instance
I'm attempting to test interactions with a Nexus server that requires authentication for the
I am attempting to test user interaction with an off the shelf product. The
Attempting to implement a poor man's test of whether a process is still running
We are attempting to use a SQL Server 2003 database for our test records
I am attempting to test the monger mongodb driver for clojure (which is essentially

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.