Тёмный
No video :(

x86 Assembly: Hello World! 

John Hammond
Подписаться 1,8 млн
Просмотров 1,5 млн
50% 1

If you would like to support me, please like, comment & subscribe, and check me out on Patreon: / johnhammond010
E-mail: johnhammond010@gmail.com
PayPal: paypal.me/johnh...
GitHub: github.com/Joh...
Site: www.johnhammond...
Twitter: / _johnhammond

Опубликовано:

 

29 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1,3 тыс.   
@owenwexler7214
@owenwexler7214 3 года назад
You know it's a hard language when the "Hello World!" video is almost 15 minutes.
@danielesquivel3155
@danielesquivel3155 3 года назад
Xd
@molamola5260
@molamola5260 3 года назад
Still better than developing android apps
@volodymyrodaysky2182
@volodymyrodaysky2182 3 года назад
@@molamola5260 ikr dude
@definesigint2823
@definesigint2823 3 года назад
*TL;DR:* It may be easier to learn this by going _forward_ into the abstraction, instead of unraveling our current abstractions _backwards._ *Longer:* Nudge: Not _hard_ but _more specific_ ; assembly is easy when taken as an abstraction of the more tedious. Before assembly (of programs, containing opcodes), programmers flipped a bank of 8 physical toggle switches followed by a [SAVE] switch...per instruction. Desirable switch combos were given "op[eration]code" names so we didn't have to remember all the binary on/off states...then we punched holes in cards (tinier switches fell through these "saved" programs...then light did)...then we saved our physical switch architecture into logical (not card/switch-based) programs...etc. But inside, deep down, it's all still switches: e.g., MOV is 10111000 ... and (my point is coming) did you know: 1 and 0 don't actually mean "on" and "off" -- they represent voltage levels! .......... Oh, not excited by that? Good! This should feel like the naturally appropriate hardware/physical layer to venture _forward_ into assembly's abstractions, not backwards into the specific physics of electrical engineering. (hope this helps)
@argiziont
@argiziont 3 года назад
As for me, when i was using MASM, it was a little bit harder to write "Hello World!"
@MarkoHR
@MarkoHR 3 года назад
"int" Oh that's an integer, I know that "That's an interrupt"
@lovell8983
@lovell8983 3 года назад
"My whole life is a lie..."
@danielesquivel3155
@danielesquivel3155 3 года назад
@Metros
@simonfarre4907
@simonfarre4907 3 года назад
The only reason I knew it was an interrupt, was because I was playing along with a tutorial writing a simple debugger. Interrupt vector/value 3 is then used
@sturm1379
@sturm1379 3 года назад
@Metros *cries in python*
@fikrim8819
@fikrim8819 3 года назад
Same here lol
@mohammedalkhateem
@mohammedalkhateem 3 года назад
why is Ed Sheeran writing Assembly in my recommendations?
@nickmack7282
@nickmack7282 3 года назад
i thought exactly the same thing, cool though
@SMJSmoK
@SMJSmoK 3 года назад
a man of many talents
@sanjaicyber7841
@sanjaicyber7841 3 года назад
may be trying to write song in a diff lang
@user-vm1hi7bo5s
@user-vm1hi7bo5s 3 года назад
I'm in love with the shape of C We push and pull in a assembly Although my system is falling too I'm in love with your CPU
@LuXTerful
@LuXTerful 3 года назад
@@user-vm1hi7bo5s wow thats hilarious xD
@brayden1129
@brayden1129 4 года назад
it amazes me how you manage to look like both seth rogan and ed sheeran at the same time
@not2day646
@not2day646 4 года назад
Lmfao
@thomastmc
@thomastmc 4 года назад
The voice and even the laugh of Seth Rogen too.
@rusirumunasingha2234
@rusirumunasingha2234 3 года назад
oh god now I’m gonna see him like that
@nessitro
@nessitro 3 года назад
true lmao
@halo34856
@halo34856 3 года назад
I CANT UNSEE THIS
@zigginzag584
@zigginzag584 3 года назад
Even Hell needs a programming language.
@fabiorodrigo3638
@fabiorodrigo3638 3 года назад
That''s the most fitting description for this language.
@a8552bc
@a8552bc 3 года назад
@@fabiorodrigo3638 no that’s a better description for the brainfuck programming language, at-least assembly *can* make sense.
@computer_dude
@computer_dude 3 года назад
@@a8552bc brainfuck isn't even low-level. it was just meant to bring pain.
@a8552bc
@a8552bc 3 года назад
@@computer_dude nothing but *p a i n*
@MrHaggyy
@MrHaggyy 3 года назад
Assembly can be really neat if you get it to work, improve a compiler or Interpreter and know you made the entire world a little bit better than befor.
@klc3rd
@klc3rd 3 года назад
I’ve dabbled in C programming a lot in the past but until I learned how assembly works I didn’t totally understand why some parts of the language works the way it does. Assembly is such an underrated language to learn. New programmers I feel get too used to abstraction from the hardware. It’s so useful for understanding how a processor does what it does.
@woyermain7732
@woyermain7732 3 года назад
Assembly knowledge is the foundation of all modern programming in my mind, you need to learn it at some point
@re43p3raod3
@re43p3raod3 3 года назад
assembly- is...... like java- a waste of your soul i tried a week iof programming in it and i couldnt understand the basics of fucking hello world in that god forsaken language XD
@AhmedMahmoud-tv9vw
@AhmedMahmoud-tv9vw 3 года назад
@@re43p3raod3 I mean It's not like you are going to make apps with it tho. it's also useful for debugging.
@re43p3raod3
@re43p3raod3 3 года назад
@@AhmedMahmoud-tv9vw its now been two weaks since i have been programming this language and well, later to find out its good for hardware thats it you cant apps but i will admit its good for that at least debguing and hardware information
@theshermantanker7043
@theshermantanker7043 3 года назад
@@re43p3raod3 Java's Hello World is just as simple as every other language y'know that right
@BeastinlosersHD
@BeastinlosersHD 4 года назад
"I'm on arch Linux"... Oh boy that's how you know hes for real
@keyg8745
@keyg8745 3 года назад
...btw
@najtofnin2009
@najtofnin2009 3 года назад
Why? It's very user friendly and very common.
@okie9025
@okie9025 3 года назад
@@najtofnin2009 :D
@xelnagamex
@xelnagamex 3 года назад
BTW. Did you know? I use arch too.
@grandmakisses9973
@grandmakisses9973 3 года назад
Arch sucks
@ibrahimnasir4487
@ibrahimnasir4487 4 года назад
Damn seth rogan is a dope programmer
@afrozenpizza
@afrozenpizza 4 года назад
You saw through is clever weight loss and name change! -Seth- John, if you need a better placement, please reach out to us. You know who we are.
@michaelaramis1210
@michaelaramis1210 4 года назад
i thought he was ed sheeran
@TFDUDE123
@TFDUDE123 4 года назад
​@@Max-db6hq Every RU-vid comment thread has the following: 1) Funny comment 2) Funny follow-up comments 3) A rude comment that doesn't get the joke or pretends not to
@iphgfqweio
@iphgfqweio 4 года назад
@@TFDUDE123 3) Chicken little with Seth Rogan voice, weird
@matheusrocha8345
@matheusrocha8345 4 года назад
I scrolled to the comments looking for this! Mr. Hammond doesn't only look like Rogen, but sounds like him too!
@conejohh
@conejohh 4 года назад
More assembly please, I would really like to learn it, your video goes straight to the point! And is really easy to follow
@faridrzayev5093
@faridrzayev5093 4 года назад
why you want to learn it?
@conejohh
@conejohh 4 года назад
@@faridrzayev5093I think it will make me a better person....just kidding. I am a programmer but never had the chance to get in to it in professionally, I think learning assembly will give me a totally different perspective on programming
@faridrzayev5093
@faridrzayev5093 4 года назад
@@conejohh i installed virtual enviroment with win7 32x and spent 3-4 monts intensively learning assembly and give it up,,just dont want others to make same mistake, spend your time to learn valuable things to become real professional
@yowie7169
@yowie7169 4 года назад
@@faridrzayev5093 Why did you quit?
@deadyanothaikiropool1chait713
@deadyanothaikiropool1chait713 4 года назад
I guess the knowledge is really rare I guess...?
@fabiandtheink619
@fabiandtheink619 4 года назад
11:45, as far as I know it's like this: Code -> compiler -> assembly Assembly -> assembler -> object Object -> linker -> executable Executable -> loader -> memory
@user-bo5vr1ib6i
@user-bo5vr1ib6i 4 года назад
You're absolutely correct, except a compiler is (usually) used for translation of higher-level languages to ASM or machine code. So since ASM obviously doesn't need to be translated back to itself, it just goes through an assembler (which is essentially a compiler specifically designed for ASM) to machine code and the rest of your list. :)
@wakomike29
@wakomike29 4 года назад
TLDR: Assembler
@bernardcrnkovic3769
@bernardcrnkovic3769 3 года назад
@@user-bo5vr1ib6i it is still a compiler. a very simple one, maybe even one-pass, mnemonic 1:1 instruction language
@user-bo5vr1ib6i
@user-bo5vr1ib6i 3 года назад
@@bernardcrnkovic3769 As far as I have been able to find, there are different opinions on this. I've usually heard the definition that an assembler is a translator for assembly to machine code, and a compiler is a translator for high-level languages to machine code or any intermediate and that these definitions cannot be mixed. But I've also heard a definition that matches yours, where an assembler is just defined as a compiler for assembly. I think we can both agree on your definition :)
@BitwiseMobile
@BitwiseMobile 3 года назад
Modern compilers don't typically transform to assembler. They create a syntax tree which they then generate machine code from. Compilers are much more advanced than assemblers. I could write an assembler in an afternoon practically, while a fully featured compiler would take several weeks or months to complete. You don't have to worry about stacks, variables, scopes, or any of the other stuff that high level languages abstract to. It's one line equals one instruction (usually). The same can't be said for a higher level language. A single line of C code: printf("Hello World!"); generates about what we just saw.
@puppe1977
@puppe1977 4 года назад
Explanation of $-message syntax: $ means current location (i.e message_length) - address of message, gives difference between message and message_length = length of string. It only works if they are after one another.
@puppe1977
@puppe1977 4 года назад
@Steven Tsakiris Thanks for your kind words!
@MMIIRRKKOO
@MMIIRRKKOO 4 года назад
@Steven Tsakiris In C, is like having two members of a structure one after the other and substracting the offsetof each one of them. Gives you the length. en.cppreference.com/w/cpp/types/offsetof
@WistrelChianti
@WistrelChianti 3 года назад
thanks for the explanation. Never a fan of "this is some weird syntax, deal with it without explanation"
@WistrelChianti
@WistrelChianti 3 года назад
@@Frazzer951 but... But... The entire universe exists just so I don't have to google something X'D
@lucaspelegrino1
@lucaspelegrino1 3 года назад
@@Frazzer951 to be fair, google isnt great for weird syntax search
@GBGSK
@GBGSK 4 года назад
Assembly: *how low can you go?* Python: *how high you get?* > Me: *stuck at boot in Arch*
@dizzlemaker9504
@dizzlemaker9504 4 года назад
Binary: *Y E E T*
@literalcode
@literalcode 3 года назад
@@dizzlemaker9504 My time has come... *_Y E E T_*
@davidwelsh8387
@davidwelsh8387 3 года назад
Glad I'm not the only one making the "why does this look exactly like python" observation.
@Black-Dawg-Jesus
@Black-Dawg-Jesus 3 года назад
"How high are you"? Me: 1
@technophobian2962
@technophobian2962 3 года назад
@Divyansh Singh they literally don't even compare.
@aidangarvey7049
@aidangarvey7049 4 года назад
And to think this is how Rollercoaster Tycoon 2 was programmed, by one person
@crashniels
@crashniels 4 года назад
Lots of old Games were coded in assembly. Assembly is super light weight and was necessary for the time.
@David-2501
@David-2501 4 года назад
​@@crashniels Except RT and RT2 were published in 1999 and 2002. Quake, which was written in C (mostly), was published in 1996. Chris Sawyer is absolute madlad to write a game in assembly in those times! Then again, the game ran as smooth as butter!
@KnightPlaylist
@KnightPlaylist 4 года назад
@@crashniels Have you seen Roller Coaster Tycoon 2? Its a feat of near super human levels.
@1906Farnsworth
@1906Farnsworth 3 года назад
Think of this: Lotus 123 (for those of a sufficient age)was entirely in assembly.
@teratoma.
@teratoma. 3 года назад
@@KnightPlaylist the game holds up strongly even today literally a masterpiece
@realdragon
@realdragon 4 года назад
* 25 lines of code * So that's how you write simple hello world program
@xrafter
@xrafter 4 года назад
It is 7 instructions and 10 more for the data so more than 17 instructions can you do this in higher level than assembly . You cannot with out a library
@TanPham-sn3fc
@TanPham-sn3fc 3 года назад
I used to do that in Z80 assembly language!
@lauriekimani
@lauriekimani 3 года назад
hold my python
@EAisLootbox
@EAisLootbox 3 года назад
@@lauriekimani your python just bit me :(
@ber2996
@ber2996 3 года назад
@@lauriekimani lmao Python is now transcending High-level it's slower than most high-level languages but has simpler syntax
@SchoolforHackers
@SchoolforHackers 4 года назад
John - Love the way you’re doing this. Teaching by bringing the student along while you learn is a great technique, but it requires a teacher who isn’t afraid to share their “fumbling around”. Your total lack of egotism makes it a good experience. And you’re in good company: you remind me a little of Ippsec, who beats on things till he breaks them, with no shyness about describing his thought process. My students are going to devour this. And want more.
@_JohnHammond
@_JohnHammond 4 года назад
Thanks for the kind words! I'll try and keep some more of these coming!
@unseenentity326
@unseenentity326 4 года назад
When I did assembly, a long time ago, I had an Accumulator, an X register and a Y register. I also had to build my own print loop and print 1 byte at a time to the screen... The glory days! :)
@superduper6090
@superduper6090 2 года назад
huge respect to you programmers of old who did the hardwork for computers, us newer gen are so used to abstracted languages that we forget to apprecite all the work you did for us when you had to program using a switch.
@williamdrum9899
@williamdrum9899 2 года назад
Good old 6502. I started there as well (two years ago!)
@unseenentity326
@unseenentity326 2 года назад
@@williamdrum9899 heh, not hard to tell that I was on the 6502
@nickwallette6201
@nickwallette6201 Год назад
Kids have it so easy these days, with their multiple registers, VIMs, and NASMs. haha :-D
@yankeebastard8684
@yankeebastard8684 2 года назад
It's been 3 years and I'm sure you're far beyond this by now but in case anyone in the comments are wondering why certain things are necessary: Strings in assembly are *character arrays* because each ASCII character is 8-bits long (this is why we use db/define byte when creating the message label) and each character is put in it's own memory address - ie an array of characters. This is why we must pass the length of the string when we call the write syscall. When the syscall is made, register EAX only holds the *memory address where the character array starts* (the message label is *not* a value - it is a *location)* and EBX holds the length of the array. Additionally, the $ symbol defines the memory address the assembler currently is at when it's assembling the object file. The line directly before it is where the character array was defined. Immediately after the last address of the character array is the address in which the label "message_length" is defined, thus making $ equal to the memory address right after the end of the string. "$-message" is literally just arithmetic: "the memory address immediately after the string($) minus(-) the memory address of the beginning of the string(message)" which, of course, equals the length of the string.
@janlucsaneaux1915
@janlucsaneaux1915 11 месяцев назад
It's been 1 year since your comment and I'm sure you're even better at explaining things but that was a fantastic explanation!
@leonardodavinci4259
@leonardodavinci4259 9 месяцев назад
Thank you
@mrhappysmiley2968
@mrhappysmiley2968 4 года назад
5:57 - 7:50 This helped me connect the pieces and completely understand how assembly works. I would have never known about this if you have never said it. Thank you John!
@_JohnHammond
@_JohnHammond 4 года назад
Awesome! Happy to hear that! Thanks so much for watching!
@hasrulmuhammad8271
@hasrulmuhammad8271 3 года назад
Ssd: |kl
@Michael-db9ns
@Michael-db9ns Год назад
I'm convinced learning assembly is, in a weird way, like learning Latin. Both are the building blocks of modern languages. And you don't need to know assembly or Latin, but they sure as hell help you understand the nuances of other languages that are built off of them. Or maybe that made no sense, and I just need to go to sleep.
@duppy404
@duppy404 Год назад
Go sleep
@mrnobodyatallnoneed
@mrnobodyatallnoneed Год назад
@bruh same here
@TecUltimate
@TecUltimate Год назад
Write directly in Assembly is the best for a tremendous performance in less resources because an compiler is good in optimization but when you know exactly what you want you can make games in Kb of size.
@monsieurLDN
@monsieurLDN 11 месяцев назад
Youre making sense since they are borh buildinf blocks but i also have to go sleep
@Spider-Man-Hampter
@Spider-Man-Hampter Год назад
Assembly = 100 lb weight. C = 75 lb weight. C++= 50 lb weight. Python = 25 lb weight. If you can lift 100 lbs you can then for sure lift anything lower
@leumgui
@leumgui 3 года назад
me before the video: "damn I hate low-level languages" me after the video: "damn I *really hate* low-level languages"
@SamehMustafa007
@SamehMustafa007 3 года назад
In assembly language programming, however, you are working directly with the processor's instruction set and other high level language are child can't do anything directly for controlling pc or any things you want than assembly language it is between machine language and high level language I hope come the day and learned it 💪
@luizfernandonoschang8298
@luizfernandonoschang8298 3 года назад
@Non Sequitr you use assembly when you need very refined control over the hardware or when you need to make very specific optimizations to make your code run faster/use less space. I don't know how it is nowadays, but some years ago in the game industry programmers had to optimize their codes with assembly to make them run smoothly. The game Crash Bandicoot for PS ONE is a nice example: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-izxXGuVL21o.html
@kitamuram4389
@kitamuram4389 3 года назад
the more skills, the more powers
@intrepidsouls
@intrepidsouls 3 года назад
I actually liked asm even more after this video
@kawosdhdos
@kawosdhdos 3 года назад
@Non Sequitr i wanna do it because youre communicating directly to the computer like isnt that cool af
@nathanabrogena6147
@nathanabrogena6147 3 года назад
"When your codes don't run like they used to before"
@JaLikon65
@JaLikon65 2 года назад
If anyone is wondering the answer to John's question about what registers each argument to the system call goes in... Do a "man 2 syscall" on a Unix-based system, and scroll down to where it says "The second table shows the registers used to pass the system call arguments". That table will tell you what registers are used for each argument :) AND it does it for just about every CPU architecture / instruction set in existence, which is pretty dang cool to see!
@elicn
@elicn 4 года назад
Regarding the '$' sign explanation at 03:37: that's not a weird notation. The '$' sign stands for "the current location" and may be used anywhere in the code (e.g. "jmp $" to make a jump-to-self infinite loop), so this is actually an address. Additionally, specifying a symbol name means taking its address [not value]; so now it easy to see that when writing "$-some_symbol" it simply means "take the current address and subtract some_symbol's address from it". When this is put right after the some_symbol, it would result in its size because the assembler [the program that converts Assembly code to binary] doesn't optimize anything and keep the symbols in the order you specified.
@boggless2771
@boggless2771 4 года назад
That makes a lot of sense!
@williamdrum9899
@williamdrum9899 2 года назад
Some assemblers use *
@69k_gold
@69k_gold Год назад
Correct, that's why it's very important to calculate length right after declaring the string
@godslayer1685
@godslayer1685 Год назад
@@69k_gold I was wondering why is it necessary to know the actual length of string...... In this video, John didn't displayed the string length so, I was wondering why he had the need to know the length of the string?
@guychamberlain-webber2109
@guychamberlain-webber2109 Год назад
@@godslayer1685 you specify the length so the sys call knows how many characters to write to stdout
@nikkehtine
@nikkehtine 4 года назад
you know the meme that someone writes a hello world program and says "hackerman"? if you can write a hello world program in assembly you can unironically call yourself a hacker
@CrippleX89
@CrippleX89 4 года назад
After several attempts at getting started with ASM (or at least understanding the basics) and failing time and time again because of waaaayy too much information, I finally found someone who could explain some basics to me! What the hell syscalls are and how you invoke them, what interrupts are (had a basic understanding, I now understand it a bit better), what the sections are actually for... THANK YOU SO MUCH! Apparently, sometimes it takes a beginner to teach a beginner...
@_JohnHammond
@_JohnHammond 4 года назад
Thank you so much for all the kind words! I really appreciate it! Thanks for watching!
@delarosomccay
@delarosomccay 2 года назад
When I was 13 I taught myself x86 assembler via the DOS DEBUG command in MSDOS 3.3. I had help from Compute!, Dr. Dobbs, and a few other publications that gave tutorials, but most of it was tinkering by looking at machine code via the DEBUG command, making a small change, and watching the result. I had to input raw opcodes, but I had a table. Then I discovered MASM and my world opened up :D. Then about 3 years later I discovered this archaic language called C (it wasn't archaic then, it was pretty new at the time :D, and there wasn't C++ and a CFront compiler yet) and my life was changed, again. Later in college I couldn't figure out why everyone was struggling with pointers. In assembler everything is a pointer, so I could see through the abstraction that the language was giving us and pointers were very intuitive to me (still are). Now I am currently designing my own ISA along with a 4 stage pipeline RISC processor complete with two floating point units, and two integer units in Verilog. Actually, to be honest, my ISA is heavily based on MIPS, so it's not so much a design as a reimplementation. That will make it easier for me to target it using GCC and LLVM when I'm done.
@jameshofmann5996
@jameshofmann5996 Год назад
You didn't mention peek() and poke()
@delarosomccay
@delarosomccay Год назад
@@jameshofmann5996 To be honest that's what got me into assembly in the first place. My uncle was an English Lit teacher at LBSU, and him and a computer science graduate created a program to help non English speakers learn the language easier. He let me see the code one night when he was visiting, and BASIC is pretty intuitive, so I grasped it right away without ever touching a computer. He let me play around on his TRS-80 Model 100 (one of the first portable computers) and I couldn't be pulled away the entire weekend he was visiting. I asked him about the peek and poke instructions, and he explained to me that is how you put things and take things out of memory. That led me to find out more about those kinds of things, and I was introduced to assembly. So you can say that peek and poke are what really started it all for me :D
@samdvich
@samdvich 3 года назад
"oh that seems kinda easy" > notices that this is just a hello world program and is only for a particular cpu "...nvm"
@user-le8ul4nr5t
@user-le8ul4nr5t 3 года назад
Imagine being able to print an entire string at once, and not a single character at a time! This reply was mad by the Apple II Gang.
@makerofstartup7902
@makerofstartup7902 3 года назад
also try sending string to multiple ip, and display it in easy GUI, no no no - not in console or dos box - we're not in 1960-ties. Think it would be impossible to John Hammond, and Hello world is junk 3 operands piece of not even code - instructions.
@HrHaakon
@HrHaakon 3 года назад
#!/usr/bin/bash echo "Hello! It's me. Redbum."
@ianeverett5461
@ianeverett5461 Год назад
This is really cool, I remember trying to learn assembly in the '80s and it was a nightmare on the hardware we were using.
@Night-xn1ks
@Night-xn1ks 4 года назад
I'd love to see more of this! There's a sore lack of good assembly videos and I've already run through most of them
@kamalkhan4368
@kamalkhan4368 Год назад
Never encountered anyone teaching hello world in assembly that easy wow.. great work...
@alister_
@alister_ 3 года назад
I started programming in assembly when I was a kid. This made me feel somewhat nostalgic. I really enjoyed writing assembly code and I really don't know why I stopped at some point. I'll give it a try again. It was so f* good!
@orenwolfe6506
@orenwolfe6506 3 года назад
I too cut my teeth on Assembly Programming fifty years ago on a PDP-8. Good assembler programmers are scarce these days.
@rohitjadhav4868
@rohitjadhav4868 3 года назад
Python Code to do the same thing : - print("Hello World")
@hussey4826
@hussey4826 3 года назад
That is the advantage a scripting language offers
@_JohnHammond
@_JohnHammond 3 года назад
Yo, Code Geass is an INCREDIBLE show
@bulldoggentv1933
@bulldoggentv1933 3 года назад
33 minutes ago?
@Mauricetz
@Mauricetz 3 года назад
You forgotten the "!"
@HrHaakon
@HrHaakon 3 года назад
Now all you have to do is install python... ;) Also you should add the crunchbang to tell your shell where to go find the interpreter..
@georgeandrews2839
@georgeandrews2839 4 года назад
Machine code is the processor commands built into it's instruction decoder. Machine code is in binary. Machine deals with the registers, transfer buses and arithmetic logic unit within the processor. Assembly is the first "higher" language above machine code and is in hexadecimal. Each "higher language" is made of commands that will be decoded into machine language. The "higher" a language is above machine code, the more restrictive it becomes and the more structure is required. All languages above machine are basically "short hand" built with predefined structure and commands. Hex is "0" through "F" Octal is "0" through "7" The X86 processor is built upon the design of the 465L ITT computer ( 32 bit )
@Cest.La.Vie..
@Cest.La.Vie.. Год назад
Comparing to old Assembly I used in Unix and Dos environment this is almost a high-level language.
@traykeller5717
@traykeller5717 4 года назад
So what you pretty much ended up doing Is teaching me something that took 2 weeks to learn into 15 min. Good info man. There's not alot of good sites or videos out there that keeps it short and simple.
@Kyusoath
@Kyusoath 4 года назад
'welcome, to Jurassic park.'
@lfernandorg
@lfernandorg 3 года назад
I saw Assembly long time ago, and never used again, the video was great, instructive, and easy to understand. thank you for shared!
@esu7116
@esu7116 3 года назад
15 min for hello world in x86 Assembly ok
@ericzou4301
@ericzou4301 4 года назад
Thank you! I've been trying to learn Assembly for ages, and for a long time I've been just copying code and not knowing what It's supposed to do. Finally, someone's here to actually explain it well enough for me to make something myself! +1 subscriber for you!
@daboxguy3848
@daboxguy3848 3 года назад
YES! I can finally make an assembly executable instead of constantly emulating it. More x86 tutorials would be awesome.
@shawnerekson3800
@shawnerekson3800 2 года назад
I am learning about computer architecture at my university rn and you have taught me more in 15 minutes about assembly than he has in 2 hours:)
@bob-ny6kn
@bob-ny6kn Год назад
Put your tictok down and pay attention, because I guarantee the instructor is teaching, or he wouldn't be teaching.
@UCFc1XDsWoHaZmXom2KVxvuA
@UCFc1XDsWoHaZmXom2KVxvuA 3 года назад
That is the fastest and most efficient Hello, World! you'll ever run
@hamidcrazy9027
@hamidcrazy9027 3 года назад
Not really, the code above is not optimized
@alister_
@alister_ 3 года назад
@@hamidcrazy9027 How could it be optimized?
@hamidcrazy9027
@hamidcrazy9027 3 года назад
@@alister_ what I'm 100% sure of : a faster way to mov 0 into a resgiter is to xor it with it self, so if you "xor ebx,ebx" instead of mov in the second syscall, you'll have a faster zeroing, plus the code will be smaller by 2 bytes (smaller instructions effects the caching and the fetching positively which improves the speed what I'm not 100% sure of : you can brake some instructions into smaller ones (remember the small instruction effect I just talked about ?), i,e "move eax, 4" can be replaced with "xor eax, eax" and "add al, 4" but be sure to put them as far from each others as you can so you don't cause a stall (basically making the code slower) e.g the xor should be the first instruction in the code while the add should be right before the syscall this could save a couple nano seconds, which shouldn't matter that much, but the first xor tip shows that you know your assembly
@tacitozetticci9308
@tacitozetticci9308 3 года назад
@hamid crazy Ah yes. Teach me master.
@hamidcrazy9027
@hamidcrazy9027 3 года назад
@@tacitozetticci9308 I ain't no master but I can probably suggest some books if you wanna learn assembly
@RandomTorok
@RandomTorok 3 года назад
You just time warped me 25 years into the past. January 1995 and I was learning assembly. And April 1995 was probably the last time I ever wrote any assembly.
@Kabbone
@Kabbone 4 года назад
Hey John, never use "pacman -Sy" for installing a package. If you do this, your packages could be not persistant at that point, because the new package comes from the updated repository index and the rest of your packages are still from the old index. There could be also dependency problems. It can be easily fixed with another "pacman -Su" after the install.
@_JohnHammond
@_JohnHammond 4 года назад
Oh crap, okay! That is super good to know, thank you!
@thebirdhasbeencharged
@thebirdhasbeencharged 4 года назад
Btw, this guy Kabbone uses Arch.
@baitinq3155
@baitinq3155 4 года назад
Better yet do pacman -Syu
@robotduck77
@robotduck77 4 года назад
The reason why I hate Arch rolling release. Other distros doesn't force you to update all other packages before installing new package.
@Kabbone
@Kabbone 4 года назад
@@robotduck77 Ehm, it doesn't, you just don't update the index before, simple pacman -S without the y for updating the index
@samuelmurphy5751
@samuelmurphy5751 Год назад
I am currently reading "Secrets of Reverse Engineering" by Eldad Eilam & I have been learning about what a stackframe is & how stack pointers work. I know this book was worth my $40.00 because I actually understood this video.
3 года назад
11:28 "so let's go ahead and compile this" --> The process of translating assembly language into machine code is done via an assembler utility - Nasm(which you're using here) is such a utility. Assembly language is near-identical to machine code and uses mnemonics to represent each machine code(CPU) instruction on a 'direct-one-to-one-basis' so that every CPU instruction is covered by its own mnemonic(Assembly language) instruction. Compilers, on the other hand, are used to translate from higher level languages into machine code.
@IlKaiserChannel
@IlKaiserChannel 3 года назад
You are damn right. Every instruction written in assembly is equal to a series of 1s and 0s. Depending from the kernel those are represented in different ways.
@homelessrobot
@homelessrobot 3 года назад
This isn't really true. There is still quite a lot of relatively high level stuff going on in the average assembler (which is a type of compiler, btw). For instance, all of the labels? Theres no correlation in machine code. If you are generating object code, it might get used to construct a symbol table, but the machine knows nothing about any of that; thats the operating system/loader that interprets that information. How the assembler uses it though it to give you a relatively high level and convenient way to talk about things written at locations in memory that correlate to data and code that you have specified somewhere else in your source code. Instructions taking operands of different sizes, like rax vs eax? There's quite a lot that the assembler has to do to make this distinction, especially in x86_64. Some assemblers aren't even machine specific, and all of the instructions are actually specified in a macro language embedded in the assembler (fasmg for instance). You should try comparing the input to an assembler that someone has written by hand with the output from a dissasembler that is trying to 'guess' at the input. It can (sometimes) figure out what was instructions, and what was data, and how it relates to other blocks of code and data, but even in translating from assembly to machine code (or object code) quite a lot of information is lost.
3 года назад
@@homelessrobot "For instance, all of the labels? Theres no correlation in machine code." --> I don't mean to be disrespectful, but this one, single, bizarre, incorrect statement that you made displays a flashing "Warning!!" banner above your head, burning so bright you can see it from the Moon. I have to conclude that your experience of programming is...rather limited. In Assembly (as in many other languages) you are free to declare labels (they're merely used as destination pointers). The Assembler's extremely simple job is to set all branch/jump instructions to the label's address, or, if the label is a data pointer, then set all relevant data addresses to here...all as applicable. There are other uses for labels, though these cover their most frequent use.
@najtofnin2009
@najtofnin2009 3 года назад
@ Really? Tell me, what address does it assign to the labels?
@najtofnin2009
@najtofnin2009 3 года назад
@@IlKaiserChannel It does not equal a series of 1s and 0s in any way other than the completely trivial (i.e. all code is 1s and 0s). The kernel has nothing to do with the representation of instructions.
@Lateset
@Lateset 3 года назад
Python 14 minute tutorial: you can start working XD Assembler 14 minute tutorial: you can make hello world
@davidlancaster5804
@davidlancaster5804 3 года назад
I'm in such a love hate relationship with this kind of stuff.
@mainmeister
@mainmeister 3 года назад
I once wrote a Perkin Elmer block mode terminal in z80 assembler which ran on a Xerox 820 PC running CP/M. The 820 has a 40 pin edge card connector inside where you could mount a circuit card. I ended up burning eeproms of the program and designed a wire wrapped board to hold the eeproms. When the computer was first turned on you could select to boot from the bios or the eeproms. The company ended up making a couple of hundred of these and had my wire wrap board manufactured by a Californian manufacturer. Thank god I only had to wire wrap the prototype! This brought back many memories of the good ol' days in 1986.
@CyclesMcHurtz
@CyclesMcHurtz 4 года назад
This video makes me so very happy, thank you. I feel a great many programmers would benefit from understanding the lowest level of operations, and building from this into higher-level systems and languages.
@paulpkae
@paulpkae 4 года назад
Brings back a lot of memories. I coded x86 assembly back in the 80's and 90's . I recall using a fantastic debugger at the time called AFD (I think it was developed by Intel), got us out of lots of troubles.
@auxchar
@auxchar 4 года назад
Representing a byte as 0xA instead of 0x0A, while allowed, is somewhat odd, considering that one digit of hex corresponds to four bits.
@williamdrum9899
@williamdrum9899 2 года назад
Yeah I don't like looking at it so I add the extra zero. For whatever reason I almost never use decimal numbers either in assembly, mostly hex (and binary for bitmasks)
@auxchar
@auxchar 2 года назад
@@williamdrum9899 I use whichever is appropriate, depending on context.
@hellcatchuck2723
@hellcatchuck2723 2 года назад
I am brand new to your channel but I must say I've watched so so many videos in the past two days and thank you so much for sharing all of your knowledge. You're awesome. Thanks so much.
@pinakinkale
@pinakinkale 3 года назад
“I forgot to mention I use arch”
@gusfl2
@gusfl2 3 года назад
"I use arch, btw"
@suntexi
@suntexi 3 года назад
It's nice to see x86 assembler in action. As an IBM mainframe systems programmer, I had to know how to use 360 assembler and up. I always loved to see the output listing clean after assembling the source code because the object code could now be linked ready to be run. 360/370/390 used base/displacement to address storage, with (usually) one register as the module base and the other 15 registers for other things, but always, at the start of the module, you saved all the values existing in the registers, and restored them when you exited, via R14. R13 pointed to this save area, if my memory serves. R15 pointed to the pararmeter list. Please excuse the ramblings down memory lane, of an accredited elderly computer nerd.
@soroushsafarzadeh8321
@soroushsafarzadeh8321 3 года назад
Now all that Assembly course I passed in college is starting to make sense!
@deanlhouston
@deanlhouston 4 года назад
Some info on the $ interpretation by the assembler. The $ is a multi use macro telling the assembler different things depending on the use. The $ in front of a number indicates it is a hex number, and is especially useful in the example is $aa, which is a tiny bit more concise than typing 0xaa, but more importantly tells the assembler that a hex number like "aa" is not a code label reference, but instead a literal value. The $ is also heavily used as a pointer containing the current value of the instruction pointer. That looks like how the assembler is interpreting your data definition, meaning $ being the current "address" of the data variable "message_len" minus the address your variable "message" refers to, which is simply pointer math, yielding the length of the string "message".
@SumanRoy.official
@SumanRoy.official 4 года назад
Please do Assembly videos step by step tutorial, the way you deliver it, is the best I can see on any RU-vid channel.
@erosmlima5981
@erosmlima5981 3 года назад
Assembly was my first playlist created at github, and until now I never try to make hello world, thanks for teach us.
@fusca14tube
@fusca14tube 4 года назад
Hi John... great video! Just one detail... you could you the "section .rodata" (read only data) instead of "section .data" because the message variable is a constant. ;)
@_JohnHammond
@_JohnHammond 4 года назад
Oh sweet! Good tip! Thank you for letting me know! I'll have to do that in the future for things that I know won't change. Thanks again!
@electricimpulsetoprogramming
@electricimpulsetoprogramming 3 года назад
Bom dia Fabiano, voce é brasileiro, tem alguma dica pra quem esta começando a ser programador?
@fusca14tube
@fusca14tube 3 года назад
@@electricimpulsetoprogramming a dica é vc desenvolver a sua lógica de programação, e isso pode ser feito em QQ ambiente, com QQ linguagem, inclusive usando um Arduino.
@saulnier
@saulnier 3 года назад
It is great to see instructional/informative videos like this showing up once in awhile. Unfortunately it sometimes seem that viewers do not seem to understand that this is not meant to be a tutorial on how to print out "Hello world!", but rather to demonstrate the underpinnings of what it takes to make the hardware do what you want it to do. In the end Python, GO, C, Basic, Lisp etc need to be compiled down to the metal for it to work. At the risk of dating myself, I remember programming eProms by setting the binary equivalent of the opcode on the data bus, setting the address on the address bus and throwing the write switch. Yes, actually pulling up the appropriate lines (=bits) with manual switches on an IMSAI 8080. Made an error? No problem. Just remove the sticker on the eProm to expose the circuit to UV light and start all over again. Anyway, remember no matter how fancy your programming language is today, in the end it's all 1's and 0's. Thank you. @JohnHammond
@b3ngtb
@b3ngtb 3 года назад
I'm probably a bit late to the party, but the .data section is for (long lived) variables and both the string and it's length are really constants. So you can have both the code and the constants in the .text section.
@passaronegro349
@passaronegro349 2 года назад
here in Brazil we follow your work ,,, the caption is of great value .. thank you !!!
@vijeta1383
@vijeta1383 4 года назад
great, loved it. It's interesting.Please make a series on assembly if possible.
@lohphat
@lohphat Год назад
I'm an old skool guy who cut my teeth on Z80 assembly in the late 70s. For completeness, I'd put a halt instruction after the last system call in the highly unlikely event the "exit" call failed and returned control. The halt would keep the execution from then hitting unintentional data/memory contents which follow.
@mimmovisconti2559
@mimmovisconti2559 4 года назад
Do you know that in vim you can use :set ft=nasm for better assembly highlighting.
@erflipao1211
@erflipao1211 3 года назад
Saw this video a year ago, did not understand anything. I learnt this year computer hardware basics from the ground up, until I managed to have a decent knowledge of the AVR architechture and its corresponding asm instruction set and behaviour. Happy to see the results as I understood everything you explained with no problems at all :)
@Zomp420
@Zomp420 3 года назад
You forgot the comma....it's "Hello, World!"
@matand009
@matand009 4 года назад
Excellent. I see no problems here and to be honest it is much more straightforward then when I took an x86 course in college.
@iloveplasticbottles
@iloveplasticbottles 4 года назад
This is why I have mad respect for nasa engineers. Look at how many lines Seth Rogan wrote just to say "Hello World"
@pwlegolas3
@pwlegolas3 2 месяца назад
Thanks John.. Love your tutorials ... Keep inspiring .
@davidprock904
@davidprock904 4 года назад
I'm working on my own Computer Architecture from the ground up, so far with just a logic gate simulator. And making my own OS to go with it. They are perfectly integrated with each other. Its going to be way better, and my form of assembly will be easier. And more powerful. That part is hard to explain
@_JohnHammond
@_JohnHammond 4 года назад
Sweet! Looking forward to hearing about it when it is done, please do keep me updated!
@lauriekimani
@lauriekimani 3 года назад
You've earned my respect
@Crazylom
@Crazylom Год назад
Any news, David?
@davidprock904
@davidprock904 Год назад
@ᏟᎡᎪᏃᎽᏞΘᎷ I have slowed down on it because of everything going on in life. But I've got it to a point where not much more can be changed or added. There is no ALU or Control Unit, there is no State... but only in regards to being that state is very local and limitless. It's I'm the category of a PIM, but it's (memory isn't what you think) and execution takes place where the code resides, no fetching required. So the way my architecture is, I got what I call a cell, that contains the simplest of logic, so extra logic to be able to soft code the basic 7 logic gates. All clusters are exactly identical to each other. One cluster connects to eight others in a 3D Stack. In regards to XYZ memory addressing, it isn't possible with the standard way of doing it, got to get back to work...finish telling you later, leave another comment so I'll get notified of your comment to remind me
@B1GL0NGJ0HN
@B1GL0NGJ0HN 9 месяцев назад
@davidprock904 and then?
@LokiCDK
@LokiCDK 2 года назад
I haven't touched assembly much since doing some disassembly with Art of Exploitation. This was great, thank-you!
@nilsirl
@nilsirl 4 года назад
For the message variable, you mention 0xa as being an "argument", I view it just as concatenation.
@_JohnHammond
@_JohnHammond 4 года назад
Oooooh, that's totally a better way for it to be described. Good call, thanks!
@seancantwell12
@seancantwell12 Год назад
John, you should definitely do a series dedicated to assembly code! I can't seem to find any courses where the instructors have your enthusiasm and commitment! You really make a difference with the way you teach.
@nathanlamaire
@nathanlamaire 4 года назад
You made me, as C developer, to be interested in assembly language!
@igorthelight
@igorthelight 4 года назад
In Visual Studio you may compile C++ code to assembly and then to machine code. Maybe you may do this with C. You will see how your C programs looks in Assembly :-)
@NomoregoodnamesD8
@NomoregoodnamesD8 4 года назад
Godbolt is an incredibly useful tool for mapping C/C++ code to assembly output, showing both in color-coded blocks
@jingyitay6179
@jingyitay6179 3 года назад
i gave you a like just because you told everyone you are here to learn. that means a lot and a great reminder to other learners. hope to you see more in the future
@javi3266
@javi3266 3 года назад
I'm on my last year of Computer Engineering and I can say that one of the most challenging but satisfying languages I've learnt is Assembly Language (I learnt ARM Assembly Language). Once you learn the logic of it, it's actually a fun language to program on. I remember the last test I had to do in my Foundations of Computer class: multiply matrix A with matrix B in assembly language. I needed at least 7/10 on that exam and the Assembly Language was 5 points. Guess who got a 7,5 and passed it! However, I admit that it looks scary and not everyone can program it. I suggest you publish a VHDL video. I swear that VHDL got me on my nerves every single time.
@yonnileung
@yonnileung 3 года назад
I Learn x86 assembly 23 years ago, go to library get a 1XXX pages brick then home, spend two weeks complete a super stupid integration that excel never can handle (2000 lines , result is 3kBytes exe, and my mum said you should take a bath).... It's good experience and i never forgot how hard to coding by assembly ....
@j3r3miasmg
@j3r3miasmg 4 года назад
To show what was generated by ld, you could use objdump -D and compare with your asm file. Congratz, nice video.
@NorteXGame
@NorteXGame 3 года назад
That's the longest Hello World tutorial I've seen...
@nirmitshah7660
@nirmitshah7660 4 года назад
Hey man waiting since a long time for a video on assembly language please make a series on reversing like liveoverflow has made on binary exploitation plzz Ur videos are great!!!
@sairaj5660
@sairaj5660 3 года назад
The best video on exact syntax explanation of assembly
@omaribrahim3370
@omaribrahim3370 4 года назад
he looks like he does minecraft on the side. for a sec i thought he was that one minecraft guy.
@_JohnHammond
@_JohnHammond 4 года назад
I guess that is not me unfortunately ahaha!
@jammincoder
@jammincoder 2 года назад
I wrote this program the other day, but I didn't know what he heck was happening. It's awesome how you explained everything in a way so easy to understand! Now I know a little more about ASM that I didn't before, thanks!
@WinningEmpire
@WinningEmpire 4 года назад
damn. ed sheeran is really killin it
@jimkokko5
@jimkokko5 3 года назад
Somebody has probably already mentioned this, but here goes: At 3:30, the dollar sign character ($) refers to the memory address at the current position, which in this case refers to the position (address) of the message_length data entry. Therefore, "$-message" translates to "address of message_length minus address of message", which of course is equal to the length of the message itself.
@deadyanothaikiropool1chait713
@deadyanothaikiropool1chait713 4 года назад
"Hope you learn a little bit new" Naaaaa...I mean this simple one is just everywhere on the internet... And it's really hard to find new knowledge one... So I pressed like and sub!
@_JohnHammond
@_JohnHammond 4 года назад
Hahahah that's for sure -- thank you so much!
@uuu12343
@uuu12343 3 года назад
I’m not quite sure why RU-vid suddenly recommended me a x86 ASSEMBLY video - but regardless of that, I’m really intrigued and now realise I wanna learn more about ASSEMBLY on linux I learn assembly now and then and in school, but never got around to actually coding it under the x86 architecture, only using the msp430
@El_Croc
@El_Croc 4 года назад
Clearly presented, thanks. Not understanding how you knew which parameters from the C reference correlated to the EBX, ECX, EDX registers? Is there a convention, or standard that is always true with param. order??
@tibielias
@tibielias 3 года назад
that's x86 system call on Linux for you. eax stores the system call value, simply calls write(int fd, pointer to buffer, size_t buffer_size). Those parameters go into ebx (fd), ecx (pointer to buffer), edx(buffer length) respectively. Every time you make a system call in Linux on x86 eax will store the system call number, ebx - the first argument, ecx - the second one, edx - the third one and then (if you happen to make a system call that requires more than 3 arguments) the rest of the arguments needed to be pushed onto the stack. When you do that, you need to be mindful of the order you do that, because the system will pop the argument from the top of the stack, so your last pushed data (in this case the argument) is read first that gets read (popped) and somewhere down the line the first data you pushed onto the stack is read as the last piece of data (that would be your last argument).
@El_Croc
@El_Croc 3 года назад
@@tibielias Thank-you
@polloymedio
@polloymedio 3 года назад
You triggered an old nightmare with this one. Had to write a compressor/decompressor in the University using this back in the day and had me crying for quite some time
@neilbradley
@neilbradley 4 года назад
Thank you for calling it "assembly" rather than "assembler". ;-) Nice vid!
@LowLevelLearning
@LowLevelLearning 3 года назад
Awesome video! x86 is really hard for beginners, this made it easy.
@ohmyshell
@ohmyshell 4 года назад
please do more assembly im loving this...i usually use visual studio code and i wanted to know why move from sublime to vim? **edit** also why move to arch?
@ralesarcevic
@ralesarcevic 4 года назад
Chicken Nuggets 'cause Ubuntu sucks and Arch is a really good distro
@yuvalm.5855
@yuvalm.5855 4 года назад
@@ralesarcevic Why does Ubuntu suck? I believe it's a very good distro, super easy to use and really not that much different from other mainstream distros out there. Would love to hear your opinion.
@frankschneider6156
@frankschneider6156 4 года назад
Rale Sarcevic Oh god, not the distro kiddies again. Not sure if you haven't learned it by now ... but there is no "best" tool, but only more or less suitable tools. Arch is a fine distro, but Ubuntu is too, as is Mint and whatever there is floating around on "popular" distros out there. What's "best" always depends on what you want to achieve and who wants to achieve it. I agree, that Ubuntu has imho indeed some quite irritating and proprietary properties, nonetheless is it quite well suited for some target groups and has properties you won't find on Arch (if you need or even want them is a quite different thing), while ArchLinux possibly better fulfills your needs. That's why there are different distros out there and not just one, because different people have different problems and thus different needs. After 40 years of OS wars people should have learned that there is nothing like "the best computer", "the best OS", "the best editor", the best distro" or "the best programming language". There are just tools suited better and less well for solving a specific problem. What this is, strongly depends on the goal to be achieved, the person trying to achieve it and the specific circumstances. You surely know the say "If all you have is a hammer ....".
@ralesarcevic
@ralesarcevic 4 года назад
Yuval M. Because it's bloated af, has limited availability of 32-bit libraries (no support for vulkan or mesa, can't recall which of those) which means gaming on Ubuntu is practically impossible and that's forgetting what they did in the past Only good thing about it is that it's easy af to install it unlike Arch (but that ofc brings less customization options so it's a tradeoff some people aren't willing to take)
@ralesarcevic
@ralesarcevic 4 года назад
Frank Schneider I agree that there isn't really a single best distro out there, but I never said Arch was the best, only that it's better than Ubuntu
@burningera1921
@burningera1921 2 года назад
Thank you very much for this video! You really helped me to understand the basics of the asm.
@_crys_
@_crys_ 4 года назад
Hey John, which vim color theme are you using? Looks really pleasing to the eye
@gwmain1862
@gwmain1862 4 года назад
I think it's gruvbox
@sickthotsonmymind2299
@sickthotsonmymind2299 4 года назад
Once again John, great video and it's quite timely. A lot of us younger cats need all the help we can get with Assembly language. You're the man
@mayathemaster
@mayathemaster 4 года назад
How glad I am to live in the 2019
@igorthelight
@igorthelight 4 года назад
Because you don't have to use Assembler? :-) True. It's overkill now. If you need 100% fast code - use C with maximum optimizations during compiling. For noob friendliness use Python.
@jasoncrouch99781
@jasoncrouch99781 2 года назад
It's pretty much inspired me to start again. thank you.
Далее
“Hello, world” from scratch on a 6502 - Part 1
27:25
What Is Assembly Language?
24:56
Просмотров 453 тыс.
The Phishing Website that Hacked Linus Tech Tips
27:11
Просмотров 319 тыс.
computers suck at division (a painful discovery)
5:09
How the Best Hackers Learn Their Craft
42:46
Просмотров 2,6 млн
x86 Assembly Crash Course
10:45
Просмотров 831 тыс.
I Designed My Own 16-bit CPU
15:46
Просмотров 2 млн