Assembly

Course
Time
13 hours 15 minutes
Difficulty
Beginner
CEU/CPE
14

Video Transcription

00:01
Hello. This is Dr Miller, and this is Episode 11.2 of Assembly
00:06
today. What we're going to do is we're gonna download and install the template.
00:10
So the template
00:12
this template is specific to arm, so it's similar to the X 86 template. And so what we're going to do is we're gonna download install it,
00:20
and then it will create projects for us that we can use for our coating purposes.
00:26
So I've got a raspberry pi here that I can ssh into.
00:31
And so
00:32
I've cleaned it up.
00:37
So the first thing that we're going to dio
00:39
let's go back here
00:42
as we were going to download the template. So that's we're gonna use the w get commands to w get space. It should be colon slash slash
00:50
CS that you and Kate I E D u slash till day. Miller slash arm template, Doctor Dodge Easy.
00:56
And you make sure you get all the letters to correct capitalisation. Then we'll extract it.
01:00
We will run the fix on it, and then you will need to log out and log back in now. I've already run it so I won't have to log out. But you will have toe log out or open a new terminal in order for it to work.
01:12
All right,
01:15
so let's go ahead and download it.
01:19
Okay, So it should say that it had saved our file.
01:25
If we do an ls, we should see the arm template here.
01:33
So now I should see a folder called Template. If I do dot, slash templates, fix
01:40
that should fix my environment. So now is the point where you would log out and log back in,
01:45
and then you create a new project we can use arm jen and then the name of our
01:51
project that we want to create.
01:53
So I'm gonna create one called Fred.
01:57
And here it says, successfully clear it'd Fred if you try and do it again.
02:01
Um, it says that that director already exists, so we can't recreate it
02:06
and for doing it unless And look at our files. We see that now
02:09
it started. We had armed template dot targets e g z womb. We extracted that. We ended up with a folder called Template.
02:15
And now we have an additional folder called Project.
02:21
All right, so if we go in a project again, this is where our projects will be So we can go into Fred.
02:27
We can see
02:29
we have our library. We have our make file, and then we have our assembly file. So go ahead and add it, Fred. I am Sam.
02:36
So let's add some, um, A messaging. So this is similar to the example given in the first arm lecture.
02:45
So here we're just gonna add a
02:50
string here. We're going to tell it to a line on four byte boundaries,
02:58
and then arm has some different directives so we can see an ask e string that ends in a zero is A S C i z.
03:06
And then we can just type of string
03:10
hello world with an exclamation point.
03:14
And we can even put a slash in in here who won a new line.
03:19
And then if we want to go ahead and print off that we can,
03:24
um, we'll learn about these commands later LD R zero
03:30
message.
03:35
We'll do branch of link print
03:38
strings that'll print a string off.
03:42
We can also do things like move.
03:46
Are zero the number?
03:49
Um, let's pick a number 19
03:53
being a new branch of link print. Didn't
03:57
It's a lot of print off that number Natural number 19.
04:01
And then we're all done down here. So here is our you see comments are either slash *** tricked. And then at the end, asterix slash that's multi line or a single line.
04:12
And then, ah, regular comment is slash, slash and then everything after that and you can see syntax highlighting here shows that for me so that I can see that
04:23
Go ahead and write and quit,
04:26
and then we can type, make and so make we'll go ahead and run
04:30
the assembler on,
04:31
um, our assembly files. Afraid, I sm,
04:35
um it also run it on our library, and then we can use DCC to compile it into a binary cold. Fred
04:44
Additionally, we need to make sure that we save our link register.
04:47
So I didn't say push LR
04:51
when we're done, we need to restore that because that saves where we needed to go at the end. So pop,
04:59
no are.
05:00
And then additionally, we've got to create our text segment which wasn't by default set up there so dot text
05:09
for our main program.
05:12
So
05:14
now if we type make,
05:17
we can see that it should be built. And now when we run that, we can see that it prints off Hello world and then the number 19.
05:30
So today we looked at installing the template for arm and then using it in a similar way that we use our X 86 template.
05:39
So looking forward, we're going to talk about some of the instructions that we saw. So, for example, moving data to and from memory.
05:46
So we were able to load our string and load the number
05:49
19 from Variables. And so we'll look at how we do that in arm, which is going to differ a little bit than what we did in x 86.
06:00
So if you have questions, you can email me at Miller MJ at you and Keita et you, and you can find me on Twitter at No House, 30

Up Next

Assembly

This course will provide background and information related to programming in assembly. Assembly is the lowest level programming language which is useful in reverse engineering and malware analysis.

Instructed By

Instructor Profile Image
Matthew Miller
Assistant Professor at the University of Nebraska at Kearney
Instructor