May 10th, 2010
Hi all
Sorry it has been so long since my last update. I’ve had projects that took higher priority than my emulation development. I still have very little free time to work on emulation but I will make more of an effort to make time for it and this site.
I will start looking back into gameboy sound emulation and will write a tutorial on it when I finish.
Also I wanted to say thanks to those of you who have left positive comments, it is appreciated. Ive been searching the internet and found a few people using my tutorials for their own emulators which is great to see.
Thanks
CS
Posted in Uncategorized | 3 Comments »
May 6th, 2009
Well I have implemented all 4 channels and individually they sound correct. When I combine them though there is a serious issue. Although I can still hear each channel playing correctly it is like the mixing is causing the seperate channels to be playing at the wrong volume. Still it shouldnt be too long until I have it working. Expect a gameboy sound tutorial soon. Im hoping to be on to my Sega Mega Drive/Genesis emulator by the start of June
CS.
Posted in Gameboy | 33 Comments »
April 27th, 2009
Well I have finally started sound emulation for the gameboy and am finding it much more difficult than the SMS. There really seems to be a lack of sound emulation resources on the net. For the time being I am only emulating the two square waves as I have experience with how these work from the SMS. Although I have implemented everything to do with the square waves it still isnt producing the correct tune. The beat seems correct but the notes are completely off. Still encouraging though as this was exactly how my SMS sounded a day or two before I cracked it.
On a slightly annoying note my trunk svn gameboy dev seems to have a few bugs in the vdp and cpu that have appeared out of nowhere. I might look into redeveloping my Gameboy emulator when I have finished the sound as the knowledge I have gained from developing the SMS I feel I could take it to the next level. Still I’m getting impatient to start my mega drive/genesis emulator…
CS
Posted in Gameboy | No Comments »
March 17th, 2009
Well it has taken me a ridiculous amount of time to pull my finger out and complete the SMS tutorials, but I have finally finished. You can view these tutorials here
I feel more motivated lately to continue wih my emulation work after a few months break. I’ll more than likely optimize my gameboy emulator and add sound to it next.
CS
Posted in Sega Master System | 1 Comment »
February 3rd, 2009
Just a quick note to let you all know that Im still alive and kicking. I have completed most of my SMS emulation tutorials which can be found here. All that is left to do is the VDP emulation tutorial which Ive mostly written so expect it in the next few days.
Whilst writing these tutorials I have had one eye on the sega mega drive/genesis hardware notes so hopefully soon I can start emulating this system. This system looks very interesting and should be a good step up in difficulty.
CS
Posted in Uncategorized | 4 Comments »
December 18th, 2008
I am ready to release the first version of my sega master system emulator. It has approximately 95% compatibility which is enough for me to start writing the SMS tutorials and upload them to the main site. Hopefully I should have them written by the end of the week and I can go back to my Gameboy emulator and implement sound.
The SMS has been a really fun project and I’ve learnt a lot more about emulation programming from it, but have also realised how much left there is to learn. Hopefully my next emulator (Sega Mega Drive/Genesis) will have more advance emulation techniques.
Keep watching this space for the release of my emulator along with source code and the “how-to” tutorials.
CS
Posted in Sega Master System | No Comments »
December 16th, 2008
I’ve been searching the internet recently trying to find some good documentation on sound emulation. None exist. Hopefully when I finish my emulator and write my “how to emulate the sega master system” tutorial on my site, the section on sound emulation should be a good resource to new programmers.
I have found a good article on the SMS sound chip SN79489 written by Maxim which explains how it works, and I have been programming in the dark trying to implement this into my emu. I believe my sound emulator is now 100% complete with the tiny problem that it doesnt seem to be synchronised with the cpu so the frequency of the music is incorrect. Apart from this it seems to be working fine.
Now im on my christmas holidays I should have enough time to get my SMS emulator finished by the end of the week which will be a great achievement. As soon as it’s finished I’ll write the tutorials for it and then go back to my gameboy emulator to tweak it and emulate sound before moving on to the sega mega drive, which im really looking forward to.
Merry Christmas all
CS.
Posted in Sega Master System | No Comments »
November 10th, 2008
Well this week I’ve entered a world of pain with my emulator debugger. First of all I had to debug street fighter to see why it wasnt working and it turned out that it was relying on the reading of the mapper control registers (0xFFFC-0xFFFF) to return the values of the mapped address of 0xDFFC-0xDFFF. As soon as I put this into the game I had immediate success.
I finally managed to get mode 2 sprite emulation working which was down to a really stupid error on my part.
Finally I’ve been debugging why my code masters larger res screen doesnt work and why the graphics are screwy in mortal kombat.
Luckily for me they were both the same error. The error was with my 8 and 16 bit opcodes for adc and sbc. Now this is how I emulated 8 bit adc (for when adding register c to register a):
BYTE before = m_RegisterAF.hi ;
BYTE toAdd = m_RegisterBC.lo ;
if (isCarrySet)
toAdd++ ;
m_RegisterAF.hi += toAdd ;
if ((before + toAdd) > 0xFF)
SetCarryFlag() ;
else
ResetCarryFlag() ;
// code to work out the other flags
Can you spot whats wrong with the above code?
Solution:
At first glance this looks fine however think what would happen if register C was 0xFF? When the carry gets added the toAdd variable wraps back round to 0. So register a stays set to 0xFF which is correct, however the setting of the c flag never gets set. This was causing the following instruction in mortal kombat (jump if carry is set) to fail.
That took me ages to find!
However both mortal kombat and micro machines are playable. My main concern now is why half of the games I play suffer from graphic flicker…. Better get my debugger back out.
Fortunately this is the last of the big bugs that need debugging and then it’s on to sound emulation (oh joy). However the end feels just round the corner.
CS
Posted in Sega Master System | No Comments »
November 2nd, 2008
If any of you are writing a Z80 emulator then take it from me dont rely on zexall too much. If zexalls output says you have a bug then you most definately do. However if it says that the test went ok it doesnt mean that they are bug free.
I managed to fix a bug in my emulator without zexalls help which was causing a few games to display the background incorrectly. Mainly Lemmings and Land of Illusion. This bug has been haunting me for awhile so im quite relieved to have fixed it.
I have recently found out that some games run at the wrong speed with my emulator so after checking all my opcodes to see if they are emulating their cycles correctly I was left with the conclusion it must be an error with my vsync emultion. Sure enough I wasnt moving on to the next scanline quick enough which was causing too few vsync interrupts to occur which is one of the main way speed is controlled in games. This is now fixed (after a day of headache) and all games play at the correct speed ( or should I say all tested games?
)
Over the past few days I have also emulated the none maskable reset interrupt, the different screen resolution controlled by the current vdp mode and the codemasters mapper. Although the codemasters mapper is implemented correctly the majority of the games show issues with background rendering. However I believe this to be a problem with the background rendering routine rather than the mapper iteself because there is not much room for error with the mapper (compared to the sega mapper anyway).

CS
Posted in Sega Master System | No Comments »
October 29th, 2008
I’m starting to come to the end of my master system emulator and thought it best to make a list of what needs doing before I start writing the tutorials.
Easy:
- All control pad buttons including player 2 (Implemented)
- Correct Game Speed (Fixed)
- Reset Interrupt (Fixed)
- CodeMasters Mapper (Fixed)
Medium:
- Zexall test completion (Fixed)
- Speed optimizations (Implemented)
- Render background correctly for larger screen res (Fixed)
- Render mode 2 sprites correctly (Fixed)
- Change screen res for codemaster games (Fixed)
Difficult:
- Sound (Implemented)
- Fix graphical bugs found in Land of Illusion, Lemmings (Fixed)
- Fix bug Street Fighter (Fixed)
- Find out why some roms dont show first screen (Fixed)
- Fix bug in mortal kombat (Fixed)
- Fix black graphic flicker in some games (Fixed)
Whenever I fix one of these items I’ll edit this post and label them as fixed.
Doesn’t look too bad does it?
CS
Posted in Sega Master System | No Comments »