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:
  • 407 Vote(s) - 3.58 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CYFA - Creating Your First Assembler - Introduction

#1
Well, it's that time of year again. The time I sit down and crank out a bunch of really complex tutorial threads that some members will read, learn, and apply over the next year. While I was discussing options on Discord, @"Ender" brought up compiler theory, which was the subject of last year's

[To see links please register here]

series, where members got some inside knowledge on how parsers and compilers work. This year, we will continue that spirit by adding the next step in the software development chain: The Assembler.

So, the assembler, an integral part of software development in the days of old and today. We've already learned how to parse human written source code into a machine understandable format, from there it's optimized and so forth through a compiler and converted to assembly language. This assembly language is important, but also interesting. You're used to writing your code in the same language and compensating for minor library differences in how you do things. This is totally different with assembly. Every processor has its own features, and therefore its own assembly language. For this series, we will be using ARM processors, specifically the ARM1176 series (the CPU's found in the original rPI). This series won't be ultra long, but it won't be short. Maybe 5 parts total. I will be leaving off many of the processor capabilities, my goal is simply to describe how it operates so you can extend it. The original assemblers were written in either assembly language or machine code, we will be writing ours in C, so brush up on that.



Ok, so we have a few questions to ask ourselves before we dive in:
  • What is an assembler and assembly language?
  • What essential role does the assembler play?
  • How do they function on a basic level?

What is an assembler and assembly language?
The assembler is a translator (or interpreter in cases with JIT) for human or machine written code. Your compiler doesn't make a binary file, in fact it just produces more source code (a lot more). It's up to the other tools you use to convert these into something that you can use. As for the assembly language, it's a series of mnemonics that we as programmers have the honor of memorizing and stressing over so that we don't have to write our programs directly with a hexedecimal editor.

What essential role does the assembler play?
The assembler serves as the bridge between code and action. Many people often confuse it with a compiler, it is not. This program is responsible for translating that code your compiler spit out (or that you wrote because you hate yourself), into a specific format for your processor. This format, and often even the input code changes from processor to processor (AMD is very different from ARM, which is worlds apart from TI), so you need a different assembler for each CPU. This separation between compiler and assembler is what allows you to write the same code for whatever system you're using. Without this, you would have versions of windows source code for every CPU made (Phenom, FX, Ryzen, i7, i9, Coffee Lake, etc). The linker also plays an integral part in this, but we won't talk about that much in this series (maybe next time).

How do they function on a basic level?
Consider them an intermediate, a translator of sorts. Assemblers are just find and replace engines on a basic level. There are very few lines that you can write, so it's technically feasible to just hard code them all in and use straight find replace (some disassemblers do this). We won't be doing it that way, we will do it properly. It is important to not though, that assemblers do not optimize your code. If you write the assembly code for the processor to do something, it does that thing exactly how you asked it to, nothing more, nothing less.



Alright, I hope you're salivating by now, this is going to be an exciting series. I'll be working on a way for you to test your code out as you play with the assembler, so that we don't have to reverse engineer it all. More than likely we will use a linux operating system with qemu and lldb installed, so be prepared to install one if you don't already use one (like a real man).
Reply

#2
Quote:(10-10-2017, 08:57 AM)Slacker Wrote:

[To see links please register here]

Posting to add to my archive of tutorials.
I strongly recommend any one wishing to learn specific skills to message this guy he writes in depth and detailed tutorials :smile:

Awww, I'm flattered. My take on it, is I want to see SL be a booming hub of intelligent people. If I have to spend some time writing these things to get there, I'm happy to.
Reply

#3
Posting to add to my archive of tutorials.
I strongly recommend any one wishing to learn specific skills to message this guy he writes in depth and detailed tutorials
Reply

#4
You know the routine though tag me in them please do I have them for when I am ready
Reply

#5
Quote:(10-10-2017, 09:05 AM)Slacker Wrote:

[To see links please register here]

You know the routine though tag me in them please do I have them for when I am ready

Tag me as well please.

I'm looking forward to this.
Reply

#6
I'll be reading these, whether or not I reply to them all or not. So thanks.
Reply

#7
Quote:(10-10-2017, 09:05 AM)Slacker Wrote:

[To see links please register here]

You know the routine though tag me in them please do I have them for when I am ready

Quote:(10-10-2017, 09:43 PM)Ender Wrote:

[To see links please register here]

Quote: (10-10-2017, 09:05 AM)Slacker Wrote:

[To see links please register here]

You know the routine though tag me in them please do I have them for when I am ready

Tag me as well please.

I'm looking forward to this.

I generally won't remember to tag a bunch of people in these threads. I do usually also post a link in discord though. Since signature length is so small im considering just putting up a simple webpage with links to all the series and individual tutorials.
Reply

#8
Quote:(10-11-2017, 04:12 AM)phyrrus9 Wrote:

[To see links please register here]

Quote: (10-10-2017, 09:05 AM)Slacker Wrote:

[To see links please register here]

You know the routine though tag me in them please do I have them for when I am ready

Quote:(10-10-2017, 09:43 PM)Ender Wrote:

[To see links please register here]

Quote: (10-10-2017, 09:05 AM)Slacker Wrote:

[To see links please register here]

You know the routine though tag me in them please do I have them for when I am ready

Tag me as well please.

I'm looking forward to this.

I generally won't remember to tag a bunch of people in these threads. I do usually also post a link in discord though. Since signature length is so small im considering just putting up a simple webpage with links to all the series and individual tutorials.

That would be DOPE (WebPage)
But either way as soon as I see them I CnP then off site for my storage and keep them for future reads.
Reply

#9
I tried to learn C# coding a couple of years back, and have really basic Javascript knowledge; must say this thread helped me a lot to understanding a lot more than before. Thanks!
Reply

#10
Quote:(12-28-2020, 09:09 PM)Disguised Wrote:

[To see links please register here]

I tried to learn C# coding a couple of years back, and have really basic Javascript knowledge; must say this thread helped me a lot to understanding a lot more than before. Thanks!

I'd suggest you take another go at it. C# has changed A LOT in the last 5 years.

side note: 2,000 views on this thread, 8 replies :/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

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