Hello. This is Dr Miller, And this is Episode 11.12 of Assembly.
So today we're going to give an arm load and store with multiple operations.
So using the load multiple on the store, multiple. It's best to use an array. And so what we're gonna do is we're going to use strings, so strings, air naturally arrays.
And so we're gonna copy a string from one buffer to another use L D. M and S T m.
And then we're going to load some parts of a string into memory and then do a swap on those.
So let's get our terminal open. I've already created our project.
All right, so we're gonna wanna have at least one string
I won't put a new line in there,
and then we'll have our next message
on this Allocate. Ah, 100 bytes for that one.
so we'll go ahead and save our registers,
Mainly link register.
You know that. There.
All right. So what we want to do is we want to,
um usar load and store in order to copy the string. And my string just happens to be
just enough bites that we can do the copy Very simply. So
we will do. Load register are zero
message mood register R. One R five
message one. So now we've got our pointers set up.
And so if we want to load the whole thing, we can say load, multiple
and we can store that in registers R one to R four.
And now, since it's stored in our one through our four, we can go ahead and save it into the other race. So STM
So we will load the data into these registers and then store it back into these registers.
So that should copy our string for us.
And then what we'd like to do is we want to do a swap on some of these, and so we'll go ahead and do load register
and then load multiple
O. R. Zero and we'll add a right back there
because we're gonna load it into R one and R two. So that update the point of the fact that we just loaded,
um to full registers worth
so that would be eight bites.
So add that to our pointer
and then we can say load. Multiple are zero
it's our pointer got updated and we can update this point or two if we want.
But our pointer got updated from this operation and it also will get updated from this one.
load in and we're gonna basically swap these around.
So we load our base address back,
and then we're gonna write thes bites back in the opposite order so we'll do
as tm So we're gonna right into our zero with the right back.
All right? Are three
and then we'll write R one and R two
again, we're updating the pointer to the fact that we just wrote a bites.
Okay, so that should swap
a B c d e f with G h i J k l
in memory, and then we'll go ahead and print off our strings.
and they should be done
so we can see that we reverse the first
eight characters with the 2nd 8 characters.
And then we were able to copy all of the data from this into a another array and then print it off.
And so we successfully copied the dating successfully, were able to print it off,
and I copied more than just that, but it copied data for us.
So today's lecture we used L d m and S t m in orderto load multiple into multiple registers.
If you have questions, you can email me, Miller MJ at you and Kate I e to you, and you can find me on Twitter at Milhouse 30.