static int internaleclockphase;
static bool cia_cycle_accurate;
+int cia_timer_hack_adjust = 1;
+
static bool acc_mode(void)
{
return cia_cycle_accurate;
case 7:
{
uae_u16 tval = t->timer - t->passed;
+ // fast CPU timer hack
+ if ((t->cr & CR_START) && !(t->cr & CR_INMODE1) && !(t->cr & CR_INMODE) && t->latch == t->timer) {
+ if (currprefs.cachesize || currprefs.m68k_speed < 0) {
+ uae_u16 adj = cia_timer_hack_adjust;
+ if (adj >= tval && tval > 1) {
+ adj = tval - 1;
+ }
+ tval -= adj;
+ }
+ }
if (reg == 4 || reg == 6) {
return tval & 0xff;
}
if (!acc_mode()) {
// if inaccurate mode: do everything immediately
+ // Fast CPU timer hack. If timer is stopped, add few extra ticks to timer before stopping it.
+ if ((t->cr & CR_START) && !(val & CR_START) && !(t->cr & CR_INMODE1) && !(t->cr & CR_INMODE) && t->timer == t->latch) {
+ if (currprefs.cachesize || currprefs.m68k_speed < 0) {
+ uae_u16 adj = cia_timer_hack_adjust;
+ if (adj >= t->timer && t->timer > 1) {
+ adj = t->timer - 1;
+ }
+ if (t->timer > adj) {
+ t->timer -= adj;
+ }
+ }
+ }
+
if (val & CR_LOAD) {
val &= ~CR_LOAD;
t->timer = t->latch;
}
+
if (val & CR_START) {
if (!CIA_timer_inmode(tnum, val)) {
t->inputpipe = CIA_PIPE_ALL_MASK;
extern int logitech_lcd;
extern uae_s64 max_avi_size;
extern int floppy_writemode;
+extern int cia_timer_hack_adjust;
extern DWORD_PTR cpu_affinity, cpu_paffinity;
static DWORD_PTR original_affinity = -1;
on_screen_keyboard = getval(np);
return 2;
}
+ if (!_tcscmp(arg, _T("cia_timer_hack"))) {
+ cia_timer_hack_adjust = getval(np);
+ return 2;
+ }
#endif
return 0;