• ayyy@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      68
      ·
      28 days ago

      The game Roller Coaster Tycoon was famously hand written in raw CPU instructions (called assembly language). It’s only one step removed from writing literal ones and zeros. Normally computers are programmed using a human-friendly language which is then “compiled” into CPU instructions so that the humans don’t have to deal with the tedium and complication of writing CPU instructions.

      • OsrsNeedsF2P@lemmy.ml
        link
        fedilink
        English
        arrow-up
        23
        ·
        edit-2
        27 days ago

        To further emphasize this, I had an assembly course in university. During my first lab, the instructor told us to add a comment explaining what every line of assembly code did, because if we didn’t, we would forget what we wrote.

        I listened to his advice, but one day I was in a rush, so I didn’t leave comments. I swear, I looked away from the computer for like 2 minutes, looked back, and had no idea what I wrote. I basically had to redo my work.

        It is not that much better than reading 1s and 0s. In fact in that course, we spent a lot of time converting 1s and 0s (by hand) to assembly and back. Got pretty good at it, would never even think of writing a game. I would literally rather create my own compiler and programming language than write a game in assembly.

        • pivot_root@lemmy.world
          link
          fedilink
          English
          arrow-up
          15
          ·
          27 days ago

          I’m probably completely insane and deranged, but I actually like assembly. With decent reverse engineering software like Ghidra, it’s not terribly difficult to understand the intent and operation of isolated functions.

          Mnemonics for the amd64 AVX extensions can go the fuck right off a bridge, though. VCVTTPS2UQQ might as well be my hands rolling across a keyboard, not a truncated conversation from packed single precision floats into packed unsigned quadword integers.

          • emergencybird@lemmy.world
            link
            fedilink
            English
            arrow-up
            9
            ·
            27 days ago

            I had a course in uni that taught us assembler on z/os. My advisor told me most students fail the course on the first try because it was so tough and my Prof for that course said if any of us managed to get at least a B in the course, he’d write us a rec letter for graduate school. That course was the most difficult and most fun I’ve ever had. I learned how to properly use registers to store my values for calculations, I learned how to use subroutines. Earned myself that B and went on to take the follow up course which was COBOL. You’re not crazy, I yearn to go back to doing low level programming, I’m mostly doing ruby for my job but I think my heart never left assembler hahaha

          • MonkderVierte@lemmy.ml
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            27 days ago

            Ah yes, there was this guy in our tech school class that used to code golf in assembly. Was a crack in math and analytics too, which might explain it somewhat. Well, everyone is different i guess.

        • ericbomb@lemmy.world
          link
          fedilink
          English
          arrow-up
          10
          arrow-down
          1
          ·
          27 days ago

          To send the point home even more, this is how in python you make a line of text display:

          print("Hello World")

          This is the same thing, in assembly (According to a blog I found. I can’t read this. I am not build better.)

            org  0x100        ; .com files always start 256 bytes into the segment
          
              ; int 21h is going to want...
          
              mov  dx, msg      ; the address of or message in dx
              mov  ah, 9        ; ah=9 - "print string" sub-function
              int  0x21         ; call dos services
          
              mov  ah, 0x4c     ; "terminate program" sub-function
              int  0x21         ; call dos services
          
              msg  db 'Hello, World!', 0x0d, 0x0a, '$'   ; $-terminated message
          

          But python turns that cute little line up top, into that mess at the bottom.

          I like python. Python is cute. Anyone can read python.

          • pivot_root@lemmy.world
            link
            fedilink
            English
            arrow-up
            6
            ·
            27 days ago

            That assembly is for a DOS application. It would be more verbose for a modern Linux or Win32 application and probably require a linker script.

            But python turns that cute little line up top, into that mess at the bottom.

            Technically, not quite. Python is interpreted, so it’s more like “call the print function with this string parameter” gets fed into another program, which calls it’s own functions to make it happen.

            • ericbomb@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              27 days ago

              Yeah over simplifying it a bit, and that’s funny that the stupid thing I found wasn’t even stupid enough.

              But was mostly trying to impart that we should be happy for modern languages, because for every line you write in a modern language, it’ll do a dozen things on the back end for you that in assembly you’d need to do by hand.