A commodore 64 emulator ported to Microsoft Silverlight by Pete Brown
"Just to prove Silverlight was up to the task"
This is the raw (and I do mean raw), buggy source code for a Frodo-based port of a C64 emulator for Silverlight 3 Beta
. Future revs may move to a port of Vice, but I wanted to make the current source available while I mull that decision over.
Currently only a small set of games work or partially work. C64 basic commands and typical disk access work. Up to four drives are supported. Currently no sound support. The emulator is pretty CPU intensive
due to zero optimization and lots of array copies; if you're not running a fast dual core machine, you're going to see something close to 100% CPU utilization. This isn't a deficiency in Silverlight, rather the result of some pretty inefficient translation from pointers to array copies. This will be fixed.
If you want to use the function keys the browser normally eats, you need to run the application out of browser. Most other keys are mapped. Run-stop is mapped to Escape.
The interesting thing about the approach I used, is the display is a 50fps video, generated at runtime in Silverlight 3. This uses the enhanced MediaStreamSource (managed codec) support introduced in Silverlight 3.Additional Information
A video showcasing this emulator may be found on Channel 9 here:http://channel9.msdn.com/posts/Dan/Honorable-Mention-MIX09-Show-Off-Contest-Silverlight-Commodore-64-Emulator/
A podcast Scott Hanselman did with me at MIX09 covers this emulatorhttp://www.hanselman.com/blog/HanselminutesPodcast155AC64EmulatorWithSilverlight3ByPeteBrown.aspx
(and yes, 1mhz, not 1hz :) )References
Frodo Emulator: http://frodo.cebix.net/
Sharp C64: http://sourceforge.net/projects/sharp-c64
Frodo is the best place to go for reference. Sharp C64 is what I used as a starting point, but it has some bugs that Frodo does not. Note that Frodo itself is a very CPU-intensive emulator when compared to others. Starting with a C# port still saved me a ton of time and allowed me to understand how everything worked without getting back into C/C++ right away. Sharp C64 was written by Stuart Carnie http://aussiebloke.blogspot.com
, based on the Frodo source code.Screen ShotOther Silverlight Information
If you're interested in Silverlight, be sure to subscribe to my blog at http://10rem.net
Follow me on Twitter at http://twitter.com/pete_brownAttention Mac and Linux Users
The code unfortunately has a dependency on Windows. Specifically, I needed to use platform-specific key codes to map some of the keys that Silverlight does not natively recognize. I'm working with some folks in the moonlight community to get the correct linux keycodes. However, I still need Mac keycodes, as I do not have a mac to test with.
If you're interested in helping me out there, please contact me in the dicussion list or via my blog.