Modern x64 Assembly 4: Data Types

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 พ.ย. 2024

ความคิดเห็น • 92

  • @jamesshelton3827
    @jamesshelton3827 4 ปีที่แล้ว +51

    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 :).

  • @sent4dc
    @sent4dc 7 ปีที่แล้ว +10

    1:20 also to add to this: besides signed and unsigned division and multiplication, assembly also has signed and unsigned bit shift operations.

  • @ChrisPinCornwall
    @ChrisPinCornwall 2 ปีที่แล้ว +1

    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.

  • @0x90meansnop8
    @0x90meansnop8 3 ปีที่แล้ว +2

    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.

    • @Aerazar
      @Aerazar 2 ปีที่แล้ว

      no problem citizen

  • @2359-UK
    @2359-UK 7 ปีที่แล้ว +19

    My fav channel

    • @disk0__
      @disk0__ 7 ปีที่แล้ว +4

      Lo Janus one might say he's a real10

    • @WhatsACreel
      @WhatsACreel  7 ปีที่แล้ว +2

      Classic!

  • @kelseywilliams6561
    @kelseywilliams6561 3 ปีที่แล้ว

    This guy sounds like Eric Idle and it's so mesmerizing I can't help but learn assembly.

  • @meneldal
    @meneldal 4 ปีที่แล้ว +1

    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.

  • @allmycircuits8850
    @allmycircuits8850 4 ปีที่แล้ว +2

    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.

    • @_yakumo420
      @_yakumo420 3 ปีที่แล้ว

      Cheers, I appreciate it!

  • @christianthurow
    @christianthurow 4 ปีที่แล้ว +4

    Thank you so much for creating these tutorial videos, they have been a huge help to me :)

  • @Marisueksu
    @Marisueksu 3 ปีที่แล้ว

    Christ the fact you can use db as code instructions AND get a disassembly out of that is fascinating.

  • @sent4dc
    @sent4dc 7 ปีที่แล้ว +3

    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

  • @antonioastorino7488
    @antonioastorino7488 4 ปีที่แล้ว +1

    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 :)

    • @Aerazar
      @Aerazar 2 ปีที่แล้ว

      cool

  • @Calm_Energy
    @Calm_Energy 5 ปีที่แล้ว +3

    @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

    • @Calm_Energy
      @Calm_Energy 5 ปีที่แล้ว

      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!

    • @WhatsACreel
      @WhatsACreel  5 ปีที่แล้ว +2

      @@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

    • @WhatsACreel
      @WhatsACreel  5 ปีที่แล้ว +2

      @@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 :)

    • @Calm_Energy
      @Calm_Energy 5 ปีที่แล้ว

      @@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!

    • @WhatsACreel
      @WhatsACreel  5 ปีที่แล้ว +2

      @@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 :)

  • @Omikoshi78
    @Omikoshi78 3 ปีที่แล้ว +1

    4:10 I think 32 and 64 bit range for unsigned should be 0 to 2^N-1 where N is 32 or 64.

  • @walidkhames1966
    @walidkhames1966 11 หลายเดือนก่อน

    Thank you Creel.

  • @IndellableHatesHandles
    @IndellableHatesHandles 3 ปีที่แล้ว

    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.

  • @EricCartmanFTW
    @EricCartmanFTW 2 ปีที่แล้ว

    @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

  • @allmycircuits8850
    @allmycircuits8850 4 ปีที่แล้ว +11

    9:10 hjkjher? I don't even know her!

    • @thehorse1sbrown
      @thehorse1sbrown 3 ปีที่แล้ว

      That's australian for hitchhiker right?

  • @joaoparedes_tp
    @joaoparedes_tp 4 ปีที่แล้ว +1

    @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.

    • @Alex-op2kc
      @Alex-op2kc 3 ปีที่แล้ว

      yeah double quad word is the width of an xmm register: 128-bits

  • @zagortenej793
    @zagortenej793 2 ปีที่แล้ว

    When I saw your first video I was think that Luka Modric started coding⚽

  • @owxl3135
    @owxl3135 4 ปีที่แล้ว +2

    Thank you for your great videos.
    Are the following 3 instruction equivalent?
    mov bl, myByte
    mov bl, [myByte]
    mov bl, byte ptr [myByte]

    • @WhatsACreel
      @WhatsACreel  4 ปีที่แล้ว +2

      You want LEA to load the address. MOV will move the value at the address.
      Hope this helps, cheers for watching :)

    • @owxl3135
      @owxl3135 4 ปีที่แล้ว +1

      @@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.

    • @WhatsACreel
      @WhatsACreel  4 ปีที่แล้ว +2

      @@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 :)

  • @sanyammalhotra58
    @sanyammalhotra58 6 ปีที่แล้ว +1

    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".

    • @deadoptick01
      @deadoptick01 6 ปีที่แล้ว

      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.

    • @franzlyonheart4362
      @franzlyonheart4362 4 ปีที่แล้ว

      deadoptick01 , “whoooosh“

    • @joaoparedes_tp
      @joaoparedes_tp 4 ปีที่แล้ว

      @@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.

    • @deadoptick01
      @deadoptick01 4 ปีที่แล้ว

      @@joaoparedes_tp Thank for the clarifications :)

  • @miyazakizachary5108
    @miyazakizachary5108 3 ปีที่แล้ว

    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.

  • @warlikerichard1497
    @warlikerichard1497 3 ปีที่แล้ว

    You're excellent, I'm really thankful, it helps me a lot.

  • @VlingoVideo
    @VlingoVideo 7 ปีที่แล้ว +2

    great video as usual

    • @Aerazar
      @Aerazar 2 ปีที่แล้ว

      right on, rite on

  • @peyastig6371
    @peyastig6371 6 ปีที่แล้ว +13

    How do you get so good at this ? From your job? ):

    • @WhatsACreel
      @WhatsACreel  6 ปีที่แล้ว +58

      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!!

  • @fghsgh
    @fghsgh 3 ปีที่แล้ว

    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?

  • @azertyuiop7893
    @azertyuiop7893 7 ปีที่แล้ว +1

    Can you do the db trick at 12:27 in GNU assembler, NASM or whatever other assembler ?

    • @WhatsACreel
      @WhatsACreel  7 ปีที่แล้ว +3

      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!

  • @daboxguy3848
    @daboxguy3848 3 ปีที่แล้ว

    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?

  • @dailydoseofshtposts6891
    @dailydoseofshtposts6891 ปีที่แล้ว

    Hey, great video, helpful and entertaining. I love the series and i learned a lot about modern assembly!

  • @drip888
    @drip888 ปีที่แล้ว

    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?

  • @Omikoshi78
    @Omikoshi78 3 ปีที่แล้ว

    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?

  • @bharat_132
    @bharat_132 4 ปีที่แล้ว

    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...

    • @Aerazar
      @Aerazar 2 ปีที่แล้ว

      remember, a learner is the teacher of his own mind

  • @sakuranooka
    @sakuranooka 4 ปีที่แล้ว

    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"?

    • @WhatsACreel
      @WhatsACreel  4 ปีที่แล้ว +1

      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 :)

    • @marioluoni3899
      @marioluoni3899 4 ปีที่แล้ว

      @@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?

    • @WhatsACreel
      @WhatsACreel  4 ปีที่แล้ว +1

      @@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

  • @saaako23
    @saaako23 6 ปีที่แล้ว

    you are a nice guy ! thank you for your infos from germany

  • @thehorse1sbrown
    @thehorse1sbrown 3 ปีที่แล้ว

    Thank you so much!

  • @anangnurprasetya636
    @anangnurprasetya636 4 ปีที่แล้ว

    Good ,
    please share the material !

  • @diegonayalazo
    @diegonayalazo 3 ปีที่แล้ว

    Thanks

  • @josecassiolima8523
    @josecassiolima8523 5 ปีที่แล้ว

    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.

  • @BGDMusic
    @BGDMusic 2 ปีที่แล้ว

    a nice tutorial :)

  • @antoniocs8873
    @antoniocs8873 4 ปีที่แล้ว

    Where is the power point for this video?

  • @hrc5098
    @hrc5098 6 ปีที่แล้ว +5

    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.

    • @WhatsACreel
      @WhatsACreel  6 ปีที่แล้ว +3

      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, 谢谢, 再见:)

  • @greenkerbal632
    @greenkerbal632 3 ปีที่แล้ว

    Are there CPUs that support 128 bits? Or maybe even 256 or 512?

  • @vertigo6982
    @vertigo6982 6 ปีที่แล้ว

    Can you make a video on what SIMD is?

    • @WhatsACreel
      @WhatsACreel  6 ปีที่แล้ว

      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!

  • @badrakhariunchimeg1031
    @badrakhariunchimeg1031 5 หลายเดือนก่อน

    Can exe read movie?

  • @Alex-op2kc
    @Alex-op2kc 3 ปีที่แล้ว

    Playlist: th-cam.com/play/PLKK11Ligqitg9MOX3-0tFT1Rmh3uJp7kA.html

  • @abcz___hello
    @abcz___hello 9 หลายเดือนก่อน

    👏👏👏

  • @badrakhariunchimeg1031
    @badrakhariunchimeg1031 5 หลายเดือนก่อน

    Proc -1

  • @xrafter
    @xrafter 4 ปีที่แล้ว

    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

  • @89elmonster
    @89elmonster 7 ปีที่แล้ว

    Lost me at the floating point section of the video ):

    • @WhatsACreel
      @WhatsACreel  7 ปีที่แล้ว

      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!

    • @JamesOfKS
      @JamesOfKS 6 ปีที่แล้ว

      try reading this www.csee.umbc.edu/courses/undergraduate/313/fall07/burt/CMSC313_lectures/Floating%20Point/floatingPoint.html

    • @JamesOfKS
      @JamesOfKS 6 ปีที่แล้ว +1

      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.

    • @vertigo6982
      @vertigo6982 6 ปีที่แล้ว

      I'm not surprised. I came across programming videos where they skipped over Float and taught people Double in its place.

  • @JamesOfKS
    @JamesOfKS 6 ปีที่แล้ว

    3:55 Don't say the D word.

  • @jacks3611
    @jacks3611 4 ปีที่แล้ว

    7:14

  • @yetunaung9932
    @yetunaung9932 7 ปีที่แล้ว

    Good!

  • @noobythicc1484
    @noobythicc1484 3 ปีที่แล้ว

    C:\Users\Paprika\
    lol

  • @romankusakin6650
    @romankusakin6650 2 ปีที่แล้ว

    Love it! The Fastest. DividePriority: 01 after 00 after DataAnalytics. Enjoy the silence!🥳🎼🎵🎶