Skip to content

Commit

Permalink
Merge pull request #519 from udo-munk/dev
Browse files Browse the repository at this point in the history
merge dev
  • Loading branch information
udo-munk authored Jan 18, 2025
2 parents 105aba6 + 93c8342 commit 589a6c8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
1 change: 1 addition & 0 deletions picosim/srcsim/picosim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 8 additions & 3 deletions z80core/simcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <inttypes.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions z80core/simdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef SIMDEFS_INC
#define SIMDEFS_INC

#include <stdbool.h>
#include <stdint.h>

#define COPYR "Copyright (C) 1987-2024 by Udo Munk and others"
Expand Down Expand Up @@ -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
*/
Expand Down
12 changes: 8 additions & 4 deletions z80core/simglb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
9 changes: 5 additions & 4 deletions z80core/simglb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 589a6c8

Please sign in to comment.