I don’t need something practical. I just need something fun to keep me motivated.

    • ulterno@programming.dev
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      5 days ago

      IDK really, perhaps you can use a book.
      I mainly did it in the 8085 practicals during B.Tech and they had a handy learning kit with a HEX keyboard so we could Assemble it manually on paper, write the program directly to a given RAM address and then run it from there. For ARM, we just used Keil µVision.
      Now I just download an x64 instruction manual or just look up the instructions on the web, on the occasional requirement of reading disassembly.

      I don’t recommend starting with x86_64 reference. While it can be used just fine, it has lots of instructions and and you instead want a very small subset of them.


      Also, there will be a great difference between using an OS and not doing so, as going with one, then includes a lot of potential boilerplate.

    • orclev@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      5 days ago

      So, there’s not a great answer to that. The big problem is that x86 assembly is painful because the x86 instruction set is a weedy overgrown mess due to being built on top of literal decades of cruft. Even a CPU made today starts off by booting up pretending to be an 8086 processor, a 16 bit CPU from 1978. To get to a “modern” operating mode you need to walk through a series of configuration steps to get the CPU into the correct mode, but all those modes and configs add a lot of noise when trying to understand x86 assembly. For that reason it’s probably a good idea to start by not learning x86, but instead the far more minimal and sane ARM assembly.

      The problem of course is that there’s like a 99% chance that the system you’re going to be working on when learning assembly is an x86 system not an ARM one. So now you need two more things, you need an assembly cross-compiler to use your x86 system to build an ARM executable, and you need an ARM emulator to run it. Personally I’d install LLVM (specifically clang) and start by writing a small C wrapper with some inline assembly in it. For running it I’d use QEMU and a Linux ARM image (maybe one of the raspberry pi distros).

      Finally allow me to introduce you to one of the absolute coolest tools out there godbolt compiler explorer. Godbolt allows you to take a snippet of code written in one of dozens of supported languages and see the assembly instructions that various compilers would produce from that code. This is a great way to learn more about not just assembly, but any of the supported languages and is also an invaluable tool for doing fine grained optimizations.

      • ageedizzle@piefed.caOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 days ago

        Even a CPU made today starts off by booting up pretending to be an 8086 processor, a 16 bit CPU from 1978.

        That’s fascinating.

        The godbolt compiler looks like it would be very useful for learning programming. Reminds me of this website even though it’s not quite the same because it’s a game.

        Thanks!