Solved

how to store or save to a memory location

Posted on 2004-05-01
4
275 Views
Last Modified: 2008-02-26
ok,
sorry that my last post was unclear to some of you.

here's my next question in regards to LC-3 assembly language.

i've read a string of chars, one char at a time. everytime i read a char from the console, i want to store it in a memory area (some memory block).

let's say the momory block should starts at x3201. so for example, if i read "hello" from the console, i want to store 'h' in x3201, 'e' in x3202 (ie x3201 offset by 1),
'l' in x3203 ... etc

this is what i'm done (and it's not working :-| ):
----------------------------------------------------
Data  .FILL  x3201

;so for the first char read, i do this (trying to store it)
;first char is in say R0

; R1 is a ptr to memory block, Data
LED R1,Data
 
; offset by 0, points R1 to first memory  slot
; i don't think this is right, but don' know any better
STR R1,R0,#0                      

the next time a char is read, i'll have to move the ptr to next memory slot and save the char there .... and so on. hope i've made it clear enough
-----------------------------

can anyone help
thanks
r
0
Comment
Question by:ransula
4 Comments
 

Author Comment

by:ransula
ID: 10968658
i'm reading a max of 20 chars
store the chars in memory starting at x3201 ...

i tried using
LDR R1,R0,#0

instead of
STR R1,R0,#0

but doesn't work either
0
 
LVL 12

Accepted Solution

by:
stefan73 earned 125 total points
ID: 10975751
Hi ransula,
> ; offset by 0, points R1 to first memory  slot
> ; i don't think this is right, but don' know any better
> STR R1,R0,#0                      

The order is not correct. Try
STR R0,R1,#0

instead. You can also use
ST R0,R1
...as you offset is 0.

So if you want to store your characters, you need to increase R1 at loop end
ADD R1,R1,#1
...and store your R0 value:
ST R0,R1



Cheers,
Stefan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Show semaphore name in Pascal 12 639
Buffer Bomb Level 3 (Dynamite) 5 7,329
Assembly doubt on logical or operations 3 314
query on MOV assembly instruction 6 568
Note: This is the second blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   Every month t…
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 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

14 Experts available now in Live!

Get 1:1 Help Now