cfgfile_dwrite_str(f, _T("ciaa_type"), ciatype[p->cs_ciatype[0]]);
cfgfile_dwrite_str(f, _T("ciab_type"), ciatype[p->cs_ciatype[1]]);
cfgfile_dwrite_str(f, _T("unmapped_address_space"), unmapped[p->cs_unmapped_space]);
+ cfgfile_dwrite(f, _T("keyboard_handshake"), _T("%d"), currprefs.cs_kbhandshake);
cfgfile_dwrite (f, _T("chipset_hacks"), _T("0x%x"), p->cs_hacks);
if (is_board_enabled(p, ROMTYPE_CD32CART, 0)) {
|| cfgfile_intval(option, value, _T("kickstart_ext_rom_file2addr"), &p->romextfile2addr, 1)
|| cfgfile_intval(option, value, _T("monitoremu_monitor"), &p->monitoremu_mon, 1)
|| cfgfile_intval(option, value, _T("genlock_scale"), &p->genlock_scale, 1)
- || cfgfile_intval(option, value, _T("genlock_mix"), &p->genlock_mix, 1))
+ || cfgfile_intval(option, value, _T("genlock_mix"), &p->genlock_mix, 1)
+ || cfgfile_intval(option, value, _T("keyboard_handshake"), &p->cs_kbhandshake, 1))
return 1;
if (cfgfile_strval (option, value, _T("comp_trustbyte"), &p->comptrustbyte, compmode, 0)
static unsigned int ciabprb, ciabdra, ciabdrb, ciabsdr, ciabsdr_cnt;
static int div10;
static int kbstate, kblostsynccnt;
+static unsigned long kbhandshakestart;
static uae_u8 kbcode;
static uae_u8 serbits;
if (m68k_getpc() >= 0xf00000 && m68k_getpc() < 0xf80000)
check_keyboard();
}
- if ((val & 0x40) == 0 && (ciaacra & 0x40) != 0) {
+ if ((val & 0x40) != 0 && (ciaacra & 0x40) == 0) {
+ // handshake start
+ if (kblostsynccnt > 0 && currprefs.cs_kbhandshake) {
+ kbhandshakestart = get_cycles();
+ }
+ } else if ((val & 0x40) == 0 && (ciaacra & 0x40) != 0) {
+ // handshake end
/* todo: check if low to high or high to low only */
+ if (kblostsynccnt > 0 && currprefs.cs_kbhandshake) {
+ int len = (int)get_cycles() - (int)kbhandshakestart;
+ if (len < currprefs.cs_kbhandshake * CYCLE_UNIT) {
+ write_log(_T("Keyboard handshake pulse length %d < %d (CCKs)\n"), len / CYCLE_UNIT, currprefs.cs_kbhandshake);
+ }
+ }
kblostsynccnt = 0;
#if KB_DEBUG
write_log (_T("KB_ACK %02x->%02x %08x\n"), ciaacra, val, M68K_GETPC);