diff --git a/picosim/srcsim/picosim.c b/picosim/srcsim/picosim.c index 14a1fae5..9a13ab0f 100644 --- a/picosim/srcsim/picosim.c +++ b/picosim/srcsim/picosim.c @@ -51,6 +51,7 @@ #include "disks.h" #include "rgbled.h" +#include "picosim.h" #ifdef WANT_ICE static void picosim_ice_cmd(char *cmd, WORD *wrk_addr); diff --git a/z80core/simcore.c b/z80core/simcore.c index 518b0d29..73dc074e 100644 --- a/z80core/simcore.c +++ b/z80core/simcore.c @@ -11,7 +11,6 @@ #include #include -#include #include #include @@ -298,6 +297,10 @@ BYTE io_in(BYTE addrl, BYTE addrh) fp_led_data = io_data; #endif +#ifdef IOPANEL + port_flags[addrl].in = true; +#endif + LOGD(TAG, "input %02x from port %02x", io_data, io_port); cpu_time -= get_clock_us() - clk; @@ -353,6 +356,10 @@ void io_out(BYTE addrl, BYTE addrh, BYTE data) fp_led_data = IO_DATA_UNUSED; #endif +#ifdef IOPANEL + port_flags[addrl].out = true; +#endif + cpu_time -= get_clock_us() - clk; } @@ -361,7 +368,6 @@ void io_out(BYTE addrl, BYTE addrh, BYTE data) */ void start_bus_request(BusDMA_t mode, Tstates_t (*bus_master)(BYTE bus_ack)) { - bus_mode = mode; dma_bus_master = bus_master; bus_request = 1; @@ -372,7 +378,6 @@ void start_bus_request(BusDMA_t mode, Tstates_t (*bus_master)(BYTE bus_ack)) */ void end_bus_request(void) { - bus_mode = BUS_DMA_NONE; dma_bus_master = NULL; bus_request = 0; diff --git a/z80core/simdefs.h b/z80core/simdefs.h index e931bb31..0ad9222f 100644 --- a/z80core/simdefs.h +++ b/z80core/simdefs.h @@ -8,6 +8,7 @@ #ifndef SIMDEFS_INC #define SIMDEFS_INC +#include #include #define COPYR "Copyright (C) 1987-2024 by Udo Munk and others" @@ -92,6 +93,13 @@ typedef uint64_t Tstates_t; /* uint64 for counting T-states */ typedef enum { BUS_DMA_NONE, BUS_DMA_BYTE, BUS_DMA_BURST, BUS_DMA_CONTINUOUS } BusDMA_t; +#ifdef IOPANEL +typedef struct port_flags { + bool in: 1; /* input port accessed */ + bool out: 1; /* output port accessed */ +} port_flags_t; +#endif + /* * macro for declaring unused function parameters */ diff --git a/z80core/simglb.c b/z80core/simglb.c index 0162ce95..4230f95a 100644 --- a/z80core/simglb.c +++ b/z80core/simglb.c @@ -75,17 +75,21 @@ int cpu_needed; /* don't adjust CPU freq if needed */ #ifdef FRONTPANEL uint64_t fp_clock; /* simulation clock */ float fp_fps = 30.0; /* frame rate, default 30 usually works */ -WORD fp_led_address; /* lights for address bus */ -BYTE fp_led_data; /* lights for data bus */ WORD address_switch; /* address and programmed input switches */ -BYTE fp_led_output = 0xff; /* inverted IMSAI/Cromemco programmed output */ #endif -#ifdef SIMPLEPANEL +#if defined(FRONTPANEL) || defined(SIMPLEPANEL) WORD fp_led_address; /* lights for address bus */ BYTE fp_led_data; /* lights for data bus */ BYTE fp_led_output = 0xff; /* inverted IMSAI/Cromemco programmed output */ #endif +/* + * Variables for iopanel + */ +#ifdef IOPANEL +port_flags_t port_flags[256]; /* port access flags */ +#endif + /* * Flags to control operation of simulation */ diff --git a/z80core/simglb.h b/z80core/simglb.h index 6b2c6df8..005654d0 100644 --- a/z80core/simglb.h +++ b/z80core/simglb.h @@ -56,17 +56,18 @@ extern int tmax, cpu_needed; #ifdef FRONTPANEL extern uint64_t fp_clock; extern float fp_fps; -extern WORD fp_led_address; -extern BYTE fp_led_data; extern WORD address_switch; -extern BYTE fp_led_output; #endif -#ifdef SIMPLEPANEL +#if defined(FRONTPANEL) || defined(SIMPLEPANEL) extern WORD fp_led_address; extern BYTE fp_led_data; extern BYTE fp_led_output; #endif +#ifdef IOPANEL +extern port_flags_t port_flags[256]; +#endif + extern int s_flag, l_flag, m_flag, x_flag, i_flag, f_flag, u_flag, r_flag, c_flag; #ifdef HAS_CONFIG