I'm taking an introduction to assembly language class, and I want to say that you've been an absolute godsend. My teacher has very unintuitive lectures, and the homeworks and programming assignments have been disjointed and confusing. Just from watching the first video in this series, I gained a better understanding of what all of this meant than from five chapters of our horrible, horrible book. Thank you so much for making this series.
Just started my assembly programming class 2 weeks ago and I 100% agree with you haha, my professor is a nice dude but his teaching style is just not for me (writing down lecture notes on a piece of paper rather than typing out the code and giving us examples and all of that)
mate, I don't care if you see this comment or not. But thanks for this videos! wasted hours with arm, moved to x86 because of a friend. Discovered your tutorial in the process, and loved it.
I'm very grateful that these videos exist. They are a slower paced and detailed explaination of how these things all work. It's a complex subject that can't be taught as if the lesson were a speedrun.
This tutorial is amazing. The last time i used Assembly was on the C64, and this is nearly Stoneage. But there are equalities that makes it easyer to unterstand x86
5:11 kinda missed jnz there (jump if not zero) if you code a loop with a countdown for example its pretty usefull but thats probably one of the special cases you mentioned there
Thank you so much for sharing your knowledge and time! I've always wondered what exactly is happening in assembler. Your tutorials are straight forward and very easy to unserstand. Looking forward for some practical examples, a simple game would be nice. Maybe a simple GUI? Probably I'm reacting prematurely but it's amazing how simple it is to handle tasks in asm. With conditional looping you are all set to start doing something useful. Now a good question would be: what exactly can we do nowadays in assembler that can be useful besides drivers. For examples I have a frontend background. I keep hearing about web assembly. Any thoughts on this? Cheers! I'm subscribed, waiting for new cool vids.
Not sure about some of the other stuff but, on your question about a simple GUI. While it is entirely possible to code a simple* GUI in assembly, it would most likely be out of the scope of this series. On Linux, you have a display server. You can connect to this server through libraries (code that has also been turned into assembly and then to an executable), and 'draw' your GUI. (This is an overly simplified overview of it.) But to do that you need to understand how those said libraries work. That would mean he would have to teach you about a binary that someone else made rather than teaching about assembly itself. *simple from a visual perspective, not a coding one
I did some lookup and i find out that: 1. When "EAX" = 1, it indicates the exit system call. The "EBX" register is used to pass the exit status. 2. The exit system call typically expects an 8-bit unsigned value (0-255) for the exit status. Which you get from the "EBX" So 420 in hexadecimal is 0x01A4. When truncated to 8 bits, only the least significant byte (A4 in hex, which is 164 in decimal) is used as the exit status.
About that register ecx that you're using as a loop counter: if you set it to 10 or higher, the exit will always be 0. Is that because the sys_exit only reads a part of the number, overflow?
Hi, Great video! When specifying the number of iterations, why did you store the number in ecx, does that register have special significance or is it just because its the next unused general purpose data register?
I tried ecx = 8 with the looping program to find out 2 to the power of 8, but the exit status is 0. This is the same for anything with ecx > 8. It works correctly with ecx=7 and the exit status code is 128. In gdb, the value of ebx is 256 with ecx = 8, but in the terminal as exit status it is 0.
Anyone else having issues with example #4? I copied the example code straight from github and still get the following: Ex4.asm:12: error: parser: instruction expected
basically he is using a presentation software it's not a terminal just powerpoint stuff. For x86 assembly the tutorial is using linux or unix like operating system. you will also need nasm assembler and gnu c compiler (gcc) for gnu linker software. If you are in windows you can use tdm gcc compiler tdm-gcc.tdragon.net/ for ld and you can downlod nasm binary from here: www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D and don't forget to add them to system path variable.
In the ex3.asm example, when ecx has the value of 101 and the jump condition jl is not met, I understand that the exit status will be changed to 13. But in that case, will the interrupt code at skip: section still be executed? Or not anymore since it never met the condition? Any help would be greatly appreciated!
What an absolute chad, thanks my man, btw, I wonder, would nasm work on MacOS? My classmates are using TASM via Dosbox to learn assembly language, but I can’t figure out how to run it on a Mac.
Not really... It's just the language that computers speak. You're probably thinking of a dissasembler, which takes any program and gives you it's assembly code, in a way that you can understand and manipulate
@@sebastiangudino9377 "which takes any program and gives you it's assembly code, in a way that you can understand and manipulate" which is exactly what this series is about, so youre wrong
@@nIrUbU01 Not really, dissassemblers are a tool, assembly is a language, learning to code assembly and learning tl read assembly are pretty different skills. Yes, being able to write programs in assembly would be usedul for craking, and hacking in general. But is not the "Key to crack any software". I if that's what the commenter was looking for, then looking at tools might be more usefull for them. You can learn all the insteuctions in x86 assembly, and that will not really help you on it own to crack a program without proper tools to use
@@nIrUbU01 If you can code it, you can read your own code, but that does not mean you can take any program compiled from any compiler, dissassemble it, and know what they are doing, compilation is a complex process, and there are a million ways to compile the same code. For example, maybe you can write assembly code to calculate factorials of numbers. But if you write that same code in something like Haskell using recursion and compile it somehow, the fact that haskell uses first class functions and graph reduction will be in the assembly, making code that is very very very hard to follow for humans, specialy if you do not know what you are looking at. Even basic stuff like GCC name mangling can be very confusing and intinidating if you do not know what you are looking at - Edited to fix typos
02:03 The Spectre has a different opinion on that ;> 07:31 There's a LOOP instruction that could do that even more efficient, without the need of DEC, CMP and JG ;) 08:15 How is adding 1 six times supposed to produce 64? :q
It will be 13, because after the "mov ebx, 13" it will go on to the "int 0x80". A Label does NOT mean, that the code under in will only be run when there is a jump to it. It will also run if the EIP comes by normal to the label
I tested it out and it returned 13. It appears that the label still runs sequentially going down the program, unlike, for example, a C function that may never be called.
dekotu labels has only one meaning in assembly language. It is an alias for an address. Since you don’t know how long your code segments are going to be, the real addresses will be calculated by the assembler when you run the assembler. It can be translated to either absolute of relative addresses. In the case of absolute addresses, jump to this specific address, as opposed to relative addresses, like jump 32 addresses forward (or backward). Both are calculated at assembly time. Assembly has no notion of “functions”. The processor has one instruction pointer. This one is advanced as long as it is not modified by any other operation. Jump and move would modify the instruction pointer. Also return and call will do. Edit: I looked for a move instruction to manipulate EIP directly, turns out that the jump instruction is just an alias for mov eip, x. Which makes sense d’oh!
I have taught in a NYC college mainframe assembly programming a s personally have written about 2 million lines of assembly code in my career, i can say you need to go over CPU architecture first as programming in assembly Lang you NEED to have a good understanding of a particular CPU before you can introduce assembly language. In addition it is very helpful to use a debugger that can single step each instruction so the student can actually see whats going on. When I learned assembly language the mainframe was my best teacher. It was impossible to write code that would crash the system as both the hardware and o/s was indestructible. It would NEVER let you do something bad enough to crash it. I find hoaxing ONE register (AX) on the x86 CPU, extremely limiting. I consider the x86 platform to be a toy in a grown up world
That's nice. But not everyone is learning assembly for the purpose of writing 2 million lines of it. A lot of the people watching this are learning it to help with reverse engineering or to get a better understanding of how C code works behind the scenes. You can call x86 a toy language all you want, but the bottom line is that it (and its x86_64 offspring) are still pervasive in modern computing. So, good for you for learning mainframe assembly, but before you go around telling people that your approach is the only right one, keep in mind that not everyone has the same goals as you.
Nice. I like how you're doing this in small-ish chunks. It's easier to assimilate that way. Looking forward to future videos.
it's the best assembly tutorial out of 15 others that top the list when searching YT
Easier to understand also like the chapters in a book.
I'm taking an introduction to assembly language class, and I want to say that you've been an absolute godsend.
My teacher has very unintuitive lectures, and the homeworks and programming assignments have been disjointed and confusing.
Just from watching the first video in this series, I gained a better understanding of what all of this meant than from five chapters of our horrible, horrible book.
Thank you so much for making this series.
Just started my assembly programming class 2 weeks ago and I 100% agree with you haha, my professor is a nice dude but his teaching style is just not for me (writing down lecture notes on a piece of paper rather than typing out the code and giving us examples and all of that)
How did the class go?
mate, I don't care if you see this comment or not. But thanks for this videos!
wasted hours with arm, moved to x86 because of a friend. Discovered your tutorial in the process, and loved it.
I'm very grateful that these videos exist. They are a slower paced and detailed explaination of how these things all work. It's a complex subject that can't be taught as if the lesson were a speedrun.
We have a real talent when it comes to teaching, congrats!! You made assembly languages much easier to be learned !
I've been trying to get into assembly for so long, with this series I finally start understanding what all of these magic symbols mean! Thanks so much
This tutorial is amazing.
The last time i used Assembly was on the C64,
and this is nearly Stoneage. But there are equalities that
makes it easyer to unterstand x86
I needed a large refresher, and this gave me this in spades.
I like these and im following along. Great for a noob like me. Keep doing them!
You're carrying my scholarly endeavers for Assembly rn keep up the good work. 🧠✨️
Great video, the way you address each line really helps. Thanks
This video is a little older now, but you are a great teacher!
Thank you for these videos. Your work has not gone unappreciated. :)
Dear DavyBot, you are a great teacher!
This helps a lot especially when your professor is very unorganized and is hard to understand sometimes.
This guy is the best on youtube!
What happens if you don't do _int 0x80_ ? Does the program still exit, or does the CPU just stays idle when this process is "executing"?
Great material. Thanks for sharing your knowledge!
5:11 kinda missed jnz there (jump if not zero) if you code a loop with a countdown for example its pretty usefull but thats probably one of the special cases you mentioned there
My professor could learn a lot from you
Thank you so much for sharing your knowledge and time! I've always wondered what exactly is happening in assembler. Your tutorials are straight forward and very easy to unserstand. Looking forward for some practical examples, a simple game would be nice. Maybe a simple GUI? Probably I'm reacting prematurely but it's amazing how simple it is to handle tasks in asm. With conditional looping you are all set to start doing something useful. Now a good question would be: what exactly can we do nowadays in assembler that can be useful besides drivers. For examples I have a frontend background. I keep hearing about web assembly. Any thoughts on this? Cheers! I'm subscribed, waiting for new cool vids.
Not sure about some of the other stuff but, on your question about a simple GUI. While it is entirely possible to code a simple* GUI in assembly, it would most likely be out of the scope of this series. On Linux, you have a display server. You can connect to this server through libraries (code that has also been turned into assembly and then to an executable), and 'draw' your GUI. (This is an overly simplified overview of it.) But to do that you need to understand how those said libraries work. That would mean he would have to teach you about a binary that someone else made rather than teaching about assembly itself.
*simple from a visual perspective, not a coding one
Awesome tutorial series, thank you for making this! God bless.
Nice videos DAvy, keep it up in 2024!
Awesome tutorial! Thanks for this great work!
Very very cool! Transistors & logic gates ftw
Why can 'ebx' store a maximum of 164? If I "int 0x80" after "mov ebx, 420" the exit status will always be 164. I could not find the answer online.
I did some lookup and i find out that:
1. When "EAX" = 1, it indicates the exit system call. The "EBX" register is used to pass the exit status.
2. The exit system call typically expects an 8-bit unsigned value (0-255) for the exit status. Which you get from the "EBX"
So 420 in hexadecimal is 0x01A4. When truncated to 8 bits, only the least significant byte (A4 in hex, which is 164 in decimal) is used as the exit status.
Thank you for your wonderful videos.
Thank you for this video series.
Thank you for great explanations
In the ex3.asm, why did the program print ebx's value and not eax's??
if you know the answer please let me know too
@@godslayer1685 bro still i haven’t figured it out 🥲
About that register ecx that you're using as a loop counter: if you set it to 10 or higher, the exit will always be 0. Is that because the sys_exit only reads a part of the number, overflow?
slowly starting to understand
Nice presentation
Great video 🔥
you are such a sunshine
Bro new sub man your amazing ❤
God bless you, sir!
Very easy to understand.
How can I print some text from inside the loop?
Thank you for the video.
How does it know if the value stored in ecx is signed or not?
Hi,
Great video!
When specifying the number of iterations, why did you store the number in ecx, does that register have special significance or is it just because its the next unused general purpose data register?
Seems like ECX is general purpose register that is commonly used to store the loop count (from a simple Google search).
At 7:50 why `echo $?` gave 16 and 64? We've clearly set eax to 1, `echo $?` should give 1. Please I need explaination.
Because of the add ebx, ebx instruction coming after mov ebx, 1. this instruction adds ebx to itself and saves the result into itself
@@LeoonK okay
Terrific work!
may I know what is the assembler you use
I tried ecx = 8 with the looping program to find out 2 to the power of 8, but the exit status is 0. This is the same for anything with ecx > 8. It works correctly with ecx=7 and the exit status code is 128. In gdb, the value of ebx is 256 with ecx = 8, but in the terminal as exit status it is 0.
is cmp ecx
jg label
equivalent to
if(ecx > 0)
{
eax = 1
}
Great tutorial :)
Very good, many thanks!
Anyone else having issues with example #4?
I copied the example code straight from github and still get the following:
Ex4.asm:12: error: parser: instruction expected
thanks so much, but what is the software used for programming?
basically he is using a presentation software it's not a terminal just powerpoint stuff. For x86 assembly the tutorial is using linux or unix like operating system. you will also need nasm assembler and gnu c compiler (gcc) for gnu linker software.
If you are in windows you can use tdm gcc compiler tdm-gcc.tdragon.net/ for ld and you can downlod nasm binary from here: www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D and don't forget to add them to system path variable.
In the ex3.asm example, when ecx has the value of 101 and the jump condition jl is not met, I understand that the exit status will be changed to 13. But in that case, will the interrupt code at skip: section still be executed? Or not anymore since it never met the condition? Any help would be greatly appreciated!
since the condition failed, the skip section will not be executed!
Great vídeo tutorial :) thank you!
What an absolute chad, thanks my man, btw, I wonder, would nasm work on MacOS? My classmates are using TASM via Dosbox to learn assembly language, but I can’t figure out how to run it on a Mac.
Yes nasm work in macOS i used it.
Which operating system did you use to use assembly language?
Linux with NASM assembler!
I should have seen thid 2 years earlier than now omfg
I love this.. this is the key to cracked any software.. xD
Not really... It's just the language that computers speak. You're probably thinking of a dissasembler, which takes any program and gives you it's assembly code, in a way that you can understand and manipulate
@@sebastiangudino9377 "which takes any program and gives you it's assembly code, in a way that you can understand and manipulate" which is exactly what this series is about, so youre wrong
@@nIrUbU01 Not really, dissassemblers are a tool, assembly is a language, learning to code assembly and learning tl read assembly are pretty different skills. Yes, being able to write programs in assembly would be usedul for craking, and hacking in general. But is not the "Key to crack any software". I if that's what the commenter was looking for, then looking at tools might be more usefull for them. You can learn all the insteuctions in x86 assembly, and that will not really help you on it own to crack a program without proper tools to use
@@sebastiangudino9377 "learning to code assembly and learning tl read assembly" - How are those different? If you can code it you can read it.
@@nIrUbU01 If you can code it, you can read your own code, but that does not mean you can take any program compiled from any compiler, dissassemble it, and know what they are doing, compilation is a complex process, and there are a million ways to compile the same code. For example, maybe you can write assembly code to calculate factorials of numbers. But if you write that same code in something like Haskell using recursion and compile it somehow, the fact that haskell uses first class functions and graph reduction will be in the assembly, making code that is very very very hard to follow for humans, specialy if you do not know what you are looking at. Even basic stuff like GCC name mangling can be very confusing and intinidating if you do not know what you are looking at
- Edited to fix typos
Is there a brain reboot button cuz I believe my just crashed
This more of a class presentation on assembly rather than a teaching guide.
Thankyou. Need humbly your knowledge.
Please, just be True.
Your friends are your life.
Your Cool and you have friends.
02:03 The Spectre has a different opinion on that ;>
07:31 There's a LOOP instruction that could do that even more efficient, without the need of DEC, CMP and JG ;)
08:15 How is adding 1 six times supposed to produce 64? :q
he is not adding 1 six times, he is adding ebx to ebx 6 times, so:
mov ebx, 1 ;ebx = 1
add ebx, ebx ;ebx = 2
add ebx, ebx ;ebx = 4
add ebx, ebx ;ebx = 8
add ebx, ebx ;ebx = 16
add ebx, ebx ;ebx = 32
add ebx, ebx ;ebx = 64
@@henriqueferreirao559 Thank you !
At 4:57 the value will not be 13 because you didn't perform a system interrupt after "mov ebx, 13"
It will be 13, because after the "mov ebx, 13" it will go on to the "int 0x80".
A Label does NOT mean, that the code under in will only be run when there is a jump to it. It will also run if the EIP comes by normal to the label
I tested it out and it returned 13. It appears that the label still runs sequentially going down the program, unlike, for example, a C function that may never be called.
dekotu labels has only one meaning in assembly language. It is an alias for an address. Since you don’t know how long your code segments are going to be, the real addresses will be calculated by the assembler when you run the assembler. It can be translated to either absolute of relative addresses. In the case of absolute addresses, jump to this specific address, as opposed to relative addresses, like jump 32 addresses forward (or backward). Both are calculated at assembly time. Assembly has no notion of “functions”. The processor has one instruction pointer. This one is advanced as long as it is not modified by any other operation. Jump and move would modify the instruction pointer. Also return and call will do. Edit: I looked for a move instruction to manipulate EIP directly, turns out that the jump instruction is just an alias for mov eip, x. Which makes sense d’oh!
i love thanks
this shiz is lit brv
he's just too cute
I have taught in a NYC college mainframe assembly programming a s personally have written about 2 million lines of assembly code in my career, i can say you need to go over CPU architecture first as programming in assembly Lang you NEED to have a good understanding of a particular CPU before you can introduce assembly language.
In addition it is very helpful to use a debugger that can single step each instruction so the student can actually see whats going on.
When I learned assembly language the mainframe was my best teacher. It was impossible to write code that would crash the system as both the hardware and o/s was indestructible. It would NEVER let you do something bad enough to crash it.
I find hoaxing ONE register (AX) on the x86 CPU, extremely limiting. I consider the x86 platform to be a toy in a grown up world
That's nice. But not everyone is learning assembly for the purpose of writing 2 million lines of it. A lot of the people watching this are learning it to help with reverse engineering or to get a better understanding of how C code works behind the scenes. You can call x86 a toy language all you want, but the bottom line is that it (and its x86_64 offspring) are still pervasive in modern computing. So, good for you for learning mainframe assembly, but before you go around telling people that your approach is the only right one, keep in mind that not everyone has the same goals as you.
you remind me of pewdiepie
Thanks for the knowledge!