diff options
| author | 2009-01-27 23:39:44 +0000 | |
|---|---|---|
| committer | 2009-01-27 23:39:44 +0000 | |
| commit | b62bc23922460dba9aee945ac80b84b8083d772d (patch) | |
| tree | 54ca865f064c8ec57bc1ae823cfe9c5fec76def0 | |
| parent | 4dbe268df420b60ecbd38ab3b527957d147e86ea (diff) | |
Add calculation for caps >= 100pf to buck rogers LS626 frequency calculation.
Formula was derived from figure 6 of LS624/628/629 & 625/626/627 datasheet.
"BUCK ROGERS" is now centered and big ship appears centered over br's ship.
Please Co-Credit Guru
| -rw-r--r-- | src/mame/video/turbo.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/mame/video/turbo.c b/src/mame/video/turbo.c index 9e5d1c0ed11..8356f8d061b 100644 --- a/src/mame/video/turbo.c +++ b/src/mame/video/turbo.c @@ -249,17 +249,27 @@ INLINE UINT32 sprite_xscale(UINT8 dacinput, double vr1, double vr2, double cext) vco_cv = 5.0; if (vco_cv < 0.0) vco_cv = 0.0; - if (vco_cv < 1.33) - vco_freq = (0.68129 + pow(vco_cv + 0.6, 1.285)) * 1e6; - else if (vco_cv < 4.3) - vco_freq = (3 + (8 - 3) * ((vco_cv - 1.33) / (4.3 - 1.33))) * 1e6; + if (cext < 1e-11) + { + if (vco_cv < 1.33) + vco_freq = (0.68129 + pow(vco_cv + 0.6, 1.285)) * 1e6; + else if (vco_cv < 4.3) + vco_freq = (3 + (8 - 3) * ((vco_cv - 1.33) / (4.3 - 1.33))) * 1e6; + else + vco_freq = (-1.560279 + pow(vco_cv - 4.3 + 6, 1.26)) * 1e6; + + /* now scale based on the actual external capacitor; the frequency goes */ + /* up by a factor of 10 for every factor of 10 the capacitance is reduced */ + /* approximately */ + vco_freq *= 50e-12 / cext; + } else - vco_freq = (-1.560279 + pow(vco_cv - 4.3 + 6, 1.26)) * 1e6; - - /* now scale based on the actual external capacitor; the frequency goes */ - /* up by a factor of 10 for every factor of 10 the capacitance is reduced */ - /* approximately */ - vco_freq *= 50e-12 / cext; + { + /* based on figure 6 of datasheet */ + vco_freq = -0.9892942 * log10(cext) - 0.0309697 * vco_cv * vco_cv + + 0.344079975 * vco_cv - 4.086395841; + vco_freq = pow(10.0, vco_freq); + } /* finally, convert to a fraction (8.24) of 5MHz, which is the pixel clock */ return (UINT32)((vco_freq / (5e6 * TURBO_X_SCALE)) * 16777216.0); @@ -905,7 +915,8 @@ static void buckrog_prepare_sprites(running_machine *machine, turbo_state *state info->plb[level] = 0; info->offset[level] = offset << 1; info->frac[level] = 0; - info->step[level] = sprite_xscale(xscale, 1.2e3, 500/*820*/, 220e-12); + /* 820 verified in schematics */ + info->step[level] = sprite_xscale(xscale, 1.2e3, 820, 220e-12); } } } |
