x86 Assembly: Hello World!

  Рет қаралды 1,444,146

John Hammond

John Hammond

4 жыл бұрын

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/johnhammond010
GitHub: github.com/JohnHammond
Site: www.johnhammond.org
Twitter: / _johnhammond

Пікірлер: 1 300
@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
@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!"
@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 2 жыл бұрын
Assembly knowledge is the foundation of all modern programming in my mind, you need to learn it at some point
@re43p3raod3
@re43p3raod3 2 жыл бұрын
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 2 жыл бұрын
@@re43p3raod3 I mean It's not like you are going to make apps with it tho. it's also useful for debugging.
@re43p3raod3
@re43p3raod3 2 жыл бұрын
@@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 2 жыл бұрын
@@re43p3raod3 Java's Hello World is just as simple as every other language y'know that right
@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...?
@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 KZfaq 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!
@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 3 жыл бұрын
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.
@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
@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.
@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
@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!
@nathanabrogena6147
@nathanabrogena6147 3 жыл бұрын
"When your codes don't run like they used to before"
@leumgui
@leumgui 3 жыл бұрын
me before the video: "damn I hate low-level languages" me after the video: "damn I *really hate* low-level languages"
@grahamhart4972
@grahamhart4972 3 жыл бұрын
yeah like at the end I'm just thinking "who the fuck would EVER want to use that?" like freaking 10 lines of code to print hello world translates to literally one in python
@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 жыл бұрын
@@grahamhart4972 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: kzfaq.info/get/bejne/n-Coi6qmu7KWYaM.html
@kitamuram4389
@kitamuram4389 3 жыл бұрын
the more skills, the more powers
@intrepidsouls
@intrepidsouls 3 жыл бұрын
I actually liked asm even more after this video
@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
@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 Жыл бұрын
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 10 ай бұрын
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 8 ай бұрын
Thank you
@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
@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
@ZaHandle
@ZaHandle Жыл бұрын
@@duppy404You’re right Why am I watching this video at 2am?
@mrnobodyatallnoneed
@mrnobodyatallnoneed Жыл бұрын
@@ZaHandle 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 9 ай бұрын
Youre making sense since they are borh buildinf blocks but i also have to go sleep
@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
@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
@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."
@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!
@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!
@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!
@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.
@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
@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!
@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.
@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..
@Cest.La.Vie..
@Cest.La.Vie.. Жыл бұрын
Comparing to old Assembly I used in Unix and Dos environment this is almost a high-level language.
@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.
@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 :)
@esu7116
@esu7116 3 жыл бұрын
15 min for hello world in x86 Assembly ok
@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.
@burningera1921
@burningera1921 2 жыл бұрын
Thank you very much for this video! You really helped me to understand the basics of the asm.
@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
@daboxguy3848
@daboxguy3848 2 жыл бұрын
YES! I can finally make an assembly executable instead of constantly emulating it. More x86 tutorials would be awesome.
@kamalkhan4368
@kamalkhan4368 Жыл бұрын
Never encountered anyone teaching hello world in assembly that easy wow.. great work...
@STREETBOYXY
@STREETBOYXY Жыл бұрын
amazing, nice work, easy to understand, feel ready for the complex algorithms now !!
@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
@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
@Kyusoath
@Kyusoath 4 жыл бұрын
'welcome, to Jurassic park.'
@LokiCDK
@LokiCDK 2 жыл бұрын
I haven't touched assembly much since doing some disassembly with Art of Exploitation. This was great, thank-you!
@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.
@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.
@mimmovisconti2559
@mimmovisconti2559 4 жыл бұрын
Do you know that in vim you can use :set ft=nasm for better assembly highlighting.
@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.
@pwlegolas3
@pwlegolas3 Ай бұрын
Thanks John.. Love your tutorials ... Keep inspiring .
@Lateset
@Lateset 3 жыл бұрын
Python 14 minute tutorial: you can start working XD Assembler 14 minute tutorial: you can make hello world
@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 KZfaq channel.
@givdb5513
@givdb5513 Жыл бұрын
Excellent video!! No one ever explained the details so well as you!!
@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.
@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.
@soroushsafarzadeh8321
@soroushsafarzadeh8321 3 жыл бұрын
Now all that Assembly course I passed in college is starting to make sense!
@deex3283
@deex3283 3 жыл бұрын
Nice clear explanation, thank you! Especially for demonstration of the way to understand syscalls with uint32 file and man pages
@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".
@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.
@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
@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.
@deansmith7163
@deansmith7163 Жыл бұрын
Great video! I like how you improvised.
@pinakinkale
@pinakinkale 3 жыл бұрын
“I forgot to mention I use arch”
@gusfl2
@gusfl2 3 жыл бұрын
"I use arch, btw"
@vijeta1383
@vijeta1383 4 жыл бұрын
great, loved it. It's interesting.Please make a series on assembly if possible.
@jasoncrouch99781
@jasoncrouch99781 2 жыл бұрын
It's pretty much inspired me to start again. thank you.
@passaronegro349
@passaronegro349 2 жыл бұрын
here in Brazil we follow your work ,,, the caption is of great value .. thank you !!!
@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.
@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!
@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
@davidlancaster5804
@davidlancaster5804 3 жыл бұрын
I'm in such a love hate relationship with this kind of stuff.
@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.
@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.
@josephstalin8442
@josephstalin8442 Жыл бұрын
According to my notes, it’s the assembler assembly code to turn it into byte code and the compiler converts normal code to assembly, though both steps are a part of the compilation process
@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.
@louga31
@louga31 4 жыл бұрын
Hey, does anyone know a good assembly course? (preferably in video format)
@_JohnHammond
@_JohnHammond 4 жыл бұрын
The Pentester Academy: x86 Assembly Language and Linux Shellcoding is reportedly VERY good. That's where I get started to get material for this video. www.pentesteracademy.com/course?id=3
@abstractumx
@abstractumx 2 жыл бұрын
thanks for sharing! assembly is crazy!
@sairaj5660
@sairaj5660 3 жыл бұрын
The best video on exact syntax explanation of 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.
@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"
@polloymedio
@polloymedio 2 жыл бұрын
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
@CesarAugustoRL
@CesarAugustoRL Жыл бұрын
Excellent video, thank you for the detailed explanation
@Zomp420
@Zomp420 3 жыл бұрын
You forgot the comma....it's "Hello, World!"
@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
@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 )
@Moody0101
@Moody0101 2 жыл бұрын
I always learn something new when I watch your content :3 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!
@_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
@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.
@erosmlima5981
@erosmlima5981 2 жыл бұрын
Assembly was my first playlist created at github, and until now I never try to make hello world, thanks for teach us.
@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.
@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!
@blenderlove2386
@blenderlove2386 3 жыл бұрын
Eye-Opening. Thanks!
@BeatMax2023
@BeatMax2023 3 жыл бұрын
Really interesting insight. Thanks for sharing!
@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!!!
@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
@protocol2746
@protocol2746 Жыл бұрын
What a lot of output code does it use a “null detection” print. All it means is that you append a null character i.e. 0x0 to the end of your string, and CMP to 0 otherwise loop and print. It means you don’t have to hold the length inside a variable - very useful!
@VulcanOnWheels
@VulcanOnWheels 4 жыл бұрын
1:11 I recognize that from Cobol. 8:23 You can move all three lines at the same time. Just go to the top semicolon, tap the Esc key and type this for each indent you want to make: 3 > > 3 being the number of lines you want to indent.
What Is Assembly Language?
24:56
javidx9
Рет қаралды 451 М.
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 70 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 23 МЛН
Looks realistic #tiktok
00:22
Анастасия Тарасова
Рет қаралды 105 МЛН
Exploring How Computers Work
18:12
Sebastian Lague
Рет қаралды 3,4 МЛН
x86 Assembly Crash Course
10:45
HackUCF
Рет қаралды 826 М.
GHIDRA for Reverse Engineering (PicoCTF 2022 #42 'bbbloat')
17:44
John Hammond
Рет қаралды 200 М.
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 2,1 МЛН
Linux File System/Structure Explained!
15:59
DorianDotSlash
Рет қаралды 4 МЛН
ЯЗЫК АССЕМБЛЕРА С НУЛЯ | #1 НАЧАЛО
54:43
Web in Native Assembly (Linux x86_64)
2:03:41
Tsoding Daily
Рет қаралды 55 М.
Malware Development: Processes, Threads, and Handles
31:29
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 70 МЛН