From mboxrd@z Thu Jan 1 00:00:00 1970 From: corey@lod.com (Corey Lindsly) Date: Sat, 6 May 2017 08:09:13 -0700 (PDT) Subject: [TUHS] Discuss of style and design of computer programs from a In-Reply-To: <20170506144011.GF28787@mcvoy.com> Message-ID: <20170506150913.57571411A@lod.com> > Personally, I find code that is clean, straightforward, obvious to be > beautiful. The clever stuff usually strikes an odd note, not a good > one. > > --lm I am not a programmer. Almost four decades ago, my first computer was a TRS80 Model 1 with 16KB RAM. I spent one month disassembling and stepping through the Z80 code for the resident Microsoft BASIC interpreter. The entire thing fit in a 12KB PROM so it was originally written in assembly and tightly optimized. It was fascinating and extremely instructive. All these years later, I could probably still slap together a Z80 program if I needed to. Anyway, I reached one point in the assembly code that I simply could not understand. It seemed like a mistake, and I went through it again and again until I finally realized what it was doing. There was a branch/loop that jumped to the middle of a multi-byte machine instruction, so that branch had to be disassembled and stepped separately until it "synced" up with the other branch again. Maybe this is standard practice in programming (I don't know) but at the time I thought, what kind of evil genius devised this to save a few bytes of memory? --corey