A.D.A. Amiga Demoscene Archive

  Welcome guest! Please register a new account or log in

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / how check winuae from code ?

 

Author Message
kasie
Member
#1 - Posted: 9 May 2006 12:38
Reply Quote
how to check from code, that system where is binary is running, is winuae, with 100% result ?
StingRay
Member
#2 - Posted: 9 May 2006 14:17
Reply Quote
I use the fact that UAE doesn't have 1oo% prefetch emulation. Since I don't want to spoon-feed you, I am not gonna post any code. :)
Basically, what you have to do is this:

You modify an instruction (SMC, woohoo \o/) and check the result directly after you modified it. On a real Amiga, you'd still have the ORIGINAL (i.e. unmodified) instruction due to the prefetch cache whereas on UAE you will have the NEW instruction, i.e. the one that you just "entered" with lovely SMC. :) That very trick was also used back in the day to baffle novice crackers. :D
Angry Retired Bastard
Member
#3 - Posted: 9 May 2006 14:59
Reply Quote
This, however, will only work for machines that HAVE a cache, so it could tell you that your amiga 500 is an emulator...
StingRay
Member
#4 - Posted: 9 May 2006 15:01
Reply Quote
Sorry to spoil your fun but even a500/68000 HAS prefetch cache! :D
winden
Member
#5 - Posted: 9 May 2006 15:21
Reply Quote
I recall UAE can be configured to emulate the next-word-prefetch when doing plain 68000, since it was needed for some very old games :)
StingRay
Member
#6 - Posted: 9 May 2006 15:28 - Edited
Reply Quote
Hmm, yeah, I remember some "more compatible" setting or something. :) I'll do some tests. :D
StingRay
Member
#7 - Posted: 9 May 2006 16:40 - Edited
Reply Quote
Ok, apparently the "more compatible" mode indeed emulates the prefetch. :)
(on 68000 ONLY!)

Just hacked a small .exe and checked it ($dff180 output rulez!). What's interesting though, if you disable "more compatible" and then enable it again on the fly, my prefetch cache trick works again. Guess that's another lovely bug in UAE. :D
kasie
Member
#8 - Posted: 9 May 2006 21:18
Reply Quote
hardcore .. why do not check just on uae.device is here or not ?
doom
Member
#9 - Posted: 25 May 2006 00:25
Reply Quote
uae.device would work, but it could be easily hidden if the UAE developers think it's a "compatibility issue"

UAE has really lousy FPU emulation (wrap instead of clamp, incompatible with 68k round-off modes and no extended precision floats).

UAE in JIT mode is way faster than an 060, so check instruction timing.

Check if UAE traps odd-aligned word fetches like a 68000 would.

Check sprite-sprite and sprite-playfield collisions (they're often disabled in UAE).

Check if you've got 8 MB of chipmem for some odd reason.

Check the raster/blanking behaviour. As far as I can tell, UAE triggers the vertical blanking interrupt at the beginning of the display window as opposed to the beginning of the frame. Can be detected with e.g. copper interrupts.

Generally just find stuff that doesn't work, figure out what goes wrong and duplicate it. And use redundant checks just in case they fix something.
krabob
Member
#10 - Posted: 29 May 2006 10:18
Reply Quote
> but it could be easily hidden if the UAE developers think it's a "compatibility issue" .

checking uae device is the right thing to do to check for UAE, just because it was done for this purpose. The does-it-behave-like-a-real-amiga-or not is tricky, and your forget that tons of other amiga OS also use 68k emulations, even on amiga classic. I mean, a MOS or AOS4 amiga1200 PPC user will throw a 68k executable and see "ohhh your are using UAE !!!"
on the other hand, there are absolutely no reason for a compatibility issue thing, has it check the presence of a device that wouldn't exist on classics.

When you want to know if there is TCPIP, check bsdsocket.library, if you want to know if there is cybergraphics, check cybergraphics.library, if you
want to know if you have FPU, ask the exec funcs, and if you want to know if you are under UAE check uae.device.
kasie
Member
#11 - Posted: 29 May 2006 10:24
Reply Quote
krabob, did you have email ?:) (want to talk with you a bit)
doom
Member
#12 - Posted: 1 Jun 2006 19:27
Reply Quote
> on the other hand, there are absolutely no reason for a compatibility issue thing, has it check the presence of a device that wouldn't exist on classics.

What I meant was, if too many executables appear that refuse to run on UAE and detect UAE by looking for uae.device, it would become a "compatibility issue", in that hiding uae.device would make those applications work.

With the amount of crap I suffered from UAE making Kilofix, I was really tempted to add some checks to break the demo on UAE with a message telling the user he's a twat. I made it "UAE compatible" instead by doing lots of unnatural things, especially with the FPU code and the raster/vblank code.

As for other emulators, well, you need to detect those too. If nothing else then in order to present a message to the user saying "This demo may not run properly on an emulator. If it doesn't work, and you feel you need to bug me about it, please kill yourself first."

 

  Please register a new account or log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0