please do not stop this will help alot of ppl, and between us i already know everything on these videos so far but i still watch them somehow :) really makes you think.
@invaderstim880411 ай бұрын
This video helped me visualise the stack better than any other video
@RAINE____6 жыл бұрын
Mate, you're explaining this so well. Cheers!
@myles91937 жыл бұрын
I just realised how new all of these assembly videos are, please don't stop. Im really enjoying following along
@nealshin124710 ай бұрын
Best assembly lecture I ever had…why I wasted so much time in uni😂
@jcfree334 жыл бұрын
What Wybiral is doing is called "giving something back". Thank you, sir.
@Sizifus3 жыл бұрын
You're really good at explaining the assembly language concepts in easy-to-digest manner. Thank you, you're a life saver
@Daniel-m4l1p Жыл бұрын
Such awesome content and explaination, until now I never learned x86 assembly so well. Thanks!
@hosseinjavan1373 жыл бұрын
do not lose that smile. it's beautiful. Thanks for the tutorial!
@youssefmostafa57889 ай бұрын
just realized this vid is 6 years old
@philzz66344 жыл бұрын
Turning yellow to hello! is magical
@reizinhodojogo39563 ай бұрын
yellow - y0000w + h00000 = hello
@colza10255 жыл бұрын
You are awesome!! You are an incredible teacher!!! I'll follow you in my whole life!!!
@elbozo57233 жыл бұрын
this guy is just too based
@N03n03-e5y5 жыл бұрын
Guys lets pay him by watching all the advertises on his videos without skipping 'em .
@firmman45054 жыл бұрын
that's what I did
@Npc51503 жыл бұрын
I don't know why I decided to watch this video. I could just use the AOAsm book as a refresher... I was just really bored. Pleasantly surprised. I like your format. It's cool that you smile a lot, and you look oddly like Joaquin Phoenix.
@youngsinatra19 ай бұрын
Thank you so much for your explanations! Some of the best!
@luanfelipe88823 жыл бұрын
you are helping me a lot, im brazillian and i cant find good assembly contents in my language, but i know a little bit of english so it's helping me a lot, thank you :D
@smit17xp3 жыл бұрын
thanks. this is really helpful. cleared my confusion about stack a lot
@yusenliu18452 жыл бұрын
For those of you who are using a 64-bit machine and incurred segmentation fault for the last piece of assembly code (ex6.asm), here is one solution: Note that we are using 64-bit registers here - not esp, but rsp. Besides, the syscall invocation is a bit different. 12 global _start 13 14 section .text 15 _start: 16 sub rsp, 4 ; allocate 4 bytes on the stack 17 mov [rsp], byte 'H' ; move 'H' to address esp 18 mov [rsp+1], byte 'e' 19 mov [rsp+2], byte 'y' 20 mov [rsp+3], byte 10 21 22 ; sys_write() 23 mov rax, 1 ; sys_write() 24 mov rdi, 1 ; print to stdout 25 mov rsi, rsp ; pointer to the bytes to write 26 mov rdx, 4 ; number of bytes to write 27 syscall ; do syscall 28 29 ; sys_exit() 30 mov rax, 60 ; sys_exit() 31 mov rdi, 0 ; exit status is 0 32 syscall
@iconoclastsc25 ай бұрын
Thank you.
@drjmansplace51743 жыл бұрын
When one uses PUSH to push the integer onto the stack, remember that it POP off in the reverse order.
@DarkLegends20084 жыл бұрын
Please continue the assembly series! THKs from Brazil
@chaoukidhib75457 жыл бұрын
Well done! Very well explained. Thanks!
@ЖукОбычниик4 жыл бұрын
I was trying to do this 3:15 on a 64-bit operating system and it said: 64-bit operating system doesn’t support 32-bit absolute addressing. Is there anything I can do / change the code somehow?
@complexitytr90983 жыл бұрын
No need to change code. Just do a compile and ld for 64bit system.
@ЖукОбычниик3 жыл бұрын
@@complexitytr9098 i solved this a while ago but ok
@complexitytr90983 жыл бұрын
cool
@longlostwraith51065 жыл бұрын
A bit late to the party, but I just want to point out something: (mov [addr], byte 'H'), although accepted by NASM, is ambiguous. There are three possible instructions: (mov mem8, imm8), (mov mem16, imm8) and (mov mem32, imm8), and no sensible way for the assembler to choose between them. On the other hand, if you did: (mov byte [addr], 'H'), there's only a single opcode that can satisfy this instruction.
@AJSquirrel534 жыл бұрын
So NASM knows that 'H' is only one byte, but doesn't know that [addr] is one byte? I'm confused why you don't also need to specify that 'H' is a byte. Why not do both? (mov byte [addr], byte 'H') I guess [addr] could point to any arbitrary spot in memory, but since addr was defined as a byte, shouldn't NASM "know" this?
@xrafter4 жыл бұрын
@@AJSquirrel53 Not addr is a pointer not a byte. Pointer is 8 but 4 in x84 But [addr] is the value that pointing to by the pointer in this. Addr = 0x133 ; address in memory [Addr] = 'h' ; the value that Addr point to. Pointer are just pointer you the programmer will make the process read 4 byte or 1 or 6 By 'mov byte ' that will move a one byte and even if you don't give nasm the length of the data It will work because nasm will know somehow the length of the data byte but for better practice use byte and so on. You only need to type byte once not in the both sides . Usually ins first operand . It is just a style really
@elbozo57233 жыл бұрын
wondering why my assembler shit itself, thanks
@BlancheNuit Жыл бұрын
I don't understand what that refers to : (mov mem8, imm8), (mov mem16, imm8) and (mov mem32, imm8) Although, an address points to a memory location that is 1 byte, so when you do : (mov [addr], byte 'H') it should be trying to write as many bytes as is given in the second argument, from the first address in the left argument and to the following addresses until what's on the right is over. Right ? It can't be ambiguous
@upliftingspirit68736 жыл бұрын
1. Is it by convention that 'mov %eax, 4' prints something on the screen? If I do 'mov %eax, 3' is it another sys_call? 2. 6:13 , '1234' Shouldn't go to [28] address? Since it's the first push? 3. Stacks have always 8 cells, each one 4 bytes? (in total 8*4=32)
@DavyBot6 жыл бұрын
1. The value of EAX specifies the type of system call and 4 is the code for a sys_write call type. If you set EAX to 3 it would be a sys_read call. Here's a chart of system calls and an explanation of what purpose the other registers serve for each call type: syscalls.kernelgrok.com/ 2. The push operation decreases ESP *first* and then writes the value. So if ESP starts at 28 a push will actually write the value at 24. 3. Stacks can be much larger than 8 integers. If you run "ulimit -s" on a Linux machine it should tell you the maximum stack size in kb. On my machine it's 8192kb which would hold (8192*1024)/4 integers (=2097152)
@upliftingspirit68736 жыл бұрын
3. So what does the x86 has to do with the stack ?
@cyrilsubramanian48835 жыл бұрын
@@upliftingspirit6873 I'm pretty sure 32 bits only represents the number of bits per cell (32 bits, or 4 bytes), not the number of cells in a stack.
@upliftingspirit68735 жыл бұрын
@@cyrilsubramanian4883 You mean 32 cells in the stack?
@XxStormProductionsxX6 жыл бұрын
thank you sir for sharing knowledge in such a professional manner
@joshmadakor30124 жыл бұрын
lmao " ~bye ♪ ". Thanks so much for these
@youssefmostafa57889 ай бұрын
love these tutorials man
@joaoadm942 жыл бұрын
"Welcome back!"
@kerron683 жыл бұрын
Your tutorials are awesome! Can you recommend any books you like that teaches in the same way you do?
@bonbonpony6 жыл бұрын
04:00 How about base two? Is there a way to write base-2 number literals?
@michaeljoshua50405 жыл бұрын
Ah, you mean binary! Yes.. you can. Just add the letter *b* after the binary number you write. Example code: mov eax, 1 mov ebx, 01101010b int 0x80 Which will return 106.
@araujo_882 жыл бұрын
Awesome series, thank you so much!
@arslanrasit8 ай бұрын
Why I'm impressed
@therealxunil27 жыл бұрын
Good stuff!
@samaellovecraft10 ай бұрын
Thanks for the knowledge!
@drygordspellweaver87612 жыл бұрын
I dropped a like to help the algorithm. Gotta push asm onto Gen Z before it goes extinct!
@youssefmostafa57889 ай бұрын
wait how do i view the stack in visual studio
@f_x97717 жыл бұрын
Great video! Can follow up with you, keep up the great work!!
@greob6 жыл бұрын
Thank you very much for this series. Very well explained and illustrated. Loved it!
@tim_allen_jr Жыл бұрын
Can't wait till i get to the point where i can write Assembly creativly.
@WistrelChianti3 жыл бұрын
Thanks! Very well explained.
@viktorreusch76904 ай бұрын
That's cool, but how do I print content of registers (eax, ebx and so on)? Thanks in advance!
@jimivie4 жыл бұрын
you are good at these thumbs up
@joshmadakor30124 жыл бұрын
Bro you are a Saint.
@AxOutdoors3 жыл бұрын
I'm getting a segmentation fault running the code at the end. Any ideas why that might be?
@complexitytr90983 жыл бұрын
Same no idea.
@DarshanSenTheComposer4 жыл бұрын
Hello there! Thank you very much for the lessons. I was watching your video while trying out everything on my terminal open on the right. Found something weird running the code at 9:50. It printed a highlighted '%' at the end of the message. So, I increased the stack size and added an 0x0a at the end of the string and added 1 to the contents of the edx register. It seemed that the problem was solved. I tried to see the exit status of the code at the end of part 1 by moving len to the ebx register before exiting. Guess what? It added a 1 to the string length as well! It seems like we need to include the null byte when we address the length of the string. Please feel free to correct me if I went wrong anywhere. Thank you. Stay safe. :)
@b00i00d4 жыл бұрын
I was thinking of making a similar comment (about '\0') without running through any code
@DarshanSenTheComposer4 жыл бұрын
@@b00i00d :)
@xrafter4 жыл бұрын
@@DarshanSenTheComposer No you just print something was in the memory before syscall are little bit tricky i don't know how they works but some of them don't work probably with out aligning the memory. The % is something you left before or a program left it in the stack since the deallocate only affects the esp and ebp but the values of the character is still there and you can access it . Of course some time the byte are usually zero but after using the stack it will change the values and all of that. So the write will print anything that was there before even if it was 0 and in case of 0 mean nothing
@danielgn62276 жыл бұрын
Hey does anyone know why we use [ ] to access the stack? Is it like accessing the index of an array? If I try to execute *mov esp, byte 'H'* I suppose the _value_ of esp gets overwritten with the value of 'H', instead of accessing the _space_ that esp is pointing to. Am I right?
@DavyBot6 жыл бұрын
You're exactly right, it's like indexing into an array or dereferencing a pointer in C. This is how you distinguish between operations on the address value itself (which is an integer) or the data located at that address.
@danielgn62276 жыл бұрын
@@DavyBot Thank you! Makes more sense now
@StrangeIndeed4 жыл бұрын
That's some good stuff right there
@henkoegema6390 Жыл бұрын
Well done !! 😃
@OmbreeTV5 жыл бұрын
You are awesome! Thank you so much
@complexitytr90983 жыл бұрын
stuck... getting segmentation fault. Even with the github one(ex6). Any idea?
@jonahsimmons36453 жыл бұрын
Me too. I'm trying to do it for 64bit with (nasm -f elf64 name.asm; ld name.o) and valgrind tells me that "Access not within mapped region". When I assemble and link the way he does it, it works though. I just need to figure how 64 bit stacks work. Hope that helps a bit.
@Luftbubblan5 жыл бұрын
To me it feels so strange when assigning system call? and exit status? etc. Why wouldn't stuff like this be at a fixed register? I notice you use eax ebx ecx most of the time. Like, how does the program know that for example mov eax, 4 is supposed to control something, not just be a number in a general register? Sry if i explained that bad but hope someone knows and can clarify :D
@beyondcatastrophe_5 жыл бұрын
When you call the system interrupt, the program on their side reads first the eax to decide which function to call. It then reads however many arguments it needs from ebx, ecx, ... For your program those registers are still general purpose, it's just that another program reads those and interprets it, then writes something back as an answer.
@baruchben-david41964 жыл бұрын
After printing the message, my system doesn't place a CR, so my prompt shows up on the same line of the message.
@ntsystem4 жыл бұрын
I'm trying to understand, does eax, ebx, ecx, edx have to be used in sequential order? what's stopping people from having "ecx" register as the stdout file descriptor instead of the ebx register?
@lukaspinoti1074 жыл бұрын
All of the registers must be used for their purpose. I am not sure what determines this behaviour though.
@lukaspinoti1074 жыл бұрын
maybe the bios?
@shiehuapiaopiao3 жыл бұрын
@@lukaspinoti107 they are pre-programmed intel registers
@lukaspinoti1073 жыл бұрын
Actually no, the syscalls are defined by the Linux kernel. When you do int 0x80 you are talking to Linux.
@complexitytr90983 жыл бұрын
Lol the old me's here!! Took me a 1+ year to figure out these things thanks to garbage search results, its time we need a good search engine.(i wasted huge time, 1 year seriously😭😭, curse these search engines) Nvm back to topic. Its cause you are doing a "sys write". Read about it/search it. Wish, you all find some good websites to have a smooth learning, at least not time wasting, bad sites. Tips: old+security related websites are best
@thefaith016 жыл бұрын
Thanks for this
@user-ye1eo1qv2i4 жыл бұрын
Hello, what have i done wrong? global _start section .data: addr db "yellow" section .text: _start: mov [addr], byte 'H' mov [addr+5], byte '!' mov eax, 4 mov ebx, 1 mov ecx, addr mov edx, 6 int 0x80 mov eax, 1 mov ebx, 0 int 0x80 Because im getting segmentation error. Also big thanks to you sir for making this!
@xrafter4 жыл бұрын
1.changing a read only data 2 can be fixed by putting . Before data and remove the : after it Because the : make it read only and that doesn't make change
@jalolturdiev97273 жыл бұрын
Thank you
@adityaband69197 жыл бұрын
Awesome
@lilraahdreadlockvideosandm16485 жыл бұрын
Thanks🔥
@MutalibGozalov7 ай бұрын
thanks mate
@N03n03-e5y5 жыл бұрын
Bro what you used to make this video i mean what is this editor ?
@armandothomazini77155 жыл бұрын
Why did you set the adress that ESP points to on ecx?
@xrafter4 жыл бұрын
Because the syscall need to be in the ecx
@complexitytr90983 жыл бұрын
Lol i was u once. Read about "write" :)
@shrekkinosciocchino15203 жыл бұрын
why use an "int 0x80" every 3-4 lines?
@complexitytr90983 жыл бұрын
It invokes system call. For example- you wrote in a paper the items you need for grocery. Now you handed over the paper to a shop keeper and got the items. Int 0x80 works like the handed down paper to shop keeper(int 0x80 = shop keeper). Do bit searches if you got time and etc.
@shrekkinosciocchino15203 жыл бұрын
@@complexitytr9098 Thanks
@samlopez39954 жыл бұрын
But why is ESP 28? What defines that?
@complexitytr90983 жыл бұрын
Dont know much, as im a newbie too thought its been around a year. Esp- 32bit register. Also it represent top of the stack. The stack thing may be is imaginary. Nvm in the video its 28 cause, he wrote 28 to describe esp. Cause esp is always indicating top of the stack in real program. In a real program you may find esp Different.
@myartchannel82055 жыл бұрын
You didn't specify whether you need global _start or labels in the push example.
@xrafter4 жыл бұрын
You always need labels especially start label
@aa3018756 жыл бұрын
Thanks.
@imcnx15635 жыл бұрын
The stack was false, when pushing data the pointer will increase & not decrease so when popping data the pointer will decrease
@cyrilsubramanian48835 жыл бұрын
No, it's not incorrect. The stack grows "downwards". Don't get confused about pushing and popping, pushing simply puts things on top of the stack, popping "takes them away" (kinda). When you push, the stack pointer will decrease (that is, go "upwards"), allowing you to place something on "top" of the stack. Remember, the key is that the stack grows downwards.
@cyrilsubramanian48835 жыл бұрын
As proof, try moving esp into ebp, push something (like 0xff) onto the stack. Then call the system_call handler (mov eax, 1) but instead of moving 0 into ebx, move ebp into ebx, and subtract esp from ebx. When you run this, you will find that $? will return 4. This means that the value of esp decreased by 4 at some points, which would've occurred when you pushed 0xff onto the stack.
@JulesBashizi3 жыл бұрын
cool
@AlienAndrew515 жыл бұрын
Funny thing is I took computer architecture and design in college and it didn't make as much sense as they way you explain it.
@HK-sw3vi3 жыл бұрын
fucking perfect!
@one_shot_phill23683 жыл бұрын
Hey, do you know why esp is represented at the bottom of the stack in his diagram, and moved higher every time something was pushed onto the stack? I would’ve thought it would be at the top of the stack to start with?
@z00ne157 жыл бұрын
Dword.
@chrod646 жыл бұрын
Sword.
@mistakenmeme5 жыл бұрын
Nword
@Thydus.5 жыл бұрын
Di-sword?
@blushingbutterfly77422 жыл бұрын
How can you put a multi-letter string with db, if db is for a single byte? I am new to asm and I just cannot wrap my head around this.