]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
POT counters are incremented during strobe slot
authorToni Wilen <twilen@winuae.net>
Fri, 22 Aug 2025 16:11:25 +0000 (19:11 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 22 Aug 2025 16:11:25 +0000 (19:11 +0300)
custom.cpp
include/inputdevice.h
inputdevice.cpp

index e557951276eeec0df4d18e37273c0c5d8fe3f260..18d88d4b3d0d1f9b45c5933fbea600fa5bd2ec44 100644 (file)
@@ -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)
index 6c7e189660c92e011a9a9fafd5cc3e746817db8a..a0bc70657364b24504c42ada8c29662ed7e1f77a 100644 (file)
@@ -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);
index 5c9d85093f3340f5db774d81bfea49e9c62c8994..9b9367c76c87dd9a3c74d9028d0eb5944316da1c 100644 (file)
@@ -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 ();