And now - some of the development Max'a:
Continuing the theme of emulators
Alex'om started, a few words
I want to say about how to protect
from them (mostly from UKV).
Not everyone may like the presence of an integrated
debugger, a which almost any program
You can not just tune, but
hack. And it can not intercept the pressing ESC (exit the
debugger) - this is not the Spectrum, and Pressing this buttons
leaves no trace ... (This was would be great: press any kettle
ESC, to dig deeper into the program, and there - SHADOW
FORMATTER ...) Therefore, there is only one way - at the very
beginning of the program detect the launch of an emulator and
reset.
After a series of inhuman experiments on UKV
Spectrum Debugger, it was found
several ways:
1) The following bytes: # DD, # DD,
# 23 are interpreted by the emulator
as INC HL, whereas for
Spectrum is - INC IX. Ie If, after such a check register
increased HL, then the program running under the emulator.
2) Absolutely not emulated
3rd and 5 th bits of the flag register - it dropped to zero.
140.
XOR A
ADD A, 240
PUSH AF
DEC SP
POP AF
AND 40
2
If after such
procedures in the battery will
score - a program UKV.
3) garter for speed.
Measured rate compared with any number is not recommended.
First - and Spectrum
rate may be slightly
vary.
Second - the rate of the emulator can be chosen (eg
lower cut-off frequency of 2
times - as a result of clock cycles between interrupts will be
more).
Better to do so. UKV strongly
slow when working with attributes. Now if you make a measurement
cycles between interrupts and
cycle count put the team record numbers in the range of
attributes, then you will get a single value.
If you then repeat the measurement again, but the record
number in conventional memory, the result will be different.
At present, these Spectrum
two numbers are equal.
140.
Cycle 1 st:
LD BC, 50
XOR A
COUNT1 INC BC
LD (22528), A
JR COUNT1
Cycle 2 nd:
LD BC, 0
XOR A
COUNT2 INC BC
LD (65535), A
JR COUNT2
2
In the first cycle is a team
LD BC, 50. This is done to
to give a 'head start' slower (on the emulator) cycle (suddenly
Spectrum also slightly inhibits
when writing the attributes ...)
Naturally, to run these
cycles are needed immediately after
HALT'a and out of them - through
procedure for handling IM 2.
It now remains to compare the two
these numbers, for example - SPEED1 and
SPEED2:
LD HL, SPEED1
LD DE, SPEED2
AND A
SBC HL, DE
JR C, EMU
OKAY ...
The same can be done
with the findings of the ports - emulator
very, very slowly changing
Border color (after all, "border" - at
Actually only part of the screen
at IBM, and the emulator after every OUT'a to port 254 changes
color All border pixels, and it takes considerable time).
Alex also wrote about another
emulator - Z80TRDOS.
So: all of the above tests on it do not work - it is more
compatible than UKV Spectrum Debugger.
Yes, and defend against it not
is meaningless, since Z80 does not monitor.
Nevertheless, I can recommend the following: LD HL, (# FFFF).
After this, Z80TRDOS hopelessly hangs together with the PC,
and the only thing that can help -
button RESET (seven woes - one
RESET ...)
Incidentally, the same will happen with
UKV, if your PC is not installed EMS-Memory.
More Alex wrote about cases of corruption ROM (as in an
emulator ROMs - RAM is only with software
forbidden entry, apparently
Sometimes, this check does not work ...)
I could not find such
conditions under which the
this damage.