From: Toni Wilen Date: Sat, 21 Jan 2023 10:48:42 +0000 (+0200) Subject: Fix cycle-accurate CIA emulation mode HI timer load. X-Git-Tag: 41010~4 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=c1afbc0597849ffc65e3d525c820d9b9383cb26c;p=francis%2Fwinuae.git Fix cycle-accurate CIA emulation mode HI timer load. --- diff --git a/cia.cpp b/cia.cpp index 89d4df8b..b4bddb68 100644 --- a/cia.cpp +++ b/cia.cpp @@ -1477,6 +1477,9 @@ static void CIA_thi_write(int num, int tnum, uae_u8 val) t->latch = (t->latch & 0xff) | (val << 8); + // If ONESHOT: Load and start timer. + // If CONTINUOUS: Load timer if not running. + if (!acc_mode()) { // if inaccurate mode: do everything immediately @@ -1498,15 +1501,15 @@ static void CIA_thi_write(int num, int tnum, uae_u8 val) } else { // if accurate mode: handle delays cycle-accurately - t->loaddelay |= 1 << 2; - if (!(t->cr & CR_START)) { t->loaddelay |= 1 << 1; + t->loaddelay |= 1 << 2; } if (t->cr & CR_RUNMODE) { t->cr |= CR_START; t->loaddelay |= 0x01000000 << 1; + t->loaddelay |= 1 << 2; } } }