Thesis on emulation

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
drx
Interested
Posts: 16
Joined: Mon Jul 02, 2007 8:45 pm

Thesis on emulation

Post by drx » Mon Jul 16, 2012 7:29 pm

Hi guys,

Wasn't sure where to post this, so here goes. (edit: oh, just noticed there's a blabla section, sorry)

I finally got around to writing my master's thesis, and I sorta wanted to write an emulator but I wanted to get a general idea on how thing's are done, etc. Hence the idea to write a thesis on emulation.

Here it is: http://lukezapart.com/EmulationThesis.pdf

I would love to hear your comments, so please let me know what sucks, what is missing and what is incorrect (especially the parts about sound as I'm not an expert).

I even managed to credit some of you :)

Luke / drx
Last edited by drx on Mon Jul 16, 2012 11:39 pm, edited 1 time in total.

Gigasoft
Very interested
Posts: 95
Joined: Fri Jan 01, 2010 2:24 am

Post by Gigasoft » Mon Jul 16, 2012 10:59 pm

Although many games have large tiles composed of smaller tiles, this has nothing to do with the graphics hardware, unless you count the NES where palette selection applies to four tiles at once, making 16x16 tiles made of 8x8 tiles a natural design choice.

Figure 16 is wrong, as it lists SNES and Saturn with indexed color depths of 11 and 15. It should be 9 and 11. The so-called 11 bit format on SNES and 15 bit format on Saturn are direct color formats. It probably shouldn't be called "Nintendo SNES" either, since the N stands for Nintendo.

SNES can't rotate or scale sprites.

The 8 FM algorithms supported by the YM2612 aren't supposed to mimic specific instruments, but some are better suited for certain sounds than others. A sound designer typically determines the best algorithm to use by looking at a spectrogram of the instrument he is trying to mimic and through trial and error.

The main thing that is wrong with this "thesis" is that most of it isn't about emulation. There are many details about systems for which there are emulators, but apart from the chapter on CPU emulation, there is little about how to actually emulate them.

There are also many sentences that are awkward or that don't mean anything. Remember, you're not trying to explain to someone over the phone what an emulator is. Every word should mean something, and every sentence should mean what it says. Don't sound like a politician trying to get out of an embarassing question or a suspect being interrogated by the police. An example of what I'm talking about it this absolutely awful sentence in the beginning of chapter 3: "There are a number of enhancements to be made in an emulator". What on earth is an "enhancement" and why are these enhancements "to be made" in "an" emulator? If you don't know what to write here, take a minute to think about why you feel that there are a number of enhancements to be made. Is it because it is customary to do so? Is it a tradition? Do they augment the user experience? What kind of impact do these features have on the overall design choices for an emulator?

Since you haven't written an emulator yourself, it might be difficult to write about emulation. You can study source codes for existing emulators to get to know more about their inner workings. It's also probably a good idea to think about the following topics and see if there's anything that needs to be mentioned:
- Maintaining sprite, background and texture caches
- Emulating mid-frame effects efficiently
- Save states, movies, determinism and sources of indeterminism
- High resolution graphics, filtering, other graphical enhancements, and the problems they may present
- Things that are hard to emulate
- Avoiding undesirable sound artifacts when the emulator is running fast or slow
- Emulating network interfaces
- Debugger code and data breakpoints

bgvanbur
Interested
Posts: 46
Joined: Fri Jun 22, 2012 11:13 pm

Post by bgvanbur » Mon Jul 16, 2012 11:22 pm

Original: "For example, the Sega Genesis has a palette that can hold up to 64 different colors selected from 512 different color values."

Suggestion: "For example, the Sega Genesis has four palettes and each palette can hold 16 colors selected from 512 different color values."

Figure 15 is a picture you did not make (I have seen it on Wikipedia before), you should cite the source.

I agree Figure 16 is wrong and needs some clarifications/updates.

Figure 20, "sprite size" perhaps should be "max sprite size"? Also, Sega Genesis could flip the sprite, wonder if any this should be noted in this figure.

Figure 22 should be cited. Perhaps figure 24 too if that is taken from somewhere.

This seems like an ok introduction so far, though I only took a quick read through. I think the real meat about emulation will be nice to read once you write that. Good luck on your thesis!

drx
Interested
Posts: 16
Joined: Mon Jul 02, 2007 8:45 pm

Post by drx » Mon Jul 16, 2012 11:55 pm

Thanks, great feedback so far.
Although many games have large tiles composed of smaller tiles, this has nothing to do with the graphics hardware, unless you count the NES where palette selection applies to four tiles at once, making 16x16 tiles made of 8x8 tiles a natural design choice.

Figure 16 is wrong, as it lists SNES and Saturn with indexed color depths of 11 and 15. It should be 9 and 11. The so-called 11 bit format on SNES and 15 bit format on Saturn are direct color formats. It probably shouldn't be called "Nintendo SNES" either, since the N stands for Nintendo.

SNES can't rotate or scale sprites.

The 8 FM algorithms supported by the YM2612 aren't supposed to mimic specific instruments, but some are better suited for certain sounds than others. A sound designer typically determines the best algorithm to use by looking at a spectrogram of the instrument he is trying to mimic and through trial and error.
Thanks, will modify accordingly.
The main thing that is wrong with this "thesis" is that most of it isn't about emulation. There are many details about systems for which there are emulators, but apart from the chapter on CPU emulation, there is little about how to actually emulate them.
Since you haven't written an emulator yourself, it might be difficult to write about emulation.
Real thesis or no, most people do boring stuff for their master's thesis (at least around here), such as Django apps for managing cooking recipes. Since I already have to write a long paper on something, might as well be an introduction to emulation.

I've written "toy" emulators before, obviously nothing I have released. My paper/article is supposed to be an article introducing someone to emulation, not necessarily a manual on how to write an emulator. Perhaps I should have mentioned beforehand that it's supposed to be light on details.
There are also many sentences that are awkward or that don't mean anything. Remember, you're not trying to explain to someone over the phone what an emulator is. Every word should mean something, and every sentence should mean what it say
True. The draft is rough and I mean to polish it. The problem with writing stuff is that you develop blind-spots and don't see some things, which is why I decided to post here. Chapter 3 is an example.
- Maintaining sprite, background and texture caches
- Emulating mid-frame effects efficiently
- Save states, movies, determinism and sources of indeterminism
- High resolution graphics, filtering, other graphical enhancements, and the problems they may present
- Things that are hard to emulate
- Avoiding undesirable sound artifacts when the emulator is running fast or slow
- Emulating network interfaces
- Debugger code and data breakpoints
This a great list, thanks again.
Figure 15 is a picture you did not make (I have seen it on Wikipedia before), you should cite the source. Figure 22 should be cited.
I put some public domain pics as placeholders before I can substitute my own. I fully plan to cite sources of things I end up using in the final version.
Figure 20, "sprite size" perhaps should be "max sprite size"?
That's what it was supposed to mean; awkward wording I agree.
Perhaps figure 24 too if that is taken from somewhere.
That's mine.

Once again, thanks for the wonderful feedback so far and taking the time to reply.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Jul 17, 2012 12:11 am

drx wrote:Real thesis or no, most people do boring stuff for their master's thesis (at least around here), such as Django apps for managing cooking recipes. Since I already have to write a long paper on something, might as well be an introduction to emulation.

I've written "toy" emulators before, obviously nothing I have released. My paper/article is supposed to be an article introducing someone to emulation, not necessarily a manual on how to write an emulator. Perhaps I should have mentioned beforehand that it's supposed to be light on details.
Holy CRAP! No wonder engineers don't take "Computer Scientists" seriously. I didn't finish my Master's Thesis because of politics between professors at the Uni I attended, but it was on "Proton lithography of nano scale features and their affect on planar quantum structures." :lol:

Getting my BSEE, I had undergrad computer classes that went into more detail than your Master's Thesis. :cry:

Huge
Very interested
Posts: 197
Joined: Sat Dec 13, 2008 11:50 pm

Post by Huge » Tue Jul 17, 2012 12:14 am

Chilly Willy wrote:"Proton lithography of nano scale features and their affect on planar quantum structures." :lol:
I'd read that.

bgvanbur
Interested
Posts: 46
Joined: Fri Jun 22, 2012 11:13 pm

Post by bgvanbur » Tue Jul 17, 2012 12:11 pm

Chilly Willy wrote:Holy CRAP! No wonder engineers don't take "Computer Scientists" seriously. I didn't finish my Master's Thesis because of politics between professors at the Uni I attended, but it was on "Proton lithography of nano scale features and their affect on planar quantum structures." :lol:

Getting my BSEE, I had undergrad computer classes that went into more detail than your Master's Thesis. :cry:
There are tons of politics when dealing with a master's thesis. For mine in Computer Engineering I wrote a "Graphical Microcode Simulator with a Reconfigurable Datapath" program and the thesis paper was supposed to be short and sweet just because you have to write a paper for a master's thesis. It was controversial since it was mostly a large project with a paper, where as most other people were mostly writing a paper with a small useless project. My simulator is now used by the computer architecture classes at my college so it was well worth the effort. Well that simple paper had three advisors, everyone wanting a different style and level of detail. Since one advisor compared my thesis paper to other papers, I couldn't have a short and sweet paper to appease him. A couple months before I defended I had an advisor leave and a new advisor that wanted a whole new set of requirements. I loved writing the program but I hated writing the paper.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Jul 17, 2012 5:28 pm

bgvanbur wrote:
Chilly Willy wrote:Holy CRAP! No wonder engineers don't take "Computer Scientists" seriously. I didn't finish my Master's Thesis because of politics between professors at the Uni I attended, but it was on "Proton lithography of nano scale features and their affect on planar quantum structures." :lol:

Getting my BSEE, I had undergrad computer classes that went into more detail than your Master's Thesis. :cry:
There are tons of politics when dealing with a master's thesis. For mine in Computer Engineering I wrote a "Graphical Microcode Simulator with a Reconfigurable Datapath" program and the thesis paper was supposed to be short and sweet just because you have to write a paper for a master's thesis. It was controversial since it was mostly a large project with a paper, where as most other people were mostly writing a paper with a small useless project. My simulator is now used by the computer architecture classes at my college so it was well worth the effort. Well that simple paper had three advisors, everyone wanting a different style and level of detail. Since one advisor compared my thesis paper to other papers, I couldn't have a short and sweet paper to appease him. A couple months before I defended I had an advisor leave and a new advisor that wanted a whole new set of requirements. I loved writing the program but I hated writing the paper.
Yeah, that was the reason I didn't finish my Master's - I needed the head of the math department, the head of the physics department, and the head of the electrical engineering department to work together... except I could only ever get any TWO to work together. I got tired of the politics after a year and went and got a job. :x

Your last couple sentences hit the nail on the head - using the proton lithography chamber was as awesome as flying the Enterprise, but trying to work with the "advisors" was worse than pulling your own wisdom teeth.

slobu
Very interested
Posts: 85
Joined: Tue Apr 03, 2012 6:02 pm

Post by slobu » Tue Jul 17, 2012 5:44 pm

Chilly Willy wrote:...except I could only ever get any TWO to work together.
Were there names Fas, Goode & Chiep?

bgvanbur
Interested
Posts: 46
Joined: Fri Jun 22, 2012 11:13 pm

Post by bgvanbur » Tue Jul 17, 2012 7:14 pm

Chilly Willy wrote: Yeah, that was the reason I didn't finish my Master's - I needed the head of the math department, the head of the physics department, and the head of the electrical engineering department to work together... except I could only ever get any TWO to work together. I got tired of the politics after a year and went and got a job. :x

Your last couple sentences hit the nail on the head - using the proton lithography chamber was as awesome as flying the Enterprise, but trying to work with the "advisors" was worse than pulling your own wisdom teeth.
After about a year and a half working on my thesis, I also got a job before finishing my thesis. It took another six months before I could finally get some agreement to defend it. Many times I thought about just stopping. And I think one head of department would be bad (one of mine was a former department head). Having three sounds impossible!

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Jul 17, 2012 7:34 pm

slobu wrote:
Chilly Willy wrote:...except I could only ever get any TWO to work together.
Were there names Fas, Goode & Chiep?
Hehehe - pretty much. :lol:

There was a lot of professional in-fighting at U of H back then (late 80's), with big budgets on the line. Physics eventually won when Dr. Chu discovered his high temp superconductor, but they had already been getting a bigger budget, which caused a lot of bad feelings on campus. It didn't help that they took the main parking lot for the Engineering colleges and turned it into the new business college. It also didn't help that English majors got more computer time than Engineering majors. I used my English computer account far more often, and thanked heaven I had it.
bgvanbur wrote:After about a year and a half working on my thesis, I also got a job before finishing my thesis. It took another six months before I could finally get some agreement to defend it. Many times I thought about just stopping. And I think one head of department would be bad (one of mine was a former department head). Having three sounds impossible!
If I had gotten a job in Houston, I'd have probably stuck it out, but my job was in Arizona. That was pretty much the nail in the coffin.

I had been working with someone through the mail on a project while going to grad school, so when his company relocated to Arizona, he offered me a job when they were done moving. Given the stress I was under at the Uni, I decided it was probably better to take the job.

Post Reply