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

sync dev with master #509

Merged
merged 40 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
77321e3
Merge pull request #458 from udo-munk/dev
udo-munk Sep 23, 2024
29fac83
Merge pull request #459 from udo-munk/dev
udo-munk Sep 24, 2024
b06cc61
Merge pull request #460 from udo-munk/dev
udo-munk Sep 25, 2024
b335174
Merge pull request #461 from udo-munk/dev
udo-munk Sep 27, 2024
5ccfc6b
Merge pull request #462 from udo-munk/dev
udo-munk Sep 30, 2024
ac73c36
Merge pull request #463 from udo-munk/dev
udo-munk Nov 24, 2024
1863325
Merge pull request #466 from udo-munk/dev
udo-munk Dec 3, 2024
0d8e2ba
Merge pull request #470 from udo-munk/dev
udo-munk Dec 7, 2024
5406385
Merge pull request #473 from udo-munk/dev
udo-munk Dec 9, 2024
b3c7637
Merge pull request #474 from udo-munk/dev
udo-munk Dec 10, 2024
97d67cc
Merge pull request #476 from udo-munk/dev
udo-munk Dec 11, 2024
1e770fa
Merge pull request #479 from udo-munk/dev
udo-munk Dec 13, 2024
430de17
Merge pull request #485 from udo-munk/dev
udo-munk Dec 15, 2024
412bb6c
Merge pull request #487 from udo-munk/dev
udo-munk Dec 16, 2024
b19d57d
Merge pull request #488 from udo-munk/dev
udo-munk Dec 19, 2024
8b1ea20
Merge pull request #490 from udo-munk/dev
udo-munk Dec 19, 2024
b9041c9
Merge pull request #491 from udo-munk/dev
udo-munk Dec 20, 2024
6541c9f
Merge pull request #495 from udo-munk/dev
udo-munk Dec 21, 2024
e84f685
Merge pull request #498 from udo-munk/dev
udo-munk Dec 23, 2024
5821c9d
Merge pull request #499 from udo-munk/dev
udo-munk Dec 23, 2024
3bb6a6d
Merge pull request #501 from udo-munk/dev
udo-munk Dec 24, 2024
8ec01af
Merge pull request #503 from udo-munk/dev
udo-munk Dec 26, 2024
e9958ed
Merge pull request #505 from udo-munk/dev
udo-munk Dec 27, 2024
7422a69
Merge pull request #507 from udo-munk/dev
udo-munk Dec 30, 2024
b4644bb
first steps to add SDL2 support
sneakywumpus Jan 6, 2025
6fe43c8
frontpanel formating
sneakywumpus Jan 6, 2025
e0d0aac
make frontpanel window close button work
sneakywumpus Jan 6, 2025
b558bf0
add typeahead buffer for SDL
sneakywumpus Jan 7, 2025
6b8b139
fix #ifdef jungle for X11
sneakywumpus Jan 7, 2025
2975d3c
optimize VDM and VIO: use texture and set pixels directly
sneakywumpus Jan 7, 2025
d98ed6c
frontpanel text display clean-up
sneakywumpus Jan 7, 2025
8f8d853
fix copyrights
sneakywumpus Jan 7, 2025
2ffb5aa
fix X11 compilation on macOS; don't just crash when frontpanel openWi…
sneakywumpus Jan 7, 2025
6228b89
32-bit depth buffer needed for macOS native OpenGL, clean-up frontpanel
sneakywumpus Jan 8, 2025
a887434
reset GL context attributes; don't install SDL signal handlers
sneakywumpus Jan 8, 2025
d4d8f75
add mouse wheel support for zooming in/out of the 3D view
sneakywumpus Jan 8, 2025
793815a
add mouse wheel support for X11; use 24-bit depth buffer; version 2.1C
sneakywumpus Jan 8, 2025
57e4c25
add linker option -rpath for macOS
sneakywumpus Jan 8, 2025
a073ef2
add more linker options for macOS
sneakywumpus Jan 8, 2025
caa8f40
Merge pull request #508 from sneakywumpus/addsdl2
udo-munk Jan 8, 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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,7 @@ distclean:
$(MAKE) -C $$subdir/srcsim distclean; \
done

.NOTPARALLEL: all

.PHONY: all tools libs bioses misc machines reassemble FORCE \
install uninstall clean distclean
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ Full documentation is at https://www.icl1900.co.uk/unix4fun/z80pack
## Ubuntu

### Building
First install the needed dependencies:
First install the needed dependencies for X11:

sudo apt install build-essential libglu1-mesa-dev libjpeg9-dev

Then run
or for SDL2:

sudo apt install build-essential libsdl2-dev libsdl2-image-dev

Then for X11 run

make

or for SDL2 run

WANT_SDL=YES make

to build all the MACHINES mentioned in the Makefile.

## Release vs Development
Expand All @@ -42,7 +50,8 @@ finished release.

### Running CP/M 2.2

CP/M 2.2 is the ancestor of MS-DOS. Use this command to invoke CP/M 2.2 with two disks containing some sample programs and sources.
CP/M 2.2 is the ancestor of MS-DOS. Use this command to invoke CP/M 2.2 with
two disks containing some sample programs and sources.


(cd cpmsim; ./cpm22)
Expand Down Expand Up @@ -92,7 +101,8 @@ Clock frequency 630.22 MHz

### Running CP/M 3

CP/M 3 was the next generation of CP/M with features from MP/M to notably be able to use more RAM along with a lot of other nice features.
CP/M 3 was the next generation of CP/M with features from MP/M to notably
be able to use more RAM along with a lot of other nice features.

Run with:

Expand Down Expand Up @@ -173,10 +183,11 @@ A>dir a:
A: CPM3 SYS : VT100DYN COM : TRACE UTL : HIST UTL : PROFILE SUB
SYSTEM FILE(S) EXIST
A>dir b:
B: BNKBDOS3 SPR : CPM3 SYS : LDRBIOS3 MAC : SCB MAC : RESBDOS3 SPR : BIOS3 MAC : PATCH COM
B: GENCPM COM : BDOS3 SPR : GENCPM DAT : BOOT Z80 : M80 COM : LINK COM : L80 COM
B: WM COM : MAC COM : WM HLP : BNKBIOS3 SPR : LDR SUB : INITDIR COM : CPMLDR COM
B: COPYSYS COM : CPMLDR REL : RMAC COM : SYSGEN SUB
B: BNKBDOS3 SPR : CPM3 SYS : LDRBIOS3 MAC : SCB MAC : RESBDOS3 SPR
B: BIOS3 MAC : PATCH COM : GENCPM COM : BDOS3 SPR : GENCPM DAT
B: BOOT Z80 : M80 COM : LINK COM : L80 COM : WM COM
B: MAC COM : WM HLP : BNKBIOS3 SPR : LDR SUB : INITDIR COM
B: CPMLDR COM : COPYSYS COM : CPMLDR REL : RMAC COM : SYSGEN SUB
A>bye

System halted
Expand Down
14 changes: 7 additions & 7 deletions altairsim/conf/system.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ fp_size 800
# front panel port value for machine without fp in hex (00 - FF)
fp_port 0

# VDM background and foreground colors in hex RGB format
# VDM background and foreground colors in RGB format
# white Monitor
vdm_bg 303030
vdm_fg FFFFFF
vdm_bg 48,48,48
vdm_fg 255,255,255
# green Monitor
#vdm_bg 002000
#vdm_fg 00BF00
#vdm_bg 0,32,0
#vdm_fg 0,191,0
# amber Monitor
#vdm_bg 202000
#vdm_fg FFBF00
#vdm_bg 32,32,0
#vdm_fg 255,191,0
# Add scanlines to VDM monitor, 0 = no scanlines
vdm_scanlines 1

Expand Down
106 changes: 56 additions & 50 deletions altairsim/srcsim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# and the executable saved as '../machinesim'
MACHINE = altair
# emulate a machine's frontpanel
FRONTPANEL = YES
FRONTPANEL ?= YES
# 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 @@ -34,28 +36,6 @@ ROMS_DIR = $(DATADIR)/roms
### END MACHINE DEPENDENT VARIABLES
###

###
### FRONTPANEL VARIABLES
###
ifeq ($(FRONTPANEL),YES)
FP_SRCS = fpmain.cpp
FP_DEFS = -DFRONTPANEL
FP_LIB = $(FP_DIR)/libfrontpanel.a
FP_LDLIBS = -lfrontpanel -ljpeg -lGL -lGLU
LINK = $(CXX)
LINKFLAGS = $(CXXFLAGS)
else
FP_SRCS =
FP_DEFS =
FP_LIB =
FP_LDLIBS =
LINK = $(CC)
LINKFLAGS = $(CFLAGS)
endif
###
### END FRONTPANEL VARIABLES
###

SIM = ../$(MACHINE)sim

CORE_DIR = ../../z80core
Expand All @@ -64,85 +44,111 @@ FP_DIR = ../../frontpanel

VPATH = $(CORE_DIR) $(IO_DIR) $(FP_DIR)

###
### START O/S PLATFORM DEPENDENT VARIABLES
###
include $(CORE_DIR)/Makefile.in-os

###
### SDL2/X11 PLATFORM VARIABLES
###
ifeq ($(WANT_SDL),YES)
PLAT_DEFS = -DWANT_SDL
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
ifeq ($(TARGET_OS),BSD)
PLAT_INCS = -I/usr/local/include
PLAT_LDFLAGS = -L/usr/local/lib
PLAT_LDLIBS = -lthr
PLAT_LDLIBS = -lX11
else ifeq ($(TARGET_OS),LINUX)
PLAT_LDLIBS = -lX11
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
endif
ifeq ($(TARGET_OS),LINUX)
PLAT_LDLIBS = -lm -lpthread
endif
###
### END SDL2/X11 PLATFORM VARIABLES
###

###
### FRONTPANEL VARIABLES
###
ifeq ($(FRONTPANEL),YES)
FP_DEFS = -DFRONTPANEL
FP_LIB = $(FP_DIR)/libfrontpanel.a
ifeq ($(WANT_SDL),YES)
ifeq ($(TARGET_OS),OSX)
PLAT_INCS = -I/opt/X11/include
PLAT_LDFLAGS = -L/usr/local/lib -L/opt/X11/lib
FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework OpenGL
else
FP_LDLIBS = -lfrontpanel -lSDL2_image -lGL
endif
else
FP_LDLIBS = -lfrontpanel -ljpeg -lGL
endif
endif
###
### END O/S DEPENDENT VARIABLES
### END FRONTPANEL VARIABLES
###

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

CSTDS = -std=c99 -D_DEFAULT_SOURCE # -D_XOPEN_SOURCE=700L
CWARNS = -Wall -Wextra -Wwrite-strings
CXXSTDS = -std=c++03 -D_DEFAULT_SOURCE # -D_XOPEN_SOURCE=700L
CXXWARNS = -Wall -Wextra

# Production - the default
COPTS = -O3 -U_FORTIFY_SOURCE
CXXOPTS = -O3 -U_FORTIFY_SOURCE

# Development - use `MODE=DEV make build`
ifeq ($(MODE),DEV)
COPTS = -O3 -fstack-protector-all -D_FORTIFY_SOURCE=2
CXXOPTS = -O3 -fstack-protector-all -D_FORTIFY_SOURCE=2
endif

# Debug - use `DEBUG=1 make build`
ifneq ($(DEBUG),)
COPTS = -O -g
CXXOPTS = -O -g
endif

CFLAGS = $(CSTDS) $(COPTS) $(CWARNS) $(PLAT_CFLAGS)
CXXFLAGS = $(CXXSTDS) $(CXXOPTS) $(CXXWARNS) $(PLAT_CXXFLAGS)
CFLAGS = $(CSTDS) $(COPTS) $(CWARNS)

LDFLAGS = -L$(FP_DIR) $(PLAT_LDFLAGS)
LDLIBS = $(FP_LDLIBS) -lX11 $(PLAT_LDLIBS)
LDLIBS = $(FP_LDLIBS) $(PLAT_LDLIBS) -lm -lpthread

INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644

# core system source files for the CPU simulation
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
simmain.c simsdl.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)
XXSRCS = $(FP_SRCS)
OBJS = $(SRCS:.c=.o) $(XXSRCS:.cpp=.o)
DEPS = $(SRCS:.c=.d) $(XXSRCS:.cpp=.d)
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)

all: $(SIM)

$(SIM): $(OBJS) $(FP_LIB)
$(LINK) $(LINKFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@

$(DEPS): sim.h

%.d: %.c
@$(CC) -MM $(CFLAGS) $(CPPFLAGS) $< > $@

%.d: %.cpp
@$(CXX) -MM $(CXXFLAGS) $(CPPFLAGS) $< > $@

-include $(DEPS)

$(FP_LIB): FORCE
Expand Down
52 changes: 49 additions & 3 deletions altairsim/srcsim/simcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* Copyright (C) 2008-2021 Udo Munk
* Copyright (C) 2021 David McNaughton
* Copyright (C) 2025 by Thomas Eberhardt
*
* This module reads the system configuration file and sets
* global variables, so that the system can be configured.
Expand All @@ -29,6 +30,7 @@
* 22-JAN-2021 added option for config file
* 31-JUL-2021 allow building machine without frontpanel
* 29-AUG-2021 new memory configuration sections
* 03-JAN-2025 changed colors configuration to RGB-triple
*/

#include <stddef.h>
Expand Down Expand Up @@ -59,7 +61,7 @@ void config(void)
FILE *fp;
char buf[BUFSIZE];
char *s, *t1, *t2, *t3, *t4;
int v1, v2;
int v1, v2, v3;
char fn[MAX_LFN - 1];

int num_segs = 0;
Expand Down Expand Up @@ -224,9 +226,53 @@ void config(void)
fp_size = atoi(t2);
#endif
} else if (!strcmp(t1, "vdm_bg")) {
strncpy(&bg_color[1], t2, 6);
if ((t3 = strtok(NULL, " \t,")) == NULL ||
(t4 = strtok(NULL, " \t,")) == NULL) {
LOGW(TAG, "missing parameter for %s", t1);
continue;
}
v1 = strtol(t2, NULL, 0);
if (v1 < 0 || v1 > 255) {
LOGW(TAG, "invalid red component %d", v1);
continue;
}
v2 = strtol(t3, NULL, 0);
if (v2 < 0 || v2 > 255) {
LOGW(TAG, "invalid green component %d", v2);
continue;
}
v3 = strtol(t4, NULL, 0);
if (v3 < 0 || v3 > 255) {
LOGW(TAG, "invalid blue component %d", v3);
continue;
}
bg_color[0] = v1;
bg_color[1] = v2;
bg_color[2] = v3;
} else if (!strcmp(t1, "vdm_fg")) {
strncpy(&fg_color[1], t2, 6);
if ((t3 = strtok(NULL, " \t,")) == NULL ||
(t4 = strtok(NULL, " \t,")) == NULL) {
LOGW(TAG, "missing parameter for %s", t1);
continue;
}
v1 = strtol(t2, NULL, 0);
if (v1 < 0 || v1 > 255) {
LOGW(TAG, "invalid red component %d", v1);
continue;
}
v2 = strtol(t3, NULL, 0);
if (v2 < 0 || v2 > 255) {
LOGW(TAG, "invalid green component %d", v2);
continue;
}
v3 = strtol(t4, NULL, 0);
if (v3 < 0 || v3 > 255) {
LOGW(TAG, "invalid blue component %d", v3);
continue;
}
fg_color[0] = v1;
fg_color[1] = v2;
fg_color[2] = v3;
} else if (!strcmp(t1, "vdm_scanlines")) {
if (*t2 != '0')
slf = 2;
Expand Down
Loading
Loading