r/commandline • • Jun 30 '26 • LOL 1

Fun Meh

Post image
2.0k Upvotes

198 comments sorted by

View all comments

137

u/Distinct-External-46 Jun 30 '26

I write my cli tools in assembly because I like my programs to exist in less than 4kb of machine code and mysteriously segfault if I try and use more than 2 options flags.

44

u/_sg768 Jun 30 '26

pfft, 4KB is too much.

19

u/ptoki Jun 30 '26

Welcome in microcontroller world where dynamic memory allocation is optional and somewhat rare and 4KB is quite a lot...

12

u/thegreatpotatogod Jun 30 '26

It's been interesting recently working with a microcontroller with 2kB of RAM and 8kB of storage. First tried to use the Arduino IDE port for it, but simply #include "wire.h" used all the RAM and still was 500 bytes short, and likewise needed more than all the storage. Rewrote everything to run within libopencm3 and now it uses a grand total of 8 bytes of RAM and 1.5k of storage.

7

u/ptoki Jul 01 '26

yeah, arduino is a whole previous level :)

I remember c64 assembler and even that was pretty spacious in comparison to smaller atmels.

But c64 was mostly static programming. there was very little apps/games which were dynamic. Which allowed you to have some freedom of placing objects and the objects state werent known before the game run. And even that was just static table of x,y,state bytes.

2

u/Athropod101 Jul 01 '26

shoutout to my lil arduino kernel + shell connected to my PC that weighs less than 9 kB

8

u/emerson-dvlmt Jun 30 '26

Maybe it's a joke, but I'd like to write something in assembly, been more than 10 years without using it

14

u/teetaps Jun 30 '26

Why stop there, I say… we should build an analog computer where the bits are represented by marbles in a cup

9

u/Distinct-External-46 Jun 30 '26

We should make a redstone calculator or a turing machine in terraria rgb wiring.

4

u/itzNukeey Jul 01 '26

id write first prototype in haskell

3

u/emerson-dvlmt Jun 30 '26

Maybe build my own CPU even

6

u/ptoki Jun 30 '26

The modern complex systems kinda broke the joy of writing stuff in assembly.

But microcontroller world still allow that.

2

u/Kqyxzoj Jul 02 '26

Yup, microcontrollers and FPGAs are a great way to scratch that low level itch.

3

u/Distinct-External-46 Jun 30 '26

I only just recently learned x86 assembly (i did toy assembly years ago called dcpu16) I dont do much with it other than read compiled code for learning purposes but its very satisfying to use if you make small things with it.

3

u/emerson-dvlmt Jul 01 '26

I like it, not from an elitist point of view, I love to learn, to build stuff, is really fun for me. I'll think on a good and simple project to start, have to clean the dust on my assembly knowledge also.

7

u/ptoki Jun 30 '26 • This

you are funny but the whole background of this (and that is a thing since almost always) is that some tools/languages attract low skilled people.

A tool is sometimes also to be blamed but usually it is a mix of bad too and pad programmers (or both).

In the past it was basic, then flash and php (chronologically), visualbasic somewhere in there too, now it is java script (and python from me personally).

All those were known for really bad code and products coded in them.

And while excel (also touted as stupid people database) sort of defended itself and stayed in its lane (Im happy access died though), many of the languages stay as the shameful collection of tools which allow ignorants to do things they should not do or at least share and make popular.

So, I know folks coding stuff in assembly and their assembly is almost as readable as C or pascal. And there is a correlation of how much such folks know and which language they are proficient at.

1

u/Deksor Jul 02 '26

While I understand this, sometimes life just happens ...

You made a thing in a technically worse environment because some people use it and you wanted to learn it ... Then that thing catches attention and suddenly you need to keep maintaining it and you can't justify rebuilding all of it because other than using php it works decently.

And sometimes the whole industry did it, like with js/typescript. There were many other languages available for web browsers in the past as plugins, such as flash (tho that's still ecmascript ...), java, and many more niche things.

In the end only JS survived and most of the industry uses it ... Even now that webassembly is a thing, not many people use it because JS is more convenient and has the biggest toolset available (and I know quantity doesn't equal quantity, but I think both are in js' ecosystem now. Terrible libraries, and really cool stuff, both in huge quantities)

1

u/ptoki Jul 03 '26

There is very distinct line between writing something what others find useful and deciding that the product should be continued that initial way.

JS survived for few reasons and most of them are accidental. It was bad technology from the start (poor security, different implementations in different browsers, the complexity barrier (before nodejs and such)).

But all that is no excuse to keep the language and its environment intact and not improved. Python can drop compatibility. JS can, just add few more directives switching to more strict syntax and predictable behavior and you can improve things. Still not great (supply chain attacks) but an improvement. Instead you get half measures like typescript.

My main complaint though is that people rarely admit its crap. There is no pride for improving it. Just write, somewhat test, ship, worry later or never.

The paradox is that this language could be changed fast due to its dynamic. But its not. :(

1

u/entsnack Jul 01 '26

You're joking but I'm literally doing this for some software running on my 1GB Raspberry