The movl %eax, -0x14(%rbp) instruction could be unused code generated by the compiler. Compilers (especially older generations or without optimization) may do this sometimes because they might think, This y variable may be used for another thing later, so let me keep it in the %eax register and back it up in memory.
Not sure I can program an old game like Doom with C language?? How do you get all the graphics and graphical controls working. Surely it took a really long time. What are some of the command that would be used in graphical manipulation? I only got to be able to do maths and print text on screen. Then gave up.
After 11 Years still perfect content to grasp!!! Well done!! The first assembly lines are set up for ret addr and ret value for int main and reserve var space on stack. But i am sure u already know this xD
So… I endeavored to teach myself assembly when I was all the way back in probably middle school… found the book in the library… looked in it… just to get the current time and print it out took about 20 pages of code… I was like SCREW THAT and never looked back but your code appears to be much shorter than that… is that reasonable to believe?
When i got a real computer (i did have a Sinclair and some books so i was aware of things) i got vc++. I finally found the "hello windows" api sample. I got a micro controller board and did the assembly and c samples…this helped. ..i later did a precreate() and inherited the app class but eliminated all win frame windows and used c to write my programs. I cringe when i hear these discussions about languages…it is all machine code in the end. This comparison is exactly what i did on micro. That was when it made sense. I am very disappointed that math and science classes don't teach some pascal or c logic…history classes should discuss computer history. I always found it easier to investigate the origins of technology…this shows how the more managable ideas grow into more advanced systems. I know so many people that think tech is black magic and refuse to engage. Everyone should see this comparison. See how a few lines of code works. Learn that they can apply logic to live decisions. If rob liker store then…go to prision…simple stuff like that
For the printf block around 6:15, Ben glosses over why gcc sets low byte of rax to 0. `movb $0x0, %al` I had a guess about null termination of the return value of printf, but that's void, so I asked the bot. Pretty interesting:
This has nothing to do with null-terminating the string or with printf's return value. This is a requirement of the System V AMD64 ABI for variadic functions (functions that take … in their prototype, like printf). The ABI says: before calling a variadic function, the caller must set %al to the number of vector (SSE/floating-point) registers being used to pass arguments. Since this call to printf("%dn", x) passes only an integer — no floating-point arguments — the count is zero. So %al is set to 0x0
Also if anyone wants to disassemble on linux, you can use objdump.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
Lovely
I love videos with this video format. Its like ACTUAL hands-on than staring on a screen
Commodore p
C je sui malade.
Unless you've actually written a compiler, you have no idea the number of optimizations that were done.
The mobv $0x0, %al probably has to do with printf() being a multi-parameter function. The parameter list has to be terminated.
Thank God for Ken Thomson and Dennis Ritchie who saved us from this cryptic mess.
The movl %eax, -0x14(%rbp) instruction could be unused code generated by the compiler. Compilers (especially older generations or without optimization) may do this sometimes because they might think, This y variable may be used for another thing later, so let me keep it in the %eax register and back it up in memory.
How my college expect me to compile and gives output in a way
Dont let my university see this
Personally I welcome our machine code overlords
machine language = beautiful, fast, laconic
C = ugly, slow
very cool stuff
knowing that pen costs a lot
As a student, I am supposed to do my homeworks instead of watching random videos youtube recommended me as this one
Compiler are AI. Except the prompt is in C language instead of English.
Eax command prompt
Not sure I can program an old game like Doom with C language?? How do you get all the graphics and graphical controls working. Surely it took a really long time. What are some of the command that would be used in graphical manipulation? I only got to be able to do maths and print text on screen. Then gave up.
Glad I found this in time as software engineering student 🙏🏽💯
After 11 Years still perfect content to grasp!!! Well done!!
The first assembly lines are set up for ret addr and ret value for int main and reserve var space on stack. But i am sure u already know this xD
callq is a system call to be executed by OS kernel because an user program cannot directly access Hardware like Display Unit.
So… I endeavored to teach myself assembly when I was all the way back in probably middle school… found the book in the library… looked in it… just to get the current time and print it out took about 20 pages of code… I was like SCREW THAT and never looked back but your code appears to be much shorter than that… is that reasonable to believe?
you know printing out code seems silly, but i like this way more than someone just wiggling their cursor around on a screen…
When i got a real computer (i did have a Sinclair and some books so i was aware of things) i got vc++. I finally found the "hello windows" api sample. I got a micro controller board and did the assembly and c samples…this helped. ..i later did a precreate() and inherited the app class but eliminated all win frame windows and used c to write my programs. I cringe when i hear these discussions about languages…it is all machine code in the end. This comparison is exactly what i did on micro. That was when it made sense. I am very disappointed that math and science classes don't teach some pascal or c logic…history classes should discuss computer history. I always found it easier to investigate the origins of technology…this shows how the more managable ideas grow into more advanced systems. I know so many people that think tech is black magic and refuse to engage. Everyone should see this comparison. See how a few lines of code works. Learn that they can apply logic to live decisions. If rob liker store then…go to prision…simple stuff like that
これはコンパイラが出力したマシン語を解説している動画になります。
実際にマシン語でプログラムを組む場合は、変数をメモリーのどの番地に格納するかを自分で決めないといけません。
(スタック内で処理する場合はこの限りではありません)
画面表示も、1文字ずつ表示したい場所のVRAMアドレスを求め、キャラクターコードを直接書き込む必要があります。
ASM still isn't machine language. To see the actual machine language, you open the exe file in a hex editor using binary mode.
For the printf block around 6:15, Ben glosses over why gcc sets low byte of rax to 0. `movb $0x0, %al` I had a guess about null termination of the return value of printf, but that's void, so I asked the bot. Pretty interesting:
This has nothing to do with null-terminating the string or with printf's return value. This is a requirement of the System V AMD64 ABI for variadic functions (functions that take … in their prototype, like printf).
The ABI says: before calling a variadic function, the caller must set %al to the number of vector (SSE/floating-point) registers being used to pass arguments. Since this call to printf("%dn", x) passes only an integer — no floating-point arguments — the count is zero. So %al is set to 0x0
Also if anyone wants to disassemble on linux, you can use objdump.
I remember when I first learned C language after programming in assembler. It felt like walking after crawling for so long.
Woww super cool!!!
why tf am i watching this. i dont even do cmp sci i do econ XD
I finally understand z score. Thank you.
5:51 implementation printf () right :"
AI
como cojones llegue hasta aquí?
wait, what??? no longjmp()?
Not a programmer at all but I always thought Assembler IS machine code, that it's the same thing.
Really appreciate the insights in this video.
American study method: real machine asm and C.
European study method: asm of a simplified von Neumann machine and pseudocode similar to pascal.
🧐
I’m out I’m going back to rust and JS