Detecting OpenMSX or RealMSX?

Page 9/10
2 | 3 | 4 | 5 | 6 | 7 | 8 | | 10

By Daemos

Prophet (2059)

Daemos's picture

05-03-2023, 15:52

Sooner the later this is going to be abused for whatever reason and within time false positives will start to show up as the emulation improves. The same happened in android and rooting.

By Accumulator

Champion (329)

Accumulator's picture

05-03-2023, 22:58

@Manuel,
Prove it is working? For MSX2 check the status register I mentioned. When using real MSX the status register mentioned is changing, similar like R register. OpenMSX or other emulator shows 0x00 and not changing.... There is your prove!
Furthermore, as Grauw stated, the MSX VDP has a 'bug', reading the status register and F flag sometimes misses the set bit when the VDP and reading goes simultaneously. No prove necessary, it is a fact! Maybe this can be emulated, but I have my doubts,.... I think the sailboat guy can agree...Wink
Status register (R#15) is MSX2 and up (Just to inform)

By Accumulator

Champion (329)

Accumulator's picture

10-03-2023, 02:22

@Manuel:

Here is the code for MSX2 (and I guess msx2 and up, tested on Sony HBF..... and OpenMSX) :

        ORG   &HC000
START:
        DI
        LD    A,245
        OUT   (&H99),A
        LD    A,15+128
        OUT   (&H99),A
        NOP
        NOP
        LD    C,0
        LD    B,255

TEST:   IN    A,(&H99)
        OR    A
        JR    Z,JUMP
        INC   C
JUMP:   DJNZ  TEST
        LD    A,C
        LD    (WTF),A

        XOR   A
        OUT   (&H99),A
        LD    A,15+128
        OUT   (&H99),A

        EI
        LD    A,(WTF)
        OR    A
        RET   NZ
        LD    A,1
        LD    (EMULAT),A
        RET
WTF:      DB    0
EMULAT:  DB    0

build/compile it and run it!
defusr=&hc000:a=usr(0)
?peek (emulat)

result: 1= in emulator! (MSX2 and up version)

Manuel, listen carefully!!! You presume all emulators are perfect, they aren't! Even if you look at the code of MAME and MSX VDP emulation, some is missing.... The goal is to emulate 100%, but you need some stupid fuckers like me, among, to show you out of the box possibilies... Only after reporting, out of the box, or showing posibilities it can be detected, change is happening. I prefer 100% emulation, however if I like to test some undocumented (combinations) or want to have the result from the VDP without the necessary waiting time,... or what happened if I poll a register (or combination) of registers too often (can for example the vdp handle all requests), or polling unspecified vdp registers (47-63), or a command related to vdp 32-46, that is not menioned, or even vdp status registers, (officially, only a few, but 245 shows my proof!!!)

Food for thought!!!

PS: I have some drive to find ways, over and over again to detect emulation...... You should be happy, because I am reporting....

@Wlcracks, did the increase to 32 work?
emulatwl.bin
64 times check refresh for you specially!

By Wlcracks

Hero (565)

Wlcracks's picture

10-03-2023, 16:09

Accumulator wrote:

@Wlcracks, did the increase to 32 work?
emulatwl.bin
64 times check refresh for you specially!

not sure what you mean with increase to 32 but this file still outputs " No Z80 inside" on a real VG8020/00.

By Manuel

Ascended (19461)

Manuel's picture

10-03-2023, 20:03

Can people confirm that reading non-existing VDP status registers always results in 0? If yes, then we can fix that in openMSX. We somehow thought they returned 0xFF.

By Accumulator

Champion (329)

Accumulator's picture

10-03-2023, 20:47

On original MSX2 the register increases (like R register ) and emulator is fixed as 0x00
I have checked all status registers above 9 and find some interested discrepancies...

By Accumulator

Champion (329)

Accumulator's picture

10-03-2023, 21:38

@Wlcracks,

you used the new files in the post mentioned above?
I'll get back... (after returned from drawing table)

I created also another file:
version2
10 bload "emulat2.bin"
20 poke &Hc0b6,128
30 defusr=&Hc000:a=usr(0)

@Wlcracks, I will create a file for you and will show all retrieved data on which i base my assumption.

By Manuel

Ascended (19461)

Manuel's picture

10-03-2023, 22:07

Accumulator wrote:

On original MSX2 the register increases (like R register ) and emulator is fixed as 0x00
I have checked all status registers above 9 and find some interested discrepancies...

In openMSX it is fixed at 0xFF, not 0x00...

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

11-03-2023, 01:32

Sorry to jump in without reading all the history, but I think that best way to detect OpenMSX vs RealMSX is to measure the exact CPU speed against some other device... by default OpenMSX runs at 3579545Hz speed and that is theoretically correct answer, but in reality there are tons of things that put it off a big way starting from room temperature. -> If the speed is always same 3579545Hz it must be emulator.

Sure, you can get around the detection very easily, but I'm not really sure, what was the original purpose.

By Accumulator

Champion (329)

Accumulator's picture

11-03-2023, 02:15

@manuel, strange... the result of my openmsx , and status reg 245 is 00, never mind..
Even that is the case, the status register of original msx is changing almost every time....
0 or 255... goes not give a fuck!!! I double checked 00 is status register 245 and triple checked

status register 255 -0

VDP status registers from 255 to 0 from left to right... (REAL MSX)

@Wlcracks,
try this one..
just bload"emulatv2.bin",r

If is it still not working, please after running, bsave the file again ,
bsave "msx1-test.bin",&hc000,&hc1e1
and send to me .... so I can analyse.

Page 9/10
2 | 3 | 4 | 5 | 6 | 7 | 8 | | 10