This is really good. Most other sources I've seen on assembly jump around and are hard to follow, the learning here follows a very logical process. Instructor has a very positive attitude too so that's a plus :).
A bit late to the party, but I just love your videos and am learning a lot. I was a mainframe systems prog and never lost my love for assembler. Thank you so much.
Dude, for real. You safed my time. I haven't programmed in asm for years now, and now, in the middle of the pandemic I got bored and I had to figure everything out again from the beginning. Started with my IDE. It's always the IDE that causes problems, for me at least. Thank you.
On many compilers (except MSVC, which treat is a regular double), you can use the real10 datatype by using long double in your code. Check your compiler documentation obviously.
Somehow the simplest explanation for me what two's complement numbers are is like that: let's say number 1001 0000 in binary. If it is unsigned, we convert it: 1 * 2^7 + 0 * 2^6 + 0 * 2^5 + 1 * 2^4 + ... = 128 + 16 = 144. If it is signed number, it's all the same, except the very first term should be taken with 'minus' sign: 1 * (-2^7) + 0 * 2^6 + 0 * 2^5 + 1 * 2^4 + ... = -128 + 16 = -112 It immediately shows simplicity of this format, its 'linearity'. It doesn't have weird things like 'plus 0' and 'minus 0'. Also it comes crystal clear why we can store numbers from -2^15 to 2^15-1 and so on. Hope it could help someone.
Hey, thanks. Little hint. You can define numbers in hex format to make them match what is shown in the VS "watch" window, by adding h at the end, as such: db 12h, 49h
@4:41 you said maybe you'll do videos to show us ieee 754 tricks, yes please. I don't know why but I'm obsessed with this standard, the format is just so fascinating and denormals are extra cool. Q/Snans, -/+ inf, etc
And now that I'm at the simd /avx part of the video I need help on this stuff. I'm reading about using the vex prefix and totally lost so any guidance would be greatly appreciated!
@@Calm_Energy I made a vid called "ieee 754 floating point magic bit hacks" a few years back. It's got some nice tricks in it :) Nothing about denormals or nans though...:( Maybe I can redo at some point
@@Calm_Energy The vex prefix is largely about the machine code. From ASM, we just put a "V" in front of the instructions when we're using the AVX, and the Assembler handles the prefix and encoding for us. So instead of "MOVAPD XMM0, XMM1", it becomes "VMOVAPD YMM0, YMM1". The AVX instructions are cool because we get non destructive operations, "VADDPD YMM0, YMM1, YMM2" adds YMM1 and YMM2 and stores in YMM0. Anywho, VEX and REX, etc. prefixes are mostly to do with the bytes of the machine code. The actual changes to the code are minimal. Hope this helps :)
@@WhatsACreel Yes! Helps very much. I'm amazed by all the "extensions" in Intel instructions but I suppose I shouldn't be. Any company or organization is going to seek to grow or improve, and in their case they then need to add instructions so we can utilize the new features in the hardware. Fun stuff! Thank you for your guidance!
@@Calm_Energy Some believe that the instruction set war between AMD and Intel has led to x64 becoming bloated and unwieldy. All the prefixes, and extra registers, etc. It started with MMX, which was wildly successful due to some very colourful marketing from Intel (look up the old MMX ads, they're great!). I think the only way to stop this crazy opcode battle is if something like ARM can take the PC market away from x86. Maybe the writing is on the wall... Interesting stuff. Anywho, rant aside, cheers for watching, have a good one :)
@11:50 you said "if you want to move a floating point value into an integer register".. do you mind elaborating a bit more on that? Eax is a general purpose 32 bit register correct? and real4 is 32 bits as well. thank you so much for the great ASM videos
@Creel, your "Integer Data Type Ranges" has a small mistake. QWord (64 buts) is Quad Word and not Double Quad Word. The Double Quad Word, also called a Paragraph, is 128 bits or 16 bytes.
@@WhatsACreel Thanks a ton for your prompt answer. I am sorry I changed the comment in the meantime, as I watched #5 and it became clear `lea` is what I'm after. Won't be posting questions until I finish watching the whole series.
@@owxl3135 All good mate! Yep, those instructions are the same! Sometimes the assembler wants to know the data size, sometimes not. I usually put in the brackets and data size just to be clear, but you can often leave them off. Thanks for watching :)
A very small correction; even for unsigned it ranges from 0 to (2^32 - 1) in case of DWORD and similarly for the rest. For people who didn't notice the change, all I did was add "-1".
I will give you a tips if you dont know, unsigned mean that the number can't be negative so if you put -1 you will get the maximun value that a unsigned can get.
@@deadoptick01 what Sanyam Malhotra means is that the maximum value for an unsigned DWord is 2³² - 1 and not just 2³². 2³² actually overflows a 32 bit register and wraps it around to just 0.
I am interested in real10. Why the IEEE come up with such specification. I suggest that you could add some examples of applications that use for certain data types very with big range. Maybe NASA is using it. Anyway, very cool and great tutorial.
I only program in ASM occasionally for work. Most of my ASM adventures are to push my hardware for my own evil master plans!! Seriously tho, once you're over the initial learning curve, ASM becomes mighty simple. There's a whole bunch of little things, data types, register names, calling conventions, basic instructions, etc. Once you know them, you know the whole language! There's thousands of instructions, but you only need to know a dozen or so off by heart. It's a great language, I am still learning, appreciate the compliment, cheers and good luck!!
A few comments: First, I thought extended precision floats were fairly common? C has them as "long double", at least. They are only required to have precision equal to a regular "double", but most commonly they are implemented as real10. Second, I do not really see how... mov al,byte ptr [myByte] ...and... mov al,myByte ...are the same. At least in the assembly I know best, Z80, the size of the data a pointer points to is inferred from the size of the register you are trying to store it to. So for example in... ld a,(pointer) ...pointer would point to a byte, but in... ld hl,(pointer) ...pointer would point to a word. If you just did... ld hl,pointer ...it would store the value of the pointer (so not the value it is pointing to), to HL. It's the brackets that mean "dereference a pointer" (which for some reason Zilog decided to use () and not []). And if you try to... ld a,pointer ...the assembler will most likely complain, because it is truncating a 16-bit value to 8 bits. So what I imagine now is that... mov al,[myByte] ...will read a byte from [myByte] and store it to AL (the size being implied by the size of AL), and... mov al,myByte ...would try to store a 64-bit value to an 8-bit register and throw an error during assembly. It just seems needlessly complicated the way it is here. Is there any case in which doing it in the way I suggested would cause ambiguity? Perhaps in... inc [pointer] ...? Maybe it would suffice then to only give the size of the data in that one case?
Great question! NASM seems fine with it, though I didn't actually execute my program, so can't be sure. GNU, I'm not sure about, it doesn't use the same syntax, but there's probably something very similar available. If you're able to test it in GNU, let us know how you go. Have a good one and thanks for watching!
So, if I understand correctly, using a 32 bit instruction after using 64 bit instructions will clear any instruction stored beforehand. Is this to do with pushing and popping? Is there a way to work around this?
9:11 when you give 89.5, the value you see in the watch is 89.5000000. This is fine but when i put 46.7, the watch shows 46.7000008 Why is there an inaccuracy?
good work sir... in india we believe teachers as god... but education here is horrible... i literally cried today(not joking)... i just wanted to learn assembly cuz i wanted to understand computers more... just before sleeping i found this playlist and sir, u are god to me... respect from heart sir... i want to learn more from u sir ,i have had a great hard time trying to just learn, i want to help people and contribute to society, i will make world a better place to live... restore the real meaning of teachers in india and its culture of respect to teacher... srry for horrible eng...
byt ptr [myByte] is just the syntax for a memory variable. Sometimes you can use myByte by itself and the assembler will be smart enough to infer the data size, but it's often clearer to use the longer syntax because it specifies the data size and stands out as a memory operand in the code. Each assembler specifies memory operands differently, and that's just the Microsoft version. It just means the value of a variable! Hope this helps, cheers for watching :)
@@WhatsACreel Cheers for your reply :) So, I guess in this particular example the assembler can infer the data size because we're loading it into an 8-bit register. Right? Out of curiosity, any example at hand where the assembler isn't smart enough to infer the size?
@@marioluoni3899 It likes the "xmmword ptr" syntax for SIMD memory. Not sure why it can infer that, but it always complains without it. Ha! Just the way the Assembler works, I guess
The course is great, and if you launch China video, you will be a legend, because we have a population of 1400000. I am from China, I am a scholar, my education is only the level of ordinary high school, English is the worst of all my courses. This is the biggest obstacle to my learning programming.I've been studying vt-x technology recently.IT's very selfish of people in China to do IT. They don't want to communicate. They think that if someone else has learned this technology, they may be under more pressure.
I would make a course if I could speak Chinese. Actually would love to visit China, it is an amazing place! I am sad that programmers believe they should hide their knowledge. I believe we should share to help each other. There is too much selfish in the world. Anywho, hello from Australia, 谢谢, 再见:)
Machine code? Really funny . This thing is hard Not because it written in numbers but because it is there is around 13 billion instructions possiblties
Sorry to hear that, the floats are just a data type for string numbers with decimal point. There's 3 to choose from, with differing levels of precision. Anywho, thanks for watching and commenting, have a great day!
but basically we usually read scientific notation as [sign][mantissa]E[exponent] like -1.1E-3 would be -0.0011 . I may be wrong but if his slide has them in order it would be [sign byte][exponent bits][mantissa bits]. I also presume the left bit of exponent is a sign bit for the exponent... i may be wrong there.
This is really good. Most other sources I've seen on assembly jump around and are hard to follow, the learning here follows a very logical process. Instructor has a very positive attitude too so that's a plus :).
1:20 also to add to this: besides signed and unsigned division and multiplication, assembly also has signed and unsigned bit shift operations.
A bit late to the party, but I just love your videos and am learning a lot. I was a mainframe systems prog and never lost my love for assembler. Thank you so much.
Dude, for real. You safed my time. I haven't programmed in asm for years now, and now, in the middle of the pandemic I got bored and I had to figure everything out again from the beginning. Started with my IDE. It's always the IDE that causes problems, for me at least. Thank you.
no problem citizen
My fav channel
Lo Janus one might say he's a real10
Classic!
This guy sounds like Eric Idle and it's so mesmerizing I can't help but learn assembly.
On many compilers (except MSVC, which treat is a regular double), you can use the real10 datatype by using long double in your code. Check your compiler documentation obviously.
Somehow the simplest explanation for me what two's complement numbers are is like that:
let's say number 1001 0000 in binary. If it is unsigned, we convert it:
1 * 2^7 + 0 * 2^6 + 0 * 2^5 + 1 * 2^4 + ... = 128 + 16 = 144.
If it is signed number, it's all the same, except the very first term should be taken with 'minus' sign:
1 * (-2^7) + 0 * 2^6 + 0 * 2^5 + 1 * 2^4 + ... = -128 + 16 = -112
It immediately shows simplicity of this format, its 'linearity'. It doesn't have weird things like 'plus 0' and 'minus 0'. Also it comes crystal clear why we can store numbers from -2^15 to 2^15-1 and so on. Hope it could help someone.
Cheers, I appreciate it!
Thank you so much for creating these tutorial videos, they have been a huge help to me :)
Christ the fact you can use db as code instructions AND get a disassembly out of that is fascinating.
Hey, thanks. Little hint. You can define numbers in hex format to make them match what is shown in the VS "watch" window, by adding h at the end, as such:
db 12h, 49h
Fantastic video. I loved it when you showed that you can write machine code directly in the .asm file. I'll do some experiments with that ASAP :)
cool
@4:41 you said maybe you'll do videos to show us ieee 754 tricks, yes please. I don't know why but I'm obsessed with this standard, the format is just so fascinating and denormals are extra cool. Q/Snans, -/+ inf, etc
And now that I'm at the simd /avx part of the video I need help on this stuff. I'm reading about using the vex prefix and totally lost so any guidance would be greatly appreciated!
@@Calm_Energy I made a vid called "ieee 754 floating point magic bit hacks" a few years back. It's got some nice tricks in it :) Nothing about denormals or nans though...:( Maybe I can redo at some point
@@Calm_Energy The vex prefix is largely about the machine code. From ASM, we just put a "V" in front of the instructions when we're using the AVX, and the Assembler handles the prefix and encoding for us. So instead of "MOVAPD XMM0, XMM1", it becomes "VMOVAPD YMM0, YMM1". The AVX instructions are cool because we get non destructive operations, "VADDPD YMM0, YMM1, YMM2" adds YMM1 and YMM2 and stores in YMM0. Anywho, VEX and REX, etc. prefixes are mostly to do with the bytes of the machine code. The actual changes to the code are minimal. Hope this helps :)
@@WhatsACreel Yes! Helps very much. I'm amazed by all the "extensions" in Intel instructions but I suppose I shouldn't be. Any company or organization is going to seek to grow or improve, and in their case they then need to add instructions so we can utilize the new features in the hardware. Fun stuff! Thank you for your guidance!
@@Calm_Energy Some believe that the instruction set war between AMD and Intel has led to x64 becoming bloated and unwieldy. All the prefixes, and extra registers, etc. It started with MMX, which was wildly successful due to some very colourful marketing from Intel (look up the old MMX ads, they're great!). I think the only way to stop this crazy opcode battle is if something like ARM can take the PC market away from x86. Maybe the writing is on the wall... Interesting stuff. Anywho, rant aside, cheers for watching, have a good one :)
4:10 I think 32 and 64 bit range for unsigned should be 0 to 2^N-1 where N is 32 or 64.
Thank you Creel.
Time to combine one of your other videos with assembly. I'm gonna program a square root function using the Newton's Method in ASM.
@11:50 you said "if you want to move a floating point value into an integer register".. do you mind elaborating a bit more on that? Eax is a general purpose 32 bit register correct? and real4 is 32 bits as well.
thank you so much for the great ASM videos
9:10 hjkjher? I don't even know her!
That's australian for hitchhiker right?
@Creel, your "Integer Data Type Ranges" has a small mistake. QWord (64 buts) is Quad Word and not Double Quad Word. The Double Quad Word, also called a Paragraph, is 128 bits or 16 bytes.
yeah double quad word is the width of an xmm register: 128-bits
When I saw your first video I was think that Luka Modric started coding⚽
Thank you for your great videos.
Are the following 3 instruction equivalent?
mov bl, myByte
mov bl, [myByte]
mov bl, byte ptr [myByte]
You want LEA to load the address. MOV will move the value at the address.
Hope this helps, cheers for watching :)
@@WhatsACreel Thanks a ton for your prompt answer. I am sorry I changed the comment in the meantime, as I watched #5 and it became clear `lea` is what I'm after.
Won't be posting questions until I finish watching the whole series.
@@owxl3135 All good mate!
Yep, those instructions are the same! Sometimes the assembler wants to know the data size, sometimes not. I usually put in the brackets and data size just to be clear, but you can often leave them off.
Thanks for watching :)
A very small correction; even for unsigned it ranges from 0 to (2^32 - 1) in case of DWORD and similarly for the rest. For people who didn't notice the change, all I did was add "-1".
I will give you a tips if you dont know, unsigned mean that the number can't be negative so if you put -1 you will get the maximun value that a unsigned can get.
deadoptick01 , “whoooosh“
@@deadoptick01 what Sanyam Malhotra means is that the maximum value for an unsigned DWord is 2³² - 1 and not just 2³². 2³² actually overflows a 32 bit register and wraps it around to just 0.
@@joaoparedes_tp Thank for the clarifications :)
I am interested in real10. Why the IEEE come up with such specification. I suggest that you could add some examples of applications that use for certain data types very with big range. Maybe NASA is using it. Anyway, very cool and great tutorial.
You're excellent, I'm really thankful, it helps me a lot.
great video as usual
right on, rite on
How do you get so good at this ? From your job? ):
I only program in ASM occasionally for work. Most of my ASM adventures are to push my hardware for my own evil master plans!! Seriously tho, once you're over the initial learning curve, ASM becomes mighty simple. There's a whole bunch of little things, data types, register names, calling conventions, basic instructions, etc. Once you know them, you know the whole language! There's thousands of instructions, but you only need to know a dozen or so off by heart. It's a great language, I am still learning, appreciate the compliment, cheers and good luck!!
A few comments:
First, I thought extended precision floats were fairly common? C has them as "long double", at least. They are only required to have precision equal to a regular "double", but most commonly they are implemented as real10.
Second, I do not really see how...
mov al,byte ptr [myByte]
...and...
mov al,myByte
...are the same. At least in the assembly I know best, Z80, the size of the data a pointer points to is inferred from the size of the register you are trying to store it to. So for example in...
ld a,(pointer)
...pointer would point to a byte, but in...
ld hl,(pointer)
...pointer would point to a word. If you just did...
ld hl,pointer
...it would store the value of the pointer (so not the value it is pointing to), to HL. It's the brackets that mean "dereference a pointer" (which for some reason Zilog decided to use () and not []). And if you try to...
ld a,pointer
...the assembler will most likely complain, because it is truncating a 16-bit value to 8 bits. So what I imagine now is that...
mov al,[myByte]
...will read a byte from [myByte] and store it to AL (the size being implied by the size of AL), and...
mov al,myByte
...would try to store a 64-bit value to an 8-bit register and throw an error during assembly.
It just seems needlessly complicated the way it is here. Is there any case in which doing it in the way I suggested would cause ambiguity? Perhaps in...
inc [pointer]
...? Maybe it would suffice then to only give the size of the data in that one case?
Can you do the db trick at 12:27 in GNU assembler, NASM or whatever other assembler ?
Great question! NASM seems fine with it, though I didn't actually execute my program, so can't be sure. GNU, I'm not sure about, it doesn't use the same syntax, but there's probably something very similar available. If you're able to test it in GNU, let us know how you go. Have a good one and thanks for watching!
So, if I understand correctly, using a 32 bit instruction after using 64 bit instructions will clear any instruction stored beforehand. Is this to do with pushing and popping? Is there a way to work around this?
Hey, great video, helpful and entertaining. I love the series and i learned a lot about modern assembly!
9:11 when you give 89.5, the value you see in the watch is 89.5000000. This is fine but when i put 46.7, the watch shows 46.7000008
Why is there an inaccuracy?
Unless you’re in security and writing shell code. Is there a good reason to use asm these days? It makes the apps fragile and harder to port?
good work sir...
in india we believe teachers as god...
but education here is horrible...
i literally cried today(not joking)...
i just wanted to learn assembly cuz i wanted to understand computers more...
just before sleeping i found this playlist and sir, u are god to me...
respect from heart sir...
i want to learn more from u sir ,i have had a great hard time trying to just learn, i want to help people and contribute to society, i will make world a better place to live...
restore the real meaning of teachers in india and its culture of respect to teacher...
srry for horrible eng...
remember, a learner is the teacher of his own mind
I didn't get the ptr thingy @10:00: what does "byte ptr [myByte]" actually mean, and why, or under what conditions, is it equal to "myByte"?
byt ptr [myByte] is just the syntax for a memory variable. Sometimes you can use myByte by itself and the assembler will be smart enough to infer the data size, but it's often clearer to use the longer syntax because it specifies the data size and stands out as a memory operand in the code. Each assembler specifies memory operands differently, and that's just the Microsoft version. It just means the value of a variable! Hope this helps, cheers for watching :)
@@WhatsACreel Cheers for your reply :) So, I guess in this particular example the assembler can infer the data size because we're loading it into an 8-bit register. Right? Out of curiosity, any example at hand where the assembler isn't smart enough to infer the size?
@@marioluoni3899 It likes the "xmmword ptr" syntax for SIMD memory. Not sure why it can infer that, but it always complains without it. Ha! Just the way the Assembler works, I guess
you are a nice guy ! thank you for your infos from germany
Thank you so much!
Good ,
please share the material !
Thanks
I'm in love with your classes, too bad you speak a little fast and I as a Brazilian, take a while to digest your great classes.
x0.75 speed perhaps
a nice tutorial :)
Where is the power point for this video?
The course is great, and if you launch China video, you will be a legend, because we have a population of 1400000. I am from China, I am a scholar, my education is only the level of ordinary high school, English is the worst of all my courses.
This is the biggest obstacle to my learning programming.I've been studying vt-x technology recently.IT's very selfish of people in China to do IT. They don't want to communicate. They think that if someone else has learned this technology, they may be under more pressure.
I would make a course if I could speak Chinese. Actually would love to visit China, it is an amazing place! I am sad that programmers believe they should hide their knowledge. I believe we should share to help each other. There is too much selfish in the world. Anywho, hello from Australia, 谢谢, 再见:)
Are there CPUs that support 128 bits? Or maybe even 256 or 512?
not yet haha
Can you make a video on what SIMD is?
Yeah, I did some a while back. They're probs pretty dodgy, but maybe you can find em on the channel somewhere? SIMD is amazing!
Can exe read movie?
Playlist: th-cam.com/play/PLKK11Ligqitg9MOX3-0tFT1Rmh3uJp7kA.html
👏👏👏
Proc -1
Machine code?
Really funny .
This thing is hard
Not because it written in numbers but because it is there is around 13 billion instructions possiblties
Lost me at the floating point section of the video ):
Sorry to hear that, the floats are just a data type for string numbers with decimal point. There's 3 to choose from, with differing levels of precision. Anywho, thanks for watching and commenting, have a great day!
try reading this www.csee.umbc.edu/courses/undergraduate/313/fall07/burt/CMSC313_lectures/Floating%20Point/floatingPoint.html
but basically we usually read scientific notation as [sign][mantissa]E[exponent] like -1.1E-3 would be -0.0011 . I may be wrong but if his slide has them in order it would be [sign byte][exponent bits][mantissa bits]. I also presume the left bit of exponent is a sign bit for the exponent... i may be wrong there.
I'm not surprised. I came across programming videos where they skipped over Float and taught people Double in its place.
3:55 Don't say the D word.
7:14
Good!
C:\Users\Paprika\
lol
Love it! The Fastest. DividePriority: 01 after 00 after DataAnalytics. Enjoy the silence!🥳🎼🎵🎶