From 2e7f53d66c60156b9e001cef724b6d5939c833d0 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 22 Aug 2025 19:11:25 +0300 Subject: [PATCH] POT counters are incremented during strobe slot --- custom.cpp | 1 + include/inputdevice.h | 7 ++++--- inputdevice.cpp | 20 +++++++++++--------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/custom.cpp b/custom.cpp index e5579512..18d88d4b 100644 --- a/custom.cpp +++ b/custom.cpp @@ -10231,6 +10231,7 @@ static void process_dmal(uae_u32 v) dmalt <<= (3 * 2); dmalt |= disk_dmal(); dmal = dmalt; + inputdevice_hsync_strobe(); } static void start_dmal(void) diff --git a/include/inputdevice.h b/include/inputdevice.h index 6c7e1896..a0bc7065 100644 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -294,9 +294,10 @@ extern uae_u16 JOYGET (int num); extern void pulse_joydat(int joy, int xy, int dir); -extern void inputdevice_vsync (void); -extern void inputdevice_hsync (bool); -extern void inputdevice_reset (void); +extern void inputdevice_vsync(void); +extern void inputdevice_hsync(bool); +extern void inputdevice_hsync_strobe(void); +extern void inputdevice_reset(void); extern void write_inputdevice_config (struct uae_prefs *p, struct zfile *f); extern void read_inputdevice_config (struct uae_prefs *p, const TCHAR *option, TCHAR *value); diff --git a/inputdevice.cpp b/inputdevice.cpp index 5c9d8509..9b9367c7 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -484,8 +484,7 @@ static int digital_port[NORMAL_JPORTS][2]; static int lightpen_port[NORMAL_JPORTS]; int cubo_enabled; uae_u32 cubo_flag; -#define POTDAT_DELAY_PAL 8 -#define POTDAT_DELAY_NTSC 7 +#define POTDAT_DELAY 8 static int use_joysticks[MAX_INPUT_DEVICES]; static int use_mice[MAX_INPUT_DEVICES]; @@ -3853,10 +3852,8 @@ static void charge_cap (int joy, int idx, int charge) static void cap_check(bool hsync) { - int joy, i; - - for (joy = 0; joy < 2; joy++) { - for (i = 0; i < 2; i++) { + for (int joy = 0; joy < 2; joy++) { + for (int i = 0; i < 2; i++) { bool cancharge = true; int charge = 0, dong, joypot; uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */ @@ -3895,9 +3892,9 @@ static void cap_check(bool hsync) if (pot_dat_act[joy][i] && hsync) { pot_dat[joy][i]++; } - /* first 7 or 8 lines after potgo has been started = discharge cap */ + /* first 8 lines after potgo has been started = discharge cap */ if (pot_dat_act[joy][i] == 1) { - if (pot_dat[joy][i] < (currprefs.ntscmode ? POTDAT_DELAY_NTSC : POTDAT_DELAY_PAL)) { + if (pot_dat[joy][i] < POTDAT_DELAY) { charge = -2; /* fast discharge delay */ cancharge = hsync; } else { @@ -4360,9 +4357,14 @@ void inputdevice_playevents(void) handle_input_event(nr, state, max, (autofire ? HANDLE_IE_FLAG_AUTOFIRE : 0) | HANDLE_IE_FLAG_PLAYBACKEVENT); } -void inputdevice_hsync (bool forceread) +// strobe slot is clock for pot counters +void inputdevice_hsync_strobe(void) { cap_check(true); +} + +void inputdevice_hsync(bool forceread) +{ #ifdef CATWEASEL catweasel_hsync (); -- 2.47.3