- cross-posted to:
- programmer_humor@programming.dev
- cross-posted to:
- programmer_humor@programming.dev
I’ve been working on disassembling some 8-bit code from the 90s. Fuckers returned bits from functions using the overflow bit. Nuts.
What era was that device? Some old games on NES had to use all kinds of quirks like this to overcome hardware limitation.
It’s in an AlphaSmart. I’m working through disassembling the ROM to add some new features.
I use bit masks, suck it! (Really though, programming on an embedded CPU might be reasonable to do this, depending on the situation, but on a PC, trying to not waste bits wastes time)
exactly! it is more costly for your pc cpu to check for a bit inside a byte, than just get the byte itself, because adresses only point to bytes
Store 8 bits in the same byte then 👌
Wrong direction!
Store only bits using word-length ints (32 bits in most modern architectures), and program everything to do math using arrays of 32 int-bits to numbers!
Oh man! That took me down memory lane!
I once had to reverse engineer a database to make an invoice integration. They had an int named flags. It contained all status booleans in the entire system. Took me a while to figure that one out.
We’ve all been there, friend. The bit arrays can’t hurt you now.