3 ms·
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 t
by EvanAnderson 4y ago
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.
- kwhitefoot 4y agoWhen 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.
- vbezhenar 4y agoThose kinds of microcontrollers are still used today.