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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:28:56+00:00 2026-06-13T07:28:56+00:00

i want to add two values in memory. I have to store the letters

  • 0

i want to add two values in memory. I have to store the letters for A-J in memory location from 100 to 110 and i have to store two letters in single step, for example AH=A Al=B
and to increase Bx +2. Help 🙂 Here is my code by i don’t think that is working well. I work in Emu 8086.

 MOV AX, data
MOV DS, AX

MOV Ah,40h 

Mov Al,41h

MOV BX, 0100h

AGAIN:  
MOV [BX], Ax
inc Ah

Inc Al

add Bx,2

cmp Ah, Al

JNE AGAIN

Thank you.

  • 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-13T07:28:57+00:00Added an answer on June 13, 2026 at 7:28 am

    80×86 is “little-endian” which means that the value in AL would be stored at the lowest address and the value in AH would be stored in the highest address. This means your code would do “BADCFEHGJI”.

    If AL and AH start out being different; and you increment them both inside the loop, then they will never have the same value at the end of the loop and your program will run forever (or until it crashes, whichever comes first).

    Rather than incrementing AL and AH separately; you could do add ax,0x0101. This works (and will probably be twice as fast as the pair of increments) because you’re not expecting either of them to overflow. The same idea applies to mov al,40h and mov ah,41h, which could be a single mov ax,4140h (and probably should be mov ax,('B'<< 8) | 'A' to make it easier to understand).

    Finally, there’s a very old optimisation called “loop unrolling”. The idea is to reduce the overhead of the loop by doing more inside the loop. In your case, because the loop is so small (and everything is constant) it’d be easy to “fully unroll” and not have any loop at all. For example:

        mov ax, data
        mov ds, ax
        mov word [0x0100], ('B'<< 8) | 'A'
        mov word [0x0102], ('D'<< 8) | 'C'
        mov word [0x0104], ('F'<< 8) | 'E'
        mov word [0x0106], ('H'<< 8) | 'G'
        mov word [0x0108], ('J'<< 8) | 'I'
        ret
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I add two comboboxes from one store store have type field witch
I have two variables, key and value , and I want to add them
Suppose I want to add two buffers and store the result. Both buffers are
I have been developing an Android RSS news reader.I want to add two buttons
I want to add space after every two chars in a string. For example:
Possible Duplicate: Call web service from jQuery I want to add two numbers together,
i just want to parse two values from a html file . there will
I want to create a memory stream which contains int32, int16, single values. Using
I am new to VBA and want to add two values. The code I
I want to add two columns values of my table and sort it in

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.