@@Allen.Christian unfortunately static binary analysis is very error prone, since data is often classified as code or the other way around. dynamic analysis also has issues with incompleteness. but yeah, assembly has its place and makes modifying and analysing binaries possible.
The "Turing Complete" game is a great way of learning assembly imo. It made me realised that assembly is just a readable form of machine code, sending a pattern of electric signals to open/close transistors inside the ALU.
Be sure to disable optimization in the compilation and linker. "objdump" has an option to include the source lines with the disassembly listing, and when used with another option to mark the beginning of each source line, you can better see how the code is generated. I learned assembly on PDP-11 first, 6502 and 8080 after that (1978). Many architectures since, and still at it.
Oooh, that objdump option sounds amazing! I've used godbolt for that in the past, wasn't aware there was a local tool for that. Does it work with languages other than C? I beliefe to remember there is also some kind of sourcemap like standard for Linux.
I had done, Z80, 6502, 8080 and 6800... I had a photocopy of the PDP-11 instruction set but never got around to writing any actual code... one of my biggest regrets... programming a PDP-11 IN ASSEMBLY would be such a cool memory to have.
@@edgeeffect 6502, 6809, PDP-8 (in Intersil micro version), PDP-11, HP-1000, Data General Nova-1220, something in IBM-360 line, Unisys 1100 series, even some Rockwell's Forth processor and Transputer. Strangely enough, no Z80, Intel or ARM.
Very well done, but let me add that you should let listeners know that you could be writing assembly in 2 ways ... one with an operating system (OS) or one with no OS, also known as "running on bare metal". If the latter, there is no use of system calls because you don't have a system ... your program has direct access to all the hardware of the chip. This is usually true of microcontrollers that aren't using a real-time OS.
I started learning Assembly in 2017; and I kind of like it and hate it at the same time. But I can't seem to be able to walk away from it. I would love to see more videos. Thank You!
I have a hard time believing that this is the best strategy for learning your first assembly language. But I can see this very much being helpful at taking up another assembly language after you learned another first. Without that, to my knowledge, you'll usually have to go through a lot of documentation that's not easy to search through nor to understand in terms of the concepts we programmers use more commonly.
@@padraiglogue3568 I guess looking for some material on the basics first? Just think about all the extra explanation he gave in the video, if you really don't know any assembler at all, you wouldn't even know how to look any of that up.
Like all really good ideas, I've never thought of it ever in my life. And then, when I'm shown, I say "Oh yeah... but that's just obvious!" GREAT STUFF!
Assembly is easy to learn. The hard things imho are: 1) you gotta know how the silicone works whether it is the microprocessor, or another device. 2) being able to visualize a high level function, and breaking it down to microprocessor level. Unless u have special need, and you are a rookie, may I suggest that you either go with: a) starting to use high level language such as C/C mas mas , and learn how to write an interface between high level (eg C) to low level… b) use a simple microprocessor and do some easy stuff eg how to switch a LED on and off (basic stuff) and build your knowledge about the silicone thing Cheers Ps pointers in C/++ is quite easy in assembly. You get the concept in one language, you can easily find it out in the other ie assembly. Investigate the difference between notations like the ones below: ( can be a bit different depending on the processor/assembler): MOV ax, 0x04 MOV ax, [0x1000]
i think it is so hard. i agree that if you wanna be a master in tech, you need more and deepper. about me, im papering grad at school. Im stucking with my carrer rigth now. can u have any advice for me. i think both hardware and software is alway update. how to catch it. and have a niche for own career to focus and grow up. Sorry my english is not good. ❤
@@alans8771 When you want to execute code, it gets compiled to machine code, which is the bytes directly executed by the processor. Assembly (or assembly code) is basically just a human-readable form of this machine code, and that's what we're looking at in this video. If you're targeting an ARM processor, the Assembly code will be different than for an x86 processor. Godbolt is a great tool for seeing the Assembly code produced by your C code in realtime as you type it, so you don't have to manually do a compile and objdump (or compile with --save-temps), and you can pretty freely change the target architecture.
@@alans8771 it means what assembly code is generated if you use a c compiler to compile a .c file into an object file (.o/.obj) and view that machine code as text mnemonics by disassembling it with an assembler (such as VASM for ARM code)
You're absolutely right. I returned to C after learning 80x86 assembler and I was so much better and understood what was going on at a much deeper level. Incidentally, I learnt the small amount of ARM assembly that I needed for my job from doing exactly what you did here, writing some C code and examining the generated ASM code.
The first time Ilearnt assembly, i used that method by compiling c code with gcc and then use the disassemble of gdb (I was 16 at the time and didn't know of objdump). It helped me a lot even though right now I prefer something more straightforward like the wikipedia page on calling conventions or pages with the list of registers and all.
Less than a minute in, and YES YES YES. I've been trying to write some assembly for a Hitachi H8/520 recently, and it's... hard. I also write for 8-bit PICs, and though there is fairly decent documentation, they've gone through a few assemblers so finding the "right" information is hard. But when I do get something running successfully, oh man do I feel like a clever cookie! But seeing how code is run differently on H8 vs PIC vs AVR vs ARM vs x86-64 really gives you a good understanding of... well, how different architectures run code.
10:49 this actually taught me everything I need to talk with friends and family. By family I mean chipset family, and by friends I mean my debugging duck.
@@LowLevelTV I had an idea where I could connect my raspberry pi pico to an android phone over otg and then do serial communication between raspberry pi pico and pydroid 3 ide but it don't know how to set up communication .pyserial does not work however there is different library called usbserial4a which does work but the problem is there is not much research out there and also the examples are too complicated please can you make a simple video where you establish a communication between pi pico and pydroid 3 ide over serial communication where you can insert a yes or no on pydroid 3 ide which is sent to micro controller which causes led to turn on. please make a video
Another item learned is the size of each instruction (4 bytes). This is why that first load of x0 with 0xbabecafef00dface was done in 4 instructions instead of just 1. 👍
This one learned assembly the hard way. Starting at 16 bit DOS programming, switching to 32 Bit x86 architecture and then after years and after 64bit became popular learned 64bit ASM. I feel like I know nothing tbh.
reverse engineering c codegen is great but I learned assembly very quickly after my first computer architecture class as an undergraduate. if you can, go to your nearest state school in a comp sci/eng program. This will really make this process faster. At least see if you can audit an entry to computer architecture class. Once you have a basic understanding of the ISA and pipeline a lot of the magic of cycles/instruction (especially stuff like arm superscalar "magic" with memory fetches) makes a lot of sense.
At 11:30, there's a mistake. The STP instruction actually decrements SP _first_ (i.e. pre-increment it by -80 - notice the trailing exclamation mark wrapped on the next line) and then stores the pair of registers at the _new_ location. The LDP in the epilogue does the opposite (i.e. post-increment), it first loads the registers from SP's current location, and then increments it by 80, back to the original value, before returning. Unfortunately pre and post indexing use different syntaxes for whatever reason. Pre-index: STP , , [Address + #offset]! Post-index: STP , , [Address], #offset
I find that it's best to combine this technique with reading the manuals for the processor you're learning about. ARM is a lot harder to look up because they've got so many variants, but there are still plenty of manuals. Learning x86 is significantly easier because the manuals are easier to find and many, many people have written about the subject, plus x86 is just better overall in many ways.
Although I come from Java and JavaScript, neither of which involves managing memory, I'll need to watch this video multiple times to grasp it. I'll use RUclips's save feature to come back to it.
I beg to respectfully differ. "Rosetta Stone" method can be a useful, umm, crutch, but the first step is to understand the underlying processor architecture. For starters, just basics: register file structure, addressing modes, procedure call conventions, interrupt system. Exotics such as block moves, vector instructions etc may come later.
I agree, learning computer architecture is more important and should precede assembly programming. The compiler will attempt to avoid pipeline hazards caused by dependencies, but coding assembly by hand without understanding arch would be a mess. Beginners should know how to read and follow an ABI.
I studied assembler in college and have a basic understanding of it, so I wanted to revisit the topic. I found this video, but it’s extremely confusing. I can't imagine that someone new to assembler would find it helpful; it just seems like gibberish.
your merch store is not working. Says page is missing. Fascinating stuff btw. I feel a great attraction towards lower level programming in C and assembly in general and reverse engineering seems like a fantastic hobby! Can't wait to get into it head first!
A subtle nuance about calling convention, function prologue and epilogue is that you only care if you want to interact with external code. If you are writing everything from scratch and have very limited interaction with the outside then you are free to be as weird as you want to. Windows programmer have an intuitive understanding of this because there are multiple calling conventions on Windows.
You'll write your own conventions twice before you realize that eventually are going to a) write code that interfaces with code someone else wrote and/or b) someone else is going to have to do something with your code. Only having to deal with one linkage convention will make your life easier.
@@vanlepthien6768 Nobody will dispute that in a pragmatic world. However, in a theoretical world, when one is still on an assembly learning journey, it can be valuable to learn that you can do PUSH return_address JMP function instead of CALL in x86/x64 assembly and that the RET instruction will properly follow. Also, it's worthwhile to learn about the 4 (I think) calling conventions supported by MSVC including the differences between x86 and x64 code as this will give you a big insight on how little those conventions actually mean. __vectorcall__ is particularly interesting.
0:15 "Assembly is hard to learn" - No - assembler is very easy, hard to understand is exactly C and other variations like Cpp - so many combinations with any typecasting, pointer what I have in assembler immediatelly in 2 max 3 codelines.
Nintendo assembly is fun to learn and theres lot of examples, its a great way to learn if you're not motivated easily but are an old man and like Nintendo like me.
Assembly is hard to learn because it demands patience and curiosity; the biggest hurdle in asm is . New project == boiler plate console app stub. Side effects of becoming comfortable &| proficient in asm: looking at IML & HLL and asking why does that exist, immediately looking for inline Asm support, looking for CDecl support so you can link asm execs and libs because you can do it in asm easier; looking into Rust frequently because it looks and behaves somewhat like Asm (at least its memory management). Additionally, ref counting and state management aren't as evil as some would like to believe they are simply subject to poor implementation as well as stack & heap becoming less shadow-verse. Good vid btw.
Hey kinda off topic question but at 8:37 can you remove the instruction at location 40074c? why would you store the contents of the w0 register to the stack and load it back from the stack to the same register immediately after?
This is most likely due to compilation without any optimisations. As soon as a optimisation-level (e.g. O1) is set the instruction changes to: `sub Rn, Rn, #1` (where `Rn` is the target register where the variable is stored)
Excellent video! Every programmer should have a working knowledge of assembly for at least one CPU, for very obvious low level concept / knowledge reasons. Every concept of C++, for example, is made much easier the more you know assembly and, crucially, you'll be able to debug...fully and properly !!! - Be VERY careful in making assumptions when looking at the assembly output of any higher level / compiled program !!! ... - ...and irrespective of 'how well' you set the compiler optimisation switches !!! - Understand also, that different compilers very frequently do produce different machine code, no matter how minimal an example you give them !!! - While looking at the assembly output of well-constructed minimal examples certainly can help you along the path of learning assembly, it is, still, orders of magnitude away from how you SHOULD be learning it if you are going to take it to production and eventually expert levels !!! - While some opcodes/operand constructs appear 'simple', they frequently are not, and while other opcodes appear complex, they are. Especially when looking at all the different modes of each opcode !!! For any nations full defence, high expertise in assembly is absolutely crucial. Unfortunately, with such a massive lack in assembly teaching, any country that falls behind is leaving themselves open to a whole lot of pain.
I have a list of programming languages and concepts to learn, but your videos make me wanna add assembly to that list. For my purposes I still need to prioritize other stuff but I'll get to play with it at some point. I failed assembly back in engineering school (ca. 2010), mainly because I kinda gave up on the whole semester back then, but I still remember how frustrating the way they tried to teach it to us was 😓
Honestly I feel like I'm a visual learner & the doodling you did to explain the registers was the most useful to me. It's a shame there aren't enough visual emulators or some type of visualization to explain memory stacks, cpu registers, etc. It would be amazing if there was something like kiel uvision to show assembly code execution line by line visually like bytes being loaded into register. Flowcharts & seeing program flow seem to help me a lot too. May be I'm just dumb but I can't be the only one wishing for more visual or animated aid like 3blue1brown right?
I agree with that! Any videos which explain visually what a computer does when you declare variables, shift them, add them, get their address, etc. would be really, really appreciated. I always try to imagine the concepts in my head, some block of RAM where you assign memory and physically see how many bytes a specific variable takes, for example, or the thing about pointers and addresses. Having videos about Assembly and how everything works at that low level is definitely a must. PS: I don't wanna be that "ackshually" guy, but this thing of visual/auditive/kinetic learners is kind of a myth according to studies, and it's much more complex than that. It turns out that having the same information coming from many different sources at the same time (you being able to see, hear and do the thing at the same time) is much more effective than just receiving the information from a single type of source, and education should focus not in classifying students according to whether they learn more visually, auditively or kinetically, but rather having all of this information from the different types of sources at the same time, complementing and reinforcing itself.
Rather then learning by inference, why not just read the damn assembly language manual? That has worked well for the last 15 processors I've coded in assembly. Your technique doesn't do much for learning how the flags work, the special purpose register usage (if there is any), how the interrupts work, etc.
Was the long long in the main function (0xbabecafef00dface) some weird reference somehow to the magic number at the beginning of a Java class file 0xCAFEBABE?
The thing about assembly, is that there is a unique assembly language for every microprocessor and microcontroller out there. So, there is no single assembly language that you can learn.
I tried using that code in godbolt and there's a problem... It doesn't work at all on platform that don't use unix syscalls. So it's completely useless for microcontrollers. Sure you can just delete the line but then it doesn't tell you what to use instead.
This is not really relevant to what your trying to teach here but its important to know that in ASM you don't really have a standard return type or maybe even a calling convention. What you show here is the C convention for the C language. But in asm you can kinda do whatever you want. You can return values from a subroutine anyway you want really its just that its not going to be useable by other programs or anything on the system. If you were writing your own OS for example in ASM you could have calling conventions and return types in a different way. Is that usefull.... well no not really its better to follow the standard way to do it but its worth mentioning :P
Hot take but learning assembly to figure out how computers work is not super ideal. The programmer’s model is usually quite radically different from the micro architecture. Obviously it’s still super useful but as a hardware person, I encourage software leaning people to try diving deeper than the ISA :D
First!
FIRST LETSGO!
wowowowowwowowowo!
@@LowLevelTV Upload longer videos, with more technical insights, and we will make you first.
Interesting
what are you BIOS or BOOT Loader?
Everything is open source if you know assembly.
Correction: everything is open source if you know binary
@@mmkf The only way to know what the binary means is to know the assembly.
@@Allen.Christian unfortunately static binary analysis is very error prone, since data is often classified as code or the other way around. dynamic analysis also has issues with incompleteness. but yeah, assembly has its place and makes modifying and analysing binaries possible.
@@mmkf What if my computer is based on ternary huh?
@@Allen.Christian not for CPU researchers))) I isually create binary in my projects and only in rare cases it evaluate in assembly like language
The "Turing Complete" game is a great way of learning assembly imo. It made me realised that assembly is just a readable form of machine code, sending a pattern of electric signals to open/close transistors inside the ALU.
Yes I love that game. After that game I went on logisim and made my own computer. Safe to say it’s very slow
please may you provide the link of the game?
i love that game so much. it makes me feel stupid
Isnt that game paid though, not gnu compatible enough
Be sure to disable optimization in the compilation and linker. "objdump" has an option to include the source lines with the disassembly listing, and when used with another option to mark the beginning of each source line, you can better see how the code is generated.
I learned assembly on PDP-11 first, 6502 and 8080 after that (1978). Many architectures since, and still at it.
Fantastic.
Oooh, that objdump option sounds amazing! I've used godbolt for that in the past, wasn't aware there was a local tool for that.
Does it work with languages other than C? I beliefe to remember there is also some kind of sourcemap like standard for Linux.
@@9SMTM6 I guess that any compiled language work, but it will decompile to a C equivalent source code, wich will be much harder to read.
I had done, Z80, 6502, 8080 and 6800... I had a photocopy of the PDP-11 instruction set but never got around to writing any actual code... one of my biggest regrets... programming a PDP-11 IN ASSEMBLY would be such a cool memory to have.
@@edgeeffect 6502, 6809, PDP-8 (in Intersil micro version), PDP-11, HP-1000, Data General Nova-1220, something in IBM-360 line, Unisys 1100 series, even some Rockwell's Forth processor and Transputer. Strangely enough, no Z80, Intel or ARM.
Assembly was so beautiful, elegant and intuitive in the 8bit era
Yeah this modern shit is disgusting.
REJECT MODERNITY
GO BACK TO ASSEMBLY
16 bit is when dreams died.
32 bit is when they got curb stomped out of existence.
Plenty of opportunity to reclaim lost ghosts, however.
@@Atmatanwhat about 64 bit
@@bronkolie That's everything now.
As you should be well aware: everything sucks.
Very well done, but let me add that you should let listeners know that you could be writing assembly in 2 ways ... one with an operating system (OS) or one with no OS, also known as "running on bare metal". If the latter, there is no use of system calls because you don't have a system ... your program has direct access to all the hardware of the chip. This is usually true of microcontrollers that aren't using a real-time OS.
I started learning Assembly in 2017; and I kind of like it and hate it at the same time. But I can't seem to be able to walk away from it. I would love to see more videos. Thank You!
I learned Assembly in 1977 and feel the same way about it. But I hate the x86 language.
I have a hard time believing that this is the best strategy for learning your first assembly language. But I can see this very much being helpful at taking up another assembly language after you learned another first. Without that, to my knowledge, you'll usually have to go through a lot of documentation that's not easy to search through nor to understand in terms of the concepts we programmers use more commonly.
What would you suggest instead?
@@padraiglogue3568 I guess looking for some material on the basics first? Just think about all the extra explanation he gave in the video, if you really don't know any assembler at all, you wouldn't even know how to look any of that up.
You don'r learn assembly languages; you learn processor architectures.
@@bazoo513 reading Intel/AMD manuals is a bit too dry for my taste lol
Because it is a terrible way. The only way he "understands" what's going on is because he already knows it, lol!
Like all really good ideas, I've never thought of it ever in my life. And then, when I'm shown, I say "Oh yeah... but that's just obvious!" GREAT STUFF!
Assembly is easy to learn. The hard things imho are:
1) you gotta know how the silicone works whether it is the microprocessor, or another device.
2) being able to visualize a high level function, and breaking it down to microprocessor level.
Unless u have special need, and you are a rookie, may I suggest that you either go with:
a) starting to use high level language such as C/C mas mas , and learn how to write an interface between high level (eg C) to low level…
b) use a simple microprocessor and do some easy stuff eg how to switch a LED on and off (basic stuff) and build your knowledge about the silicone thing
Cheers
Ps pointers in C/++ is quite easy in assembly. You get the concept in one language, you can easily find it out in the other ie assembly.
Investigate the difference between notations like the ones below: ( can be a bit different depending on the processor/assembler):
MOV ax, 0x04
MOV ax, [0x1000]
i think it is so hard. i agree that if you wanna be a master in tech, you need more and deepper. about me, im papering grad at school. Im stucking with my carrer rigth now. can u have any advice for me. i think both hardware and software is alway update. how to catch it. and have a niche for own career to focus and grow up. Sorry my english is not good. ❤
This was so obvious yet still blew my mind. Thank you
Always excited to see educational material for understanding Assembler.
I use Godbolt every time I want to know how C code complies to ARM assembly. It also supports other languages, too. I recommend playing with it.
Godbolt and dogbolt are awesome tools. Similiar idea.
Thanks, Godbolt has descriptions about the keywords, that is my difficulty
What does this mean? How C code complies to ARM assembly?
@@alans8771 When you want to execute code, it gets compiled to machine code, which is the bytes directly executed by the processor. Assembly (or assembly code) is basically just a human-readable form of this machine code, and that's what we're looking at in this video. If you're targeting an ARM processor, the Assembly code will be different than for an x86 processor. Godbolt is a great tool for seeing the Assembly code produced by your C code in realtime as you type it, so you don't have to manually do a compile and objdump (or compile with --save-temps), and you can pretty freely change the target architecture.
@@alans8771 it means what assembly code is generated if you use a c compiler to compile a .c file into an object file (.o/.obj) and view that machine code as text mnemonics by disassembling it with an assembler (such as VASM for ARM code)
Ah beautiful, I was really looking for a resource to learn but I could not find anything reasonable. Thanks man!
You're absolutely right. I returned to C after learning 80x86 assembler and I was so much better and understood what was going on at a much deeper level.
Incidentally, I learnt the small amount of ARM assembly that I needed for my job from doing exactly what you did here, writing some C code and examining the generated ASM code.
Hey man can you make an x86 assembly beginner course?
I'd absolutely *love* learning assembly from you!
Seconded!
The first time Ilearnt assembly, i used that method by compiling c code with gcc and then use the disassemble of gdb (I was 16 at the time and didn't know of objdump). It helped me a lot even though right now I prefer something more straightforward like the wikipedia page on calling conventions or pages with the list of registers and all.
Same I actually learned the basics of assembly trough HIEW and comparing it to my c++ code 😂
Less than a minute in, and YES YES YES. I've been trying to write some assembly for a Hitachi H8/520 recently, and it's... hard. I also write for 8-bit PICs, and though there is fairly decent documentation, they've gone through a few assemblers so finding the "right" information is hard. But when I do get something running successfully, oh man do I feel like a clever cookie! But seeing how code is run differently on H8 vs PIC vs AVR vs ARM vs x86-64 really gives you a good understanding of... well, how different architectures run code.
10:49 this actually taught me everything I need to talk with friends and family. By family I mean chipset family, and by friends I mean my debugging duck.
Quack
@@LowLevelTV I had an idea where I could connect my raspberry pi pico to an android phone over otg and then do serial communication between raspberry pi pico and pydroid 3 ide but it don't know how to set up communication .pyserial does not work however there is different library called usbserial4a which does work but the problem is there is not much research out there and also the examples are too complicated please can you make a simple video where you establish a communication between pi pico and pydroid 3 ide over serial communication where you can insert a yes or no on pydroid 3 ide which is sent to micro controller which causes led to turn on. please make a video
Another item learned is the size of each instruction (4 bytes). This is why that first load of x0 with 0xbabecafef00dface was done in 4 instructions instead of just 1. 👍
0xbabecafef00dface is 8 bytes bro... 🤦♂️
This one learned assembly the hard way. Starting at 16 bit DOS programming, switching to 32 Bit x86 architecture and then after years and after 64bit became popular learned 64bit ASM. I feel like I know nothing tbh.
hi low level learning, must say u make some amazing vids and really help me learn new concepts.
The video-game TIS-1000 helped me so much
Zachtronics made some really great programing games like Shenzhen IO.
Köszönjük!
reverse engineering c codegen is great but I learned assembly very quickly after my first computer architecture class as an undergraduate. if you can, go to your nearest state school in a comp sci/eng program. This will really make this process faster. At least see if you can audit an entry to computer architecture class. Once you have a basic understanding of the ISA and pipeline a lot of the magic of cycles/instruction (especially stuff like arm superscalar "magic" with memory fetches) makes a lot of sense.
Can you make a video on how to setup assembly language on a machine. Like the assembler, VS code extensions or other setup things
kindly make a full course on assembly language.
Amazing!! More assembly please 😍
At 11:30, there's a mistake. The STP instruction actually decrements SP _first_ (i.e. pre-increment it by -80 - notice the trailing exclamation mark wrapped on the next line) and then stores the pair of registers at the _new_ location. The LDP in the epilogue does the opposite (i.e. post-increment), it first loads the registers from SP's current location, and then increments it by 80, back to the original value, before returning.
Unfortunately pre and post indexing use different syntaxes for whatever reason.
Pre-index: STP , , [Address + #offset]!
Post-index: STP , , [Address], #offset
I find that it's best to combine this technique with reading the manuals for the processor you're learning about. ARM is a lot harder to look up because they've got so many variants, but there are still plenty of manuals. Learning x86 is significantly easier because the manuals are easier to find and many, many people have written about the subject, plus x86 is just better overall in many ways.
It's always a good idea to bookmark the ABI.
Although I come from Java and JavaScript, neither of which involves managing memory, I'll need to watch this video multiple times to grasp it. I'll use RUclips's save feature to come back to it.
I beg to respectfully differ. "Rosetta Stone" method can be a useful, umm, crutch, but the first step is to understand the underlying processor architecture. For starters, just basics: register file structure, addressing modes, procedure call conventions, interrupt system. Exotics such as block moves, vector instructions etc may come later.
I agree, learning computer architecture is more important and should precede assembly programming.
The compiler will attempt to avoid pipeline hazards caused by dependencies, but coding assembly by hand without understanding arch would be a mess.
Beginners should know how to read and follow an ABI.
I appreciated the fish break.
I studied assembler in college and have a basic understanding of it, so I wanted to revisit the topic. I found this video, but it’s extremely confusing. I can't imagine that someone new to assembler would find it helpful; it just seems like gibberish.
shouts out to my boy Creel, I've watched so much of his content to learn x86 basics
I want to learn some low level stuff with a hope one day I can contribute to Free Pascal. My favorite compiler in za world.
Fish break, fish continue, fish return
FISH BREAK
your merch store is not working. Says page is missing.
Fascinating stuff btw. I feel a great attraction towards lower level programming in C and assembly in general and reverse engineering seems like a fantastic hobby! Can't wait to get into it head first!
I'm re-working my merch situation right now. It'll be back this summer.
Nice to see a fellow i3 enthusiast 😁😁
something i found recently to learn more about sys prog was to follow Andreas Kling writing his serenity OS from scratch.
A subtle nuance about calling convention, function prologue and epilogue is that you only care if you want to interact with external code. If you are writing everything from scratch and have very limited interaction with the outside then you are free to be as weird as you want to. Windows programmer have an intuitive understanding of this because there are multiple calling conventions on Windows.
You'll write your own conventions twice before you realize that eventually are going to a) write code that interfaces with code someone else wrote and/or b) someone else is going to have to do something with your code. Only having to deal with one linkage convention will make your life easier.
@@vanlepthien6768 Nobody will dispute that in a pragmatic world. However, in a theoretical world, when one is still on an assembly learning journey, it can be valuable to learn that you can do
PUSH return_address
JMP function
instead of CALL in x86/x64 assembly and that the RET instruction will properly follow. Also, it's worthwhile to learn about the 4 (I think) calling conventions supported by MSVC including the differences between x86 and x64 code as this will give you a big insight on how little those conventions actually mean. __vectorcall__ is particularly interesting.
I think in general, it's helpful to point learners (and experienced devs) to the ABI. As you mentioned, it contains a lot of the information needed.
L3 going back to talking about ASM is like MTV going back to playing music video.
HALLELUJER !!
0:15 "Assembly is hard to learn" - No - assembler is very easy, hard to understand is exactly C and other variations like Cpp - so many combinations with any typecasting, pointer what I have in assembler immediatelly in 2 max 3 codelines.
Assembly makes sense 🧠⚡️
I really need something like this, coding in asm feels like a hacker 😎😎
But honestly I want to learn asm for disassembling. Thanks a lot!
Nintendo assembly is fun to learn and theres lot of examples, its a great way to learn if you're not motivated easily but are an old man and like Nintendo like me.
I still have my 16 bit NASM books at my old house.
Assembly is hard to learn because it demands patience and curiosity; the biggest hurdle in asm is .
New project == boiler plate console app stub.
Side effects of becoming comfortable &| proficient in asm: looking at IML & HLL and asking why does that exist, immediately looking for inline Asm support, looking for CDecl support so you can link asm execs and libs because you can do it in asm easier; looking into Rust frequently because it looks and behaves somewhat like Asm (at least its memory management). Additionally, ref counting and state management aren't as evil as some would like to believe they are simply subject to poor implementation as well as stack & heap becoming less shadow-verse.
Good vid btw.
Love your videos 👏👏👏
ARM assembly syntax is so much cleaner than x64 wow
thank you 👍
You can make more videos about this topic ! Precius content!
Please make more for other instructions sets
thanks for the content
Hey kinda off topic question but at 8:37 can you remove the instruction at location 40074c? why would you store the contents of the w0 register to the stack and load it back from the stack to the same register immediately after?
This is most likely due to compilation without any optimisations.
As soon as a optimisation-level (e.g. O1) is set the instruction changes to:
`sub Rn, Rn, #1` (where `Rn` is the target register where the variable is stored)
I learned fast that I cannot learn assembly fast
When you dropping the first video for your upcoming Zero to Hero C programming course?
Excellent video! Every programmer should have a working knowledge of assembly for at least one CPU, for very obvious low level concept / knowledge reasons. Every concept of C++, for example, is made much easier the more you know assembly and, crucially, you'll be able to debug...fully and properly !!!
- Be VERY careful in making assumptions when looking at the assembly output of any higher level / compiled program !!! ...
- ...and irrespective of 'how well' you set the compiler optimisation switches !!!
- Understand also, that different compilers very frequently do produce different machine code, no matter how minimal an example you give them !!!
- While looking at the assembly output of well-constructed minimal examples certainly can help you along the path of learning assembly, it is, still, orders of magnitude away from how you SHOULD be learning it if you are going to take it to production and eventually expert levels !!!
- While some opcodes/operand constructs appear 'simple', they frequently are not, and while other opcodes appear complex, they are. Especially when looking at all the different modes of each opcode !!!
For any nations full defence, high expertise in assembly is absolutely crucial. Unfortunately, with such a massive lack in assembly teaching, any country that falls behind is leaving themselves open to a whole lot of pain.
I have a list of programming languages and concepts to learn, but your videos make me wanna add assembly to that list. For my purposes I still need to prioritize other stuff but I'll get to play with it at some point. I failed assembly back in engineering school (ca. 2010), mainly because I kinda gave up on the whole semester back then, but I still remember how frustrating the way they tried to teach it to us was 😓
now to do this and finally learn how to code
do it
Also java compiled class files uses cafe babe as first 2 hex binary
Honestly I feel like I'm a visual learner & the doodling you did to explain the registers was the most useful to me.
It's a shame there aren't enough visual emulators or some type of visualization to explain memory stacks, cpu registers, etc. It would be amazing if there was something like kiel uvision to show assembly code execution line by line visually like bytes being loaded into register.
Flowcharts & seeing program flow seem to help me a lot too. May be I'm just dumb but I can't be the only one wishing for more visual or animated aid like 3blue1brown right?
I think you might like the Turing Complete game, I feel like I learned more about computers in one week playing the game then 6 years of programming
I agree with that! Any videos which explain visually what a computer does when you declare variables, shift them, add them, get their address, etc. would be really, really appreciated. I always try to imagine the concepts in my head, some block of RAM where you assign memory and physically see how many bytes a specific variable takes, for example, or the thing about pointers and addresses. Having videos about Assembly and how everything works at that low level is definitely a must.
PS: I don't wanna be that "ackshually" guy, but this thing of visual/auditive/kinetic learners is kind of a myth according to studies, and it's much more complex than that. It turns out that having the same information coming from many different sources at the same time (you being able to see, hear and do the thing at the same time) is much more effective than just receiving the information from a single type of source, and education should focus not in classifying students according to whether they learn more visually, auditively or kinetically, but rather having all of this information from the different types of sources at the same time, complementing and reinforcing itself.
The real gigachad move is to reverse engineer the compiler
simply brilliant
looking levels of optimization higher that 0 is more helpful in understanding what normal code should look like.
*What did we just learn?*
I just learned that I can drop all the other asm tutorials, and instead teach it to myself!
Can you do a video on intel assembly too?
Fantastic
One of the best designed and easiest assembly languages from history was Datacraft (later harris)
Hello thanks for this toturial
Actually I need use GPU by assembly language but I don't know how do that
There is any video toturial to learning???
I didn't write, but looking at it was always cool
Who else can’t get an internship so you’re learning assembly over the summer???
Ah yes ASM brings me back to my virr days of coding.
Imagine having rust as your fav language assembly is for the pros
Rather then learning by inference, why not just read the damn assembly language manual? That has worked well for the last 15 processors I've coded in assembly. Your technique doesn't do much for learning how the flags work, the special purpose register usage (if there is any), how the interrupts work, etc.
Aren't operations in ASM read vom right does to left?
Was the long long in the main function (0xbabecafef00dface) some weird reference somehow to the magic number at the beginning of a Java class file 0xCAFEBABE?
The thing about assembly, is that there is a unique assembly language for every microprocessor and microcontroller out there. So, there is no single assembly language that you can learn.
There should be a video with technics of how you can optimise the code with ASM. Like loop unroling and etc.
Wouldn't this be "easier" by using godbolt? (local instance or otherwise?)
this is very interesting.
Do ARM CPUs have different states like x86 CPUs like 16, 32 and 64 bit modes?
You and John Hammond look so similar, if you are not him, you have to be his brother.
I use a C++ compiler from embarcadero, they allow inline assembly, But the AT&T variant, kind of tricky to me
@@stefanalecu9532 C++ Builder, it has a 64 bit CLANG compiler. Turbo C has been off the map for over 20 years.
What OS and desktop environment do you use ?
Just , Wow🤩🤯
Since our prof wanted us to suffer we were forced to program direcly in opt codes... gz.. i hate myself even more now
My favorite technique to learn assembly is the ChatGPT-method 😇
yeah but how do i async await and install npm packages in assembly?
I tried using that code in godbolt and there's a problem...
It doesn't work at all on platform that don't use unix syscalls. So it's completely useless for microcontrollers. Sure you can just delete the line but then it doesn't tell you what to use instead.
BR 14
Who needs a stack architecture? :)
babecafefoodface was very confusing... Lol
Also keep up the good work
4:07 Fish break!
Good idea.
This is not really relevant to what your trying to teach here but its important to know that in ASM you don't really have a standard return type or maybe even a calling convention. What you show here is the C convention for the C language. But in asm you can kinda do whatever you want. You can return values from a subroutine anyway you want really its just that its not going to be useable by other programs or anything on the system. If you were writing your own OS for example in ASM you could have calling conventions and return types in a different way. Is that usefull.... well no not really its better to follow the standard way to do it but its worth mentioning :P
I would like to know why anyone would want to learn arm64 over just x86_64. Just if you use apple or not?
Wow lol wow thats a nice technique
Hot take but learning assembly to figure out how computers work is not super ideal. The programmer’s model is usually quite radically different from the micro architecture.
Obviously it’s still super useful but as a hardware person, I encourage software leaning people to try diving deeper than the ISA :D