Revision: 45769
http://sourceforge.net/p/vice-emu/code/45769
Author: gpz
Date: 2025-09-16 20:19:50 +0000 (Tue, 16 Sep 2025)
Log Message:
-----------
added joyport side of the 586220 diag harness, fixed some other details. iec port and keyboard port dongles are still missing
Modified Paths:
--------------
trunk/vice/src/c64/Makefile.am
trunk/vice/src/c64/vsid-stubs.c
trunk/vice/src/diag/Makefile.am
trunk/vice/src/diag/c64_diag_586220_harness.c
trunk/vice/src/joyport/Makefile.am
trunk/vice/src/joyport/joyport.c
trunk/vice/src/joyport/joyport.h
trunk/vice/src/tapeport/tape_diag_586220_harness.c
trunk/vice/src/userport/userport_diag_586220_harness.c
Added Paths:
-----------
trunk/vice/src/joyport/joyport_diag_586220_harness.c
trunk/vice/src/joyport/joyport_diag_586220_harness.h
Modified: trunk/vice/src/c64/Makefile.am
===================================================================
--- trunk/vice/src/c64/Makefile.am 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/c64/Makefile.am 2025-09-16 20:19:50 UTC (rev 45769)
@@ -26,6 +26,7 @@
-I$(top_srcdir)/src/hvsc \
-I$(top_srcdir)/src/vdrive \
-I$(top_srcdir)/src/fsdevice \
+ -I$(top_srcdir)/src/diag \
-I$(top_srcdir)/src/imagecontents
AM_CFLAGS = @VICE_CFLAGS@
Modified: trunk/vice/src/c64/vsid-stubs.c
===================================================================
--- trunk/vice/src/c64/vsid-stubs.c 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/c64/vsid-stubs.c 2025-09-16 20:19:50 UTC (rev 45769)
@@ -1282,7 +1282,25 @@
return false;
}
+/*******************************************************************************
+ DIAG harness
+*******************************************************************************/
+void c64_diag_586220_store_joyport_dig(uint8_t port, uint8_t val)
+{
+}
+
+uint8_t c64_diag_586220_read_joyport_dig(uint8_t port)
+{
+ return 0;
+}
+
+uint8_t c64_diag_586220_read_joyport_pot(void)
+{
+ return 0;
+}
+
+
/*******************************************************************************
UI
*******************************************************************************/
Modified: trunk/vice/src/diag/Makefile.am
===================================================================
--- trunk/vice/src/diag/Makefile.am 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/diag/Makefile.am 2025-09-16 20:19:50 UTC (rev 45769)
@@ -3,6 +3,8 @@
@ARCH_INCLUDES@ \
-I$(top_builddir)/src \
-I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/c64 \
+ -I$(top_srcdir)/src/joyport \
-I$(top_srcdir)/src/datasette \
-I$(top_srcdir)/src/tapeport
Modified: trunk/vice/src/diag/c64_diag_586220_harness.c
===================================================================
--- trunk/vice/src/diag/c64_diag_586220_harness.c 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/diag/c64_diag_586220_harness.c 2025-09-16 20:19:50 UTC (rev 45769)
@@ -30,21 +30,38 @@
#include <string.h>
#include "c64_diag_586220_harness.h"
+#include "c64.h"
+#include "cia.h"
#include "datasette.h"
+#include "machine.h"
#include "tapeport.h"
#include "types.h"
+#include "log.h"
+/*#define DEBUG_DIAG_586220*/
+
+#ifdef DEBUG_DIAG_586220
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
static uint8_t c64_diag_userport_pax = 0;
static uint8_t c64_diag_userport_pbx = 0;
static uint8_t c64_diag_userport_sp1 = 0;
static uint8_t c64_diag_userport_sp2 = 0;
+
static uint8_t c64_diag_tapeport = 0;
+static uint8_t c64_diag_switches = 0;
+
static uint8_t c64_diag_joyport0 = 0;
static uint8_t c64_diag_joyport1 = 0;
+static uint8_t c64_diag_joyvalue = 0;
+
static uint8_t c64_diag_keyboard_pax = 0;
static uint8_t c64_diag_keyboard_pbx = 0;
+
static uint8_t c64_diag_serial = 0;
-static uint8_t c64_diag_switches = 0;
void c64_diag_586220_init(void)
{
@@ -61,25 +78,96 @@
c64_diag_switches = 0;
}
+
+/* USERPORT connector
+
+PIN | PIN | NOTES
+-----------------
+ 4 | 6 | CNT1 <-> CNT2
+ 5 | 7 | SP1 <-> SP2
+ 9 | M | PA3 <-> PA2
+ B | 8 | FLAG2 <- PC2
+
+ C | H | PB0 <-> PB4
+ D | J | PB1 <-> PB5
+ E | K | PB2 <-> PB6
+ F | L | PB3 <-> PB7
+
+no data lines go to other ports
+
+*/
+
+/* called by userport_diag_586220_harness_store_paX() */
void c64_diag_586220_store_userport_pax(uint8_t val)
{
c64_diag_userport_pax = val;
+ DBG(("c64_diag_586220_store_userport_pax %02x", val));
}
-
+/* called by userport_diag_586220_harness_store_pbx() */
void c64_diag_586220_store_userport_pbx(uint8_t val)
{
c64_diag_userport_pbx = val;
}
-
+/* called by userport_diag_586220_harness_store_spX */
void c64_diag_586220_store_userport_sp(uint8_t port, uint8_t val)
{
+ DBG(("c64_diag_586220_store_userport_sp port:%d val:%02x", port, val));
if (!port) {
+ ciacore_set_sdr(machine_context.cia2, val);
+ c64_diag_userport_sp2 = val;
+ } else {
+ ciacore_set_sdr(machine_context.cia1, val);
c64_diag_userport_sp1 = val;
- } else {
- c64_diag_userport_sp2 = val;
}
}
+/* called from userport_diag_586220_harness_read_paX */
+uint8_t c64_diag_586220_read_userport_pax(void)
+{
+ uint8_t retval;
+
+ retval = (c64_diag_userport_pax & 4) << 1; /* bit2 -> bit3 */
+ retval |= (c64_diag_userport_pax & 8) >> 1; /* bit3 -> bit2 */
+
+ retval ^= 0x0c;
+
+ DBG(("c64_diag_586220_read_userport_pax %02x", retval));
+ return retval;
+}
+/* called from userport_diag_586220_harness_read_pbx */
+uint8_t c64_diag_586220_read_userport_pbx(void)
+{
+ uint8_t retval;
+
+ retval = (c64_diag_userport_pbx >> 4) & 0x0f; /* bit4-7 -> bit0-3 */
+ retval |= (c64_diag_userport_pbx & 0x0f) << 4; /* bit0-3 -> bit4-7 */
+
+ return retval;
+}
+/* called from userport_diag_586220_harness_read_spX */
+uint8_t c64_diag_586220_read_userport_sp(uint8_t port)
+{
+ DBG(("c64_diag_586220_read_userport_sp port:%d val:%02x",
+ port, port ? c64_diag_userport_sp2 : c64_diag_userport_sp1));
+ if (!port) {
+ return c64_diag_userport_sp1;
+ }
+ return c64_diag_userport_sp2;
+}
+
+
+/* TAPE connector
+
+PIN | CABLE | NOTES
+-------------------
+C-3 | 7 | Motor | Joyport Switches control (MOTOR) can ground the line
+D-4 | 6 | Read | loops to 4 (READ <-> SENSE)
+E-5 | 5 | Write | Joyport Switches control (WRITE) can ground the line
+F-6 | 4 | Sense | loops to 6 (SENSE <-> READ)
+
+*/
+
+/* called from tape_diag_586220_harness... */
void c64_diag_586220_store_tapeport(uint8_t pin, uint8_t val)
{
c64_diag_tapeport &= ~(1 << pin);
@@ -86,17 +174,23 @@
c64_diag_tapeport |= (val << pin);
switch (pin) {
+ /* motor <-> write */
case C64_DIAG_TAPEPORT_MOTOR:
+ DBG(("c64_diag_586220_store_tapeport motor:%d",val));
machine_set_tape_write_in(TAPEPORT_PORT_1, val);
break;
+ case C64_DIAG_TAPEPORT_WRITE:
+ DBG(("c64_diag_586220_store_tapeport write:%d",val));
+ machine_set_tape_motor_in(TAPEPORT_PORT_1, val);
+ break;
+ /* read <-> sense */
case C64_DIAG_TAPEPORT_READ:
+ DBG(("c64_diag_586220_store_tapeport read:%d\n",val));
machine_set_tape_sense(TAPEPORT_PORT_1, val);
break;
- case C64_DIAG_TAPEPORT_WRITE:
- machine_set_tape_motor_in(TAPEPORT_PORT_1, val);
- break;
case C64_DIAG_TAPEPORT_SENSE:
- machine_trigger_flux_change(TAPEPORT_PORT_1, val);
+ DBG(("c64_diag_586220_store_tapeport sense:%d\n",val));
+ machine_set_tape_read_in(TAPEPORT_PORT_1, val);
break;
}
@@ -107,85 +201,78 @@
}
}
-void c64_diag_586220_store_joyport_dig(uint8_t port, uint8_t val)
+#if 0
+/* TODO: unused */
+uint8_t c64_diag_586220_read_tapeport(uint8_t pin)
{
- if (!port) {
- c64_diag_joyport0 = val;
- } else {
- c64_diag_joyport1 = val;
- }
-}
-
-void c64_diag_586220_store_keyboard(uint8_t port, uint8_t val)
-{
- if (!port) {
- c64_diag_keyboard_pax = val;
- } else {
- c64_diag_keyboard_pbx = val;
- }
-}
-
-void c64_diag_586220_store_serial(uint8_t val)
-{
- c64_diag_serial = val;
-}
-
-uint8_t c64_diag_586220_read_userport_pax(void)
-{
uint8_t retval;
- retval = (c64_diag_userport_pax & 4) << 1;
- retval |= (c64_diag_userport_pax & 2) >> 1;
+ retval = c64_diag_tapeport & 0xf5;
+ retval |= (c64_diag_tapeport & 8) >> 2;
+ retval |= (c64_diag_tapeport & 2) << 2;
+ retval &= (1 << pin);
return retval;
}
+#endif
-uint8_t c64_diag_586220_read_userport_pbx(void)
-{
- uint8_t retval;
+/* JOYSTICK connector
- retval = c64_diag_userport_pbx >> 4;
- retval |= (c64_diag_userport_pbx & 0xf) << 4;
+when enabled, via the analog switch connected to the tape port, bits0-4 of the
+two joystick ports are connected 1:1
- return retval;
-}
+*/
-uint8_t c64_diag_586220_read_userport_sp(uint8_t port)
+/* called by harness_store_dig */
+void c64_diag_586220_store_joyport_dig(uint8_t port, uint8_t val)
{
+ /*DBG(("c64_diag_586220_store_joyport_dig port:%d val:%02x", port, val));*/
if (!port) {
- return c64_diag_userport_sp2;
+ c64_diag_joyport0 = val;
+ } else {
+ c64_diag_joyport1 = val;
}
- return c64_diag_userport_sp1;
+ c64_diag_joyvalue = val;
}
-uint8_t c64_diag_586220_read_tapeport(uint8_t pin)
-{
- uint8_t retval;
-
- retval = c64_diag_tapeport & 0xf5;
- retval |= (c64_diag_tapeport & 8) >> 2;
- retval |= (c64_diag_tapeport & 2) << 2;
- retval &= (1 << pin);
-
- return retval;
-}
-
+/* called by harness_read_dig */
uint8_t c64_diag_586220_read_joyport_dig(uint8_t port)
{
+ /*DBG(("c64_diag_586220_read_joyport_dig port:%d",port));*/
if (c64_diag_switches) {
+#if 0
if (!port) {
return c64_diag_joyport1;
}
return c64_diag_joyport0;
+#endif
+ return c64_diag_joyvalue;
}
- return 0;
+ return 0xff;
}
+/* called by harness_read_potX */
uint8_t c64_diag_586220_read_joyport_pot(void)
{
- return 0xff;
+ /* resistor value for all resistors is 120Ohm */
+ /* diag expects 0x58...0x78 */
+ return 0x60;
}
+
+/* KEYBOARD connector */
+
+/* TODO: unused */
+void c64_diag_586220_store_keyboard(uint8_t port, uint8_t val)
+{
+ if (!port) {
+ c64_diag_keyboard_pax = val;
+ } else {
+ c64_diag_keyboard_pbx = val;
+ }
+}
+
+/* TODO: unused */
uint8_t c64_diag_586220_read_keyboard(uint8_t port)
{
if (!port) {
@@ -194,14 +281,41 @@
return c64_diag_keyboard_pax;
}
+
+/* IEC connector
+
+PIN | CABLE | NOTES
+--------------------------------------------------------------------------------
+1-5 | SRQIN - DATA | SRQIN->CIA1 FLAG DATA->CIA2 PA5/PA7
+3-4 | ATN - CLOCK |
+
+*/
+
+/* TODO: unused */
+void c64_diag_586220_store_serial(uint8_t val)
+{
+ /* Bit 7 Serial Bus Data Input
+ Bit 6 Serial Bus Clock Pulse Input
+ Bit 5 Serial Bus Data Output
+ Bit 4 Serial Bus Clock Pulse Output
+ Bit 3 Serial Bus ATN Signal Output */
+ DBG(("c64_diag_586220_store_serial %02x", val));
+ c64_diag_serial = val;
+}
+
+/* TODO: unused */
uint8_t c64_diag_586220_read_serial(void)
{
uint8_t retval;
- retval = (c64_diag_serial & 8) >> 3;
- retval |= (c64_diag_serial & 4) >> 1;
- retval |= (c64_diag_serial & 2) << 1;
- retval |= (c64_diag_serial & 1) << 3;
-
+ retval = ((c64_diag_serial >> 3) & 1) << 6; /* ATN Output -> Clock Input */
+ retval |= ((c64_diag_serial >> 5) & 1) << 7; /* Data Output -> SRQIN */
+ /* Bit 7 Serial Bus Data Input
+ Bit 6 Serial Bus Clock Pulse Input
+ Bit 5 Serial Bus Data Output
+ Bit 4 Serial Bus Clock Pulse Output
+ Bit 3 Serial Bus ATN Signal Output */
+ DBG(("c64_diag_586220_read_serial %02x (%02x)", c64_diag_serial, retval));
return retval;
}
+
Modified: trunk/vice/src/joyport/Makefile.am
===================================================================
--- trunk/vice/src/joyport/Makefile.am 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/joyport/Makefile.am 2025-09-16 20:19:50 UTC (rev 45769)
@@ -8,7 +8,8 @@
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/samplerdrv \
-I$(top_srcdir)/src/core/rtc \
- -I$(top_srcdir)/src/userport
+ -I$(top_srcdir)/src/userport \
+ -I$(top_srcdir)/src/diag
AM_CFLAGS = @VICE_CFLAGS@
@@ -34,6 +35,8 @@
inception.h \
joyport.c \
joyport.h \
+ joyport_diag_586220_harness.c \
+ joyport_diag_586220_harness.h \
joyport_io_sim.c \
joyport_io_sim.h \
joystick.c \
Modified: trunk/vice/src/joyport/joyport.c
===================================================================
--- trunk/vice/src/joyport/joyport.c 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/joyport/joyport.c 2025-09-16 20:19:50 UTC (rev 45769)
@@ -39,6 +39,7 @@
#include "cx85.h"
#include "inception.h"
#include "joyport.h"
+#include "joyport_diag_586220_harness.h"
#include "joyport_io_sim.h"
#include "joystick.h"
#include "lib.h"
@@ -132,6 +133,7 @@
return pot_port_mask_clk;
}
+/* FIXME: isn't this info in the registered device struct? */
static int joyport_device_is_single_port(int id)
{
switch (id) {
@@ -149,6 +151,7 @@
case JOYPORT_ID_PROTOPAD:
case JOYPORT_ID_PADDLES:
case JOYPORT_ID_IO_SIMULATION:
+ case JOYPORT_ID_DIAG_586220_HARNESS:
return 0;
}
return 1;
@@ -1418,6 +1421,12 @@
NULL, /* resources shutdown function */
NULL /* cmdline options init function */
},
+ { JOYPORT_ID_DIAG_586220_HARNESS, /* device id */
+ VICE_MACHINE_C64_COMPATIBLE, /* emulators this device works on */
+ joyport_diag_586220_harness_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
{ JOYPORT_ID_NONE, VICE_MACHINE_NONE, NULL, NULL, NULL }, /* end of the devices list */
};
Modified: trunk/vice/src/joyport/joyport.h
===================================================================
--- trunk/vice/src/joyport/joyport.h 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/joyport/joyport.h 2025-09-16 20:19:50 UTC (rev 45769)
@@ -85,6 +85,7 @@
JOYPORT_ID_PAPERCLIP64SC,
JOYPORT_ID_PAPERCLIP2,
JOYPORT_ID_POWERPAD,
+ JOYPORT_ID_DIAG_586220_HARNESS,
/* This item always needs to be at the end */
JOYPORT_MAX_DEVICES
@@ -150,7 +151,8 @@
JOYPORT_DEVICE_SAMPLER,
JOYPORT_DEVICE_RTC,
JOYPORT_DEVICE_C64_DONGLE,
- JOYPORT_DEVICE_IO_SIMULATION
+ JOYPORT_DEVICE_IO_SIMULATION,
+ JOYPORT_DEVICE_DIAG_HARNESS,
};
/* joystick bits */
Added: trunk/vice/src/joyport/joyport_diag_586220_harness.c
===================================================================
--- trunk/vice/src/joyport/joyport_diag_586220_harness.c (rev 0)
+++ trunk/vice/src/joyport/joyport_diag_586220_harness.c 2025-09-16 20:19:50 UTC (rev 45769)
@@ -0,0 +1,113 @@
+/*
+ * joyport_diag_586220_harness.c - Joyport part of the DIAG 586220 harness
+ *
+ * Written by
+ * groepaz <gr...@gm...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#include "vice.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "c64_diag_586220_harness.h"
+#include "joyport_diag_586220_harness.h"
+#include "joyport.h"
+#include "joystick.h"
+#include "machine.h"
+#include "resources.h"
+#include "snapshot.h"
+#include "log.h"
+
+/*#define DEBUG_DIAG_586220*/
+
+#ifdef DEBUG_DIAG_586220
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
+#ifdef JOYPORT_EXPERIMENTAL_DEVICES
+
+static uint8_t harness_read_dig(int joyport)
+{
+ uint8_t retval = c64_diag_586220_read_joyport_dig(joyport);
+ /*DBG(("harness_read_dig port:%d retval:%02x", joyport, retval));*/
+ return retval;
+}
+
+static void harness_store_dig(int joyport, uint8_t val)
+{
+ /*DBG(("harness_store_dig port:%d val:%02x", joyport, val));*/
+ c64_diag_586220_store_joyport_dig(joyport, val);
+}
+
+static uint8_t harness_read_potx(int joyport)
+{
+ return c64_diag_586220_read_joyport_pot();
+}
+
+static uint8_t harness_read_poty(int joyport)
+{
+ return c64_diag_586220_read_joyport_pot();
+}
+
+
+static int joyport_harness_enabled[JOYPORT_MAX_PORTS] = {0};
+
+static int joyport_harness_set_enabled(int port, int enabled)
+{
+ int new_state = enabled ? 1 : 0;
+
+ joyport_harness_enabled[port] = new_state;
+
+ return 0;
+}
+
+static joyport_t joyport_harness_device = {
+ "586220 DIAG Harness", /* name of the device */
+ JOYPORT_RES_ID_NONE, /* device can be used in multiple ports at the same time */
+ JOYPORT_IS_NOT_LIGHTPEN, /* device is NOT a lightpen */
+ JOYPORT_POT_REQUIRED, /* device uses the potentiometer lines */
+ JOYPORT_5VDC_NOT_NEEDED, /* device does NOT need +5VDC to work */
+ JOYSTICK_ADAPTER_ID_NONE, /* device is NOT a joystick adapter */
+ JOYPORT_DEVICE_DIAG_HARNESS, /* device is a diag harness */
+ 0, /* output bits are programmable */
+ joyport_harness_set_enabled, /* device enable/disable function */
+ harness_read_dig, /* digital line read function */
+ harness_store_dig, /* digital line store function */
+ harness_read_potx, /* pot-x read function */
+ harness_read_poty, /* pot-y read function */
+ NULL, /* NO powerup function */
+ NULL, /* NO device write snapshot function */
+ NULL, /* NO device read snapshot function */
+ NULL, /* NO device hook function */
+ 0 /* NO device hook function mask */
+};
+
+int joyport_diag_586220_harness_resources_init(void)
+{
+ return joyport_device_register(JOYPORT_ID_DIAG_586220_HARNESS, &joyport_harness_device);
+}
+
+#endif
Added: trunk/vice/src/joyport/joyport_diag_586220_harness.h
===================================================================
--- trunk/vice/src/joyport/joyport_diag_586220_harness.h (rev 0)
+++ trunk/vice/src/joyport/joyport_diag_586220_harness.h 2025-09-16 20:19:50 UTC (rev 45769)
@@ -0,0 +1,34 @@
+/*
+ * joyport_diag_586220_harness.h
+ *
+ * Written by
+ * groepaz <gr...@gm...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#ifndef VICE_JOYPORT_DIAG_586220_HARNESS_H
+#define VICE_JOYPORT_DIAG_586220_HARNESS_H
+
+#include "types.h"
+
+int joyport_diag_586220_harness_resources_init(void);
+
+#endif
Modified: trunk/vice/src/tapeport/tape_diag_586220_harness.c
===================================================================
--- trunk/vice/src/tapeport/tape_diag_586220_harness.c 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/tapeport/tape_diag_586220_harness.c 2025-09-16 20:19:50 UTC (rev 45769)
@@ -31,11 +31,11 @@
PIN | CABLE | NOTES
-------------------
-A-1 | 8 | SWa, SWb, SWc, SWd, SWa2 control (+5V)
-C-3 | 7 | SWa, SWb, SWc, SWd, SWa2 control (MOTOR) can ground the line
-D-4 | 6 | loops to 4 (READ <-> SENSE)
-E-5 | 5 | SWa, SWb, SWc, SWd, SWa2 control (WRITE) can ground the line
-F-6 | 4 | loops to 6 (SENSE <-> READ)
+C-3 | 7 | Motor | Joyport Switches control (MOTOR) can ground the line
+D-4 | 6 | Read | loops to 4 (READ <-> SENSE)
+E-5 | 5 | Write | Joyport Switches control (WRITE) can ground the line
+F-6 | 4 | Sense | loops to 6 (SENSE <-> READ)
+
*/
#include "vice.h"
@@ -55,6 +55,14 @@
#include "tapeport.h"
#include "util.h"
+/*#define DEBUG_DIAG_586220*/
+
+#ifdef DEBUG_DIAG_586220
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
#ifdef TAPEPORT_EXPERIMENTAL_DEVICES
/* Device enabled */
@@ -96,7 +104,7 @@
static void tape_diag_586220_harness_toggle_write_bit(int port, int write_bit)
{
- c64_diag_586220_store_tapeport(C64_DIAG_TAPEPORT_WRITE, (uint8_t)write_bit);
+ c64_diag_586220_store_tapeport(C64_DIAG_TAPEPORT_WRITE, (uint8_t)write_bit ? 1 : 0);
}
static void tape_diag_586220_harness_set_sense_out(int port, int sense)
Modified: trunk/vice/src/userport/userport_diag_586220_harness.c
===================================================================
--- trunk/vice/src/userport/userport_diag_586220_harness.c 2025-09-14 16:30:53 UTC (rev 45768)
+++ trunk/vice/src/userport/userport_diag_586220_harness.c 2025-09-16 20:19:50 UTC (rev 45769)
@@ -28,22 +28,18 @@
PIN | PIN | NOTES
-----------------
- 4 | 6 | CNT1 <-> CNT2
- 5 | 7 | SP1 <-> SP2
- 6 | 4 | CNT2 <-> CNT1
- 7 | 5 | SP2 <-> SP1
- 8 | B | PC2 -> FLAG2
- 9 | M | PA3 <-> PA2
- B | 8 | FLAG2 <- PC2
- C | H | PB0 <-> PB4
- D | J | PB1 <-> PB5
- E | K | PB2 <-> PB6
- F | L | PB3 <-> PB7
- H | C | PB4 <-> PB0
- J | D | PB5 <-> PB1
- K | E | PB6 <-> PB2
- L | F | PB7 <-> PB3
- M | 9 | PA2 <-> PA3
+ 4 | 6 | CNT1 <-> CNT2
+ 5 | 7 | SP1 <-> SP2
+ 9 | M | PA3 <-> PA2
+ B | 8 | FLAG2 <- PC2
+
+ C | H | PB0 <-> PB4
+ D | J | PB1 <-> PB5
+ E | K | PB2 <-> PB6
+ F | L | PB3 <-> PB7
+
+no data lines go to other ports
+
*/
#include "vice.h"
@@ -58,7 +54,16 @@
#include "joyport.h"
#include "userport.h"
#include "userport_diag_586220_harness.h"
+#include "log.h"
+/*#define DEBUG_DIAG_586220*/
+
+#ifdef DEBUG_DIAG_586220
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
#ifdef USERPORT_EXPERIMENTAL_DEVICES
int userport_diag_586220_harness_enabled = 0;
@@ -138,10 +143,11 @@
static void userport_diag_586220_harness_store_pa2(uint8_t value)
{
- pax &= 0xfb;
- pax |= ((value & 1) << 2);
+ pax &= 0xfb;
+ pax |= ((value & 1) << 2);
- c64_diag_586220_store_userport_pax(pax);
+ DBG(("userport_diag_586220_harness_store_pa2 %02x (%02x)", value, pax));
+ c64_diag_586220_store_userport_pax(pax);
}
static uint8_t userport_diag_586220_harness_read_pa3(uint8_t orig)
@@ -151,10 +157,10 @@
static void userport_diag_586220_harness_store_pa3(uint8_t value)
{
- pax &= 0xf7;
- pax |= ((value & 1) << 3);
-
- c64_diag_586220_store_userport_pax(pax);
+ pax &= 0xf7;
+ pax |= ((value & 1) << 3);
+ DBG(("userport_diag_586220_harness_store_pa3 %02x (%02x)", value, pax));
+ c64_diag_586220_store_userport_pax(pax);
}
static uint8_t userport_diag_586220_harness_read_sp1(uint8_t orig)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|