# IT Block Assembly

Video Activity

Join over 3 million cybersecurity professionals advancing their career

Sign up with

or

Already have an account? Sign In »

Video Transcription

00:00

Hello. This is Dr Miller and this episode 12.12 of assembly

00:06

Today we're gonna again talk about conditional execution, but we're going to talk about I t blocks.

00:12

So some i t conditional execution.

00:15

So thumb to does not have the bits for standalone, conditional instructions,

00:21

but in order to compensate for that a little bit, it does have I t blocks.

00:25

And so these are gonna be available for both thumb to and our moon.

00:30

And then when you get into arm version eight, it actually deprecate this functionality and removes it.

00:38

So what are I t blocks?

00:40

So I t blocks our if then blocks and they allow up to four different instructions to be conditionally executed

00:48

when they run an arm thumb to mood.

00:50

So we have this set of instructions I t t e Q. And then we have three instructions that follow this particular example.

01:00

So an I t block. So it's I t. And then it's followed the then by X, y and Z,

01:08

and then some flag that we care about.

01:11

And so X, y and Z can be either tea or E. So they're one of the two letters to your E

01:19

and then the number of them is optional. So we can have 012 or three,

01:25

and then the conditions must be ordered correctly based on what you're doing with them.

01:30

So the tea is then s O that must match our condition. The e is an else, and it must be the opposite of our condition. And then the flag is one of those conditional suffixes that we have seen.

01:44

So again, we have seen the suffixes like equal, not equal, greater than or equal to less than greater than less than equal are typically the ones that you're going to see.

01:57

So here are some example I T blocks.

01:59

And so one of the things that you're going to see is that if I have to tease, then those will have to match this condition. So e que e que e que

02:07

um and then our else is something that is not a Q or the opposite of U Q is not equal.

02:14

So this I t block has I t t e e. And so we got I then then and then and else, Or

02:23

if then else So I gotta then so we got a negative M I is

02:29

negative and pl is positive. And so these conditions have to match what's in our I t block?

02:35

Are we gonna have an I t t t

02:38

So we got three then, right? So if negative here, I got three different negative instructions that I can use for that

02:47

or i t and then e So I got one then and to else's so one then,

02:54

um g t. And then we got less than able to lessen equal two in that one.

03:02

So here's an example using the if then blocks so we can see that we have a function here and it says dot be aligned to So we're relying on to buy boundaries and then this is a thumb function.

03:15

And then our function bar is going to move our zero into our one and then compare are zero to the number 10 and then it's got it. If then

03:24

that if then then else So we've got to then is two equals and then are not equal.

03:32

So we can movinto are zero the number one and then subtract the number one from r zero

03:38

or we do move. Are 0 100 And so this one. If you type

03:44

a 10 it will give you the number zero. And if you,

03:46

um cyp something that's not equal to 10 it will give you the value. 100 right? And so this was around. What about way of doing it? I could have just done the move zero for it. But I wanted to show the if then block inside of there.

04:02

Oh, and again, you're doing a branch of Lincoln Exchange, right? So I'm setting the link register, and then I'm also exchanging instruction sets to jump into bar because this is a regular armed function, and then this is a film function,

04:18

but we can see that this is also useful for not doing some mood. So it works both ways. So all I did in this is I just did a branch in a link and I didn't do an exchange. And then I removed the header from my thumb code, and I can use the exact same code if this is an arm block or if this is a thumb block.

04:41

So today we talked about some conditional execution using I t blocks

04:47

looking forward, we will given I t block example.

04:51

And then here's our quiz. So for an I t block, what does the T in the east and for

04:58

so t stands for, then an e stands for else.

05:02

If you have questions, you can email me Miller MJ at you and k dot edu You can find me on Twitter at Milhouse 30.

Up Next

Similar Content