3 ms·
Having code run in interrupt routines reminds me of some of the hardest stuff I ever had to touch in the 8-bit days. In the Z80 processor there is a magic regi
by stevekemp 12y ago
Having code run in interrupt routines reminds me of some of the hardest stuff I ever had to touch in the 8-bit days.
In the Z80 processor there is a magic register, the R-register, which has a value which increments magically after each instruction has executed. It is possible to calculate how much it goes up by, for example "XOR A" increments R by one, but "LD IX,23000" increments R by two.
If R is given a predetermined value at the start of the protection system, its value is known after every instruction until the loading system starts.
This was used in many of the protection routines on Spectrums, usually as part of code that would decrypt routines, and it was a pain for the same reason that the interrupt would have been - if you're in a debugger you mess up the global state of that register.
- wiz21 12y agoI just can imagine :-) I also learned after that some protections used undocumented processor instructions or edge cases of some... But back in the days, you had no internet, access to documentation was not easy esp. if you were young... So although I regret the lack of friends-like-me by that time, I also appreciate the various tricks of the trades that I've learnt then... Now I write python... That's much easier but it makes programming so much more mundane. Bah, another time, another story :-) stF
- to3m 12y agoThis was on occasional occurrence on Acorn's BBC Micro, which was 6502-based and had a 16-bit free-running timer. There were a number of then-little-known details of the 6502's operation and the interaction between the 1MHz timer clock and the 2MHz CPU clock that made it difficult to predict what the hell was going on (on top of the usual code obfuscation tricks). Interesting thread - well, for former BBC Micro programmers perhaps! - on the topic: http://stardot.org.uk/forums/viewtopic.php?f=1&t=696 http://stardot.org.uk/forums/viewtopic.php?f=1&t=696
- makomk 12y agoThat is an interesting copy protection scheme, partly because it'd probably be a criminal offence to write anything like it these days. It contains code intended to silently reformat whatever's in the floppy drive if any of the checksums fail - something that could easily happen if the tape or hardware's even slightly flaky - and because genuine copies are loaded from tape that's going to be an unrelated floppy, quite possibly one with important data on it.