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.
@racsovbibli7654 жыл бұрын
So romantic :)
@ibobaiofficial4 жыл бұрын
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!
@biggSHNDO4 жыл бұрын
“Hey baby! akdj - jdbf= inr0 (1) 😜💦”
@kurororushirufuru28504 жыл бұрын
Girls nowadays will be freaked out if you show them these freaking codes on first date.
@ThatGuyDownInThe4 жыл бұрын
@@biggSHNDO LMFAO
@amihartz8 жыл бұрын
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.
@anteconfig53915 жыл бұрын
writing machine code is pointless... Unless you're a hacker that hates compilers
@joeri96034 жыл бұрын
@@coderdude9417 I'd recommend RISC-V for that. It makes it a lot easier.
@kevinrickey39254 жыл бұрын
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
@IntoxicatedDriver4 жыл бұрын
@@anteconfig5391, agreed - considering that there exist assemblers to translate assembly source to machine code.
@IntoxicatedDriver4 жыл бұрын
@@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)
@baigadil3 жыл бұрын
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!
@ozzyplayz70824 ай бұрын
u dont need to lie about being a data engineer lol
@rizzwan-4206918 күн бұрын
@@ozzyplayz7082 fym lying
@Enedrapvp8 жыл бұрын
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).
@thenineinchnailer56747 жыл бұрын
I did not know that! Thanks for the fun fact!
@heatxtm7 жыл бұрын
tons of games were written in assembly
@victornaut7 жыл бұрын
Retro Rampage City had some functionalities written in Assembly I guess...
@retiredshitposter10626 жыл бұрын
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.
@eyesnteeth16115 жыл бұрын
Love your username what school do you go to
@RnBandCrunk7 жыл бұрын
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.
@NOTMuzzaFuzza8 жыл бұрын
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.
@mrsconsolelog4 жыл бұрын
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 !
@subhashisghose2 жыл бұрын
Still somehow the best explanation of these concepts even after 6 years.
@davidpolberaff88752 жыл бұрын
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
@Dr.physioAli7 жыл бұрын
I am literally fascinated by the programmings and its complexity complexity
@statikverse7 жыл бұрын
My current project is writing a simple VM to perform arithmetic. This helped me grasp a lot. Thanks
@anere5326Ай бұрын
how it's going
@statikverseАй бұрын
@@anere5326 I passed 😊
@FranciscoLopez-es8fi8 жыл бұрын
It is really cool that this kind of content is also shown in Android Authority
@jeraldgarner16366 ай бұрын
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!
@AbdulWahab-gn5hn8 жыл бұрын
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.
@lisamariefan7 жыл бұрын
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...
@mangocode32502 жыл бұрын
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!
@Phildouf8 жыл бұрын
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!
@manuelpena45478 жыл бұрын
As a computer science student I can say it's a really good explanation. Btw, I have to say I hate assembly code lol
@GarySims8 жыл бұрын
+Manuel Peña As someone who actually has a computer science degree I can say its a good explanation as well! :-)
@davidprock9044 жыл бұрын
What im working on is more complex to make something happen, but at the same time easier to use
@JossinJax3 жыл бұрын
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?>
@manuelpena45473 жыл бұрын
@@JossinJax all assembly langs are quite similar but yeah, none of them are the same. Must be something about the assembly you use
@HarshYadav-yi7tv3 жыл бұрын
Same here bro
@orionwilson87967 жыл бұрын
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.
@farhaadali42453 жыл бұрын
Yup.....and I have recently done a course on "Computer Organization" and I loved machine and assembly level programming.
@pnamajck4 жыл бұрын
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.
@PihkalTheTihkal8 жыл бұрын
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!
@nyanator81108 жыл бұрын
ok
@JohnyPhate8 жыл бұрын
+Pihkal82 try TIS-100
@amihartz8 жыл бұрын
+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-Rumbling8 жыл бұрын
+Pihkal82 I am learning C now but I hate the strings in C because its literally an array of chars...
@perimiter8 жыл бұрын
+HeroPlane you can cheat a little and use # include
@danielcu968 жыл бұрын
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!
@elucidator12778 жыл бұрын
Even though I don't code, I did feel like I got a lot from this video...even as a layperson. Thanks Gary. :D
@biggSHNDO4 жыл бұрын
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.
@billh13373 жыл бұрын
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.
@BastianHodapp8 жыл бұрын
Funny that you upload this right now - I just tried out 6502 coding for a university assignment last week :D
@aggbak18 жыл бұрын
nes coding I presume?
@aggbak18 жыл бұрын
can you help me out with that?
@Bob-zg2zf5 жыл бұрын
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!
@fernandogallardo34772 жыл бұрын
It’s cool to know that modern hardware works with twos complement since it is hardware friendly.
@EHCBunny4real8 жыл бұрын
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.
@davidmcbenge93708 жыл бұрын
+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.
@EHCBunny4real8 жыл бұрын
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
@franknomustard7 жыл бұрын
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.
@brassj675 жыл бұрын
I wrote machine code and assembly language on a Commodore PET back in 1980
@andrewzuo868 жыл бұрын
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.
@DavidDeLuge8 жыл бұрын
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.
@gourou_t8 жыл бұрын
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
@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.
@akshatbhatt40225 жыл бұрын
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.
@IntoxicatedDriver3 жыл бұрын
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.
@ihsanbob75738 жыл бұрын
I am studying this at my first year at CS nice stuff, keep these kinds of videos rolling
@davidprock9044 жыл бұрын
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.
@stephenmvura66267 жыл бұрын
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
@MarcellDAvis11036 жыл бұрын
Joshua Waters to understand how assembly works you first of all need to know how a cpu works
@growgrowing8 жыл бұрын
My brain has now restored to tabula rasa, but loved the explanation. Thank You. On to machine code
@unlokia6 жыл бұрын
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.
@omsingharjit2 жыл бұрын
5:14 now it's makes sense to me Assembler is just newly Called complier both have same work but with different languages . Right ?
@shyamgohil15957 жыл бұрын
How assembler works??? How was the first assembler made???
@melvinfoo697 жыл бұрын
shyam gohil you write the first assembler in machine code by hand. Then you rewrite the assembler in assembly code.
@Flowtail6 жыл бұрын
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
@chrs-wltrs3 жыл бұрын
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
@IntoxicatedDriver3 жыл бұрын
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.
@IntoxicatedDriver5 жыл бұрын
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.
@NatchEvil4 жыл бұрын
This helped amazingly in my project to understand how NES games were programmed. I suddenly have a higher respect for those old cartridges.
@skycloud48024 жыл бұрын
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.
@Doomerboss8 жыл бұрын
I wish my professor would introduce us Assembly Language with a video like this back in college :D Nice video!
@FaithfulGeneral5 жыл бұрын
ok
@xceeder8 жыл бұрын
another very informative video from Gary , I'll look forward to your next video....
@Cyberdemon19853 жыл бұрын
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
@Pleiadiaes6 жыл бұрын
I don't have any programming skills, but I understood what you were explaining.
@giobikefans7 жыл бұрын
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?
@freecrac6 жыл бұрын
Yes.
@brassj675 жыл бұрын
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
@ShaulRosenzweig7 жыл бұрын
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).
@mofojackson6 жыл бұрын
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 :)
@controlledmaniac278 жыл бұрын
Done courses on C and C++, hated them both. Nice video though. Keep it up Gary.
@controlledmaniac278 жыл бұрын
It was time well spent.
@valizeth40735 жыл бұрын
Just gotta love C++, C can be a bit annoying though.
@broswirski45138 жыл бұрын
Gary is the best teacher!
@sandspatel7 жыл бұрын
Very clear, and fun way to put it across.
@DevinDTV7 жыл бұрын
Good video, though I'd have liked a more specific breakdown of the assembly code so I could fully understand what it was doing without going to another video.
@nathanmead1405 жыл бұрын
@The USSR i learned 6502 assembly in only a couple days
@davidprock9044 жыл бұрын
Look up boolean logic gates
@mikedugumquick35353 жыл бұрын
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.
@murwaz8 жыл бұрын
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. :)
@vicvic5533 жыл бұрын
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.?
@IntoxicatedDriver3 жыл бұрын
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.
@murugeshsurya-pb8ip3 жыл бұрын
man your explanations are too good
@MrKeri19976 жыл бұрын
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.
@SangeetaGupta-ov3rq7 жыл бұрын
thankyou so much,i searched everywhere meaning of bytecode in java but your video has completely cleared my doubt
@oneminutefixed50038 жыл бұрын
another awesome video, loving these series
@sishanmaharjan77595 жыл бұрын
great video :) Explains quiet well about the general concept over the types of the machine level language.
@danishvasta77428 жыл бұрын
I enjoyed playing with assembly language throughout my engineering!
@sapneshnaik8 жыл бұрын
We still learn 8086 assembly language in B tech. India
@parthaj338 жыл бұрын
thanks about this intro its really clears my doubts as i am intermediate in programming
@aryanrastogi458 жыл бұрын
nice stuff Gary and Android authority
@MrInk1138 жыл бұрын
Very nice video! Looking forward to more like these!
@perimiter8 жыл бұрын
I am doing a course on 80x86 processor assembly right now.
@CopernicoTube8 жыл бұрын
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.
@FaithfulGeneral5 жыл бұрын
ok
@IgnoreSolutions8 жыл бұрын
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.
@GarySims8 жыл бұрын
+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.
@MasthaX3 жыл бұрын
The main reason why ARM processors are in most portable devices is that they run quite allot less hot... you don't want a X86_64 based system in your pocket.
@Johnsmith-yv8txАй бұрын
so assembly language is middle man between machine code and higher level language like javascript, right? if so why?
@JefffPL8 жыл бұрын
The Enigma code was broken by three Polish mathematicians in 1932, not by Turing during WW2 :)
@honkers0095 жыл бұрын
I read about it but i think the Germans change the Enigma machine to a high level after .
@orzorzelski11424 жыл бұрын
@@honkers009 About the only changes to the machine iirc were adding more rotors to increase the number of combinations, so the amount of processing power that was required to decrypt the messages in reasonable amount of time also increased. The basic principles and methods for decryption didn't change. Further work by allies during the ww2 was based on fundamentals provided by Polish mathematicians, which also includes mechanical methods of speeding up the process - cyclometer, cryptologic bomb and perforated cards. That's why Turing was only one of the fathers of computers and definately not the first. I know, speedy reply, I only just found this video :D
@adrianoldchannel24946 жыл бұрын
The best explanation so far.
@AGRIMJAIN278 жыл бұрын
do more of these type👍
@RexGalilae8 жыл бұрын
4:31 It can be done in two lines int i = 15, j =25; i += j;
@rubberduckdebug8 жыл бұрын
+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
@RexGalilae8 жыл бұрын
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.
@GarySims8 жыл бұрын
+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 KZbin. You might also want to check out "The International Obfuscated C Code Contest."
@RexGalilae8 жыл бұрын
***** 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 KZbin. 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. ;)
@TheRafelito198 жыл бұрын
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
@jamilkafi55518 жыл бұрын
+Rafael Santana It is not recommended unless yo need it.
@TheRafelito198 жыл бұрын
+jamil kafi yeah because you have more power than Google wants you to have
@pcuser807 жыл бұрын
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)
@kaustubh3d8 жыл бұрын
Aptly explained.... No simpler way to explain the difference between them..Good going
@vinayn91105 жыл бұрын
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".
@ChrisToffer18 жыл бұрын
I've been using assembly for PIC microcontrollers, this gets realllyyyy lengthy, and hard to debug
@andrewmuller58267 жыл бұрын
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?
@NerdyTurd3077 жыл бұрын
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.
@andrewmuller58267 жыл бұрын
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.
@NerdyTurd3077 жыл бұрын
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.
@user-sz9wm4rm5c7 жыл бұрын
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-nj3uk6 жыл бұрын
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.
@mohamadalikhani26653 жыл бұрын
Complete and thorough. Keep it up👍🏻👍🏻
@ruhamabizuayehu7104 жыл бұрын
its such amazing lecture please tell us more about assembly language
@montezeminor28544 жыл бұрын
I written some assembly language a longtime ago in college. Also C, C++.
@tilakpatel12353 жыл бұрын
Thank you! you made the whole concept very clear for me
@TheWaynelds3 жыл бұрын
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.
@IntoxicatedDriver3 жыл бұрын
Most likely some are. Some aren't, for example is Atari Defender said to be written in Forth.
@leongyigan34296 жыл бұрын
This is absolutely amazing !
@eyesnteeth16115 жыл бұрын
The smile and nod gets me
@jakec5618 Жыл бұрын
Is the assembler the same as a compiler ? Also, how exactly does it "translate" the assembly language into binary ? Thanks
@JohnSmith-kd6ip2 жыл бұрын
Great, now we know how to add variables i and j with Assembly. Very helpful. But how to make a whole game with graphics? I can't believe people back in the day bothered learning Assembly.
@harsham24816 жыл бұрын
So a compiler converts high level language directly to machine code?or does it convert into assembly language??? I dint hear him.
@Tapajara4 жыл бұрын
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.
@brocksprogramming6 жыл бұрын
Good video Gary. I prefer high level languages, but I believe assembly is good to know. How about Spectre and Meltdown though.
@noway45175 жыл бұрын
Why the music in the background? It gives me a headache to concentrate on what you say because I have to try to blind out the music.
@devgr897 жыл бұрын
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?
@freecrac6 жыл бұрын
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