News for hackers. Stuff that matters.
Re:Small pleasures of programming (2020) by EvanAnderson on Saturday July 30, 2022 @11:36PM (#32292914)
Back in the 90s I wrote code for an x86 floppy bootsector to produce a little graphical display— a gradient background in VGA mode 13h with some text. Nothing too fancy.

I’d set the direction flag as part of programming the palette registers and forgot to clear it before the loop that displayed the text.

As a result of the “wrong” direction flag all my text appeared backwards.

I added a CLD instruction to clear the direction flag, “costing” one byte, reassembled and re-ran the code and found that it worked as-expected.

Then I got the idea to go remove the CLD (getting my byte back) and just reversed the text strings in the source. Then, when displayed with the “wrong” direction flag the text appeared “right”.

I still giggle about the simple pleasure that brought me, 26 years later.

Re:Small pleasures of programming (2020) by kwhitefoot on Sunday July 31, 2022 @05:13AM (#32294375)
When I was programming embedded controllers in the early 1980s with 8k ROM and 2k RAM such techniques weren't just for giggles they could save significant amounts of money by avoiding the need to redesign PCBs.
Re:Small pleasures of programming (2020) by vbezhenar on Monday August 01, 2022 @06:02AM (#32303888)
Those kinds of microcontrollers are still used today.