Here is an interview with Toni Wilen, the main coder of the excellent Amiga emulator WinUAE.
Hello Toni. Could you introduce yourself to our readers?
Hello. I am Toni Wilen, I live in Finland, I rarely talk like this and, generally, I don't care about many things. :)
You are the main developer of WinUAE, the most advanced Amiga emulator. But what did you do (in terms of programming) before WinUAE?
PC: EA NHL series player editor NHLInfo (abandoned ages ago; EA NHL became boring a long time ago) and Civilization clone Great Nations (also abandoned ages ago, lost interest). This one even started as an Amiga game.
Amiga: "serious" programs : FileMaster file manager, SysInfo (SnoopDOS-like utility) and some small utilities. Scene stuff : coded Digital Disco II and some quite ugly Admirals SF intros...
How did you get involved with UAE?
It was over 10 years ago. I don't really remember... See question 10.
Do you still have any contact with the original UAE team? (Bernd Schmidt, Brian King, Mathias Ortmann,...)
Bernd is still doing something with UAE, but he seems to have lost interest. I haven't heard anything from the others.
Who are the other people, besides yourself, working nowadays on the development of WinUAE? And what part do they play in the team?
Unfortunately, it seems I am the only one, at least who really knows how UAE works... (except Bernd, of course).
What does the "U" mean in UAE? (Since the beginning of its development, there have been several possibilities : unusable, unix, universal, ubiquitous,...)
I don't know or care. You need to ask Bernd for the true meaning. :)
What language(s) is/are used to code WinUAE?
Plain C, except some x86 assembly in JIT.
The WinUAE code seems big and complex. What were your thoughts when you took over as main programmer on Brian King's retirement from the project?
Brian was mostly porting UAE to Windows (he also did the original Picasso96 emulation and original GUI; it wasn't 100% only porting), so before I started there wasn't much difference between official UAE and WinUAE (except the GUI). It wasn't until UAE development started slowing down way too much for my taste (2004 or so, I think) and when I also finally started to understand the core code, that I decided to do everything my own way. Previously, I had sent all patches to Bernd and sources were more or less in sync.
The complexity of the code seems to be a problem for the future of WinUAE. It will surely be difficult to find another maintainer who is sufficiently familiar with Amiga hardware and software, won't it?
Yeah, that will be practically impossible.
Basically, you have to know C, Amiga hardware (just reading the hardware reference manual isn't enough; you need real-world experience with hardware-banging programs), Amiga software (not so important, but it would make debugging very difficult), full knowledge of 680x0 CPU series (very important) and, finally, Windows programming knowledge.
What are the main features you have implemented in UAE/WinUAE, both when it was maintained by Bernd Schmidt/Brian King, and since you have been the main programmer?
AGA graphics modes display was the main feature. Before that time, it was considered "impossible" to emulate AGA (I didn't understand at that time how something could be impossible to emulate, and I still don't understand), so I had to prove them wrong. :D Others were basically small updates and compatibility fixes here and there. Check the official UAE changelog (that comes with UAE sources) for more information; it has quite detailed entries.
Later updates : too many to list here.. I guess A500 near-cycle exact mode and real 68000 prefetch emulation that improved A500 compatibility greatly.
Bernd Meyer coded the JIT of WinUAE. He has also coded beta versions of PowerPC and Warp3D emulation for UAE. Do you think one day WinUAE could launch PowerPC software?
PowerPC in WinUAE = NEVER. First technical reason: I don't know anything about PowerPC CPUs and I don't want to. Other reasons: I don't care; I was never interested in PowerPC. If you want to run PowerPC programs, use some real PowerPC emulator or write your own. Also, most PowerPC programs are ports of DOS/Windows programs, so why not just run the original version? Main reason: For me, "Amiga" means only Classic 68K Amigas. PowerPC Amiga is IMHO a completely different hardware platform. Both hardware and OS makes the Amiga (IMHO !).
Are there any new features users should expect in future releases of WinUAE? And in the long term ?
Easy to use input configuration GUI. :) Currently, it is very powerful, but also really confusing and unintuitive to use.
What about support for the multi-core x86?
Very difficult. For compatible modes (like A500), practically impossible, if you want any performance gains. Chips in Amiga "talk" to each other continuously, you can't have a separate thread for chips, because continuous inter-chip messaging would kill the performance.
Some "post"-processing parts could be moved to other threads, but it isn't easy, at least if you don't want to lose performance on single core CPUs... (not interested, not worth the trouble, at least I won't waste my time for free). Also, in theory, JIT CPU emulation could be moved to a separate thread, but again, I am not interested in possible performance gains (in worst case, the result is slower performance if there is too much messaging between threads...).
Some parts of emulation have always been multithreaded, e.g. the filesystem. I am also trying to move the RTG Amiga VRAM buffer to real display copy/color space translation part to a separate thread, which should be an easy way to increase RTG performance.
Bug-free multithreaded coding is troublesome; it is all too easy to introduce bugs that will be extremely difficult to debug. It will be even more complex if it still needs to run on a single core CPU without the extra threads.
The initial goal of UAE was to be able to emulate perfectly an Amiga 500. Today, what is the new goal? A perfect global Amiga Classic emulation?
It still is perfect A500 emulation. Unfortunately, getting 100% cycle-exactness takes too much time (fixing last 1% takes 99% of the time and so on...) and recently I haven't been really interested anymore; it is too boring without any real reward just to get one rare program to work 100% correctly.
I guess another goal is to emulate all classic Amiga models, including special hardware. This does not include correct emulation speed (I have simple "rule": <68020 = accuracy is important, even if it would mean ridiculous host CPU requirement, 68020+AGA = speed first, accuracy isn't important). Emulating 68020+ CPUs with correct speed is also very complex due to internal cache(s). It is possible, but emulation speed would be unusably slow and it would not be compatible with JIT. Same with MMU emulation.
Who had the idea to include the noise of the floppy disk? And why have you included this strange idea in the emulator?
I don't remember. Basically, the only motivation for floppy sound was a program called "gurumusic" that played El Condor Pasa using the floppy drive. Of course, it had to be fully emulated. :)
What is/was the most difficult part of the Amiga to emulate?
"Difficult" is the wrong word. Emulation is easy as long as you have full hardware documentation (which you don't). At the cycle-exact hardware level, there are many things that you can only hope work like the real thing. Even one cycle difference can break some program, and in the worst case nobody notices until years later... Another "difficult" part is making emulation fast enough, which results in messy code that will be difficult to follow or understand... (and if you introduce multithreading, it is messiness^2...).
In other words: emulation coding isn't difficult, it is "only" very time consuming, especially testing stuff on a real Amiga.
Do you still use real Amigas?
Yes, but mainly for emulation testing. I programmed on my real Amiga 1200 until 1995 or so, but missing memory protection and resource tracking made debugging difficult, needing to reboot way too often.
I am also upgrading my real Amigas with hardware that I couldn't afford in 1980s/90s (being a student, etc. at that time), like accelerator boards, SCSI expansions, etc., both for compatibility testing and just because having that stuff was every Classic Amiga owner's dream at that time...
BTW, the best ever modern invention for Amiga users is the Compact Flash memory card as a HD replacement. All my real Amigas have a CF harddrive - fast, silent and small compared to real harddrives. I still need one more IDE-SCSI adapter for my "new" A3000. :)
Do you actually use WinUAE (when you're not programming it)? For which tasks and how often?
Not much. Playing Classic games, watching scene demos and, of course, testing.
In which situation is Classic Amiga still better than emulation on a very fast PC?
"Better" is subjective; there are so many variables and preferences. A few years ago I would have recommended real Amiga if you wanted guaranteed smooth scrolling, but it isn't so simple anymore with common LCD displays. Now it is hit and miss on both emulation and real Amigas. :)
Use what you prefer; nobody is forcing you to "choose". You can even use both; they are not mutually exclusive. :)
What do you think about other variants of UAE? (E-UAE, UAE4ALL,...)
I haven't used them. See the following question. :)
E-UAE looked promising, finally updating UAE for "other" operating systems. But the author seems to have disappeared completely...
Mac OS X switched to x86 in 2006. Is a Mac OS X port of WinUAE possible? And could it be done easily?
CPU isn't a problem (except for JIT). WinUAE heavily depends on Windows' subsystems. A basic port without GUI or WinUAE Windows-specific features would not be too difficult ("core" is still fully portable).
I refuse to replace GUI with some portable GUI library because :
1) most of them look very "non-Windows". I really hate Windows programs without "Windows-look" (see Java GUIs...).
2) most of them require huge separate library.
What do you think about other Amiga emulators? (Fellow,...)
I have never used Fellow. Fellow AFAIK was built to be fast on relatively slow CPUs and my goal has always been compatibility, even if it means slow and unusable emulation without a fast CPU. There is also some kind of Amiga emulation (not related to UAE or Fellow) in MESS, but apparently it is really basic.
WinUAE is an important part of Amiga Forever from Cloanto. Do you receive money from them for your work? Do they contact you for adding such or such feature?
Technically and legally, anyone can sell WinUAE; there is nothing wrong with that. But yes, I have received Amiga hardware donations from Cloanto and they are far more useful than some money.
How do you feel about the legalities surrounding the emulation of the Amiga?
Totally idiotic. I guess "Only Amiga makes it possible"... At least 1.x ROM images should be free.
Are there any other projects you are working on at the moment?
Some real Amiga related software projects just for fun, but unfortunately, I seem to lose interest too easily if it takes too long. One is a compressed Kickstart ROM that automatically decompresses all ROM modules, including 680x0 libraries and setpatch to Fast RAM without the need for an extra reboot and debug/safe mode using A1000-like disk-based ROM image loading (this is some kind of team project with Jeff Weeks who did Remus and other ROM tools).
What is your opinion about pre-configured Amiga environments like Amikit and AmigaSYS?
They are useful because they make application testing easier. No need to get all required semi-incompatible MUI classes (does anyone still think Amiga does not have "DLL Hell"?) and other libraries to make some newer software work.
As usual : use if you like pre-configured environments; do not use if you do not like.
But on the other hand, very high-end environments like AmiKit aren't really "Amiga-like" anymore in my opinion. But who cares. :)
You don't seem to be a supporter of the new generation of Amigas (with AROS, MorphOS or AmigaOS 4). Have you ever tested them? What is your opinion about these systems?
For me, Classic Amiga is only a hobby/retro. I do not want or need Amiga for serious stuff and I want to use modern, powerful hardware (which the original Amigas were), not some expensive PowerPC boards that are mostly made from obsolete PC parts. Also, an OS that doesn't have full memory protection and resource tracking isn't modern enough for me.
I have never understood why hobbyist/retro people are usually put in the same group with "next gen" Amiga users. Many of "us" are not interested (some parts of the so-called "Amiga community" see you as an enemy of "the Amiga" if you don't like or care about PowerPC Amiga stuff... Another reason why I don't take part in most Amiga discussions here and there).
You have the last word...
I hope my answers were not too confusing. :)