Lemmy.one
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
sag@lemm.ee to Programmer Humor@lemmy.ml ·
edit-2
1 年前

Anyone here use assembly?

lemm.ee

message-square
79
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
1.12K

Anyone here use assembly?

lemm.ee

sag@lemm.ee to Programmer Humor@lemmy.ml ·
edit-2
1 年前
message-square
79
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
  • davel [he/him]@lemmy.ml
    link
    fedilink
    English
    arrow-up
    50
    ·
    1 年前

    Assembly code is for writing C compilers, and C compilers are for writing Lisp interpreters.

    • henfredemars@infosec.pub
      link
      fedilink
      English
      arrow-up
      21
      ·
      1 年前

      I saw a Scheme interpreter written in assembly running a C compiler written in Scheme.

      • davel [he/him]@lemmy.ml
        link
        fedilink
        English
        arrow-up
        31
        ·
        1 年前

        • henfredemars@infosec.pub
          link
          fedilink
          English
          arrow-up
          4
          ·
          edit-2
          1 年前

          There’s actually good reasons for this design. It’s easy to write a Scheme interpreter in assembly, but it’s hard to write a C compiler in assembly that handles everything correctly. Much rather write it in higher level language if possible and Scheme lowers the bar to getting there, so you can get away from using assembly as quickly as possible. Or you can copy somebody else’s Scheme implementation of a C compiler because now you’re platform independent.

          Then you can write your C compiler in C (or steal a better compiler already written in C) and close the loop. For your final step, you use the C compiler to compile itself.

    • wewbull@feddit.uk
      link
      fedilink
      English
      arrow-up
      15
      ·
      edit-2
      1 年前

      Only the most very basic compilers. C compilers are in C mainly.

      • davel [he/him]@lemmy.ml
        link
        fedilink
        English
        arrow-up
        11
        ·
        edit-2
        1 年前

        Not the first C compiler obviously. According to this Stack Overflow post, BCPL* begat B, which begat C. Language self-hosting is pretty fascinating.

        *Perhaps BCPL was originally written in assembly; I’m not certain: https://github.com/SergeGris/BCPL-compiler

      • ulterno@lemmy.kde.social
        link
        fedilink
        English
        arrow-up
        8
        ·
        1 年前

        Talking about bootstrap here?

        • wewbull@feddit.uk
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 年前

          Indeed

      • Revan343@lemmy.ca
        link
        fedilink
        arrow-up
        2
        ·
        1 年前

        And that’s how you get the Thompson hack

    • Noble Shift@lemmy.world
      link
      fedilink
      arrow-up
      10
      ·
      1 年前

      deleted by creator

    • RestrictedAccount@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      1 年前

      Back in High School in the 80’s me and a buddy wrote a Z-80 editor assembler in TRS-DOS BASIC.

      It was not rocket science.

      • davel [he/him]@lemmy.ml
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        1 年前

        I never did get very far with the TRS-80 Editor Assembler, but that was my first exposure to such things.

        I also remember the BASIC code for the Dancing Daemon which was replete with PEEKs and POKEs, such that much of it was written in machine code.

        • RestrictedAccount@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          8 个月前

          Exactly how we did it too. We created the editor/assembler that peeked to see what was there and display it in Assembly, Hexadecimal, and ASCII.

          You could edit whichever version you wanted and it would Poke it into RAM.

          You could also save swaths to a file.

      • Alexstarfire@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        8 个月前

        True, it was computer science.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 94 users / day
  • 749 users / week
  • 2.58K users / month
  • 8.47K users / 6 months
  • 440 local subscribers
  • 38.1K subscribers
  • 1.86K Posts
  • 39.2K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.7
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org