Assembly language and machine code - Gary explains!

Поділитися
Вставка
  • Опубліковано 12 гру 2024

КОМЕНТАРІ • 464

  • @nezelg
    @nezelg 5 років тому +452

    My husband, who was a student at MIT at the time, taught me to program in assembly language on our first date! It was a big help in understanding languages in future jobs that I had as a technical writer.

    • @racsovbibli765
      @racsovbibli765 5 років тому +154

      So romantic :)

    • @ibobaiofficial
      @ibobaiofficial 4 роки тому +104

      Programmers are so bad at dating that they explain assembly language for a woman :( !
      But what's good that he won your heart :), wish you a long life!

    • @biggSHNDO
      @biggSHNDO 4 роки тому +46

      “Hey baby! akdj - jdbf= inr0 (1)
      😜💦”

    • @kurororushirufuru2850
      @kurororushirufuru2850 4 роки тому +40

      Girls nowadays will be freaked out if you show them these freaking codes on first date.

    • @ThatGuyDownInThe
      @ThatGuyDownInThe 4 роки тому +1

      @@biggSHNDO LMFAO

  • @amihartz
    @amihartz 8 років тому +238

    I've written a lot of assembly code for the TI-83 and TI-84 calculators. They're quite nifty little pocket computers that, unlike cellphones, teachers don't question you messing around with in class. They're really slow, so the only practical way of making apps is using assembly language (Z80 Assembly specifically). I learned that and wrote a ton of apps for it. Some were practically useful for class, some were just for fun, and others were just to challenge myself. It's really fun, actually, to interact so closely with the hardware. I wrote one app where you could write out a string of music notes and duration and it could actually play them through a pair of speakers plugged into the I/O port using an adapter. This is not something you can easily do with something like Java because most high-level languages don't let you directly interact with hardware so easily. I attempted to write machine code once just for the heck of it, and I wrote a simple program that could convert numbers to their hex values. But that's about all, writing machine code is pretty pointless unless your machine is so primitive it doesn't even have an assembler yet.

    • @anteconfig5391
      @anteconfig5391 5 років тому +20

      writing machine code is pointless... Unless you're a hacker that hates compilers

    • @joeri9603
      @joeri9603 5 років тому +4

      @@coderdude9417 I'd recommend RISC-V for that. It makes it a lot easier.

    • @kevinrickey3925
      @kevinrickey3925 5 років тому +3

      WORD, I learned to program the Z80 for the TRS-80 back in 1980, since then I've learned the 6502 (zero-page addressing), then finally the Intel 8088-8086 in 1990. Programming in Assembly/machine is Absolutely a rush, I still Love IT! Rodnay Zaks makes good books

    • @IntoxicatedDriver
      @IntoxicatedDriver 4 роки тому +1

      @@anteconfig5391, agreed - considering that there exist assemblers to translate assembly source to machine code.

    • @IntoxicatedDriver
      @IntoxicatedDriver 4 роки тому +1

      @@coderdude9417 for dabbling with tiny OS functionality and more (compiler, interpreter, "shell"), you may want to consider to have a look at a standalone Forth, which combines all these in a (potentially) tiny program. "Tiny" means, less than 4k (down to around 2k of code)

  • @baigadil
    @baigadil 4 роки тому +24

    last used machine code in my bachelors in computer science, we actually put little 3 pin transistors on our own toy of a PCB, created our AND, NOT, OR, NAND gates in different configuration and wrote simple arithematic operations and got happy about it! fast forward 16 years, I am doing data engineer and data science in python against big data and sometimes i get deja vu of the simplest binary operations that are happening underneath with an orchestra of more than a billion finFET transistors! its simply amazing how humans build layer upon layer over original understanding of anything all in name of efficiency and progress!

    • @ozzyplayz7082
      @ozzyplayz7082 7 місяців тому

      u dont need to lie about being a data engineer lol

    • @rizzwan-42069
      @rizzwan-42069 4 місяці тому

      @@ozzyplayz7082 fym lying

  • @Enedrapvp
    @Enedrapvp 8 років тому +93

    Roller Coaster Tycoon was also written in assembly.
    2 Assembler courses is a minimum at my university for any CS major (in 2016, IBM hires like 25% of graduates).

    • @thenineinchnailer5674
      @thenineinchnailer5674 7 років тому +5

      I did not know that! Thanks for the fun fact!

    • @heatxtm
      @heatxtm 7 років тому +7

      tons of games were written in assembly

    • @victornaut
      @victornaut 7 років тому +1

      Retro Rampage City had some functionalities written in Assembly I guess...

    • @retiredshitposter1062
      @retiredshitposter1062 6 років тому +9

      I wrote a fun game called World of Warcraft in assembly, it was a lot of work, but after 2 1/2 months I got it done. People seem to like it! It's very popular.

    • @eyesnteeth1611
      @eyesnteeth1611 5 років тому

      Love your username what school do you go to

  • @RnBandCrunk
    @RnBandCrunk 7 років тому +9

    The C compiler first optimizes your code (in C), then creates an assembly file from it and then the object file, which is machine code for the computer and finally an exe-file, which is basically the result of the linker going over the object file afaik.

  • @NOTMuzzaFuzza
    @NOTMuzzaFuzza 8 років тому +3

    If anyone wants to dig deeper into what Gary explained beautifully in this video, I would recommend to learn about the hardware and software of the Intel 8080 or 8085 microprocessor.
    It is basic enough for you to grasp the concept of mnemonics to machine code and its hardware is very simple and streamlined.

  • @mangocode3250
    @mangocode3250 2 роки тому +2

    I learn 8086 Assembly now only for 2 days. And now i can see all these possibilities in programming.
    Before assembly i programmed in C/C++ but after I discovered OS-Development I turned crazy...
    I sat 48 hours in my desktop chair and made my first little bootloader with a minimalistic GUI.
    in the beginning I thought I'll never understand assembly. But when you do its not so hard anymore.
    Except the annoying researches to remember the 8086 BIOS interrupts... and the time you spend to convert ASCII or DECIMAL to hexadecimal...
    Anyway. Assembly is the fastest and best language to use the complete computer power!

  • @mrsconsolelog
    @mrsconsolelog 4 роки тому +13

    I just started my second semester with subjects related to software engineering, and about to start assembly languages in few weeks. It sounds exiting to get a glipmse, about where and how data gets storage to translate in to binary code... Thanks !

  • @davidpolberaff8875
    @davidpolberaff8875 2 роки тому +2

    Assembly language is extremely underrated I’ve written a lot of it and I can say it was a lot more fun to learn assembly than any other language I’ve used

  • @subhashisghose
    @subhashisghose 2 роки тому +2

    Still somehow the best explanation of these concepts even after 6 years.

  • @statikverse
    @statikverse 7 років тому +5

    My current project is writing a simple VM to perform arithmetic. This helped me grasp a lot. Thanks

    • @anere5326
      @anere5326 5 місяців тому +2

      how it's going

    • @statikverse
      @statikverse 5 місяців тому

      @@anere5326 I passed 😊

  • @jeraldgarner1636
    @jeraldgarner1636 10 місяців тому

    Great explanation Gary! I'm taking my 1st Assembly Language class this week and I learn by understanding concepts visually and you are excellent at it! I remember being in electronics in Highschool, having a Vic 20 and Commodore 64, wanting a Sinclair and working to build a robot vis wire wrapping. I joined the USAF and was n communications for 8 years, then on to web design and networking in the civilian world. Programing this Assembly looks like learning Greek to me but you have helped! I hope I can learn more from you as the class progresses!

  • @orionwilson8796
    @orionwilson8796 7 років тому +1

    I'm quite new, and being that I am in the process of learning this apart from a scholastic environment, this video was indeed very helpful. thank you.

  • @Dr.physioAli
    @Dr.physioAli 7 років тому +3

    I am literally fascinated by the programmings and its complexity complexity

  • @farhaadali4245
    @farhaadali4245 3 роки тому

    Yup.....and I have recently done a course on "Computer Organization" and I loved machine and assembly level programming.

  • @AbdulWahab-gn5hn
    @AbdulWahab-gn5hn 8 років тому +1

    I am a student of electrical and electronics engineering and I had experience with Java but I really like assembly language.
    We use Atmel 8052 series as testing platform.

  • @FranciscoLopez-es8fi
    @FranciscoLopez-es8fi 8 років тому +1

    It is really cool that this kind of content is also shown in Android Authority

  • @manuelpena4547
    @manuelpena4547 8 років тому +47

    As a computer science student I can say it's a really good explanation. Btw, I have to say I hate assembly code lol

    • @GarySims
      @GarySims 8 років тому +4

      +Manuel Peña As someone who actually has a computer science degree I can say its a good explanation as well! :-)

    • @davidprock904
      @davidprock904 4 роки тому

      What im working on is more complex to make something happen, but at the same time easier to use

    • @JossinJax
      @JossinJax 3 роки тому

      Yeah in some instances i see the register on the right and the literal or variable on the left. Here, it's the opposite. What gives? Just diff. types of assembly?>

    • @manuelpena4547
      @manuelpena4547 3 роки тому

      @@JossinJax all assembly langs are quite similar but yeah, none of them are the same. Must be something about the assembly you use

    • @HarshYadav-yi7tv
      @HarshYadav-yi7tv 3 роки тому

      Same here bro

  • @pnamajck
    @pnamajck 5 років тому

    gary … just wanted to thank you for sharing your knowledge … with the discussion on machine language … i watched only for human interest and not for application.

  • @lisamariefan
    @lisamariefan 7 років тому +1

    I'm learning how to write assembly/machine code on the TI-84. I guess the actual writing isn't so bad perse but finding out about key memory locations like VRAM and figuring out the routines that you can call from ROM are what make the actual coding challenging...

  • @biggSHNDO
    @biggSHNDO 4 роки тому

    Wasn’t expecting the “not understanding what youre saying” guy to pop up at the end- that was a slick visual reference, made me feel some humour. Almost laughed. Pretty good.
    Thanks for the video- learning JavaScript, exploring the BASE basics.

  • @PihkalTheTihkal
    @PihkalTheTihkal 8 років тому +39

    Back in the days (20 years ago) assembly was one of my favorite languages.
    Sure it was a lot of work to code in it but it was light and blazingly fast.
    I loved It!
    These days I'm more of a C kind of guy.
    Btw, great video Garry, you're the best content creator AA has!

    • @nyanator8110
      @nyanator8110 8 років тому +3

      ok

    • @JohnyPhate
      @JohnyPhate 8 років тому

      +Pihkal82 try TIS-100

    • @amihartz
      @amihartz 8 років тому +1

      +Pihkal82 Last time I used assembly was with those TI-83/84 graphing calculators only a couple years ago. Those things are really slow, so the only practical way of writing fast programs is in assembly (Z80 assembly), so I learned that and wrote a lot of nifty apps for it. Working so close to the hardware is quite fun, actually.

    • @Lidi-Rumbling
      @Lidi-Rumbling 8 років тому

      +Pihkal82
      I am learning C now but I hate the strings in C because its literally an array of chars...

    • @perimiter
      @perimiter 8 років тому

      +HeroPlane you can cheat a little and use # include

  • @omsingharjit
    @omsingharjit 3 роки тому

    5:14 now it's makes sense to me Assembler is just newly Called complier both have same work but with different languages . Right ?

  • @elucidator1277
    @elucidator1277 8 років тому +16

    Even though I don't code, I did feel like I got a lot from this video...even as a layperson. Thanks Gary. :D

  • @billh1337
    @billh1337 4 роки тому

    I’m a CE and EE major and currently we are designing/creating a MIPS ISA CPU. It’s so fun and interesting but definitely the hardest and time consuming class I’ve ever taken. We have to learn both how to program in assembly and then take that knowledge and create a pipelined data path CPu.

  • @Phildouf
    @Phildouf 8 років тому +9

    Great stuff, Gary! Love the fact you're allowing AA to get "behind the scenes" of tech, to help us understand how it all works!

  • @Bob-zg2zf
    @Bob-zg2zf 5 років тому

    oh my god, this video is pretty helpful. I watched it a while back and quit watching it cuz I was lost by the time he talks half way through. However, today I talked to my coworker and we discussed about machine code and I started to re-watch this vid and I started to understand most of this video. Fabulous! Thank you so much!

  • @danielcu96
    @danielcu96 8 років тому +6

    Great explanation! I have only a little bit of insight into programming languages, but this video made the concepts of assembly language and machine code crystal clear. Love your videos Gary, keep being so informative!

  • @RexGalilae
    @RexGalilae 8 років тому +1

    4:31
    It can be done in two lines
    int i = 15, j =25;
    i += j;

    • @rubberduckdebug
      @rubberduckdebug 8 років тому +2

      +Mohammed Zaid Technically, you can do it in one line:
      int i = 15, j =25; i += j;
      I've have a few hundred lines of code squished into one line, and it worked. :P

    • @RexGalilae
      @RexGalilae 8 років тому

      Rubber Duck With Ithyphallophobia
      Hehe. LOL. I knew someone was about to say this thing =P
      I like to define a "line" in C/C++ as the statement before a semi colon.
      Even #include and #define can be considered a line despite not having semi-colons.

    • @GarySims
      @GarySims 8 років тому

      +Mohammed Zaid Lines in C aren't really a well define concept which is why C has semicolons everywhere... In the context of the video I use "lines" to refer to separate operations, i.e. setting i to 15 and so on. If you want to learn more about writing code in as very few lines as possible they I suggest you search for the Computerphile video "Code Golf & the Bitshift Variations" on UA-cam.
      You might also want to check out "The International Obfuscated C Code Contest."

    • @RexGalilae
      @RexGalilae 8 років тому +1

      *****
      True. I guess it's better to define a line your way. It's the operations that matter afterall. Not the semi-colons which can hold more than one operation as in my case.
      *...I suggest you search for the Computerphile video "Code Golf & the Bitshift Variations" on UA-cam.
      You might also want to check out "The International Obfuscated C Code Contest."*
      Hehe. It's quite interesting. I'll check it out. Good for confusing other people, I guess?
      But I still prefer pretty-print with all the indents and stuff. ;)

  • @fernandogallardo3477
    @fernandogallardo3477 3 роки тому

    It’s cool to know that modern hardware works with twos complement since it is hardware friendly.

  • @gourou_t
    @gourou_t 8 років тому

    I learnt how to perform ALP operations on Intel's 8085 and performed some operations too. It's amazing once you get the hang of it

  • @jescalm
    @jescalm Місяць тому

    Great video! Explains syntetically the difference beteeen machine code, assembly, compiled languages and even Java! Great

  • @shyamgohil1595
    @shyamgohil1595 8 років тому +11

    How assembler works???
    How was the first assembler made???

    • @melvinfoo69
      @melvinfoo69 7 років тому +10

      shyam gohil you write the first assembler in machine code by hand. Then you rewrite the assembler in assembly code.

    • @Flowtail
      @Flowtail 6 років тому

      Assembly is actually something you can do entirely by hand; so when he says “the assembler turns it into numbers”, that could mean either a computer, or an actual human

  • @brassj67
    @brassj67 5 років тому +1

    I wrote machine code and assembly language on a Commodore PET back in 1980

  • @andrewzuo86
    @andrewzuo86 8 років тому

    I like assembly. It may take a long time but you know what everything is doing. Not like some other languages that put random things like asterisks and ampersands everywhere. And then give you cryptic errors like 'segmentation fault' which leaves you to scour your entire file for a problem. It's like looking for a needle in a haystack.

  • @DavidDeLuge
    @DavidDeLuge 8 років тому +5

    Great video! Very well explained and it takes me back to my microelectronics studies back in the 80s. Needless to say, I'm a developer today but writing SAP ABAP code these days. However, I've been inspired to get a Raspberry Pi 3 and start writing Python, PHP, and Java Script to make it do things.

  • @ihsanbob7573
    @ihsanbob7573 8 років тому +3

    I am studying this at my first year at CS
    nice stuff, keep these kinds of videos rolling

  • @EHCBunny4real
    @EHCBunny4real 8 років тому +3

    In the 70's machine language and assembler was the first computer languages I programmed with. I had to use keypunch. If you did not number each card and accidentally dropped your stack you would have major problems.

    • @davidmcbenge9370
      @davidmcbenge9370 8 років тому +1

      +EH CBunny Or if you had one stuck, you had to clean the machine and hope you had everything put back correctly. I used to work on Fortran and Cobalt before DOS 2.0-6.0, I think, then I went to 3.2 word or easy, the Windows 95 and so on. Most of what I knew very well then doe's not apply now, but I have a better base understanding than most programmers today.

    • @EHCBunny4real
      @EHCBunny4real 8 років тому +1

      I worked in network design and in the 90's I had to convince many corporations it's time to let go of the past and move on to IP networking. When one group removed their mainframe they replaced it with a corporate swimming pool

  • @IntoxicatedDriver
    @IntoxicatedDriver 5 років тому

    Only few compilers generate machine code directly nowadays, as it is suggested at 5:00. The majority of compilers are just a kind of text-to-text translators, outputting assembly - which is then converted to machine code by an assembler, as part of the process to obtain an executable program. Commonly does a compiler have a switch for instructing it to keep that generated intermediate assembly source, rather than deleting it once the assembler is finished with it.

  • @growgrowing
    @growgrowing 8 років тому +1

    My brain has now restored to tabula rasa, but loved the explanation. Thank You. On to machine code

  • @davidprock904
    @davidprock904 4 роки тому +1

    I have been off and on developing an assembly language and the boolean logic gate setup to match, mine is not like the Harvard or Von Newman, one person described it as a Wetware and another person said it's like a Virtualized Wetware.
    I say it is extremely wasteful on the level of logic gates being used, and in a regard to security is absolutely horrible (but that can be worked on later)
    And those are its only flaws,, but the power and capabilities it gives you is insane,
    It would (someday maybe) be the last architecture design ever needed to be made.
    Here is a comparison to a regular computer giving you maybe an idea of the unimaginable capability.
    Just say your running an extremely intensive number crunching application. With a regular computer your stuck with the core and thread count that you have.
    My design it is theoretically unlimited but let's shape it up to a regular computer, while running this intensive number crunching. During that time let's say your not making use of the internet (your network) or your mouse or speakers, you could write new code or change current code to disable those external devices to give yourself an extra level of simultaneous parallel internal communication AKA more threads/cores.

  • @giobikefans
    @giobikefans 7 років тому +4

    So just to be clear, the assembler is software based and not built into the CPU (that is there is nothing in the CPU distinctly built to convert assembly into machine code) correct?

    • @freecrac
      @freecrac 6 років тому +3

      Yes.

    • @brassj67
      @brassj67 5 років тому +2

      The CPU only understands binary like Morse code is binary. When writing machine code it is usually written in hexadecimal rather than binary 1s and 0s. So 0101 1111 would be written as 5f. Trying to remember these hex codes and what instructions they perform in the CPU is very challenging just like trying to remember what the dots and dashes represent in Morse code. So using an op code in assembly language like MOV to indicate that you want to move data into, within or out of the CPU to memory is far easier to remember. The assembler directly converts one assembly language op code into machine code. Because of this it can be done on the fly and that is why assembly language is low level as opposed to BASIC which is high level and has to be compiled first before executing

  • @BastianHodapp
    @BastianHodapp 8 років тому +3

    Funny that you upload this right now - I just tried out 6502 coding for a university assignment last week :D

    • @aggbak1
      @aggbak1 8 років тому

      nes coding I presume?

    • @aggbak1
      @aggbak1 8 років тому

      can you help me out with that?

  • @ShaulRosenzweig
    @ShaulRosenzweig 8 років тому +3

    Not 100% true. Java is compiled to java bytecode, yes, but on android there are 1 or two more steps. It is then compiled to dex, dalvik bytecode (Android JVM used to be called dalvik), and if device is newer and runs ART (android runetime), it will be compiled to OAT on device after installation ("optimizing application" dialog is shown while it happens). OAT files are actually machine code (elf binaries). So on modern android devices Java gets compiled into machine code.
    Also, regarding NDK, while it is possible to write native executables, in most cases they are useless toys (unless you are modifying the Android itself). Most of the NDK development is to make shared libraries that run under the virtual machine, interfacing with Java via JNI (Java native interface).

  • @murugeshsurya-pb8ip
    @murugeshsurya-pb8ip 4 роки тому

    man your explanations are too good

  • @sandspatel
    @sandspatel 8 років тому

    Very clear, and fun way to put it across.

  • @SangeetaGupta-ov3rq
    @SangeetaGupta-ov3rq 7 років тому

    thankyou so much,i searched everywhere meaning of bytecode in java but your video has completely cleared my doubt

  • @MrKeri1997
    @MrKeri1997 6 років тому

    I'm currently studying electrical engineering and in this semester I have a subject called Digital Technology 2 (yes there was one in the previous semester also) and we will be writing some assembly code. I'm kinda interested but at the same time I'm not looking forward to it too much.

  • @Pleiadiaes
    @Pleiadiaes 7 років тому +1

    I don't have any programming skills, but I understood what you were explaining.

  • @Cyberdemon1985
    @Cyberdemon1985 3 роки тому

    I programmed with assembly language in college on on Vax back in 1986. 4 years later I took Data Structures which was heavy Borland Pascal programming. I hated assembly language too. lol

  • @devenmhatre8224
    @devenmhatre8224 4 роки тому

    Thanks, Nice explanation.
    Is Rust also like C, C++ which does not have something like JVM?

  • @broswirski4513
    @broswirski4513 8 років тому

    Gary is the best teacher!

  • @xceeder
    @xceeder 8 років тому +9

    another very informative video from Gary , I'll look forward to your next video....

  • @tommyhuffman7499
    @tommyhuffman7499 Рік тому

    I found your video, because I'm trying to make a decompiler to go from machine to Arm Assembly - not a full-scale project of course, just something to work with a very limited instruction set to play with.

  • @NatchEvil
    @NatchEvil 5 років тому +1

    This helped amazingly in my project to understand how NES games were programmed. I suddenly have a higher respect for those old cartridges.

    • @skycloud4802
      @skycloud4802 4 роки тому

      Yeah, I have a lot of love for my Gameboy and it baffles me how much they squeezed the games out of its extremely limited hardware. Those programmers must have been gods.

  • @akshatbhatt4022
    @akshatbhatt4022 5 років тому

    Diagram of high level language only showed that the compiler converts the high level code to low-level machine code.
    But in reality an object file is created in between that is further processed by the linker which then converts the code into low level machine code.

    • @IntoxicatedDriver
      @IntoxicatedDriver 3 роки тому

      that object code contains machine language already, with symbolic information (and more) added. I think you can consider object code to be machine code already, albeit an object file isn't exclusively machine code.

  • @chrs-wltrs
    @chrs-wltrs 4 роки тому

    I'm writing raw machine code (LC-3) for my CS course right now, and it's pretty grueling. I came here to learn what the difference was between machine and assembly

    • @IntoxicatedDriver
      @IntoxicatedDriver 3 роки тому

      in a nutshell: assembly is a symbolic representation of machine code. easier to read (and write) for humans, but harder for the machine, which prefers machine code.

  • @vinayn9110
    @vinayn9110 5 років тому

    LDA #15
    INC X
    LDX $D010
    ADC $C001,X
    first few lines of code for the Terminator. The above means "I want your clothes, your boots, and your motorcycle".

  • @oneminutefixed5003
    @oneminutefixed5003 8 років тому

    another awesome video, loving these series

  • @Doomerboss
    @Doomerboss 8 років тому +7

    I wish my professor would introduce us Assembly Language with a video like this back in college :D Nice video!

  • @pcuser80
    @pcuser80 7 років тому

    I have several own c programs running on my phone.
    All compiled with the NDK, first i was using a generic arm compiler but all programs have to statically linked. (huge file size)

  • @stephenmvura6626
    @stephenmvura6626 7 років тому +2

    i think u went more into how the CPU works and not what is meant by Assembly language for example you could have talked about symbolic addressing absolute addressing e.t.c but overall great video Gray absolutely loved it

    • @MarcellDAvis1103
      @MarcellDAvis1103 6 років тому +1

      Joshua Waters to understand how assembly works you first of all need to know how a cpu works

  • @chimpionboy
    @chimpionboy 6 років тому

    The best explanation so far.

  • @mofojackson
    @mofojackson 7 років тому +1

    You say for faster processing use 'C'. But does the same apply for C++ or just 'C' specifically ?
    Thanks for this vid and definitely giving thumbs up :)

  • @josefano
    @josefano 7 років тому

    "Smile sweetly and let the conversation carry on" lol

  • @mikedugumquick3535
    @mikedugumquick3535 3 роки тому

    Thank you. I found this video to be enlightening. Moreso, I would love to learn more about building a computer random access memory. It would be amazing to find some helpful resources.

  • @danishvasta7742
    @danishvasta7742 8 років тому +2

    I enjoyed playing with assembly language throughout my engineering!

  • @franknomustard
    @franknomustard 8 років тому +2

    I learned how to program in machine code on a user hostile 6809E machine provided to me via my electronics school, CIE. I was able to move out of my parents' house with the work I was able to get. That was over 30 years ago. It does make a difference.

  • @lokesh-2059
    @lokesh-2059 7 років тому +1

    do very compiler convert our coding to assembly language and to binary codes??? please reply me

  • @parthaj33
    @parthaj33 8 років тому +3

    thanks about this intro its really clears my doubts as i am intermediate in programming

  • @TheRafelito19
    @TheRafelito19 8 років тому +1

    Good information I didn't know there was such a thing as an NDK. That sure will be useful that way I love be able to minimize ram usage of my apps

    • @jamilkafi5551
      @jamilkafi5551 8 років тому

      +Rafael Santana It is not recommended unless yo need it.

    • @TheRafelito19
      @TheRafelito19 8 років тому +1

      +jamil kafi yeah because you have more power than Google wants you to have

  • @murwaz
    @murwaz 8 років тому

    MenuetOS is written in Assembly language :) Pretty cool little OS, I tried it years ago, but as I'm not a developer I dont have use for such an OS, but I love testing new operating systems. :)

  • @3rdwiki
    @3rdwiki 8 років тому

    I heard Rollercoaster Tycoon was written in assembly. Any thoughts on that ?
    Also, How high is high ? Is there a way to gage proficiency ?
    I'd like to do something in Lisp. But just because RMS says it's the god language , no other reason.
    Perhaps you could tell me how high Lisp is in the code ladder ?
    Also if it's possible, I'd like to hear a video on Lisp, too.

  • @mohamadalikhani2665
    @mohamadalikhani2665 3 роки тому

    Complete and thorough. Keep it up👍🏻👍🏻

  • @TheWaynelds
    @TheWaynelds 4 роки тому

    Weren’t Nintendo, Atari, and Arcade games (like MortalKombat ) written in assembly too? My old TI 86 calculator supported asm language as an alternative to its Basic program language.

    • @IntoxicatedDriver
      @IntoxicatedDriver 3 роки тому

      Most likely some are. Some aren't, for example is Atari Defender said to be written in Forth.

  • @ChrisToffer1
    @ChrisToffer1 8 років тому +2

    I've been using assembly for PIC microcontrollers, this gets realllyyyy lengthy, and hard to debug

  • @MrInk113
    @MrInk113 8 років тому +3

    Very nice video! Looking forward to more like these!

  • @eyesnteeth1611
    @eyesnteeth1611 5 років тому

    The smile and nod gets me

  • @vicvic553
    @vicvic553 4 роки тому

    So, an assembler is a programme which translates the assembly language into the machine code, right? The question is - how an assembler is created, i.e. in which language it is written, etc.?

    • @IntoxicatedDriver
      @IntoxicatedDriver 3 роки тому

      Yes, it is. And it doesn't matter what language an assembler is written in. It's a program which reads input (the assembly source), and translates it to output (machine code, or an "object file" which contains both machine code and symbolic information). The process of that translation is even rather simple, compared to what compilers do.

  • @unlokia
    @unlokia 6 років тому +3

    Hello Gary. :)
    A minor correction, if I may: OPcodes, not "OPTcodes", since they're OPeration codes.
    Thank you for another stellar video, God bless you Sir.
    Matthew.

  • @aryanrastogi45
    @aryanrastogi45 8 років тому +2

    nice stuff Gary and Android authority

  • @ruhamabizuayehu710
    @ruhamabizuayehu710 4 роки тому

    its such amazing lecture please tell us more about assembly language

  • @sishanmaharjan7759
    @sishanmaharjan7759 5 років тому

    great video :)
    Explains quiet well about the general concept over the types of the machine level language.

  • @georgeross7145
    @georgeross7145 8 років тому

    Looong ago I had to learn to program an IBM 360 machine with Fortran. This was just as Fortran 4 was coming out. I haven't bothered with it since so your update was refreshing. You mentioned lo-levels, right?
    How do "hackers" send virus'? Which language do they use?

  • @devgr89
    @devgr89 7 років тому

    While producing the machine code does compiler itself make sure that it's creating proper instruction set (32 or 64 bit) consisting of op-code and operand?

    • @freecrac
      @freecrac 6 років тому +1

      Yes and the BITS directive (BITS 16 , BITS 32 , or BITS 64) specifies whether the assembler should generate code designed to run on a processor operating in 16-bit mode, 32-bit mode, or 64-bit mode.
      Intel 80386+
      A closer look to the possible sorts of bytes of one instruction:
      Instruction Prefix 0 or 1 Byte
      Address-Size Prefix 0 or 1 Byte
      Operand-Size Prefix 0 or 1 Byte
      Segment Prefix 0 or 1 Byte
      Opcode 1 or 2 Byte
      Mod R/M 0 or 1 Byte
      SIB, Scale Index Base (386+) 0 or 1 Byte
      Displacement 0, 1, 2 or 4 Byte (4 only 386+)
      Immediate 0, 1, 2 or 4 Byte (4 only 386+)
      Format of Postbyte(Mod R/M from Intel-manual)
      ------------------------------------------
      MM RRR MMM
      MM - Memory addressing mode
      RRR - Register operand address
      MMM - Memory operand address
      RRR Register Names
      Filds 8bit 16bit 32bit
      000 AL AX EAX
      001 CL CX ECX
      010 DL DX EDX
      011 Bl BX EBX
      100 AH SP ESP
      101 CH BP EBP
      110 DH SI ESI
      111 BH DI EDI
      ---
      (Note: We observe the next two tables from the 16 bit address mode. The D flag in the code-segment descriptor is not set. The default size of memory access and the operand size (without size prefixes) is 16 bit.)
      16bit memory (No 32 bit memory address prefix)
      MMM Default MM Field
      Field Sreg 00 01 10 11=MMM is reg
      000 DS [BX+SI] [BX+SI+o8] [BX+SI+o16]
      001 DS [BX+DI] [BX+DI+o8] [BX+DI+o16]
      010 SS [BP+SI] [BP+SI+o8] [BP+SI+o16]
      011 SS [BP+DI] [BP+DI+o8] [BP+DI+o16]
      100 DS [SI] [SI+o8] [SI+o16]
      101 DS [DI] [DI+o8] [SI+o16]
      110 SS [o16] [BP+o8] [BP+o16]
      111 DS [BX] [BX+o8] [BX+o16]
      Note: MMM=110,MM=0 Default Sreg is DS !!!!
      32bit memory (Has 67h 32 bit memory address prefix)
      MMM Default MM Field
      Field Sreg 00 01 10 11=MMM is reg
      000 DS [EAX] [EAX+o8] [EAX+o32]
      001 DS [ECX] [ECX+o8] [ECX+o32]
      010 DS [EDX] [EDX+o8] [EDX+o32]
      011 DS [EBX] [EBX+o8] [EBX+o32]
      100 SIB [SIB] [SIB+o8] [SIB+o32]
      101 SS [o32] [EBP+o8] [EBP+o32]
      110 DS [ESI] [ESI+o8] [ESI+o32]
      111 DS [EDI] [EDI+o8] [EDI+o32]
      Note: MMM=110,MM=0 Default Sreg is DS !!!!
      ---
      SIB is (Scale/Base/Index)
      SS BBB III
      Note: SIB address calculated as:
      =+*(2^(Scale))
      Fild Default Base
      BBB Sreg Register Note
      000 DS EAX
      001 DS ECX
      010 DS EDX
      011 DS EBX
      100 SS ESP
      101 DS o32 if MM=00 (Postbyte)
      SS EBP if MM00 (Postbyte)
      110 SS ESI
      111 DS EDI
      Fild Index
      III register Note
      000 EAX
      001 ECX
      010 EDX
      011 EBX
      100 never Index SS can be 00
      101 EBP
      110 ESI
      111 EDI
      Fild Scale coefficient
      SS =2^(SS)
      00 1
      01 2
      10 4
      11 8

  • @kaustubh3d
    @kaustubh3d 8 років тому +2

    Aptly explained.... No simpler way to explain the difference between them..Good going

  • @jakec5618
    @jakec5618 Рік тому

    Is the assembler the same as a compiler ?
    Also, how exactly does it "translate" the assembly language into binary ?
    Thanks

  • @TheHooy
    @TheHooy 6 років тому

    Does the Android Runtime compile Java code to machine code? Or does it compile it to .oat files and something else compiles the .oat file to machine code?

  • @CopernicoTube
    @CopernicoTube 8 років тому +1

    Congratulations to explain this to people, AA! :)
    But I found myself in need to advise: bad writen C/Assembly code is much worse to performance than an average high level code.
    And lets face it: almost all handwriten and not profiled (again and again) C or Assembly code is bad and buggy.

  • @vicvic553
    @vicvic553 3 роки тому

    Hi, I have got a question - how the assembler (program) was written/implemented, i.e. it was in machine code? I'm just wondering, it translates assembly language into machine code, so it had to be implemented in some language and I gues it was in machine code, right? Of course, I am asking about the very first assembler. Am I right? If yes, how did this process of programmings in machine code look like? People were writing commands using only 0 and 1?

    • @IntoxicatedDriver
      @IntoxicatedDriver 3 роки тому

      it doesn't matter what language an assembler is written in, as long as it can translate assembly to machine code. If there's no assembler on the target you're translating to, you can use (or write, then use) a "cross assembler" written and running on a different machine. Again, this cross assembler only needs to read assembly source, written for your target CPU, and translate it to machine code for your target CPU. Such a cross assembler can, again, be written in about any language, even as shell script, if you like. But even without any assembler, cross-assembler or computer with any programming language at all, you still wouldn't need to code in 0 and 1 only - unless you only have toggles (switches) to form the bit combinations of individual machine instructions, then load them into memory -, because it'd still be easier to use hex numbers instead. Consider hex as a kind of shorthand for binary, extremely simple to convert one to the other and vice versa, but much more efficient to enter, in comparison to endless strings of zeroes and ones.

  • @andrewmuller5826
    @andrewmuller5826 8 років тому +4

    Why cant you just write something in Java, use a program to "Translate" it to machine code and save this as its own file, and then run the machine code file to make it faster? Why does Java etc. have to compile every time it runs?

    • @NerdyTurd307
      @NerdyTurd307 8 років тому +9

      because different CPUs and GPUs use different Instruction Set Architecture (ISA), meaning one set of bits (e.g. 01000110) might mean a LOAD command to one CPU, but a STORE command to another CPU. Compilers and Operating Systems (OS) will correctly convert the source code into machine code for each ISA it is compatible with. This is why you need CPUs, GPUs and their drivers need to be compatible with your OS and the compilers you're using need to be compatible with your OS. this means that if you compile a Java program into machine code on one PC, then try and execute the code on another PC, the second PC will only accept the machine code if it has the same OS, GPU, CPU and drivers as the first PC.
      think of software communication like a 5 step ladder:
      Apps
      OS
      Drivers
      BIOS
      Hardware
      Since compilers are apps, they must go through the OS first, then the Drivers, then the BIOS to tell the hardware what to do.

    • @andrewmuller5826
      @andrewmuller5826 8 років тому

      ok i see. So if you are writing a program you only intend to use on one computer, then it is possible to do this? assuming you dont change any of the drivers/gpu/other stuff? Im just thinking in terms of scientific modelling which can be really intensive.

    • @NerdyTurd307
      @NerdyTurd307 8 років тому +5

      NOTE: I'm just an amateur programmer myself using free websites (Mainly youtube and tutorialspoint), while studying at Uni. therefore take what I say with a grain of salt or two. Sorry I didn't mention that in my first reply.
      Yes, you can just have the compiled file, if that code is only going to run on 1 PC or PCs with the same OS and the same ISAs for their GPUs and CPUs, with the same drivers, e.g. video game consoles.
      HOWEVER it is extremely imported to keep your source code (Source code is the original code, with the original tools you used to make, e.g. notepad++, gcc compiler, visual studio and PC with specific specs etc.), because it is much easier to edit, debug and upgrade your code with your source code.
      While you can get machine code and de-compile/de-assemble into assembly/mid-level/high-level code you
      1. have to know what language the code was originally written in AND
      2. the de-compiler/de-assembler programs will only work if the PC you're using can understand the machine code AND
      3. the comments in your source code will be ignored by assemblers and compilers, meaning the compiled code won't have any trace of your comments.
      Let's examine the following Hello_World.c source code. Note that the "/* my first program in C */" (Without double quotes) is one of two ways to write a comment in C.
      #include
      int main() {
      /* my first program in C */
      printf("Hello, World!
      ");
      return 0;
      }
      If I compile this code using a gcc compiler I will get this a.exe file, that will display "Hello World!" (Without double quotes). Let's say I get this a.exe file and move it into a USB stick, then my original PC get's lost or breaks and I can't fix it, nor get an exact replacement, because the PC had a CPU that is no longer made. Now what the f*ck do I do with my a.exe file???
      ALWAYS keep multiple backups of your source code, via external storage devices (USB sticks, SD Cards, external HDDs etc.), cloud services (SpiderOak is my personnel recommendation, due to it's security) and backup HDDs/SSDs/SSHDs.

    • @身世成谜
      @身世成谜 8 років тому +1

      So in your opinion, it's not java, but c and cpp. Java code is organized to be running on jvm, in order to implement cross platform.

    • @rj-nj3uk
      @rj-nj3uk 6 років тому

      You compile the source code and it is converted into object files. This object files and other required library files are all combined by the linker and then loaded in memory by the loader for execution.
      Here the compiled object files are final compiled outputs. You don't have to compile the source code again if you have compiled the source and have the object code already.

  • @controlledmaniac27
    @controlledmaniac27 8 років тому +4

    Done courses on C and C++, hated them both. Nice video though. Keep it up Gary.

  • @tilakpatel1235
    @tilakpatel1235 4 роки тому

    Thank you! you made the whole concept very clear for me

  • @karobarwithakhil
    @karobarwithakhil 7 років тому

    Hi Gary I do have basic knowledge of assembly and oops i want to take it to intermediate level..but not sure as I am working on servers..i want to pursue but assembly takes time... don't know what to do??

  • @IgnoreSolutions
    @IgnoreSolutions 8 років тому

    I think NDK only let's you write *parts* of your code in C or C++. You still need some Java logic and I think even the C/C++ still compiles to the virtual machine (Davlik or Art).
    Don't quote me on this but this is what I've heard.

    • @GarySims
      @GarySims 8 років тому

      +Axiom I don't think you are right, C/C++ code compiled using the NDK compiles to native code. When you compile the app you need to specify which architecture you are compiling for, e.g. ARM, Intel etc.

  • @Tapajara
    @Tapajara 4 роки тому

    I've written assembly for a long list of processors. ARM is perhaps the most complicated and confusing of the bunch and there are many incompatible versions so it is a nightmare to keep up with them all. Some of the mnemonics look the same but don't be fooled. The code that is generated by the different mutations aren't compatible. ARM is a terrible choice as a general-purpose processor so I would recommend avoiding the ones that are built into general-purpose machines such as laptops and desktops, especially if you ever want to program them. They work for many embedded systems because the projects can manage code that is targeted at very specific processors. That's why professionals just say don't bother with assembly language. They try to convince you to wear the C straight jacket and live with the limitations.

  • @montezeminor2854
    @montezeminor2854 4 роки тому

    I written some assembly language a longtime ago in college. Also C, C++.

  • @ganapathymb1521
    @ganapathymb1521 7 років тому

    I have a doubt,
    Does The compiler convert the HLL to Assembly language then the assembler to LLL or it directly converts it to LLL?

    • @IntoxicatedDriver
      @IntoxicatedDriver 3 роки тому +2

      Most compilers compile to assembly, which is then translated by an assembler to machine code. But there exist exceptions, compilers which generate machine code directly, albeit these are rather rare nowadays. There are also compilers which translate source to source code of another high level language, and are sometimes called "translators", but sometimes the second stage compilation by the compiler of the targetted intermediate language is just silently performed as part of the compilation process. Some high level language to C, then C to assembly, and then assembly to machine code isn't uncommon.

  • @archiemeijer9978
    @archiemeijer9978 6 років тому

    2:22 Closed captions says "move one inter-village to zero". But you didn't say inter-village did you? I can't make out exactly what you said there.

  • @HEADBOY_PHENOMENON
    @HEADBOY_PHENOMENON 7 років тому

    I'm still new at C#, I'm not going anywhere near the NDK for a long while.