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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:02:07+00:00 2026-06-14T20:02:07+00:00

I have a problem, that i cant figure out: In assembly language, write a

  • 0

I have a problem, that i cant figure out:

In assembly language, write a function that receives a pointer to an array of integers and the size of this array, and changes the array by reversing its elements without copying the array to stack. Use the dedicated instructions and registers to work with arrays (esi, edi; lodsb, stosb, cld, std).

Example: 1 2 3 4 5 -> 5 4 3 2 1

Anyone have any suggestions?

  • 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-14T20:02:08+00:00Added an answer on June 14, 2026 at 8:02 pm

    Reversing an array with lodsb and stosb requires cld and std for every element (because one of the pointers needs to increment and the other needs to decrement), or alternatively, you can just forget cld and std and just cancel the incorrect increment (or decrement) of the other pointer by subtracting 2 (or adding 2) to it after each element.

    Anyway, using lodsb and stosb in this case makes things unnecessarily complicated in my opinion. I’d use something like this:

        mov esi,start_address
        mov edi,end_address
    
        mov ecx,edi
        sub ecx,esi
    
    x1: test ecx,ecx
        jz @ready
    
        mov al,[esi]
        xchg al,[edi]
        mov [esi],al
        inc esi
        dec edi
        dec ecx
        jmp x1
    
    @ready:
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with Lucene's scoring function that I can't figure out. So
I have weird problem that I cant figure it out. I've made mobile app
I have a somewhat simple problem that I cant seem to figure out. I
I have a weird problem that i can't figure out a solution for: I've
So I have a problem that I can not figure out. I am writing
I have a weird error that I cant figure out how to fix .
I Have a quite simple question that I just cant figure out. The method
I have a problem that i cant solve :( I have a user control
I am doing some localization and have bumped into a problem that I cant
I have come across a problem that i cant salve, What i have is

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.