A - Z Nasm Assembly 64Bit Programming - Loop, Stack, prinf, scanf, conditions

Поделиться
HTML-код
  • Опубликовано: 15 дек 2024

Комментарии • 57

  • @ВладиславБ-и1е
    @ВладиславБ-и1е 11 месяцев назад +3

    Note that there should be JL instruction instead of JLE to form (i < num) condition and the new line character in the end of msg2 in C code (there is 10 in asm) to make hello.c and demo.asm equivalent

    • @valentrix
      @valentrix 2 месяца назад

      JL means jump if less, JLE is jump if less or equal. I can see he meant to do JL but he probably didn't notice it, still worked tho, but it's a good point to look after

  • @skilz8098
    @skilz8098 Год назад +2

    The fact that you MUST Zero EAX before calling any functions that accepts multiple arguments... I'm not sure if I remember learning about this technical requirement.
    I've learned quite a bit over the past 20 years, but this is something I don't think I knew. Then again was based on the Linux calling convention. I've worked mostly in Windows so I'm familiar with __cdecl, __stdcall, __fastcall, etc... but even then I still don't remember knowing that you "MUST" zero out EAX before calling a function that takes multiple parameters for its arguments. I think I've learned something new. Excellent job on a very clear and precise explanation of the relationship between C/C++, Assembly and the Stack-StackFrame, Job Well Done Sir! This was very enjoyable and very educational. Thank You!

  • @s00774
    @s00774 Год назад +9

    Where did you personally learn this? Could you provide some links(text based prefered) that would help me learn this in depth?
    this is by far the best guide of assembly I have found. spectacular work man!!

  • @MieysoFelix
    @MieysoFelix Год назад +7

    WTF? I learned a loooot and I have big respects that you explained everything so good, in such a short video! Nice one bro. ✌🏻

  • @drewbell5260
    @drewbell5260 Год назад +1

    Have never seen assembly explained this well. Great job.

  • @johnmckown1267
    @johnmckown1267 5 месяцев назад +1

    Not Intel, but one thing that clinched my first professional job out of college was knowing IBM mainframe assembler. Now, this was in the late 1970s. I don't know myself how relevant it is to today's market.

  • @johnmckown1267
    @johnmckown1267 5 месяцев назад

    Good, interesting video. X64 vaguely reminds me a bit of Z80 assembler from many years ago.

  • @johnpapa8554
    @johnpapa8554 2 года назад +3

    buddy you did an amazing video. even i understood what it was about. thank you

    • @soliduscode
      @soliduscode  2 года назад +1

      Thanks for the feedback 😊

  • @traykeller5717
    @traykeller5717 3 года назад +5

    Bruh I gotta say thank you. Because of you I passed my computer architecture final. We used risc-v but your video and how you explained x86 it really helped

    • @soliduscode
      @soliduscode  3 года назад +1

      Awesome, glad it helped.

    • @avagata9309
      @avagata9309 2 года назад +1

      you do risc-v? That is really wise choice from your professor!

    • @revanvonheaven8270
      @revanvonheaven8270 Год назад

      I have a question can this be used to construct drones, car ecu codes, aviation black boxes etc. and constructing a series of your own chipsets like RISC V is it possible or can Python do the same?.

  • @rbtmdl
    @rbtmdl 2 месяца назад

    tcc also works in place of gcc. Smaller executable size too.

  • @koftabalady
    @koftabalady Год назад

    Why is your website down?

  • @ashutoshgera11
    @ashutoshgera11 2 года назад +2

    Thanks a lot man, great vid.

  • @danielleivy8180
    @danielleivy8180 11 месяцев назад +1

    error: Mach-O 64-bit format does not support 32-bit absolute addresses
    Solution: Add underscores and default rel
    global _main
    extern _printf
    extern _scanf
    default rel
    (YT won't let me link my resource)

  • @guliyevshahriyar
    @guliyevshahriyar Год назад

    Thank you very much, it has been a very compact course!

  • @kcvinu
    @kcvinu 6 месяцев назад +2

    When I ask chatGPT that how do you call a windows api function in assembly, it showed me some code and I was amazed! Parameters are picking from rsp register. Then I asked how do you get the return value of a function ? It told me to get the rax register. I was amazed again. Then I asked, Hey dude, how do i know that which register I need for a certain task ? It told me to learn NASM and i am here.

  • @qsmfoui
    @qsmfoui 3 месяца назад

    why would you do an add rsp, 16 if the leave sets it back to rbp for you instead?

  • @Benjamin_Stroup
    @Benjamin_Stroup 11 месяцев назад +1

    can i not do it on windows or something why does no one have a video for windows 11

  • @stefanwichura3405
    @stefanwichura3405 7 месяцев назад

    Could you explain why we reserve 16 bytes on the stack and the variable is only 4 bytes in this case. I looked at the stack in the gdb debugger and apart from the space for this variable, there is an address and a value of 1000 in hex.

  • @KayEdmund-f3n
    @KayEdmund-f3n Год назад

    please how do I run assembly language code in visual studio code , I have searched and have been trying but its still not working

  • @gerardovilledadev
    @gerardovilledadev 2 года назад +1

    what extensions do you use in vscode?

  • @ZeroCool2211
    @ZeroCool2211 2 года назад +20

    Bro is that Linux? Why all nas tutorials are meant for Linux? I am using windows and I cannot even make hello world program in x86 despite the tons of searches I've done on Google

    • @carlosmanuelrodriguezmarti1310
      @carlosmanuelrodriguezmarti1310 2 года назад +4

      Just use WSL and you will be fine

    • @mirakle9375
      @mirakle9375 2 года назад +4

      Use wasm on Windows. Here's a playlist with assembly tutorials for Windows: ruclips.net/p/PLKK11Ligqitg9MOX3-0tFT1Rmh3uJp7kA

    • @IonizedComa
      @IonizedComa Год назад +6

      You probably should learn eventually in your free time how to navigate and use Linux systems, how to do bash scripting etc, it's a very useful skill in the tech world

    • @EinSatzMitX
      @EinSatzMitX 7 месяцев назад

      Ive had the same problem when starting out with low level development.
      Believe me it has a reason everyone is using linux and i would strongly recommend dual booting windows with linux

    • @ArseniiMorari
      @ArseniiMorari 6 месяцев назад

      I'm using MASM on Windows

  • @AnhTúLê-s8o
    @AnhTúLê-s8o Год назад +2

    Can anyone explain, why we need to clear eax before calling function?

    • @AnhTúLê-s8o
      @AnhTúLê-s8o Год назад +2

      Ok, I got it, printf is va_arg function, so it need eax to store the number of arg.

  • @xMORAENNx
    @xMORAENNx 2 года назад +1

    'make' doesn't work. After trying to do 'nasm -f elf file.asm' the terminal outputs an array of errors such like 'impossible combination of adress sizes'

  • @ACalebsCat543plusone
    @ACalebsCat543plusone 8 месяцев назад +1

    this video fixed my hairline

  • @f_erbey
    @f_erbey 8 месяцев назад

    Can we use nasm on risc-v processor?

    • @soliduscode
      @soliduscode  7 месяцев назад +1

      I dont believe so, but you can try googling -this resource could start pointing you in the right direction stackoverflow.com/questions/75484446/open-source-and-independent-arm-and-risc-v-assemblers

  • @ΝικΝοκ
    @ΝικΝοκ 2 года назад +2

    nice one

  • @mechwarrior83
    @mechwarrior83 2 месяца назад

    MOV video, [like]

  • @ruipinheiro3525
    @ruipinheiro3525 2 года назад +2

    Good fucking job, thanks!

  • @rty1955
    @rty1955 6 месяцев назад +1

    I code in assembly on a REAL computer, not a toy that is trying to be a computer.
    X86 is brain dead.
    Why have sections?
    Think about it - Memory is memory, put whatever you want in it. Ie code, text, numbers etc. The machine dont care
    Why have a stack? No need for it. I wrote thousands of lines of code, never needed a stack. Just give me memory and let me manage it

  • @reipalacio
    @reipalacio 8 месяцев назад

    you run fast. you know too much. you know the details but I not. Please explain for people that do not know. Thanks. may respect for you

    • @soliduscode
      @soliduscode  8 месяцев назад

      will do, planning upcoming series

  • @Принуждениекмиру-ь2ц
    @Принуждениекмиру-ь2ц 2 года назад +4

    When I see people using vs code I automatically press dislike button. Hahaha.

  • @eddag6973
    @eddag6973 2 года назад

    Hello Sir good evening Can I ask help why if I execute this the Message is douled. Like Third Year college third Year college
    section .text
    global _start ;must be declared for linker (gcc)
    _start: ;tell linker entry point
    mov edx,len ;message length
    mov ecx,msg ;message to write
    mov ebx,1 ;file descriptor (stdout)
    mov eax,4 ;system call number (sys_write)
    int 0x80 ;call kernel
    mov edx,69 ;message length
    mov ecx,s2 ;message to write
    mov ebx,1 ;file descriptor (stdout)
    mov eax,4 ;system call number (sys_write)
    int 0x80 ;call kernel
    mov edx, 69 ;message length
    mov ecx,s3 ;message to write
    mov ebx,1 ;file descriptor (stdout)
    mov eax,4 ;system call number (sys_write)
    int 0x80 ;call kernel
    mov edx,69 ;message length
    mov ecx,s4 ; message to write
    mov ebx,1 ;file descriptor (stdout)
    mov eax,4 ;system call number (sys_write)
    int 0x80 ;call kernel
    mov edx,15 ;message length
    mov ecx,s5 ;message to write
    mov ebx,1 ;system call number (sys_write)
    int 0x80 ;call kernel
    mov eax,0 ;system call number (sys_exit)
    int 0x80 ;call kernel
    section .data
    msg db 'Computer organization and architecture Project',0xa ;a message
    len equ $ - msg ;length of message
    s2 times 1 db ' Name: Marth Kubulon'
    s3 times 1 db ' bi Course:BSSED major in Computer Science'
    s4 times 1 db ' Year: Third year college'
    s5 times 1 db 'Motto: Sacrifice now enjoy later'.

    • @avagata9309
      @avagata9309 2 года назад

      you need to zero terminate the string msg

    • @spaghettiking653
      @spaghettiking653 Год назад

      @@avagata9309 Why would you need to do that?

    • @avagata9309
      @avagata9309 Год назад +1

      @@spaghettiking653 In computer science a basic string is made up of sequence of bytes, each byte value represents a specific character which translates to characters. The computer has to know where the character array ends and it is much convenient to just put a 0 at the end of the sequence. When reading strings the computer keeps going until it reaches character 0. So if theres none you will happen to attempt to read from a memory address which you dont have access to or contains some other program data.
      Lot of c language courses cover these basics. I would advise learning c first.

    • @spaghettiking653
      @spaghettiking653 Год назад

      @@avagata9309 Thanks for the explanation, I did know that about strings, but I was confused why you'd need it in this example, because the system call for writing strings makes you give the number of bytes to print, so you don't need to end the string with 0 for it to work - you just need to pass the right length into the write syscall. Without reading the program any more, it seems legit to me as it is, no?