On Sun, Aug 28, 2016 at 08:56:04PM -0300, Isaac M. Bavaresco wrote: > It is said that (ancient) Microsoft Basic for Z80 is full of such > "optimizations", where a jump to the middle of a multi-byte > instruction to achieve a different instruction is used > extensively. I think it was written in assembly. Yes. A common use was 3E AF LD A,0xAF Where "3E AF" is load accumulator with immediate value 0xAF, and "AF" alone is XOR accumulator with accumulator, resulting in zero. There were equivalents using 16-bit registers as well, such as jumping into a NOP operand instead of the start of the three byte load. I've not seen this with ARM, but then most instructions are single word. RussellMc escreveu: > I've subsequently been assured that some compilers would do this if > the opportunity arose. Would they? Yes, I've seen compilers with this optimisation, but I've not remembered which ones. > If hand coded, as people have noted for other similar examples of > cleverness - "That's amazingly clever - I'd immediately fire anyone > who did that." :-). Thus is innovation disparaged. ;-) > Maintainability, even if documented and well understood, would be > close to zero. I disagree. It's an issue of style. There's also the issue of undocumented machine instructions; Z80 had a few, and it was fun to disassemble code that used them and then use them myself. --=20 James Cameron http://quozl.netrek.org/ --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .