Solved

# Assembly language

Posted on 2004-11-16
3,014 Views
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

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
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.

gL,
[r.D]
0

LVL 11

Accepted Solution

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

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

0

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 **

0

LVL 11

Expert Comment

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

### Suggested Solutions

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 (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), 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…