Hello, this is Dr. Miller, and this
is Episode eleven point eleven of
Assembly today
we're going to talk about multiple
load and multiple store.
So multiple Loden store,
so ARM has the original
load in store, so load register
and store register
and then we have some additional
ones and so we've
got the load multiple in
the store, multiple.
So LDM and strÃÂ¸m.
And then we have a bunch of
different specifications
here. How you can have conditional
execution.
We have our base register,
the right back ability
and then we can give it a list of
registers.
And then when we're done, we can
have things like increment after,
increment before, decrement after
and decrement before.
So we'll look at some examples here.
So to load multiple.
So it's LDM so we can
say load multiple are zero hour
one through our two.
So this will load the
AR zero will be a pointer and then
it will load the data point
into that by our into our one.
And then the next piece of data into
our two, we
can also have store register.
So here we got our two and our five
so we can either use a dash to
denote a sequence
or we can list them one at a time,
or we can combine the two.
So let's look at an example here.
So here we have an array and it has
a bunch of words, F, A,
B, so on and so forth, Cafe
Cafe.
And so we can see that what we do
here is we're going to
load this data in.
So we first get the address of the
array here.
And this is using a different style.
So we actually have the array
address down here that's pointed.
We could alternatively used Eldard
R zero equal
array to do that, but this
is kind of the another way to do it.
And so here we are loading that
array address into our zero
and then we're going to load
multiple. So our zero
well loaded into it are one through
our five.
And then we're doing some operations
on that and then we're going to go
ahead and store it.
So let's look at what this looks
like after we've executed.
So when we execute this instruction
now our zero has this
first word.
R2 has this word
sorry, R-1 has this word, R2 has
this word are three or
four in our five.
So we can see that those all got
loaded in from the
array that we had defined.
And so that load multiple will do
that.
And then after we did the exclusive
or in the and on our registers,
we had modified our one and R2
and we can see that our one
now looks like this are two looks
like this.
And so when we go and do the
writing, so this store multiple,
it'll write all of those values into
memory. So I went and went ahead
and in
GDB using GAF, I did examine
five Sleater five bytes
and then the value pointed to by R
zero. So R zero does the writing
and we can see that it wrote in the
data. So our one got written.
Here are two got written here
are three are written here
on down the line.
So we can see that those got written
into memory when we executed
that STM command.
So ID write all of these to the
address pointed to at that location.
So there are additional combinations
that we can have, so, for example,
we can have store multiple increment
after or load multiple
increment after
and we can put the bag in there to
do the right back and then we can
have a register or a list
of registers.
So let's look at an example,
so here we have the
we're loading the register our zero
with message and then we
go ahead and print off the string
and then we're going to load
multiple increment after
with our zero and then we'll update
its address and we'll load those
into registers are one through our
nine. So we'll load
eight times eight bytes
into memory.
So let's look at the what the
registers look like before,
so our zero pointed to our string
and we can see our sequence of
characters that are inside of our
string.
So those are right there.
And we can see that all of these
registers don't have anything
particularly interesting in them.
One points of parameters.
But after we do this load,
multiple are zero with right
back. So our zero is going to get
updated. And then this whole list of
registers, we can see that
now are zero points to the end
of the string.
And so we can see how
this data is loaded.
So right here and then you can
see test this string
output. So these are all hex values.
And then Gaffin GDB
showed us. Oh that looks like that's
pointing to a string and so it shows
us what those strings will look like
that we can see that all of this
data got loaded into all of
these registers here and then that
are zero because we had the right
back are zero gets updated
to now point to the last byte that
it had loaded. So it loaded all
these bytes up to here.
And you can see the see and
then it points to the next E inside
of that string.
So today, we talked about some
multiple load and multiple store
operations
in the future will give an example
using multiple load and multiple
store and we'll see that.
And then here's our quiz.
So given the pointer to array our
zero, how would you load data into
registers are one or two or three
are five and seven and
then update that pointer.
So we could lose load
multiple increment after hour
zero, so we've got to write back
our one through our three, our
five and our seven.
If you have questions, you can email
me Milhem, you and Katie
Dedieu and you can find me on
Twitter Millas 30.