Jump to content
DJRobX

Code change to enable SAM LE driver board support

Recommended Posts

Update: I'm getting LED output from ACDC and Metallica now.    

It's using a different write method (character by character).    Both of them use the same output structure though.     No hack will be needed for these two.    I still have to figure out why the output is stalling after a few updates.   Interrupt handling problem of some sort.   But at least there's progress. 

 

Share this post


Link to post
Share on other sites
3 hours ago, Dodger1980 said:

So, a Metallica LE VP Version with the hammer could be possible? 

Yep for sure.    I'm 90% of the way there.  

I've discovered that the AIC interrupt controller emulation is woefully incomplete.    It's supposed to manage concurrent activity (like timer and serial happening at the same time :) ), and re-fire pending IRQs when previous IRQs complete, but it's currently doing none of that.    It's probably related to why we see those "not designed for this country" messages when we press buttons too quickly at boot.     It's documented pretty clearly in Atmel's documentation.   Should have it solved soon. 

 

Share this post


Link to post
Share on other sites

Nice! At least someone can profit from the hard work DJRobX and the other pinmame devs have been doing

41 minutes ago, lucky1 said:

Great job Rob ! Can´t wait to use the UART2 implementation :-)

I have a hell of a giggle everytime I see that "OPENSOURCE" banner at the bottom of your signature.

Share this post


Link to post
Share on other sites

I´m lucky I could assist him with some useful information.

Haven´t recognized that it is still in my signature, because I don´t read my own signature very often.

I changed it before anybody gets hurt. :D

Share this post


Link to post
Share on other sites

I get a lot of volume fluctuation and popping in the audio while playing ST_161h

randr gets volume fluctuation only

Same issue with 150h, the only ST LE roms I have

Game doesn't appear to lag, at least in full screen. Fake full screen does lag for me.

Share this post


Link to post
Share on other sites
Quote

I get a lot of volume fluctuation and popping in the audio while playing ST_161h

The improved IRQ handling is very likely to help with this.   It was a real disaster before.   If you think ST LE was bad you should have seen Metallica trying to run.     I got it running way smoother thismorning.   

If you can shoot me over your inprogress table I can test on my cab.   As it is I can't do much other than look at the diagnostic menu.  

-- Rob  

Share this post


Link to post
Share on other sites

It potentially impacts all of them.     The way the code was before, many timer interrupts were being lost.    This can cause VPM to "miss" or delay events that should be happening.   Performance is a fickle thing though, by making the emulation more accurate, it may increase or decrease actual hardware CPU requirements.   In the case of Metallica it was causing the game code to burn a lot of cycles unnecessarily.

Generally speaking I want to get the emulation working first, then I will look at things I can do to speed things up. 

Share this post


Link to post
Share on other sites

Here's a new build to play with.

1) SAM performance should be significantly improved for most.   I found some low hanging fruit in the form of a working ARM7 JIT compiler that was currently only enabled for the DataEast games.   There were a couple blocking bugs, but I worked through them, and now games are running.   

2) More IRQ handling improvements.

3) Timings have been adjusted to more closely match real machines.   Not perfect yet, but family guy now feels very similar to my real machine.  It seemed very slow before (the meg solenoid, clam bonus selection animation, and finale music were super slow compared to the real thing before).    The sound rate has also been adjusted.  

4) AC/DC and Metallica LE support. 

Known issues:

Fixing the IRQ problems and switching ARM cores results in different timings.  Most games seem to be running great, but this re-introduces the CSI/IJ ball shooting bug, and the previous "fix" doesn't work.   I will need to get into the debugger and see what's going on.   Fortunately my MAME debugging skills have improved a bit through all this. :)

Walking Dead LE is partially supported.  The LED support takes a while to start up.   I got involved in the IRQ stuff for AC/DC and Metallica, and the JIT performance improvement, so I haven't gotten back to this yet.    The solenoids all work fine, it's safe to start developing against it if someone wants. 

vpmsamle.09252016.zip

Share this post


Link to post
Share on other sites

Update:

I got TWD LE to send LED data quickly by "transmitting" a bunch of 0xff's.  Seems like as long as I send it a bunch of anything other than 0x00, TWD LE will start sending me the LED data pretty fast.   This is good because the hack to enable the output wasn't clear on TWD as it was with Mustang LE.

This technique doesn't work as well for Mustang.    Mustang starts sending data faster than before, but still takes a while.   So these games definitely are looking for input.    Just need to figure out what it is that they want.

I've also done work on the IJ and CSI problem.   I got them working alongside the improved timer code.   For some reason they don't like the deferred timer interrupts, even though it's clearly what's supposed to happen according to the ATMEL documentation, and the vast majority of roms play smoothly like they're supposed to when the interrupt controller is emulated.

I can fake the old behavior by not sending a timer interrupt if the ARM core has IRQs are blocked.  Once I do that, IJ and CSI work exactly like they used to (along with the sluggish emulation, but at least I didn't break anything).    Since these are only two games, and old ones unlikely to get game code updates, I may look a programmatic hack so they run right..   The failure to launch ball is these games is really the "Not in this country" error message seen in other roms.  I'm not sure why Stern went "evil" on these two games and just silently stopped allowing balls to launch (really a main loop of game code stops looping), but it's definitely that same 60hz zero crossing check. 

The IJ / CSI problem is less of a critical issue now that I'm able to make them work.  I just didn't want to make changes that took away working games, since it's not really easy to switch VPM versions on a game by game basis .

 

Share this post


Link to post
Share on other sites

wow! This thread is really interesting reading, Almos pissed my pants when I realized that this
was not S.P.I.K.E. emulation, though this is awesome news indeed.

Keep up the good work DJRobX :D

Share this post


Link to post
Share on other sites

Here's a new build.  

1) CSI / IJ functionality is restored.

2) Mustang Pro LED support, per request.

3) Fast (enough) Walking Dead LE LED support, possibly others that don't have a specific hack in place. 

4) If you are having issues with the JIT compilation, it can be disabled in the registry.  Set at91jit to 0 in the usual ROM location.    So far I have not had any problems.   Note this option carries to WhiteStar II also.   Bonus: It can also be set anywhere from 2-0x2000000 which will allow you to specify the upper code address to stop JITing SAM.  By default this is 108000 for stern ROMs.   If you find a problematic game you may find a lower value works but still retains most of the benefit, as the majority of repeated code is in the lower 10000 bytes of the rom.   You can also use this to narrow down the exact address that causes a problem.  Tweaking this value is how I found the bad instructions in the JIT compiler.     TL;DR: I hope nobody needs this but it's there.

I've mostly accomplished what I set out to do, so this may be the last update for a while, unless someone finds an issue that needs attention.   I hope this inspires some new table updates!   If Fren's ST LE is any indication, I can't wait to see what everyone comes up with! 

Final list of new features:

1) Enable JIT compiling for faster performance, with registry option to disable. 
2) More fully implemented IRQ controller, improves sluggishness in a lot of games like Family Guy, and allows accurate timing selection.
4) LE 8 and 12 solenoid aux board support for all LE games (X-men, Metallica, ACDC, etc..) 
5) RGB 256-level LED string implementations for Star Trek LE, Mustang Pro and LE (1.45 only, other roms may work but with delay), AC/DC LE, Metallica LE,  The Walking Dead LE
3) Serial port implementation available for future ColorDMD expansion.

Known issues:

1) The more accurate timing breaks CSI / IJ.   It's not apparent to me why.    Would love to understand what it takes to make it work correctly

2) Mustang is waiting for some specific response from the LED controller board that I don't know, and what that is isn't obvious looking at code.   Hacking works fine but is ROM version specific.

3) There are two buggy JIT instructions that are not fixed.   The impact of this is pretty negligible, I've coded them to return to normal emulation.  They're not commonly used to so there's not much impact. 

Fun tidbit: CSI spits this out on its serial port when it boots! 

Z00E$SAU0100FF00TAU0100FF006AL0037FF007AL0032FF008AL0033FF00Z00A6 aStern Pinball, Inc. Proudly Presents...Z00A7 aC.S.I. - CRIME SCENE INVESTIGATIONZ00A8 aYou Could Be The Next BIG WINNER!!!Z00E.SL678ST

Tron does this too:

Z00E$6AL0037FF007AL0019FF008AL0033FF00SAU0100FF00TAU0100FF00Z00A6 aStern Pinball, Inc. Proudly Presents...Z00A7 aTron L.E.Z00A8 aYou Could Be The Next BIG WINNER!!!Z00E.SL678ST

vpm092916.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×