• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3062
  • Last Modified:

Assembly language

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.    
0
icb01co1
Asked:
icb01co1
  • 2
  • 2
1 Solution
 
DrWarezzCommented:
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.

gL,
[r.D]
0
 
dimitryCommented:
If
   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
0
 
icb01co1Author Commented:
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




0
 
icb01co1Author Commented:
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 **

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now