Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 319 Vote(s) - 3.45 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CYFA - Creating Your First Assembler - Branches and Conditionals

#1
Welcome to part 5 of the CYFA series! (If you haven't read the first 4 parts, you can find a list of them

[To see links please register here]

).

This will be the last of the boring memorization parts, at least for now. With the addition of this we will have covered all of the reference material we need to start working on code and theory! Alright, so what are we going to cover in this part? Well, firstly we'll be looking at branches. These are the equivalent of a jump for you Intel fanboys. After we dig through branches we'll finally loop back around and cover those condition fields that are at the start of every instruction. Let's get into it.

The branch format:
[Image: gF89NEr.png]

Ok, so this one looks REALLY simple, and it is! Let's look at it backwards, first we see the offset. This field is probably the most complicated field in the ARM processor, a lot goes on with it. This is the only instruction-based field that is a signed integer. It's a 24-bit 2's compliment signed offset. When this instruction is executed, this offset is sign extended (if you don't understand 2's compliment and sign extension, you should google that soon) to 32-bits, and then added to the CURRENT PC register. This means that this value is RELATIVE to the current instruction. ARM does not contain an instruction to jump to an absolute address in memory (though there is a way to do it).

Ok, so with that out of the way, let's have a look at the Link bit. This is confusing to many C++ programmers (where branch and jump both mean goto), and even for intel programmers. With ARM, there are not separate instructions for jump and call, they are both branch. With ARM, when you want to call (rather than jump), you set the link bit, which will set the value in R14 to the instruction after the branch, and then perform the branch. Likewise, ARM does not have a ret instruction, but rather you would branch (without link) to R14.



Ok, I knew that would be the fastest out of all of them to explain, and it was, so now let's go ahead and take a look at that condition field. It is a 4-bit field, meaning that we have 16 conditions. Don't get confused though, this is not an integer, don't write it as "210", it doesn't hold a number.

This is going to be relatively easy to explain to you, I'm just going to drop a table here for you to look at.
[Image: DODrpA7.png]

I apologize for the low quality of this image, I snagged it from another source, and it's small.

The most common condition code you will come across is 0xFE (AL). This one is implicit on every instruction, so if no code is specified, you will put this down.
After that, there is 0xFF (NV). You may wonder why they even included this value, it seems useless right? Not really. This value is really useful when you're writing polymorphic code, you can comment out large portions of code without losing the instructions under them! This also will come in handy when we get to writing our assembler. If the user enters in NOP, we can just set the NV code on whatever the last instruction we just wrote was, and write it again without doing any slow memory tasks.,

For our assembler, we probably won't hit hard on overflow (V-bit) or carry (C-bit) stuff, so you can go ahead and ignore the following:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

We will use instructions that use both C and V (unsigned integer comparisons) though.



Alright, so this one was VERY sort, and I'm sorry about that, but I wanted to make sure I went through the foundations stuff very slowly so that you wouldn't skim any part of it. All of this stuff is critical to being able to do the next part, where we will start writing code!

Again, I judge interest by how many replies these threads get. If I get loads of replies, I write these faster. If I get little or no replies, either the series dies or I wait a week before writing the next part (which is what happened this time).
Please reply to this.
Reply

#2
Thanks for the information. Pls upload more
Reply

#3
Bumping this to try and bring life back into this series.. Please, somebody respond to tell me you're actually reading these
Reply

#4
Quote:(11-10-2017, 08:58 AM)phyrrus9 Wrote:

[To see links please register here]

Bumping this to try and bring life back into this series.. Please, somebody respond to tell me you're actually reading these

Thanks for bumping this, as I never really saw any of them! I will save all of these.

P.S. 600th post!!! WOOP WOOP! :cool:
Reply

#5
Quote:(11-10-2017, 02:34 PM)Synthx Wrote:

[To see links please register here]

Quote: (11-10-2017, 08:58 AM)phyrrus9 Wrote:

[To see links please register here]

Bumping this to try and bring life back into this series.. Please, somebody respond to tell me you're actually reading these

Thanks for bumping this, as I never really saw any of them! I will save all of these.

P.S. 600th post!!! WOOP WOOP! :cool:

You should read through them! I just posted part 6, which is where we get to start writing code.

I always keep an up to date website with an organized list of all my tutorials, since they often get buried by SE skids.

Bookmark/save/whatever the link to that page:

[To see links please register here]

It's also linked in my signature.
But yeah, go read

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through