Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dev #534

Merged
merged 33 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2135c02
add a basic introspection panel
sneakywumpus Jan 21, 2025
adfa77c
forget to add comment that is in imsaisim
sneakywumpus Jan 21, 2025
d9e0b1e
Merge pull request #523 from sneakywumpus/dev
udo-munk Jan 21, 2025
8ef33c1
fix typo in Makefile's, add back HALT and I/O ports cpu time adjustments
sneakywumpus Jan 21, 2025
74f9d3e
Merge pull request #524 from sneakywumpus/dev
udo-munk Jan 21, 2025
7a41362
time/timing code rework
sneakywumpus Jan 22, 2025
3cedd9c
Merge pull request #525 from sneakywumpus/dev
udo-munk Jan 22, 2025
9eaf906
more time work, hopefully last one; use dma_read/write() in simbdos.c
sneakywumpus Jan 23, 2025
b648000
use curr. frequency instead of 100 MHz single stepping in free runnin…
sneakywumpus Jan 23, 2025
030124a
add history entr
sneakywumpus Jan 23, 2025
5ad4a27
Merge pull request #526 from sneakywumpus/dev
udo-munk Jan 23, 2025
0e6d445
add memory display to introspection panel
sneakywumpus Jan 23, 2025
7d4ff95
Merge pull request #527 from sneakywumpus/dev
udo-munk Jan 23, 2025
0d97e86
more logical order of VM initialization
udo-munk Jan 23, 2025
5924ac3
restore line deleted by mistake and fix typo
sneakywumpus Jan 24, 2025
66669ed
another timing update...
sneakywumpus Jan 24, 2025
24e8260
fix frequency formatting
sneakywumpus Jan 24, 2025
8315ac4
add zero check before division
sneakywumpus Jan 24, 2025
6056174
Merge pull request #528 from sneakywumpus/dev
udo-munk Jan 24, 2025
1f6edca
add some keyboard/mouse controls to change memory display base address
sneakywumpus Jan 24, 2025
bed8ee1
Merge pull request #529 from sneakywumpus/dev
udo-munk Jan 24, 2025
e68961d
fix mouse wheel with multiple windows in SDL2
sneakywumpus Jan 24, 2025
a926847
fix wrong parameter
sneakywumpus Jan 25, 2025
ed1c86d
remove include only needed for debugging printf's
sneakywumpus Jan 25, 2025
873496f
Merge pull request #530 from sneakywumpus/dev
udo-munk Jan 25, 2025
175946d
add I/O ports view to introspection panel
sneakywumpus Jan 26, 2025
f4b42c9
fix p_tab access in reset_clicked() on altairsim
sneakywumpus Jan 26, 2025
1e898b5
remove not working attempt at making port light stick during single s…
sneakywumpus Jan 26, 2025
8271ac5
Merge pull request #531 from sneakywumpus/dev
udo-munk Jan 26, 2025
6162afe
make buttons static, no draw debug by default
sneakywumpus Jan 26, 2025
adcd589
Merge pull request #532 from sneakywumpus/dev
udo-munk Jan 26, 2025
d74ae14
make buttons behave a bit more like in a GUI
sneakywumpus Jan 27, 2025
57cfeca
Merge pull request #533 from sneakywumpus/dev
udo-munk Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions altairsim/srcsim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
MACHINE = altair
# emulate a machine's frontpanel
FRONTPANEL ?= YES
# show an introspection panel
INFOPANEL ?= YES
# use SDL2 instead of X11
WANT_SDL ?= NO
# machine specific system source files
Expand Down Expand Up @@ -47,11 +49,16 @@ VPATH = $(CORE_DIR) $(IO_DIR) $(FP_DIR)
include $(CORE_DIR)/Makefile.in-os

###
### SDL2/X11 PLATFORM VARIABLES
### SDL2/X11 AND INFOPANEL PLATFORM VARIABLES
###
ifeq ($(WANT_SDL),YES)
ifeq ($(INFOPANEL),YES)
PLAT_DEFS = -DINFOPANEL -DWANT_SDL
PLAT_SRCS = simpanel.c simsdl.c
else
PLAT_DEFS = -DWANT_SDL
PLAT_SRCS = simsdl.c
endif
ifeq ($(TARGET_OS),BSD)
PLAT_INCS = -I/usr/local/include/SDL2
PLAT_LDFLAGS = -L/usr/local/lib
Expand All @@ -66,6 +73,10 @@ PLAT_LDFLAGS = -Wl,-search_paths_first -Wl,-headerpad_max_install_names \
PLAT_LDLIBS = -framework SDL2
endif
else
ifeq ($(INFOPANEL),YES)
PLAT_DEFS = -DINFOPANEL
PLAT_SRCS = simpanel.c
endif
ifeq ($(TARGET_OS),BSD)
PLAT_INCS = -I/usr/local/include
PLAT_LDFLAGS = -L/usr/local/lib
Expand All @@ -79,7 +90,7 @@ PLAT_LDLIBS = -lX11
endif
endif
###
### END SDL2/X11 PLATFORM VARIABLES
### END SDL2/X11 AND INFOPANEL PLATFORM VARIABLES
###

###
Expand Down
39 changes: 23 additions & 16 deletions altairsim/srcsim/simctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
#include "log.h"
static const char *TAG = "system";

/* cpu_switch states */
#define CPUSW_STOP 0 /* stopped */
#define CPUSW_RUN 1 /* running */
#define CPUSW_STEP 2 /* single step */
#define CPUSW_STEPCYCLE 3 /* machine cycle step */

static BYTE fp_led_wait;
static int cpu_switch;
static int reset;
Expand Down Expand Up @@ -190,14 +196,14 @@ void mon(void)

/* run CPU if not idling */
switch (cpu_switch) {
case 1:
case CPUSW_RUN:
if (!reset)
run_cpu();
break;
case 2:
case CPUSW_STEP:
step_cpu();
if (cpu_switch == 2)
cpu_switch = 0;
if (cpu_switch == CPUSW_STEP)
cpu_switch = CPUSW_STOP;
break;
default:
break;
Expand Down Expand Up @@ -274,16 +280,16 @@ static void run_clicked(int state, int val)
switch (state) {
case FP_SW_DOWN:
if (cpu_state != ST_CONTIN_RUN) {
cpu_state = ST_CONTIN_RUN;
cpu_state = ST_STOPPED; /* get out of ST_SINGLE_STEP */
fp_led_wait = 0;
cpu_switch = 1;
cpu_switch = CPUSW_RUN;
}
break;
case FP_SW_UP:
if (cpu_state == ST_CONTIN_RUN) {
cpu_state = ST_STOPPED;
fp_led_wait = 1;
cpu_switch = 0;
cpu_switch = CPUSW_STOP;
}
break;
default:
Expand All @@ -306,7 +312,7 @@ static void step_clicked(int state, int val)

switch (state) {
case FP_SW_UP:
cpu_switch = 2;
cpu_switch = CPUSW_STEP;
break;
case FP_SW_DOWN:
break;
Expand All @@ -333,9 +339,9 @@ bool wait_step(void)
return ret;
}

cpu_switch = 3;
cpu_switch = CPUSW_STEPCYCLE;

while ((cpu_switch == 3) && !reset) {
while ((cpu_switch == CPUSW_STEPCYCLE) && !reset) {
/* when INP update data bus LEDs */
if (cpu_bus == (CPU_WO | CPU_INP)) {
if (port_in[fp_led_address & 0xff])
Expand All @@ -344,7 +350,7 @@ bool wait_step(void)
}
fp_clock++;
fp_sampleData();
sleep_for_ms(1);
sleep_for_ms(10);
ret = true;
}

Expand All @@ -361,9 +367,9 @@ void wait_int_step(void)
if (cpu_state != ST_SINGLE_STEP)
return;

cpu_switch = 3;
cpu_switch = CPUSW_STEPCYCLE;

while ((cpu_switch == 3) && !reset) {
while ((cpu_switch == CPUSW_STEPCYCLE) && !reset) {
fp_clock++;
fp_sampleData();
sleep_for_ms(10);
Expand Down Expand Up @@ -401,7 +407,8 @@ static void reset_clicked(int state, int val)
/* update front panel */
fp_led_address = PC;
fp_led_data = fp_read(PC);
if ((p_tab[PC] == MEM_RO) || (p_tab[PC] == MEM_WPROT))
if ((p_tab[PC >> 8] == MEM_RO) ||
(p_tab[PC >> 8] == MEM_WPROT))
mem_wp = 1;
else
mem_wp = 0;
Expand Down Expand Up @@ -572,7 +579,7 @@ static void power_clicked(int state, int val)
if (!power)
break;
power = 0;
cpu_switch = 0;
cpu_switch = CPUSW_STOP;
cpu_state = ST_STOPPED;
cpu_error = POWEROFF;
break;
Expand All @@ -587,7 +594,7 @@ static void power_clicked(int state, int val)
static void quit_callback(void)
{
power = 0;
cpu_switch = 0;
cpu_switch = CPUSW_STOP;
cpu_state = ST_STOPPED;
cpu_error = POWEROFF;
}
Expand Down
5 changes: 5 additions & 0 deletions altairsim/srcsim/simio.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ void init_io(void)
/* create local sockets */
init_unix_server_socket(&ucons[0], "altairsim.tape");
init_unix_server_socket(&ucons[1], "altairsim.sio2");

altair_sio_reset();
altair_2sio_reset();
}

/*
Expand Down Expand Up @@ -191,6 +194,8 @@ void reset_io(void)
cromemco_dazzler_off();
tarbell_reset();
altair_dsk_reset();
altair_sio_reset();
altair_2sio_reset();
}

#if 0 /* currently not used */
Expand Down
12 changes: 12 additions & 0 deletions altairsim/srcsim/simmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#endif
#ifdef FRONTPANEL
#include "simctl.h"
#include "simport.h"
#include "frontpanel.h"
#endif

Expand Down Expand Up @@ -73,6 +74,10 @@ extern void init_memory(void);
*/
static inline void memwrt(WORD addr, BYTE data)
{
#ifdef FRONTPANEL
uint64_t t;
#endif

#ifdef BUS_8080
#ifndef FRONTPANEL
cpu_bus &= ~CPU_M1;
Expand All @@ -82,11 +87,13 @@ static inline void memwrt(WORD addr, BYTE data)

#ifdef FRONTPANEL
if (F_flag) {
t = get_clock_us();
fp_clock++;
fp_led_address = addr;
fp_led_data = 0xff;
fp_sampleData();
wait_step();
cpu_tadj += get_clock_us() - t;
} else
cpu_bus &= ~CPU_M1;
#endif
Expand All @@ -105,6 +112,9 @@ static inline void memwrt(WORD addr, BYTE data)
static inline BYTE memrdr(WORD addr)
{
register BYTE data;
#ifdef FRONTPANEL
uint64_t t;
#endif

#ifdef WANT_HB
if (hb_flag && hb_addr == addr) {
Expand Down Expand Up @@ -144,11 +154,13 @@ static inline BYTE memrdr(WORD addr)

#ifdef FRONTPANEL
if (F_flag) {
t = get_clock_us();
fp_clock++;
fp_led_address = addr;
fp_led_data = data;
fp_sampleData();
wait_step();
cpu_tadj += get_clock_us() - t;
} else
cpu_bus &= ~CPU_M1;
#endif
Expand Down
54 changes: 49 additions & 5 deletions cpmsim/srcsim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# (simple) machine name - will be suffixed with 'sim'
# and the executable saved as '../machinesim'
MACHINE = cpm
# show an introspection panel
INFOPANEL ?= NO
# use SDL2 instead of X11
WANT_SDL ?= NO
# machine specific system source files
MACHINE_SRCS = simcfg.c simio.c simmem.c simctl.c
# machine specific I/O source files
Expand Down Expand Up @@ -37,8 +41,48 @@ VPATH = $(CORE_DIR) $(IO_DIR)

include $(CORE_DIR)/Makefile.in-os

DEFS = -DCONFDIR=\"$(CONF_DIR)\" -DDISKSDIR=\"$(DISKS_DIR)\"
INCS = -I. -I$(CORE_DIR) -I$(IO_DIR)
###
### SDL2/X11 INFOPANEL PLATFORM VARIABLES
###
ifeq ($(INFOPANEL),YES)
ifeq ($(WANT_SDL),YES)
PLAT_DEFS = -DINFOPANEL -DWANT_SDL
PLAT_SRCS = simpanel.c simsdl.c
ifeq ($(TARGET_OS),BSD)
PLAT_INCS = -I/usr/local/include/SDL2
PLAT_LDFLAGS = -L/usr/local/lib
PLAT_LDLIBS = -lSDL2 -lSDL2main
else ifeq ($(TARGET_OS),LINUX)
PLAT_INCS = -I/usr/include/SDL2
PLAT_LDLIBS = -lSDL2 -lSDL2main
else ifeq ($(TARGET_OS),OSX)
PLAT_INCS = -F/Library/Frameworks -I/Library/Frameworks/SDL2.framework/Headers
PLAT_LDFLAGS = -Wl,-search_paths_first -Wl,-headerpad_max_install_names \
-Wl,-rpath,/Library/Frameworks
PLAT_LDLIBS = -framework SDL2
endif
else
PLAT_DEFS = -DINFOPANEL
PLAT_SRCS = simpanel.c
ifeq ($(TARGET_OS),BSD)
PLAT_INCS = -I/usr/local/include
PLAT_LDFLAGS = -L/usr/local/lib
PLAT_LDLIBS = -lX11 -lpthread
else ifeq ($(TARGET_OS),LINUX)
PLAT_LDLIBS = -lX11 -lpthread
else ifeq ($(TARGET_OS),OSX)
PLAT_INCS = -I/opt/X11/include -I/opt/local/include -I/usr/local/include
PLAT_LDFLAGS = -L/opt/X11/lib -L/usr/local/lib
PLAT_LDLIBS = -lX11 -lpthread
endif
endif
endif
###
### END INFOPANEL SDL2/X11 PLATFORM VARIABLES
###

DEFS = -DCONFDIR=\"$(CONF_DIR)\" -DDISKSDIR=\"$(DISKS_DIR)\" $(PLAT_DEFS)
INCS = -I. -I$(CORE_DIR) -I$(IO_DIR) $(PLAT_INCS)
CPPFLAGS = $(DEFS) $(INCS)

CSTDS = -std=c99 -D_DEFAULT_SOURCE # -D_XOPEN_SOURCE=700L
Expand All @@ -59,8 +103,8 @@ endif

CFLAGS = $(CSTDS) $(COPTS) $(CWARNS)

LDFLAGS =
LDLIBS =
LDFLAGS = $(PLAT_LDFLAGS)
LDLIBS = $(PLAT_LDLIBS)

INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
Expand All @@ -70,7 +114,7 @@ INSTALL_DATA = $(INSTALL) -m 644
CORE_SRCS = sim8080.c simcore.c simdis.c simfun.c simglb.c simice.c simint.c \
simmain.c simz80.c simz80-cb.c simz80-dd.c simz80-ddcb.c simz80-ed.c \
simz80-fd.c simz80-fdcb.c
SRCS = $(CORE_SRCS) $(MACHINE_SRCS) $(IO_SRCS)
SRCS = $(CORE_SRCS) $(MACHINE_SRCS) $(IO_SRCS) $(PLAT_SRCS)
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)

Expand Down
5 changes: 4 additions & 1 deletion cpmsim/srcsim/simio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2076,8 +2076,11 @@ static BYTE speedl_in(void)
static void speedh_out(BYTE data)
{
speed += data << 8;
tmax = speed * 10000;
f_value = speed;
if (f_value)
tmax = speed * 10000;
else
tmax = 100000;
}

/*
Expand Down
15 changes: 13 additions & 2 deletions cromemcosim/srcsim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
MACHINE = cromemco
# emulate a machine's frontpanel
FRONTPANEL ?= YES
# show an introspection panel
INFOPANEL ?= YES
# use SDL2 instead of X11
WANT_SDL ?= NO
# machine specific system source files
Expand Down Expand Up @@ -54,11 +56,16 @@ VPATH = $(CORE_DIR) $(IO_DIR) $(FP_DIR) $(NET_DIR) $(CIV_DIR)
include $(CORE_DIR)/Makefile.in-os

###
### SDL2/X11 PLATFORM VARIABLES
### SDL2/X11 AND INFOPANEL PLATFORM VARIABLES
###
ifeq ($(WANT_SDL),YES)
ifeq ($(INFOPANEL),YES)
PLAT_DEFS = -DINFOPANEL -DWANT_SDL
PLAT_SRCS = simpanel.c simsdl.c
else
PLAT_DEFS = -DWANT_SDL
PLAT_SRCS = simsdl.c
endif
ifeq ($(TARGET_OS),BSD)
PLAT_INCS = -I/usr/local/include/SDL2
PLAT_LDFLAGS = -L/usr/local/lib
Expand All @@ -73,6 +80,10 @@ PLAT_LDFLAGS = -Wl,-search_paths_first -Wl,-headerpad_max_install_names \
PLAT_LDLIBS = -framework SDL2
endif
else
ifeq ($(INFOPANEL),YES)
PLAT_DEFS = -DINFOPANEL
PLAT_SRCS = simpanel.c
endif
ifeq ($(TARGET_OS),BSD)
PLAT_INCS = -I/usr/local/include
PLAT_LDFLAGS = -L/usr/local/lib
Expand All @@ -86,7 +97,7 @@ PLAT_LDLIBS = -lX11
endif
endif
###
### END SDL2/X11 PLATFORM VARIABLES
### END SDL2/X11 AND INFOPANEL PLATFORM VARIABLES
###

###
Expand Down
Loading