• Skull giver@popplesburger.hilciferous.nl
    link
    fedilink
    arrow-up
    45
    ·
    edit-2
    3 months ago

    Assembly isn’t that hard. It’s the same imperative programming, but more verbose, more work, and more random names and patterns to remember. If you can understand “x += 3 is the same as x = x + 3”, you can understand how the add instruction works.

    I wouldn’t be able to write Rollercoaster Tycoon in assembly because keeping track of all that code in assembly files must be hell, but people pretending like you need to be some kind of wizard to write assembly code are exaggerating.

    These days, you won’t be able to beat the compiler even if you wrote your code in assembly, maybe with the exception of bespoke SIMD algorithms. Writing assembly is something only kernel developers and microcontroller developers may need to do in their day to day life.

    Reading assembly is still a valuable skill, though, especially if you come anywhere near native code. What you think you wrote and what the CPU is actually trying to do may not be the same, and a small bit of manual debugging work can help you get started resolving crashes that make no sense whatsoever. No need to remember thousands of instructions either, 99% of assembly code is just variations of copying memory, checking equality and jumping anyway. Look up the weird assembly instructions your disassembler spits out, they’re documented very well.

    • leisesprecher@feddit.org
      link
      fedilink
      arrow-up
      18
      ·
      3 months ago

      Assembly is hard, because you need to understand your problem on multiple levels and get absolute zero guidance by compilers.

      Even C guides you a tiny bit and takes away some of the low level details, so you have more mental capacity to actually solve your problem.

      Oh, and you have a standard library. Assembly seems to involve solving everything yourself. No simple function call to truncate a string or turn a char array to uppercase.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      6
      ·
      3 months ago

      I wouldn’t be able to write Rollercoaster Tycoon in assembly because keeping track of all that code in assembly files must be hell, but people pretending like you need to be some kind of wizard to write assembly code are exaggerating.

      Well, they’ve got a point for the bigger machine codes. Just the barebones specification for x86 is a doorstopper IIRC.

      From what I’ve heard, writing big stuff in assembly comes down to play-acting the compiler yourself on paper, essentially.

        • CanadaPlus@lemmy.sdf.org
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          3 months ago

          TIL. I had tried to understand it a bit, but felt lost pretty fast, and then eventually found out that’s because it’s huge. Is there a good intro to the basic instructions you’re aware of?

          By “play act the compiler” I mean a fairly elaborate system of written notes that significantly exceeds the size of the actual program. Like, it’s no wonder they started thinking about building machine compilers at that stage.

        • luciferofastora@lemmy.zip
          link
          fedilink
          arrow-up
          1
          ·
          3 months ago

          What language is your pseudocode example modeled after? It vaguely reminds me of some iOs App code I helped debug (Swift?) but I never really learned the language so much as eyeballed it with educated guesses, and even with the few things I double checked it has been a few years, so I have no clue what is or isn’t legal syntax anymore.

            • luciferofastora@lemmy.zip
              link
              fedilink
              arrow-up
              1
              ·
              3 months ago

              I’ve heard of Kotlin in the context of Android apps, but never actually used or learned it. I did one mobile app dev project with Java in Android Studio, but never had any formal classes on it either and just learned as I went (the result was shit, but we got a decent grade for being able to evaluate the difficulties and shortcomings and point out learnings).

    • luciferofastora@lemmy.zip
      link
      fedilink
      arrow-up
      1
      ·
      3 months ago

      Having toyed with video game reverse engineering, I definitely feel like I ought to learn a bit more. I understand mov, pointers and registers, and I think there was some inc and add in the code I read to try to figure out base pointers and pointer paths (using Cheat Engine), but I think knowing some more would serve me well there.