logoalt Hacker News

zahlmanyesterday at 1:56 PM2 repliesview on HN

> illegal instructions... were often used by programmers

Intentionally, with an expected effect? I'd need a citation for that.


Replies

boomlindeyesterday at 9:09 PM

Yes, many of those are perfectly stable. For example, the 6502 has an undocumented instruction commonly known as "LAX" which loads both the A and X registers at the same time in a predictable manner in most addressing modes, in the same time and space it would otherwise take to load either of those registers on their own.

The benefits of being able to do stuff like this when you need to conserve resources are obvious, and common idioms have formed around their use. Check out https://csdb.dk/release/?id=198357

chuckadamsyesterday at 3:26 PM

Some desultory googling turned up:

* https://www.nesdev.org/wiki/CPU_unofficial_opcodes#Games_usi...

* https://hitmen.c02.at/files/docs/c64/NoMoreSecrets-NMOS6510U... (doesn't name any software, but some copy protection schemes were already known to use them)