Welcome, Guest. Please login or register.

Author Topic: Is Amiga Emulation better than the real thing?  (Read 70449 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Is Amiga Emulation better than the real thing?
« Reply #179 from previous page: January 21, 2009, 12:06:06 PM »
@amigaski

You really have no idea how an emulator works do you!?

The timing of operations within the emulator must be consistent within the emulator world, not the real world. That is to say operations must be performed within the documented number of emulator cycles... If this is true, then software running on the emulator will function perfectly. Secondly, if the host CPU can run the emulated cycle faster than a real hardware cycle (thus the emulator can then wait until a real cycle would complete), the user will experience will be perfect.

Now which bit don't you get?

-Edit- bah! Shaggoth said it better :-D  

Offline shoggoth

  • Full Member
  • ***
  • Join Date: Dec 2004
  • Posts: 223
    • Show only replies by shoggoth
Re: Is Amiga Emulation better than the real thing?
« Reply #180 on: January 21, 2009, 01:09:23 PM »
@amigaski

I think you confuse "timing" and "timer". Huge difference. You can maintain *timing* for subsystems in relation to eachother without using a *timer*.

Nowadays it's common to synchronize emulation to a "virtual" electron beam. The state of each subsystem is updated every other pixel (depends on the machine itself and how accurately you need to emulate it). For a given number of pixels, you execute the corresponding number of CPU cycles, followed by the corresponding number of cycles for each subsystem.

However: back in the days, we didn't have much CPU horse power, hence people used different tricks to achieve higher speed. AFAIK it was fairly common to use interrupts and dedicated hardware if possible. It wasn't very accurate, but it enabled people to emulate machines at reasonable speed.

A good comparison is the SMS+ emulator vs. older Sega Master System emulators for the Amiga. SMS is scanline accurate and very compatible, it is however much slower compared to e.g.AmiMasterGear which iirc uses the on-board sprite hardware etc for emulation. The latter does not achieve the same level of compatibility, but is definitely useful on lower-spec machines. The former one does not need any high resolution timers or anything of that nature, yet it's superior to the older approach when it comes to emulation accuracy (note however that AmiMasterGear is excellent given the circumstances).


EDIT: I spelled like a monkey. I corrected that somewhat.
 

Offline amigaksi

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 827
    • Show only replies by amigaksi
    • http://www.krishnasoft.com
Re: Is Amiga Emulation better than the real thing?
« Reply #181 on: January 22, 2009, 12:57:57 PM »
>by shoggoth on 2009/1/21 6:53:24

>>You replied to this after about 1 year.

>Yeah. I remembered having this discussion once before and I was right. And you're just as misinformed now as you were one year ago, aparently.

Insults won't help.  Fact help.  Reality doesn't seem to care about your insults; it keeps chugging along according to its laws.  You have been misinformed since 1 year and assumed you are not so you decide to come back.  That's the reality.  

>>I never stated anyting "magical"-- just bare bone facts about hardware differences. You do need timing to emulate things that rely on it. Atari 800 has 8 POT counters that increment at exact cycle positions on the scanline; it has a fast pot scan that increments every 558 ns. A Vcount that increments at exactly 2 scanlines (228 CPU cycles) on an exact cycle consistently. Atari 800 has an IRQ that can cause an interrupt to occur at exact pixel points on the screen without flickering or diverging. It has a DLI which can also be stabilized w/o requiring WSYNC register.

>Nope. You interleave code for each subsystem, and that's what makes it cycle accurate. The internal state of each emulated part is correct in relation to eachother. That's what cycle-accurate means. You don't use timers for that. You're simply misinformed about this.

Sorry, I live in REALITY not your illusory concepts of cycle-accurate.  You are dealing with FAKE time not REAL time so the real/fake jewelry example applies.  Just having some counter for cycles is not same thing as measuring the cycle time.  Eventually you have to map the cycles to real time cycles.  We don't want to experience your fake cycles.  

>Again - this is bull. You don't need high res timers to achieve high res emulation. You seem to think so, but that's not how you do it.

Just read what you wrote-- where's the argument?  All you did was give your opinion.  If I simulate a 10-bit DAC on an OCS Amiga using Volume registers and AUDxDAT, you better get your fake time cycles to correspond to real time cycles else the output will be "bull" as you put it.  That's just one example just to see if you'll insult me or reply logically.
--------
Use PC peripherals with your amiga: http://www.mpdos.com
 

Offline shoggoth

  • Full Member
  • ***
  • Join Date: Dec 2004
  • Posts: 223
    • Show only replies by shoggoth
Re: Is Amiga Emulation better than the real thing?
« Reply #182 on: January 22, 2009, 01:36:32 PM »
Quote

amigaksi wrote:
>>I never stated anyting "magical"-- just bare bone facts about hardware differences. You do need timing to emulate things that rely on it. Atari 800 has 8 POT counters that increment at exact cycle positions on the scanline; it has a fast pot scan that increments every 558 ns. A Vcount that increments at exactly 2 scanlines (228 CPU cycles) on an exact cycle consistently. Atari 800 has an IRQ that can cause an interrupt to occur at exact pixel points on the screen without flickering or diverging. It has a DLI which can also be stabilized w/o requiring WSYNC register.


To emulate this you synchronize emulation to the electron beam. For each pixel, you let the CPU and other subsystems run the corresponding number of cycles with respect to their own clocks. That enables emulation of advanced mid-scanline hardware effects. This is a well known technique and is used in most emulators.

Quote

Quote

>Nope. You interleave code for each subsystem, and that's what makes it cycle accurate. The internal state of each emulated part is correct in relation to eachother. That's what cycle-accurate means. You don't use timers for that. You're simply misinformed about this.

Sorry, I live in REALITY not your illusory concepts of cycle-accurate.  You are dealing with FAKE time not REAL time so the real/fake jewelry example applies.


No, that's what cycle accurate means. The state of each subsystem at any given time equals that of a real system given the same number of clock cycles. That's what it means.

Quote

Just having some counter for cycles is not same thing as measuring the cycle time. Eventually you have to map the cycles to real time cycles. We don't want to experience your fake cycles.


Ok, you're talking about emulation throttling. Generally you let the system run for one frame, then you use throttling to ensure that emulation speed stays constant.

Real time emulation as you describe it have no impact on the actual accuracy of the emulation with respect to the emulated application. You've got that part wrong.

Quote

Quote

>Again - this is bull. You don't need high res timers to achieve high res emulation. You seem to think so, but that's not how you do it.

Just read what you wrote-- where's the argument?  All you did was give your opinion.  If I simulate a 10-bit DAC on an OCS Amiga using Volume registers and AUDxDAT, you better get your fake time cycles to correspond to real time cycles else the output will be "bull" as you put it.  That's just one example just to see if you'll insult me or reply logically.


Again I've explained this numerous times. Look at the source code of any modern emulator and you'll see.

About your example. As I've stated earlier, you use code interleaving to achieve synchronisation between the subsystems (in this case the sound hardware and CPU). It's possible to emulate this part perfectly, except for the small delay induced by buffering (which is necessary since computer load varies, both because of the actual emulator and fluctuations caused by other processes).
 

Offline detz

  • Full Member
  • ***
  • Join Date: Feb 2003
  • Posts: 139
    • Show only replies by detz
Re: Is Amiga Emulation better than the real thing?
« Reply #183 on: January 22, 2009, 03:35:24 PM »
Quote

spihunter wrote:
@amiga_3k

Quote
But on Amikit it didn't come near to the real fun. It seemed like ages between hitting a key and actually hear the sound!


I'm running Octamed w/ Winuae/amikit on a 3ghz Dell GX280 here and I dont get the lagging that your talking about?

Its faster and more responsive than my real 030/A1200?

I sold off all my "high end" Amiga harware after running Winuae on my Dual Xeon :-)


Yep me too, 300 quid in my pocket, and space on my  desk.
Not really played with getting the audio working properly, as I only use Octamed as a MIDI sequencer nowadays. I did play one of my old modules which used a mixture of samples and MIDI, and yeah, it was well out of sync, but I didn't play around with settings to see if I could make it better...
 

Offline amigaksi

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 827
    • Show only replies by amigaksi
    • http://www.krishnasoft.com
Re: Is Amiga Emulation better than the real thing?
« Reply #184 on: January 22, 2009, 06:45:43 PM »
>by shoggoth on 2009/1/21 8:09:23

>@amigaski

>I think you confuse "timing" and "timer". Huge difference. You can maintain *timing* for subsystems in relation to eachother without using a *timer*.

I am clear on what I stated and am sticking to it.  I already explained that-- you are just calling it "timing", but it has nothing to do with actual cycle time.  But you can write applications (and many already exist) where this cycle time is measuring actual time.

--------
Use PC peripherals with your amiga: http://www.mpdos.com
 

Offline Painkiller

  • Sr. Member
  • ****
  • Join Date: Jun 2007
  • Posts: 255
    • Show only replies by Painkiller
Re: Is Amiga Emulation better than the real thing?
« Reply #185 on: January 22, 2009, 07:14:47 PM »
For the countless of hours I have banged my head against the wall with real Amigas I'd say emulators are well worth it.

But then again nothing beats the real thing and sadly there isn't PPC emulation in WinUAE. I'm hoping that Mac Mini will finally be the new "Amiga" experience for me that will allow me to play old games via emulation and at the same time have a very modern Amiga like OS that doesn't need that much tweaking to get something running.
 

Offline shoggoth

  • Full Member
  • ***
  • Join Date: Dec 2004
  • Posts: 223
    • Show only replies by shoggoth
Re: Is Amiga Emulation better than the real thing?
« Reply #186 on: January 23, 2009, 08:54:26 AM »
Quote

amigaksi wrote:
I am clear on what I stated and am sticking to it.  I already explained that-- you are just calling it "timing", but it has nothing to do with actual cycle time.  But you can write applications (and many already exist) where this cycle time is measuring actual time.


Ok, so what you're claiming is that no matter how accurate an emulator is, you could write an application that can detect that it's not the real deal? :-)
 

Offline amigaksi

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 827
    • Show only replies by amigaksi
    • http://www.krishnasoft.com
Re: Is Amiga Emulation better than the real thing?
« Reply #187 on: January 23, 2009, 01:22:49 PM »
>by Painkiller on 2009/1/22 14:14:47

>For the countless of hours I have banged my head against the wall with real Amigas I'd say emulators are well worth it.

You mean banged your head for debugging stuff?  There's also the cross compile option that I use for that (and almost instant upload).

>But then again nothing beats the real thing and sadly there isn't PPC emulation in WinUAE.

Agreed-- nothing beats the real thing.  

>I'm hoping that Mac Mini will finally be the new "Amiga" experience for me that will allow me to play old games via emulation and at the same time have a very modern Amiga like OS that doesn't need that much tweaking to get something running.

That's the thing-- you just have to hope it will do whatever experience you are looking for.  I prefer getting things exact and knowing beforehand especially if it involves timing.
--------
Use PC peripherals with your amiga: http://www.mpdos.com
 

Offline amigaksi

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 827
    • Show only replies by amigaksi
    • http://www.krishnasoft.com
Re: Is Amiga Emulation better than the real thing?
« Reply #188 on: January 23, 2009, 01:43:59 PM »
>by shoggoth on 2009/1/22 8:36:32

amigaksi wrote:
>>I never stated anyting "magical"-- just bare bone facts about hardware differences. You do need timing to emulate things that rely on it. Atari 800 has 8 POT counters that increment at exact cycle positions on the scanline; it has a fast pot scan that increments every 558 ns. A Vcount that increments at exactly 2 scanlines (228 CPU cycles) on an exact cycle consistently. Atari 800 has an IRQ that can cause an interrupt to occur at exact pixel points on the screen without flickering or diverging. It has a DLI which can also be stabilized w/o requiring WSYNC register.

>To emulate this you synchronize emulation to the electron beam. For each pixel, you let the CPU and other subsystems run the corresponding number of cycles with respect to their own clocks. That enables emulation of advanced mid-scanline hardware effects. This is a well known technique and is used in most emulators.

Good so you agee you do need to synchronize emulation to the electron beam.  This translates to having something that can time things at 3.58Mhz or greater.  But you're wrong that it's used in most emulators as there's no way to run the corresponding number of cycles with respect to their own clocks without an accurate timer.  Remember that current processors based on caching, power management, dynamic frequency shifts, etc. can give different cycle counts running the same exact code.

>>Sorry, I live in REALITY not your illusory concepts of cycle-accurate. You are dealing with FAKE time not REAL time so the real/fake jewelry example applies.

>No, that's what cycle accurate means. The state of each subsystem at any given time equals that of a real system given the same number of clock cycles. That's what it means.

If on an Atari 800, I plot a pixel each time the CRT reaches point A, B, C, etc. on the screen, it resolves to a certain frequency.  That frequency will not be the same if you use FAKE time.

>Real time emulation as you describe it have no impact on the actual accuracy of the emulation with respect to the emulated application. You've got that part wrong.

I think we have different definitions of emulation.

>>Just read what you wrote-- where's the argument? All you did was give your opinion. If I simulate a 10-bit DAC on an OCS Amiga using Volume registers and AUDxDAT, you better get your fake time cycles to correspond to real time cycles else the output will be "bull" as you put it. That's just one example just to see if you'll insult me or reply logically.

>Again I've explained this numerous times. Look at the source code of any modern emulator and you'll see.

I don't need to look at any source code to derive a deductive conclusion that if the timing of the PC hardware isn't being used or isn't there for the given accuracy required for an application, the results will be wrong.  If I update the volume registers at 30Khz in the above example, you have two options-- write directly to the hardware at the same rate or patch up the emulator and "understand" what I am up to and buffer up data and introduce a latency.

>About your example. As I've stated earlier, you use code interleaving to achieve synchronisation between the subsystems (in this case the sound hardware and CPU). It's possible to emulate this part perfectly, except for the small delay induced by buffering (which is necessary since computer load varies, both because of the actual emulator and fluctuations caused by other processes).

But your emulator won't buffer up writes to volume registers done via some IRQ/Copper unless it knows the timing of the IRQ/Copper and that it's audio; it would be bufferring up DAC data going to AUDxDat.
--------
Use PC peripherals with your amiga: http://www.mpdos.com
 

Offline amigaksi

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 827
    • Show only replies by amigaksi
    • http://www.krishnasoft.com
Re: Is Amiga Emulation better than the real thing?
« Reply #189 on: January 23, 2009, 01:47:59 PM »
>by shoggoth on 2009/1/23 3:54:26

Quote:
--------------------------------------------------------------------------------


amigaksi wrote:
I am clear on what I stated and am sticking to it. I already explained that-- you are just calling it "timing", but it has nothing to do with actual cycle time. But you can write applications (and many already exist) where this cycle time is measuring actual time.


--------------------------------------------------------------------------------


>Ok, so what you're claiming is that no matter how accurate an emulator is, you could write an application that can detect that it's not the real deal?

I don't need to do anything special to detect it's the real deal.  For example, if I shift right the VHPOSR by a few bits and add them to some counter and use that counter overflow to draw a pixel on the screen, you won't get the same effect on the emulator unless you have timed the VHPOSR using a real timer.
--------
Use PC peripherals with your amiga: http://www.mpdos.com
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Is Amiga Emulation better than the real thing?
« Reply #190 on: January 23, 2009, 01:56:29 PM »
Quote

amigaksi wrote:
>by shoggoth on 2009/1/23 3:54:26

Quote:
--------------------------------------------------------------------------------


amigaksi wrote:
I am clear on what I stated and am sticking to it. I already explained that-- you are just calling it "timing", but it has nothing to do with actual cycle time. But you can write applications (and many already exist) where this cycle time is measuring actual time.


--------------------------------------------------------------------------------


>Ok, so what you're claiming is that no matter how accurate an emulator is, you could write an application that can detect that it's not the real deal?

I don't need to do anything special to detect it's the real deal.  For example, if I shift right the VHPOSR by a few bits and add them to some counter and use that counter overflow to draw a pixel on the screen, you won't get the same effect on the emulator unless you have timed the VHPOSR using a real timer.


As long as the VHPOSR and the counter are synchronized to the same clock, then the effect would be the same as on the real hardware, taking your unstated assumption that they are synchronized to the same clock on the real hardware...

Offline amigaksi

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 827
    • Show only replies by amigaksi
    • http://www.krishnasoft.com
Re: Is Amiga Emulation better than the real thing?
« Reply #191 on: January 23, 2009, 02:05:09 PM »
>As long as the VHPOSR and the counter are synchronized to the same clock, then the effect would be the same as on the real hardware, taking your unstated assumption that they are synchronized to the same clock on the real hardware...

Hey, we agreed on something.  Just name the clock or register on the PC that you would use.
--------
Use PC peripherals with your amiga: http://www.mpdos.com
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Is Amiga Emulation better than the real thing?
« Reply #192 on: January 23, 2009, 02:13:16 PM »
Quote

amigaksi wrote:
>As long as the VHPOSR and the counter are synchronized to the same clock, then the effect would be the same as on the real hardware, taking your unstated assumption that they are synchronized to the same clock on the real hardware...

Hey, we agreed on something.  Just name the clock or register on the PC that you would use.


Given this is a display issue, I would sync it with a virtual electron beam, as Long as the PC can perform all the operations required by the emulator before the real hardware could do it, then by the time of the screen refresh (the point where both the emulator and real hardware interface with the human), the states of the Emulator and the real machine would be identical.

-Edit- @Chaoslord :-D

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: Is Amiga Emulation better than the real thing?
« Reply #193 on: January 23, 2009, 02:26:18 PM »
@Amigaski

I am currently trying to port my game from real Amigas over to WinUAE/UAE/etc.

One of the things I do is like this:
Code: [Select]

IF (UAE) THEN
  // don't bother reading VPOSR on WinUAE. No point.
ELSE
  // take VPOSR into account when drawing realtime gfx
END_IF

Am I doing the correct thing?
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline shoggoth

  • Full Member
  • ***
  • Join Date: Dec 2004
  • Posts: 223
    • Show only replies by shoggoth
Re: Is Amiga Emulation better than the real thing?
« Reply #194 on: January 23, 2009, 02:37:31 PM »
Quote

amigaksi wrote:
Good so you agee you do need to synchronize emulation to the electron beam.  This translates to having something that can time things at 3.58Mhz or greater.  But you're wrong that it's used in most emulators as there's no way to run the corresponding number of cycles with respect to their own clocks without an accurate timer.  Remember that current processors based on caching, power management, dynamic frequency shifts, etc. can give different cycle counts running the same exact code.


"Cycles" in this case is the number of cycles the hardware in question would have completed given a particular number of pixels. It's not based on timers. And caches etc won't have any impact whatsoever on that value, since it's a relationship between the subsystems in the emulated context. You're confusing the "real" CPU with the emulated dito. The emulated CPU can run perfectly in sync with the emulated hardware regardles of performance fluctuations in the host environment.

It's like this. You know how many cycles a particular subsystem would complete during e.g. 16 pixels. In case of the CPU, let's say it's 4. Another hypothetical device completes 12 cycles during the same time span. You let the emulated CPU run 4 emulated cycles. Then you run the other hypothetical device for 12 cycles. Then you draw 16 pixels. Then you repeat this process. If needed, you can increase the resolution of this approach even further down to 1 cycle, but in many cases this is not necessary since the subsystems in question require a certain number of cycles for each task. If the granularity is right, the behavior and interaction between the subsystems in the emulator will equal that of their hardware counterparts. You've achieved cycle accuracy in the emulated context.

Quote
If on an Atari 800, I plot a pixel each time the CRT reaches point A, B, C, etc. on the screen, it resolves to a certain frequency.  That frequency will not be the same if you use FAKE time.


In the emulated context - and that's what we're discussing - it'll have the same frequency as the original. The application cannot detect the difference, nor does the user - given that the emulator runs fast enough.

Quote
I think we have different definitions of emulation.


Amigaski - I do get what you're after - but you've got the terms "emulation" and "cycle accuracy" wrong. I go by the common definition, and you clearly have your own one. Check wikipedia, for example. It'll confirm my definition of the word "emulator".

I claim that it's possible to emulate an Amiga or a A800 percectly accurate - and the definition of accurate in this case means A: the software can't tell the difference between an emulated machine and a real one, and B: the user perceives the framerate, response time etc. as a real machine.

I suspect that your definition is a comparison in real time - where the emulated machine won't be perfectly in sync with a "real" one at any given moment. Problem is, this is not even true for two "real" machines, given different hardware revisions, CPUs - it's not even true for two identical machines due to clock drifting.

Quote
>>Just read what you wrote-- where's the argument? All you did was give your opinion. If I simulate a 10-bit DAC on an OCS Amiga using Volume registers and AUDxDAT, you better get your fake time cycles to correspond to real time cycles else the output will be "bull" as you put it. That's just one example just to see if you'll insult me or reply logically.


I did answer that, at least I was under the impression that I did. The solution is pretty fundamental and you'll find the same kind of coding techniques in any modern music application. You use buffering - one buffer is calculated while another one is being replayed. This causes a slight sound latency, depending on buffer size. Given that the sound emulation catches register changes at a per sample basis, it'll sound like the original. On top of that you can apply filters etc. to mimic analog filters etc. present on the original sound hardware. Faster systems can have a smaller buffer, and hence less latency, naturally.

Quote

But your emulator won't buffer up writes to volume registers done via some IRQ/Copper unless it knows the timing of the IRQ/Copper and that it's audio; it would be bufferring up DAC data going to AUDxDat.


But the emulator will know the timing of the IRQ/Copper and the audio circuitry - in relation to eachother. It doesn't do that by keeping some hardware timer, it does so by keeping track of the cycle count of each subsystem. That cycle count is then synchronized to "real life" by means of throttling, at regular intervals.