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.
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.