Intro to x86 Assembly Language (Part 2)

Поділитися
Вставка
  • Опубліковано 30 січ 2025

КОМЕНТАРІ • 97

  • @therealxunil2
    @therealxunil2 7 років тому +136

    Nice. I like how you're doing this in small-ish chunks. It's easier to assimilate that way. Looking forward to future videos.

    • @specnaz157
      @specnaz157 6 років тому +4

      it's the best assembly tutorial out of 15 others that top the list when searching YT

    • @tim_allen_jr
      @tim_allen_jr Рік тому

      Easier to understand also like the chapters in a book.

  • @bkindr3wind641
    @bkindr3wind641 4 роки тому +59

    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.

    • @isaacolvera3987
      @isaacolvera3987 4 роки тому +4

      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)

    • @danielmcpherson9062
      @danielmcpherson9062 2 роки тому

      How did the class go?

  • @Franck_Major_X
    @Franck_Major_X 3 місяці тому +4

    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.

  • @jamesnelson7288
    @jamesnelson7288 2 роки тому +7

    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.

  • @viniciustorino2698
    @viniciustorino2698 6 років тому +37

    We have a real talent when it comes to teaching, congrats!! You made assembly languages much easier to be learned !

  • @psychicpenguin2850
    @psychicpenguin2850 3 роки тому +3

    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

  • @hasenhirn1965
    @hasenhirn1965 6 років тому +5

    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

  • @GoonCity777
    @GoonCity777 4 роки тому +2

    I needed a large refresher, and this gave me this in spades.

  • @pleasedontwatchthese9593
    @pleasedontwatchthese9593 7 років тому +21

    I like these and im following along. Great for a noob like me. Keep doing them!

  • @tim_allen_jr
    @tim_allen_jr Рік тому

    You're carrying my scholarly endeavers for Assembly rn keep up the good work. 🧠✨️

  • @Gamerlife-xv7el
    @Gamerlife-xv7el 3 роки тому +1

    Great video, the way you address each line really helps. Thanks

  • @drewkanapa4607
    @drewkanapa4607 5 років тому +1

    This video is a little older now, but you are a great teacher!

  • @IDK-kv8ob
    @IDK-kv8ob 10 місяців тому

    Thank you for these videos. Your work has not gone unappreciated. :)

  • @geogykanicheril
    @geogykanicheril 5 років тому +1

    Dear DavyBot, you are a great teacher!

  • @TheCometdefender
    @TheCometdefender 5 років тому +1

    This helps a lot especially when your professor is very unorganized and is hard to understand sometimes.

  • @mohammedqaysi4723
    @mohammedqaysi4723 4 роки тому +1

    This guy is the best on youtube!

  • @comradepeter87
    @comradepeter87 3 роки тому +5

    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"?

  • @trestenpool9045
    @trestenpool9045 4 роки тому +2

    Great material. Thanks for sharing your knowledge!

  • @Necktwister666
    @Necktwister666 9 місяців тому +1

    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

  • @Kevin-tx6gw
    @Kevin-tx6gw Рік тому +3

    My professor could learn a lot from you

  • @adrianmoisa2281
    @adrianmoisa2281 7 років тому +14

    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.

    • @sethatkins3731
      @sethatkins3731 6 років тому +3

      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

  • @SpidahRidah
    @SpidahRidah 3 роки тому +1

    Awesome tutorial series, thank you for making this! God bless.

  • @nesnavsae
    @nesnavsae Рік тому

    Nice videos DAvy, keep it up in 2024!

  • @blazed-space
    @blazed-space 3 роки тому +1

    Awesome tutorial! Thanks for this great work!

  • @GoonCity777
    @GoonCity777 4 роки тому +1

    Very very cool! Transistors & logic gates ftw

  • @lemonhasj
    @lemonhasj 5 місяців тому +1

    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.

    • @rouisaek
      @rouisaek Місяць тому

      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.

  • @learnmeabitcoin
    @learnmeabitcoin 4 роки тому +1

    Thank you for your wonderful videos.

  • @rebei
    @rebei 10 місяців тому

    Thank you for this video series.

  • @AnnelyYooo
    @AnnelyYooo 6 років тому +3

    Thank you for great explanations

  • @sankethraj4028
    @sankethraj4028 3 роки тому +1

    In the ex3.asm, why did the program print ebx's value and not eax's??

    • @godslayer1685
      @godslayer1685 Рік тому

      if you know the answer please let me know too

    • @sankethraj4028
      @sankethraj4028 Рік тому

      @@godslayer1685 bro still i haven’t figured it out 🥲

  • @njfranck
    @njfranck 3 роки тому +1

    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?

  • @rockababy
    @rockababy 4 роки тому +1

    slowly starting to understand

  • @Infinitesap
    @Infinitesap 4 роки тому +1

    Nice presentation

  • @lilraahdreadlockvideosandm1648
    @lilraahdreadlockvideosandm1648 5 років тому +2

    Great video 🔥

  • @olegfare4625
    @olegfare4625 3 роки тому

    you are such a sunshine

  • @MoveTrueRecords_
    @MoveTrueRecords_ 2 місяці тому

    Bro new sub man your amazing ❤

  • @edebevictor9221
    @edebevictor9221 5 років тому +1

    God bless you, sir!

  • @summitfxx
    @summitfxx 5 років тому +1

    Very easy to understand.

  • @aunmag
    @aunmag 6 років тому +2

    How can I print some text from inside the loop?

  • @ncrtnn
    @ncrtnn Рік тому

    Thank you for the video.
    How does it know if the value stored in ecx is signed or not?

  • @one_shot_phill2368
    @one_shot_phill2368 3 роки тому +1

    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?

    • @opposite342
      @opposite342 2 роки тому +2

      Seems like ECX is general purpose register that is commonly used to store the loop count (from a simple Google search).

  • @xanaxity
    @xanaxity Рік тому

    At 7:50 why `echo $?` gave 16 and 64? We've clearly set eax to 1, `echo $?` should give 1. Please I need explaination.

    • @LeoonK
      @LeoonK 7 місяців тому

      Because of the add ebx, ebx instruction coming after mov ebx, 1. this instruction adds ebx to itself and saves the result into itself

    • @xanaxity
      @xanaxity 7 місяців тому

      @@LeoonK okay

  • @georgeseletski8241
    @georgeseletski8241 4 роки тому

    Terrific work!

  • @Alex-rv8gw
    @Alex-rv8gw 4 роки тому +1

    may I know what is the assembler you use

  • @tanmay8253
    @tanmay8253 Рік тому

    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.

  • @kushpatel8968
    @kushpatel8968 Рік тому

    is cmp ecx
    jg label
    equivalent to
    if(ecx > 0)
    {
    eax = 1
    }

  • @mindfake_5587
    @mindfake_5587 5 років тому +1

    Great tutorial :)

  • @MissPiggyM976
    @MissPiggyM976 Рік тому

    Very good, many thanks!

  • @frenchmarty7446
    @frenchmarty7446 2 роки тому

    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

  • @mathssoso4261
    @mathssoso4261 6 років тому +3

    thanks so much, but what is the software used for programming?

    • @ahmedomar222
      @ahmedomar222 6 років тому +1

      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.

  • @oxfordcoma1797
    @oxfordcoma1797 Рік тому

    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!

    • @godslayer1685
      @godslayer1685 Рік тому

      since the condition failed, the skip section will not be executed!

  • @xty007
    @xty007 5 років тому +1

    Great vídeo tutorial :) thank you!

  • @omarelric
    @omarelric 5 років тому +2

    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.

    • @xrafter
      @xrafter 4 роки тому +1

      Yes nasm work in macOS i used it.

  • @janlavcharivmakhgalsuren6127

    Which operating system did you use to use assembly language?

    • @rouisaek
      @rouisaek Місяць тому

      Linux with NASM assembler!

  • @horseman684
    @horseman684 4 роки тому

    I should have seen thid 2 years earlier than now omfg

  • @succubus1615
    @succubus1615 6 років тому +4

    I love this.. this is the key to cracked any software.. xD

    • @sebastiangudino9377
      @sebastiangudino9377 5 років тому +2

      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

    • @nIrUbU01
      @nIrUbU01 5 років тому +2

      @@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

    • @sebastiangudino9377
      @sebastiangudino9377 5 років тому +3

      @@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
      @nIrUbU01 5 років тому +1

      @@sebastiangudino9377 "learning to code assembly and learning tl read assembly" - How are those different? If you can code it you can read it.

    • @sebastiangudino9377
      @sebastiangudino9377 5 років тому +1

      @@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

  • @JEAPI_DEV
    @JEAPI_DEV 3 роки тому

    Is there a brain reboot button cuz I believe my just crashed

  • @ryuhighabusa430
    @ryuhighabusa430 11 місяців тому +1

    This more of a class presentation on assembly rather than a teaching guide.

  • @mikediaz9033
    @mikediaz9033 Рік тому

    Thankyou. Need humbly your knowledge.
    Please, just be True.
    Your friends are your life.
    Your Cool and you have friends.

  • @bonbonpony
    @bonbonpony 6 років тому

    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

    • @henriqueferreirao559
      @henriqueferreirao559 5 років тому +9

      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

    • @deadplayer
      @deadplayer 5 років тому +1

      @@henriqueferreirao559 Thank you !

  • @ahmedomar222
    @ahmedomar222 6 років тому +3

    At 4:57 the value will not be 13 because you didn't perform a system interrupt after "mov ebx, 13"

    • @naitsab_33
      @naitsab_33 6 років тому +4

      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

    • @chunchunmaru2760
      @chunchunmaru2760 5 років тому +1

      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.

    • @roygalaasen
      @roygalaasen 5 років тому +1

      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!

  • @toki3204
    @toki3204 4 роки тому

    i love thanks

  • @HK-sw3vi
    @HK-sw3vi 3 роки тому

    this shiz is lit brv

  • @timswen5280
    @timswen5280 Рік тому

    he's just too cute

  • @rty1955
    @rty1955 3 роки тому

    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

    • @DavyBot
      @DavyBot  3 роки тому +2

      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.

  • @PhuongHuynh-qm5th
    @PhuongHuynh-qm5th 6 років тому +3

    you remind me of pewdiepie

  • @samaellovecraft
    @samaellovecraft 10 місяців тому

    Thanks for the knowledge!