Link to home
Start Free TrialLog in
Avatar of ransula
ransula

asked on

how to store or save to a memory location

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
Avatar of ransula
ransula

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of stefan73
stefan73
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial