Jump to content
IGNORED

Timers - Timer Done & MESS Emulation


StijnDW

Recommended Posts

I was playing around a bit with all the emulators around lately because I noticed something strange.
When playing California Games - BMX on my recently bought Lynx (thanks LX.NET) I noticed that there was a "Pedaling sound (squeak)". In Handy there seems to be no pedaling sound whatsoever.

Since Handy's (0.97) sound emulation is known as not to be the best I also tried Mednafen but no pedaling sound either probably because its also Handy based.

I knew MESS also was capable of emulating the Lynx but not much attention is given to it. To my disbelieve MESS did properly emulate the pedaling sound. Even most of the other games seemed to work properly and some even better then Handy.

Still I noticed a few problems.

For example :

 

Wardbirds

  • The in-game graphics seem to render better then handy but,
  • The music/sound seems to be wrong especially in the intro
  • The intro hangs at a certain point but music keeps playing.

 

Gates Of Zendocon (and here is the programming question)

  • In-game everything works as should.
  • The intro hangs at certain point and everything stops.

 

Now since an other advantage of MESS is that is includes a debugger I tried to look into the Gates Of Zendocon problem.

It looks like MESS is improperly emulating the Mikey timers.

In the debugger i was able to see that the this piece of code was always running in an endless loop

8DDF - LDA $FD17
8DE2 - AND #$08
8DE4 - BEQ $8DDF

So i looks like the code is reading out timer 5 dynamic control and tries to see if the done bit has been set. But it looks like it's never set so it the emulator continuously loops.

With the help of the debugger i evaluated the configuration of timer 5 and it was set up as this

Backup Register = 8C
Static Control = 19 (Enable reload / Enable count/ 2uS)
Count = Counts as should
Dynamic Control = always stays 0

Now can anyone clarify on which conditions the "Timer Done" bit should be set high ?

More specifically, how does it work on real hardware for a counter that works as a reload counter I'm suspecting that even for a reload counter this should be the case when it goes to 0.

 

My main goal here is to learn a bit of Lynx stuff and maybe try to improve MESS along the way.

To bad MESS seems to be a bit overlooked for Lynx emulation here at the forum. It could be a real handy tool (with the debugger) to help in software development.

 

Anyways just my 2€cents and a little screenshot of it :)

 

 

 

post-41841-0-45427400-1427839705_thumb.png

Link to comment
Share on other sites

We had a discussion in mednafen forum.

The problem is that the code does not support a few timer settings because they kill the emulator. I made a fix, but that seem to have other unexpected effects. Thus it was left as it is.

Comment: "We should rewrite the timer code from scratch"

 

http://forum.fobby.net/index.php?t=tree&&th=915&goto=3024#msg_3024

 

http://forum.fobby.net/index.php?t=msg&th=910&start=0&

Link to comment
Share on other sites

Well i fiddled around a bit with the Mess code but it not easy to adapt or it is at least beyond my skill level at this moment.

While the Mess code seems to work surprisingly well it's a very compact code and lacks commenting IMO.

 

I'm afraid you are right that the MESS code would need a rewrite of the timer to correct the bugs I encountered.

The code seems to been have been written to allow for emulation of the games but it doesn't emulate some of the smaller details of the Lynx well.

 

 

Link to comment
Share on other sites

You should distinguish between the emulation of the chip and how the sound is streamed in real time. And how both are decoupled from each other. The point is that the mednafen and mess poeple have a lot of experience on how to do that. In hand this is done with direct sound if i remember correctly. which if not the best way to do. Thus, even if the chip emulation is identical, the sound will be much better on mess and mednafen.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...