Assembly Basics: The Language Behind the Hardware

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 92

  • @Gengingen
    @Gengingen หลายเดือนก่อน +8

    Thank you! 😊 Brought back old memories - began doing this on 8048 Intel single chip microcomputer way back in 1984.

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +3

      Thank you for watching. That sounds like an incredible experience - working with the 8084 Intel chip back in 1984 must bring back some great memories. If you have any insights or suggestions, I'd love to hear them.

    • @selva0107
      @selva0107 หลายเดือนก่อน

      8086

  • @sooommm8895
    @sooommm8895 หลายเดือนก่อน +12

    Thanks, i want tallk about security computer, and data structure such as stack and linkd list , Queue 😊

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +3

      Thank you for your feedback. Data structures like stacks, linked lists and queues are definitely important topics. I'll be sure to cover them in one of my future videos, so stay tuned.

    • @abskrnjn
      @abskrnjn หลายเดือนก่อน

      Found a similar channel for data structures:- th-cam.com/video/PsTvZ_htHT8/w-d-xo.htmlsi=fu0i0cpoptybPKwy

  • @allezvenga7617
    @allezvenga7617 หลายเดือนก่อน +1

    Thanks for your sharing

  • @abskrnjn
    @abskrnjn หลายเดือนก่อน +2

    Great video, can't wait for the channel to get big 🎉

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +1

      Thank you for the kind words. I'm looking forward to growing bigger with viewers like you.

  • @jakeaustria5445
    @jakeaustria5445 หลายเดือนก่อน +1

    Thank You

  • @Pedritox0953
    @Pedritox0953 หลายเดือนก่อน +1

    Great video!

  • @fad-e2840
    @fad-e2840 หลายเดือนก่อน +1

    excelent educative material! five stars

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      Thank you for watching. I'm happy to hear that you found it helpful. Stay tuned for more content.

    • @fad-e2840
      @fad-e2840 หลายเดือนก่อน +1

      your videos are pretty well made and are clear and concise about this topic, need more viewers ✨

  • @st.charlesstreet9876
    @st.charlesstreet9876 หลายเดือนก่อน +1

    I loved the “ Simpler “ days of the TRS -80’s Z80 assembler language! 😅

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +1

      Glad to hear the video brought back memories. The Z80 assembly definitely had its charm. It's amazing how much tech has evolved since the TRS-80 days.

    • @st.charlesstreet9876
      @st.charlesstreet9876 หลายเดือนก่อน +1

      @@WhiteboardDoodles24 😉

    • @maxmuster7003
      @maxmuster7003 หลายเดือนก่อน +2

      I began with 6502 assembly, but after i used x86 assembly i don’t want to go back to 8 bit computer.

    • @limoshkamilk9887
      @limoshkamilk9887 หลายเดือนก่อน +2

      Excellent explanation of the study material. What you do is very valuable, thank you

    • @ArneChristianRosenfeldt
      @ArneChristianRosenfeldt 29 วันที่ผ่านมา

      @@maxmuster7003both these languages have implied registers. So you write down the instructions and then insert some moves to match. Important instructions like add, load and store work on all registers, I think. Now I may have to look up if encoding is more difficult for AX than for AL, AH.
      Why not check the flags after AND ? Or if you love CMP,0 so much, why not ditch flags and use RISCV?

  • @nvs-different-ideas
    @nvs-different-ideas หลายเดือนก่อน +1

    This help me a lot

  • @kcvinu
    @kcvinu หลายเดือนก่อน +1

    1. How do you choose registers ? I mean, how do you know a specific register is good to store the value ?
    2. Does assembly handles unicode string ? Especially 16bit WCHAR string
    3. Can you declare a struct in assembly language ?

    • @adammontgomery7980
      @adammontgomery7980 หลายเดือนก่อน +4

      1. There are conventions for which registers to use for returning values from subroutines. However, any can be used for whatever you want.
      2. No, you'd have to program Unicode handling.
      3. No

    • @kcvinu
      @kcvinu หลายเดือนก่อน +1

      @@adammontgomery7980 Thank you for reply. I heard that there are volatile and non-volatile registers which we need to take special care when we code in assembly. So you need proper guides/manuals, right ?
      And if there are no structs, I wonder how did assembly programmers handle their objects ?

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +2

      Thanks for your thoughtful questions.
      adammontgomery7980, great answers. To add a bit more:
      1. Yes, registers can be volatile (caller-saved) or non-volatile (callee-saved), so following conventions is key to managing them efficiently. You can refer to specific architecture manuals for guidelines.
      2. Assembly doesn't have structs like high-level languages, but you can mimic them by using memory locations and offsets to group related data. Assembly's flexibility allows programmers to come up with creative ways to organize and manage data.

    • @adammontgomery7980
      @adammontgomery7980 หลายเดือนก่อน +3

      @@kcvinu look up application binary interface (ABI) for details, but it's just a convention used for a specific architecture and compiler. Assembly doesn't use objects, just memory. Since you know the data type and therefore size of each of an object's member variables, you can just use an array instead of an object. To access an object member just take the pointer to the array (object) and add an offset. It's very easy to mess up, which is why we have higher level languages to think more abstractly.

    • @maxmuster7003
      @maxmuster7003 หลายเดือนก่อน

      ​@@kcvinuIntel developer manuals.

  • @theintjengineer
    @theintjengineer หลายเดือนก่อน +1

    Thank you.

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      You're welcome. If you have any questions or suggestions, feel free to share them.

    • @cyberjay9146
      @cyberjay9146 หลายเดือนก่อน

      ​@@WhiteboardDoodles24maybe explain these commands instead of going for a speed run how many you can list in 5 seconds 🏃‍♂️

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +1

      I wanted to provide a quick overview of basic Assembly instructions, but you're right - going in-depth with each command deserves more attention. I'll make sure to cover these in a future video, with a slower pace and more detailed explanations. Thanks for your feedback.

  • @thanhmai8582
    @thanhmai8582 หลายเดือนก่อน +2

    I have question:
    First programing language is written by hand, such as punch card and detect digital signal by holes on card or manually open close switches.
    Based on manually open close switches, they convert into abstraction as "mov" "add" in paper sheet?
    And why binary as text abstraction can generate electrical sign to
    interact with hardware

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      Great question. In the early days, computers used punch cards or switches to input instructions. Each hole or switch represented binary (1s and 0s) that the computer could understand.
      To make things easier for humans, languages like Assembly were created. Instead of flipping switches, you could use commands like 'mov' or 'add' which are easier to write and read. These commands are then translated into binary (1s and 0s) that the computer's hardware can process as electrical signals.
      Think of Assembly like a bridge: you write in a simple language and it gets converted into the binary code that the computer uses to control its hardware.

    • @thanhmai8582
      @thanhmai8582 หลายเดือนก่อน

      @@WhiteboardDoodles24 the key matter is that by which mechanism the computer can process binary as electrical signals
      Which method convert from abstraction text to physical interaction??
      As punch card, they have sensor or smth to detect holes by light

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      The key mechanism here is that computers work by detecting electrical signals. A '1' in binary represents an 'on' signal (a flow of electricity), while a '0' represents an 'off' signal (no flow of electricity). These signals travel through the computer's circuits to perform tasks.
      In modern computers, the CPU (central processing unit) processes these binary instructions. When you write Assembly code, the computer translates that into machine code (binary). The CPU has transistors, which act like tiny switches. These transistors can be turned on or off, representing 1s and 0s in binary. The sequence of binary instructions tells the transistors how to process data, perform calculations and interact with the hardware.
      As for punch cards, you're right - they had sensors that could detect holes. The holes represented binary 1s and 0s, which the computer's hardware would process similarly, by sending electrical signals based on whether a hole was detected or not.
      So, to summarize, the CPU processes binary by using electrical signals and transistors act as the switches that execute instructions based on those signals.

    • @thanhmai8582
      @thanhmai8582 หลายเดือนก่อน

      @@WhiteboardDoodles24 tks but it's still not clear how hardware detect text abstraction from series of 0 or 1
      For example, when you press the key on teleprinter, it close the switch and connect to hardware circuit for other processing
      But when you type mov r1, r2, r3, it is translated into binary code. But it is still an abstraction from screen, it need a "sensor" in order that computer hardware could realizes it is 0 or 1 to do on/off electricity
      So, what's kind of sensor and machanism?
      It need to be logic comparing to hard drive when data is retrieved from magnetic and non magnetic as 0/1 on surface..but in assembly ..series 0/1 from mov/load/add instruction is detected via I/O as keyboard?

    • @thanhmai8582
      @thanhmai8582 หลายเดือนก่อน

      No more clear explaination sir?

  • @maxmuster7003
    @maxmuster7003 หลายเดือนก่อน +3

    Java and Phyton are not easier to read and understand for me, because i don’t know which CPU instructions are used to execute a high level command.

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +3

      You're right - what makes a programming language easier or harder really depends on personal preference and experience. For some, like you, understanding how high-level commands translate to CPU instructions makes lower-level languages like Assembly more intuitive. Others might prefer the simplicity of high-level languages like Java or Python. It all depends on how you like to approach programming.

    • @maxmuster7003
      @maxmuster7003 29 วันที่ผ่านมา +1

      ​@@WhiteboardDoodles24Yes, thx.

    • @maxmuster7003
      @maxmuster7003 29 วันที่ผ่านมา

      ​@@WhiteboardDoodles24I took a look into the linux source code multiple times to search for the instruction to use a primary monitor and a secondary monitor with one graphic card that provide to connect two monitors.
      I know how to get the EDID data from the primary monitor, but i don’t how to get the data from the secondary monitor.
      I know how to use the functions of the VBE 3 bios to switch into a refreshrate controlled graphic mode using the primary linear framebuffer(address from mode specific info) and in the Windows device manager we can see the linear address of the secondary framebuffer, but i don’t know how to change the videomode for the secondary monitor. Some graphic cards start in clone mode, so the second monitor display the content of the primary framebuffer too, or it display a message with no signal.
      If it is possible i want to use different video modes&refreshrates and that the secondary monitor display the content of the secondary linear framebuffer. I like to use the 16 bit "BIG" Real Mode with 4 gb segment size for DS,ES,FS,GS segment + A20 address line on on 80386+ CPU.

  • @manojmadushanka9356
    @manojmadushanka9356 หลายเดือนก่อน +1

    thank you

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      You're welcome. Glad to hear you like the video.

  • @NamerunaTheFool
    @NamerunaTheFool หลายเดือนก่อน +1

    the language behind the hardware is actually on/off. assembly can be recoded to another language.

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +2

      That's a good observation. At its core, everything boils down to the binary on/off signals that hardware understands. Assembly serves as a bridge between these binary instructions and higher-level languages, making it easier for us to code. Thanks for your input.

  • @Rennu_the_linux_guy
    @Rennu_the_linux_guy หลายเดือนก่อน

    the best way to learn assembly is to boot up cheat engine with an old single player game or the tutorial and try to mod its code while its running. the amount of knoweldge and intuition i gained from it was incredible. even modded in the healtb regen system from gtav into san andreas :3

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      That's an awesome way to learn Assembly. Hands-on experience like that can really deepen your understanding. Modding games is a fun way to apply what you've learned, especially adding a health regen system from GTA V to San Andreas! Thanks for sharing your insight.

    • @Zpheme12
      @Zpheme12 21 วันที่ผ่านมา

      You should make a video showing how to do that, I’m pretty sure a lot of people would watch. I am one of those

  • @fdauti_ca
    @fdauti_ca หลายเดือนก่อน

    it is also a must know for cracking software, right?

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +1

      Assembly is certainly a foundational skill for understanding how software works at a low level, including reverse engineering for legitimate purposes like debugging or security research. Technically speaking, yes, however, those skills should always be applied ethically and legally.

  • @limoshkamilk9887
    @limoshkamilk9887 หลายเดือนก่อน +1

    ❤❤❤

  • @matthewgarcia6017
    @matthewgarcia6017 หลายเดือนก่อน +2

    Where was this video when I took microcontroller programming

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      Glad you found it helpful. I wish it had been around back then too. I'll be creating more videos on such topics, so stay tuned for more.

  • @saiba-b7l
    @saiba-b7l หลายเดือนก่อน +2

    is it hard to learn it?

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      Great question. Learning Assembly can be a bit challenging at first because it's closer to how the computer actually works, but with time and practice, it becomes easier to understand. If you're interested in how hardware interacts with software, it can be really rewarding. Starting with simple programs and gradually building up is a good approach.

  • @staninjapan07
    @staninjapan07 หลายเดือนก่อน +1

    Fascinating, though I did not understand more than about 5% of it.

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      Thanks for watching. Assembly can be tricky at first. Feel free to share what parts were confusing and I'll do my best to clarify or point you to some helpful resources.

    • @Rockyzach88
      @Rockyzach88 หลายเดือนก่อน +2

      Basically pretend you have this weird electronic object that has various buttons on it. The object is capable of holding isolated "bits" of info (on or off) in containers (called registers). It can also shift those bits around. Think like a row of light switches as a register but the light switches are a lot smaller. If you have 10 switches and the first 9 are in the off position and the 10th is in the on position. Well then pretend (just for the hell of it) you actually want the first switch on and the remaining 9 off. Well you aren't going to physically move the light switch from the wall and place it at the beginning. Instead you are just going to flip the first one on and flip the last off.
      So that's one thing this weird object does but how? Well it has the buttons right? Well turns out if you press some (or all) of those buttons in specific order and at the right time, you can flip those light switches how you want to.
      However, you find out that that to do that one example from a ove you have to press A LOT of those buttons and you have to do it at weird time intervals.
      And turns out to get anything useful out of these switch flips (for humans) you have do a A LOT (and I mean A LOT) of these "switch flips" operations. It's too hard to do mechanically (or basically impossible). So what do you do?
      You build a table where one column are "mnemonics" (short human reable words), and the other column is a serious of button pushes.
      Then you build another weird electronic object that can parse/read those mnemonics that you wrote on a txt file, look at the table and push those buttons for you in the correct order and at the right times.

    • @gcolombelli
      @gcolombelli หลายเดือนก่อน +1

      If you have no previous experience with any kind of programming, assembly can be a tough place to start. This is just a overview / introduction, so don't be shocked if you feel a little lost, it will eventually pass as you learn more about it. Or if you find assembly too hard, maybe try a high level language like Python, it's super simple for beginners and much more forgiving than starting with something like C (too low level) or Scheme (too abstract).
      Don't get me wrong, it's perfectly possible to start with Assembly, C, Scheme or almost any other language, but it all depends on how good is the material you're using to learn from, and most material I've found for C and Scheme will only work for a highly motivated individual who is comfortable seeking additional information by himself or herself. Something like Python or Ruby is much easier to start with, then after you got the basics and are comfortable with it, you can migrate to another language if you feel like it isn't a good fit for what you want to do.

  • @matthouben4242
    @matthouben4242 หลายเดือนก่อน

    The need for using Assembly has decreased considerably as compilers for langues like C have become so optimized that they produce faster and more efficient code than human programmers using Assembly directly.

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน +4

      Modern compilers for languages like C have indeed become highly optimized, often producing code that rivals or even surpasses what could be written manually in Assembly for many applications. However, Assembly is still valuable in certain situations, such as when low-level control over hardware is needed or in performance-critical sections of code where even the smallest optimizations matter. It's also helpful for understanding how high-level code translates into machine instructions. Thanks for sharing your insights.

    • @maxmuster7003
      @maxmuster7003 29 วันที่ผ่านมา +1

      I use assembly just for fun and i know some tips like memory and code alignment or paralell execution with pairing simple and complex instructions to prevent stall.

  • @darylivanhisola2867
    @darylivanhisola2867 หลายเดือนก่อน +11

    you cannot put Assembly language and easy together

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      Fair point. Assembly definitely has a learning curve, but once you get the hang of it, it can be really satisfying to work so close to the hardware. Thanks for watching.

  • @jayj.4975
    @jayj.4975 หลายเดือนก่อน

    The video should be checked for high pitch sound.

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      I reviewed the audio on different devices and didn't notice any high-pitched sound. It might be a local issue on your end. Could you please tell me where exactly in the video you experienced the high-pitched sound?

  • @Seupai-n1f
    @Seupai-n1f หลายเดือนก่อน +2

    "Coding in assembly language is difficult because we need to type many lines of code for a simple task"
    AI: *I gotchu homie!*

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      You've got a point. Coding in assembly can feel like writing a novel just to add two numbers. But with AI around, we can definitely simplify things. Thanks for sharing your thoughts!

    • @ArneChristianRosenfeldt
      @ArneChristianRosenfeldt 29 วันที่ผ่านมา

      @@WhiteboardDoodles24why do you say this when all CPUs have ADD and most have FADD ? Single cycle ? If you want UI, link to it .
      Your set-up code is your code. And it is not even long. You can add immediates.

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  29 วันที่ผ่านมา

      @@ArneChristianRosenfeldt Good points. You are right that many CPUs have efficient instructions like ADD and FADD, which can simplify some tasks. My comment was more about the overall verbosity of assembly compared to higher-level languages where tasks can be accomplished with fewer lines. Thanks for sharing your perspective.

    • @ArneChristianRosenfeldt
      @ArneChristianRosenfeldt 28 วันที่ผ่านมา +1

      @@WhiteboardDoodles24 Yeah, I have other comments discussing this. One thing I learned to love about higher level languages is built-in sort. C has it, JS has it. Also I like expressions, if the language has a good debugger to follow the "Return Value" of each parentheses. Sadly, a lot of high level IDE vendors could not appreciate their language for a long time. I always ended up assigning local variables to be able to inspect and assert them. I felt thrown back into assembler language. Instead, they want me to use Lambdas and Objects. In the end you loose all oversight. I can have the same fun in assembler because there are instructions to copy the value between a GPR and the PC and vice versa.
      Farbrausch wrote a 64k demos running on windows in assembly language, but full of syscalls. Interestingly, the OS does not sort your array for you. So you still gotta link in a C runtime? On C64 assembler progamms tend to call into Kernal and BASIC a lot.
      And then there is register convention. Like on 68k 8 registers are for addresses. On x86 we have SP, BP for the stack frame. BX for this. MIPS has zero in one register and one register is reserved for interrupts. When I write assembler, I insist that all my registers are mine and that I don’t need to follow a calling convention. MIPS reserves register for some stuff which really does not belong into UserSpace! I feel bullied like from Java Boilerplate.

  • @insidiousmaximus
    @insidiousmaximus 25 วันที่ผ่านมา

    ahhhh whiteboard burning my retina

  • @poghuman8676
    @poghuman8676 หลายเดือนก่อน

    4:53

  • @BaablnRiver
    @BaablnRiver หลายเดือนก่อน

    1 year traditional lerning in 12 min . 🎉

    • @WhiteboardDoodles24
      @WhiteboardDoodles24  หลายเดือนก่อน

      Thank you for watching and for the great feedback. I'm really happy to hear you found the video helpful and concise.