this post was submitted on 04 Aug 2024
486 points (98.2% liked)

Programmer Humor

19589 readers
572 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 16 comments
sorted by: hot top controversial new old
[โ€“] bandwidthcrisis@lemmy.world 44 points 3 months ago (1 children)

I bought a PC kit and it said "some assembly required" so I always try to link at least one asm file in my projects.

[โ€“] Chee_Koala@lemmy.world 6 points 3 months ago

Hahahaha ๐Ÿคฃ

[โ€“] TunaCowboy@lemmy.world 16 points 3 months ago (1 children)

Generally speaking the OS is your universe and you interact via syscalls. Linking libc is also an option.

In some instances you may need to roll your own, but it's likely to be small and specialized.

[โ€“] TheBananaKing@lemmy.world 15 points 3 months ago (1 children)

:stares in genX:

That's not assembly, that's ikea.

Back in my day...

Remember before .dlls were a thing and you had to write your own config files for every game that you installed on DOS?

[โ€“] addie@feddit.uk 15 points 3 months ago

My old job had a lot of embedded programming - hard real-time Z80 programming, for processors like Z800s and eZ80s to control industrial devices. Actually quite pleasant languages to do bit-twiddling in, and it's great to be able to step through the debugger and see that what the CPU is running is literally your source code, opcode by opcode.

Back when a computers were very simple things - I'm thinking a ZX Spectrum, where you can read directly from the input ports and write directly into the framebuffer, no OS in your way just code, then assembly made a lot of sense, was even fun. On modem computers, it is not so fun:

  • x64 is just a fucking mess

  • you cannot just read and write what you want, the kernel won't let you. So you're going to be spending a lot of your time calling system routines.

  • 99% of your code will just be arranging data to suit the calling convention of your OS, and doing pointless busywork like stack pointer alignment. Writing some macros to do it for you makes your code look like C. Might as well just use C, in that case.

Writing assembly makes some sense sometimes - required for embedded, you might be writing something very security conscious where timing is essential, or you might be lining up some data for vectorisation where higher-level languages don't have the constructs to get it right - but these are very small bits of code. You would be mad to consider "making the whole apple pie" in assembly.

[โ€“] HonorableScythe@lemm.ee 13 points 3 months ago* (last edited 3 months ago)

I was taught assembler in my second year at school

It's kind of like construction work

With a toothpick, for a tool

~ The Eternal Flame, by Bob Kanefsky

[โ€“] DacoTaco@lemmy.world 11 points 3 months ago (2 children)

I have. Mostly on embedded devices that have no OS and you need something very specific.

... Or that one time i was reverse engineering a console kernel. I wrote arm asm then. Was actually fun to do tbh

[โ€“] SpaceNoodle@lemmy.world 4 points 3 months ago (1 children)

ARM assembly is so lovely to work with compared to the old CISC garbage.

[โ€“] ApexHunter@lemmy.ml 1 points 3 months ago (1 children)

m68k assembly was my favorite back in the day.

[โ€“] SpaceNoodle@lemmy.world 1 points 3 months ago

I love ARM assembly so much that I'm looking at it right now.

[โ€“] TheL321@lemmy.dbzer0.com 3 points 3 months ago (1 children)
[โ€“] DacoTaco@lemmy.world 2 points 3 months ago* (last edited 3 months ago)

Haha ye. It is super interesting to see all those OS principals and seeing how nintendo implemented them. Stuff i will never forget either and some design patterns i have implemented in my actual job too

[โ€“] quantenzitrone@lemmings.world 3 points 3 months ago (1 children)

If everything above ASM is the Universe, what is below? What is the ALU, CU and everything else that goes into Processor design? What comes before the Universe?

[โ€“] technom@programming.dev 4 points 3 months ago

Solid state physics.

[โ€“] stsquad@lemmy.ml 2 points 3 months ago

I write assembly for test cases and early setup code. I read far more assembly than I write.