Got it. Perhaps by having it as a option that is off by default older/slower machines do not suffer from the function being inside openms. Very powerfull computers i7+ threadrippers and all that extreme HW could do the variations without any problems. Or am I too optimistic?
@Daemos: I'm sure it's implementable with good performance, even on older machines. I only wanted to point out that it's not a trivial change in the current code base. And I gave some historical perspective for why it is like that.
Thnx for clearing up. Understood.
I have adjusted my program, and it is possible to detect an emulator.
As you have seen the code, and I have adjusted it a bit, however I know it works on real MSX and emulator. My disk drive broke and have to order another one.
I have combined the speed and emulation in one again. First checking the F flag (stat reg 0) with some mnemonics for timing and later without timing (waiting period).
As Grauw indeed mentioned in another post, sometimes de cpu get not correct info from the vdp (when F flag is set, at same time as you request info from vdp).
So I am requesting the routine for detecting for like 128 times, and subtract the lowest counter from highest counter. For example results from requesting vdp with counter, max result 213, minus min 170 (missed F flag)result. If difference is over 10 (in fact over 3 even)... Real MSX else emulator..
This is the explanation of the program.
When I have tested it enough I will post it, so far so good!
I prophesize a cold war, a tech racing between OpenMSX developers and emulators exploiters from now on
.
not the first of such events going on. Same is happening in the android world where root detection goes to such extremes that they are sometimes even getting false positives.
But it will eventual be very beneficial for the openmsx team as the emulation will become so damn well that eventually we can stop calling it emulation. Downside is that developers may start creating detection techniques because for some reason they don't want their stuff running on emulation.
If you are interested: (maybe some timing adjustment is needed, so far I could not find any flaws..) Speed needs some adjustment, because I like to detect Z80 from 2.6Mhz up to 50Mhz, so result has to be multiplied by 0.8928. (needs some work still)
Z80 minimum speed is 2.6Mhz and up to around 50Mhz. I calculated the multiplier is 0.8928 (B);
B*3=2.6, B*4=3.5712, B*8=7.14 etc etc...
@Daemos, you are correct. However, now almost everyone is connected with internet, you can make statistics on real and emulation. Furthermore, you can warn users of software for bugs or other unwanted noticeable results of running in emulator. And last, but not least, to remind the coder, he/she/it is running the software in emulator and has to be tested in real machine.
New routine finished and tested.
For easy testing I have put notification" No Z80 inside" for emulation and " Z80 inside" for real MSX.
OpenMSX and WebMSX will mention "No Z80 inside".....
Assembly file : emulator.asm
Binary file: emulator.bin
Zip file: emulator.zip
It will output text in screen 0. (width 80)
bload "emulator.bin",r
will do..
Awaiting comments
It will output text in screen 0. (width 80)
Width 80 will not work on most MSX1 machines (real and emulated)
Maybe better to choose width 40 for the output text
I noticed!! But text will show anyway.... But Ok ...
As you requested!!!
Updated!
I used minimum of 'bug' F flag possible, 8 refreshes, if not occurring, increase times of reading....
If this feature is emulated, I got (an)other way(s)...
HINT: for example: Read VDP status register 245 (really!!) . If it is 0 you are in emulator.
MSX2 and up... example, afterwards read contents of WTF..
; Emulation detecy MSX 2and up : WIP ORG &HC000 START: DI LD A,245 OUT (&H99),A LD A,15+128 OUT (&H99),A NOP NOP IN A,(&H99) LD (WTF),A XOR A OUT (&H99),A LD A,15+128 OUT(&H99),A EI RET WTF: DEFB 0