this post was submitted on 15 May 2025
1158 points (98.6% liked)

Programmer Humor

23376 readers
1109 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 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Subverb@lemmy.world 39 points 6 days ago* (last edited 6 days ago) (3 children)

The 8-bit Intel 8051 family provides a dedicated bit-addressable memory space (addresses 20h-2Fh in internal RAM), giving 128 directly addressable bits. Used them for years. I'd imagine many microcontrollers have bit-width variables.

bit myFlag = 0;

Or even return from a function:

bit isValidInput(unsigned char input) { // Returns true (1) if input is valid, false (0) otherwise return (input >= '0' && input <= '9'); }

[–] frezik@midwest.social 16 points 6 days ago (2 children)

Nothing like that in ARM. Even microcontrollers have enough RAM that nobody cares, I guess.

[–] malank@lemm.ee 10 points 6 days ago

ARM has bit-banding specifically for this. I think it’s limited to M-profile CPUs (e.g. v7-M) but I’ve definitely used this before. It basically creates a 4-byte virtual address for every bit in a region. So the CPU itself can’t “address” a bit but it can access an address backed by only 1 bit of SRAM or registers (this is also useful to atomically access certain bits in registers without needing to use SW atomics).

[–] Treczoks@lemmy.world 1 points 6 days ago (1 children)

Tell this to the LPC1114 I'm working with. Did you ever run a multilingual GUI from 2kbytes RAM on a 256x32 pixel display?

[–] Subverb@lemmy.world 1 points 4 days ago (1 children)

I did a multilingual display with an 8031 in 1995 on a 2x16 text LCD. I had 128 bytes of RAM and an EPROM. Did English, Spanish and German.

You kids have it so easy nowadays. 🤣

[–] Treczoks@lemmy.world 1 points 4 days ago

Last counting was 114 languages on the LPC1114. And yes, with normal LCDs I've done similar things on an 8051 before.

[–] the_tab_key@lemmy.world 13 points 6 days ago

We could go the other way as well: TI's C2000 microcontroller architecture has no way to access a single byte, let alone a bit. A Boolean is stored in 16-bits on that one.

[–] jkercher@programming.dev 5 points 6 days ago

And, you can have pointers to bits!