Assembly language

Posted on 2004-11-16
Last Modified: 2006-11-17
Hi experts,

        I need an explination of the difference between store word and store byte in assembly language. I know that with normal variables i can use the store word command to store a register value to a physical address. i.e.
                             LDI         R7, 3                // Load imediately the value 3 to register 7

                             STW      R7, MINS          // Store word the value of R7 to addressrepresented                      
                                                                  // by MINS

But what about indexed addressing;

                          LDI        R7, 3                   // get subscript
                     LDB       R5, ARRAY, R7  // = ARRAY[3]
So here the indexed value of ARRAY[3] is stored in R5. But how do i store the value of 5 to that indexed memory location? Is it;
                         LDI      R2, 5
                         STB     R5,0,R2

If anyone knows what im talking about here please help me. P.S. i know the syntax may not be typical as it is for a teaching assembly language ERICA which isnt widely known but i guess if your familiar with traditional assembly languages you'll know what im talking about.

Thanks, Chris.    
Question by:icb01co1
    LVL 9

    Expert Comment

    I think that you'd get a much faster, and better solution if you asked this question in the Assembly Language section.

    Request a move to there in the Community Support.

    LVL 11

    Accepted Solution

       LDI       R7, 3                 // get subscript
       LDB      R5, ARRAY, R7  // R5 <- ARRAY[3]
    Then to store 5 -> ARRAY[4] (let's take 4, because you didn't mention)
       LDI       R7, 4
       LDI       R5, 5
       STB      R5, ARRAY, R7

    Author Comment

    Ok one more thing would;

      LDI       R7, 3                 // get subscript
      LDB      R5, ARRAY, R7  // R5 <- ARRAY[3]

    Store the address location of ARRAY[3] in R5 or the actual value.

    In other words if

    ARRAY[3] = 4;

    Would R5 hold the value 3 or the address location? If it hold the address location how do i access the value? Would it be like this?

      LDI       R7, 3                 // get subscript
      LDB      R5, ARRAY, R7  // R5 <- ARRAY[3]
      LDW     R2, R5            // R2 <-4


    Author Comment

    Sorry mis type i meant .

    ** rest of question **

    Would R5 hold the value 4  or the address location? If it hold the address location how do i access the value? Would it be like this?

    ** rest of question **

    LVL 11

    Expert Comment

    I think that
      LDW     R2, R5            
    is OR
    1) illegal command
    2) it will load to R2 word from address: [0 + R5] = 4
    3) it is equal to MOV R2, R5 and R2 <- 4

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    SwapWord function 11 1,115
    Windows 7, Delphi Code, Drawcolumn ERROR 13 400
    z390 Assembly 5 516
    memory mapped I/O query 6 119
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now