diff --git a/README.md b/README.md index 65af8554..09c5ee3f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ First install the needed dependencies for X11: or for SDL2: - sudo apt install build-essential libsdl2-dev libsdl2-image-dev + sudo apt install build-essential libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev Then for X11 run diff --git a/altairsim/conf/fan.wav b/altairsim/conf/fan.wav new file mode 100644 index 00000000..f219989d Binary files /dev/null and b/altairsim/conf/fan.wav differ diff --git a/altairsim/conf/panel.conf b/altairsim/conf/panel.conf index d43755d3..4ca8bc4b 100644 --- a/altairsim/conf/panel.conf +++ b/altairsim/conf/panel.conf @@ -193,33 +193,35 @@ light LED_PROT pos=2.74,5.95 light LED_WAIT pos=2.09,4.65 light LED_HOLD pos=2.74,4.65 -switch SW_15 type=object operate=toggle objects=sw_down,sw_up pos=3.99,3.34,0. size=.6,.6 -switch SW_14 type=object operate=toggle objects=sw_down,sw_up pos=5.00,3.34,0. size=.6,.6 -switch SW_13 type=object operate=toggle objects=sw_down,sw_up pos=5.60,3.34,0. size=.6,.6 -switch SW_12 type=object operate=toggle objects=sw_down,sw_up pos=6.25,3.34,0. size=.6,.6 - -switch SW_11 type=object operate=toggle objects=sw_down,sw_up pos=7.20,3.34,0. size=.6,.6 -switch SW_10 type=object operate=toggle objects=sw_down,sw_up pos=7.85,3.34,0. size=.6,.6 -switch SW_09 type=object operate=toggle objects=sw_down,sw_up pos=8.50,3.34,0. size=.6,.6 -switch SW_08 type=object operate=toggle objects=sw_down,sw_up pos=9.45,3.34,0. size=.6,.6 - -switch SW_07 type=object operate=toggle objects=sw_down,sw_up pos=10.10,3.34,0. size=.6,.6 -switch SW_06 type=object operate=toggle objects=sw_down,sw_up pos=10.75,3.34,0. size=.6,.6 -switch SW_05 type=object operate=toggle objects=sw_down,sw_up pos=11.70,3.34,0. size=.6,.6 -switch SW_04 type=object operate=toggle objects=sw_down,sw_up pos=12.35,3.34,0. size=.6,.6 - -switch SW_03 type=object operate=toggle objects=sw_down,sw_up pos=12.95,3.34,0. size=.6,.6 -switch SW_02 type=object operate=toggle objects=sw_down,sw_up pos=13.90,3.34,0. size=.6,.6 -switch SW_01 type=object operate=toggle objects=sw_down,sw_up pos=14.55,3.34,0. size=.6,.6 -switch SW_00 type=object operate=toggle objects=sw_down,sw_up pos=15.20,3.34,0. size=.6,.6 - -switch SW_PWR type=object operate=toggle objects=sw_down,sw_up pos=1.00,2.04,0. size=.6,.6 - -switch SW_RUN type=object operate=mom_off_mom objects=sw_down,sw_up,sw_center pos=4.04,2.04,0. size=.6,.6 -switch SW_STEP type=object operate=mom_off_mom objects=sw_down,sw_up,sw_center pos=5.30,2.04,0. size=.6,.6 -switch SW_EXAMINE type=object operate=mom_off_mom objects=sw_down,sw_up,sw_center pos=6.60,2.04,0. size=.6,.6 -switch SW_DEPOSIT type=object operate=mom_off_mom objects=sw_down,sw_up,sw_center pos=7.85,2.04,0. size=.6,.6 -switch SW_RESET type=object operate=mom_off_mom objects=sw_down,sw_up,sw_center pos=9.15,2.04,0. size=.6,.6 -switch SW_PROTECT type=object operate=mom_off_mom objects=sw_down,sw_up,sw_center pos=10.45,2.04,0. size=.6,.6 -switch SW_INT type=object operate=mom_off_mom objects=sw_down,sw_up,sw_center pos=11.70,2.04,0. size=.6,.6 -switch SW_AUX type=object operate=mom_off_mom objects=sw_down,sw_up,sw_center pos=13.00,2.04,0. size=.6,.6 +switch SW_15 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=3.99,3.34,0. size=.6,.6 +switch SW_14 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=5.00,3.34,0. size=.6,.6 +switch SW_13 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=5.60,3.34,0. size=.6,.6 +switch SW_12 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=6.25,3.34,0. size=.6,.6 + +switch SW_11 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=7.20,3.34,0. size=.6,.6 +switch SW_10 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=7.85,3.34,0. size=.6,.6 +switch SW_09 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=8.50,3.34,0. size=.6,.6 +switch SW_08 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=9.45,3.34,0. size=.6,.6 + +switch SW_07 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=10.10,3.34,0. size=.6,.6 +switch SW_06 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=10.75,3.34,0. size=.6,.6 +switch SW_05 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=11.70,3.34,0. size=.6,.6 +switch SW_04 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=12.35,3.34,0. size=.6,.6 + +switch SW_03 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=12.95,3.34,0. size=.6,.6 +switch SW_02 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=13.90,3.34,0. size=.6,.6 +switch SW_01 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=14.55,3.34,0. size=.6,.6 +switch SW_00 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=15.20,3.34,0. size=.6,.6 + +switch SW_PWR type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up pos=1.00,2.04,0. size=.6,.6 + +switch SW_RUN type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up,sw_center pos=4.04,2.04,0. size=.6,.6 +switch SW_STEP type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up,sw_center pos=5.30,2.04,0. size=.6,.6 +switch SW_EXAMINE type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up,sw_center pos=6.60,2.04,0. size=.6,.6 +switch SW_DEPOSIT type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up,sw_center pos=7.85,2.04,0. size=.6,.6 +switch SW_RESET type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up,sw_center pos=9.15,2.04,0. size=.6,.6 +switch SW_PROTECT type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up,sw_center pos=10.45,2.04,0. size=.6,.6 +switch SW_INT type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up,sw_center pos=11.70,2.04,0. size=.6,.6 +switch SW_AUX type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw_down,sw_up,sw_center pos=13.00,2.04,0. size=.6,.6 + +fansound fan.wav diff --git a/altairsim/conf/switch_off.wav b/altairsim/conf/switch_off.wav new file mode 100644 index 00000000..de22804c Binary files /dev/null and b/altairsim/conf/switch_off.wav differ diff --git a/altairsim/conf/switch_on.wav b/altairsim/conf/switch_on.wav new file mode 100644 index 00000000..360b8043 Binary files /dev/null and b/altairsim/conf/switch_on.wav differ diff --git a/altairsim/srcsim/Makefile b/altairsim/srcsim/Makefile index b4e9850a..1c748a62 100644 --- a/altairsim/srcsim/Makefile +++ b/altairsim/srcsim/Makefile @@ -51,6 +51,7 @@ include $(CORE_DIR)/Makefile.in-os ### ifeq ($(WANT_SDL),YES) PLAT_DEFS = -DWANT_SDL +PLAT_SRCS = simsdl.c ifeq ($(TARGET_OS),BSD) PLAT_INCS = -I/usr/local/include/SDL2 PLAT_LDFLAGS = -L/usr/local/lib @@ -89,9 +90,12 @@ FP_DEFS = -DFRONTPANEL FP_LIB = $(FP_DIR)/libfrontpanel.a ifeq ($(WANT_SDL),YES) ifeq ($(TARGET_OS),OSX) -FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework OpenGL +FP_INCS = -I/Library/Frameworks/SDL2_image.framework/Headers \ + -I/Library/Frameworks/SDL2_mixer.framework/Headers +FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework SDL2_mixer \ + -framework OpenGL else -FP_LDLIBS = -lfrontpanel -lSDL2_image -lGL +FP_LDLIBS = -lfrontpanel -lSDL2_image -lSDL2_mixer -lGL endif else FP_LDLIBS = -lfrontpanel -ljpeg -lGL @@ -103,7 +107,7 @@ endif DEFS = -DCONFDIR=\"$(CONF_DIR)\" -DDISKSDIR=\"$(DISKS_DIR)\" \ -DBOOTROM=\"$(ROMS_DIR)\" $(FP_DEFS) $(PLAT_DEFS) -INCS = -I. -I$(CORE_DIR) -I$(IO_DIR) -I$(FP_DIR) $(PLAT_INCS) +INCS = -I. -I$(CORE_DIR) -I$(IO_DIR) -I$(FP_DIR) $(PLAT_INCS) $(FP_INCS) CPPFLAGS = $(DEFS) $(INCS) CSTDS = -std=c99 -D_DEFAULT_SOURCE # -D_XOPEN_SOURCE=700L @@ -133,9 +137,9 @@ 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 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) + 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) $(PLAT_SRCS) OBJS = $(SRCS:.c=.o) DEPS = $(SRCS:.c=.d) @@ -168,10 +172,10 @@ uninstall: clean: _rm_obj _rm_deps _rm_obj: - rm -f $(OBJS) + rm -f *.o _rm_deps: - rm -f $(DEPS) + rm -f *.d distclean: clean rm -f $(SIM) diff --git a/altairsim/srcsim/simctl.c b/altairsim/srcsim/simctl.c index 5b437d73..a5fd0341 100644 --- a/altairsim/srcsim/simctl.c +++ b/altairsim/srcsim/simctl.c @@ -68,7 +68,7 @@ static BYTE fp_led_wait; static int cpu_switch; static int reset; static BYTE power_switch = 1; -static int power; +static BYTE power; static void run_clicked(int state, int val), step_clicked(int state, int val); static void reset_clicked(int state, int val); @@ -120,6 +120,7 @@ void mon(void) fp_framerate(fp_fps); fp_bindSimclock(&fp_clock); fp_bindRunFlag(&cpu_state); + fp_bindPowerFlag(&power); /* bind frontpanel LED's to variables */ fp_bindLight16("LED_ADDR_{00-15}", &fp_led_address, 1); @@ -233,6 +234,7 @@ void mon(void) #ifdef FRONTPANEL if (F_flag) { /* all LED's off and update front panel */ + power = 0; cpu_bus = 0; bus_request = 0; IFF = 0; @@ -558,7 +560,7 @@ static void power_clicked(int state, int val) case FP_SW_DOWN: if (power) break; - power++; + power = 1; cpu_bus = CPU_WO | CPU_M1 | CPU_MEMR; fp_led_address = PC; fp_led_data = fp_read(PC); @@ -569,7 +571,7 @@ static void power_clicked(int state, int val) case FP_SW_UP: if (!power) break; - power--; + power = 0; cpu_switch = 0; cpu_state = ST_STOPPED; cpu_error = POWEROFF; @@ -584,7 +586,7 @@ static void power_clicked(int state, int val) */ static void quit_callback(void) { - power--; + power = 0; cpu_switch = 0; cpu_state = ST_STOPPED; cpu_error = POWEROFF; diff --git a/cpmsim/srcsim/Makefile b/cpmsim/srcsim/Makefile index 19fbd36a..83531f64 100644 --- a/cpmsim/srcsim/Makefile +++ b/cpmsim/srcsim/Makefile @@ -68,8 +68,8 @@ 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 simsdl.c simz80.c simz80-cb.c simz80-dd.c simz80-ddcb.c \ - simz80-ed.c simz80-fd.c simz80-fdcb.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) OBJS = $(SRCS:.c=.o) DEPS = $(SRCS:.c=.d) @@ -98,10 +98,10 @@ uninstall: clean: _rm_obj _rm_deps _rm_obj: - rm -f $(OBJS) + rm -f *.o _rm_deps: - rm -f $(DEPS) + rm -f *.d distclean: clean rm -f $(SIM) diff --git a/cromemcosim/conf_2d/fan.wav b/cromemcosim/conf_2d/fan.wav new file mode 100644 index 00000000..f219989d Binary files /dev/null and b/cromemcosim/conf_2d/fan.wav differ diff --git a/cromemcosim/conf_2d/panel.conf b/cromemcosim/conf_2d/panel.conf index 517840b5..0c147a30 100644 --- a/cromemcosim/conf_2d/panel.conf +++ b/cromemcosim/conf_2d/panel.conf @@ -144,32 +144,32 @@ v 0 1 #switches -switch SW_15 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=.7,1.6,0. size=.65,1.2,1 -switch SW_14 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=1.37,1.6,0. size=.65,1.2,1 -switch SW_13 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=2.02,1.6,0. size=.65,1.2,1 -switch SW_12 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=2.67,1.6,0. size=.65,1.2,1 - -switch SW_11 type=object operate=toggle objects=red_sw_down,red_sw_up pos=3.32,1.6,0. size=.65,1.2,1 -switch SW_10 type=object operate=toggle objects=red_sw_down,red_sw_up pos=3.97,1.6,0. size=.65,1.2,1 -switch SW_09 type=object operate=toggle objects=red_sw_down,red_sw_up pos=4.64,1.6,0. size=.65,1.2,1 -switch SW_08 type=object operate=toggle objects=red_sw_down,red_sw_up pos=5.31,1.6,0. size=.65,1.2,1 - -switch SW_07 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=6.65,1.6,0. size=.65,1.2,1 -switch SW_06 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=7.33,1.6,0. size=.65,1.2,1 -switch SW_05 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=7.98,1.6,0. size=.65,1.2,1 -switch SW_04 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=8.63,1.6,0. size=.65,1.2,1 - -switch SW_03 type=object operate=toggle objects=red_sw_down,red_sw_up pos=9.28,1.6,0. size=.65,1.2,1 -switch SW_02 type=object operate=toggle objects=red_sw_down,red_sw_up pos=9.95,1.6,0. size=.65,1.2,1 -switch SW_01 type=object operate=toggle objects=red_sw_down,red_sw_up pos=10.62,1.6,0. size=.65,1.2,1 -switch SW_00 type=object operate=toggle objects=red_sw_down,red_sw_up pos=11.28,1.6,0. size=.65,1.2,1 - -switch SW_EXAMINE type=object operate=mom_off_mom objects=blue_sw_down,blue_sw_up,blue_sw_center pos=12.65,1.6,0. size=.6,1.2,1 -switch SW_DEPOSIT type=object operate=mom_off_mom objects=red_sw_down,red_sw_up,red_sw_center pos=13.30,1.6,0. size=.6,1.2,1 -switch SW_RESET type=object operate=mom_off_mom objects=blue_sw_down,blue_sw_up,blue_sw_center pos=13.95,1.6,0. size=.6,1.2,1 -switch SW_RUN type=object operate=mom_off_mom objects=red_sw_down,red_sw_up,red_sw_center pos=14.60,1.6,0. size=.6,1.2,1 -switch SW_STEP type=object operate=mom_off_mom objects=blue_sw_down,blue_sw_up,blue_sw_center pos=15.25,1.6,0. size=.6,1.2,1 -switch SW_PWR type=object operate=toggle objects=pwr_sw_dn,pwr_sw_up pos=15.90,1.6,0. size=.7,1.2,1 +switch SW_15 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=.7,1.6,0. size=.65,1.2,1 +switch SW_14 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=1.37,1.6,0. size=.65,1.2,1 +switch SW_13 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=2.02,1.6,0. size=.65,1.2,1 +switch SW_12 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=2.67,1.6,0. size=.65,1.2,1 + +switch SW_11 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=3.32,1.6,0. size=.65,1.2,1 +switch SW_10 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=3.97,1.6,0. size=.65,1.2,1 +switch SW_09 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=4.64,1.6,0. size=.65,1.2,1 +switch SW_08 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=5.31,1.6,0. size=.65,1.2,1 + +switch SW_07 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=6.65,1.6,0. size=.65,1.2,1 +switch SW_06 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=7.33,1.6,0. size=.65,1.2,1 +switch SW_05 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=7.98,1.6,0. size=.65,1.2,1 +switch SW_04 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=8.63,1.6,0. size=.65,1.2,1 + +switch SW_03 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=9.28,1.6,0. size=.65,1.2,1 +switch SW_02 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=9.95,1.6,0. size=.65,1.2,1 +switch SW_01 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=10.62,1.6,0. size=.65,1.2,1 +switch SW_00 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=11.28,1.6,0. size=.65,1.2,1 + +switch SW_EXAMINE type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up,blue_sw_center pos=12.65,1.6,0. size=.6,1.2,1 +switch SW_DEPOSIT type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up,red_sw_center pos=13.30,1.6,0. size=.6,1.2,1 +switch SW_RESET type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up,blue_sw_center pos=13.95,1.6,0. size=.6,1.2,1 +switch SW_RUN type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up,red_sw_center pos=14.60,1.6,0. size=.6,1.2,1 +switch SW_STEP type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up,blue_sw_center pos=15.25,1.6,0. size=.6,1.2,1 +switch SW_PWR type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=pwr_sw_dn,pwr_sw_up pos=15.90,1.6,0. size=.7,1.2,1 #address lights @@ -230,3 +230,5 @@ light LED_RUN pos=14.95,3.85 light LED_INTEN pos=14.30,3.85 light LED_WAIT pos=15.50,3.85 light LED_HOLD pos=16.10,3.85 + +fansound fan.wav diff --git a/cromemcosim/conf_2d/switch_off.wav b/cromemcosim/conf_2d/switch_off.wav new file mode 100644 index 00000000..de22804c Binary files /dev/null and b/cromemcosim/conf_2d/switch_off.wav differ diff --git a/cromemcosim/conf_2d/switch_on.wav b/cromemcosim/conf_2d/switch_on.wav new file mode 100644 index 00000000..360b8043 Binary files /dev/null and b/cromemcosim/conf_2d/switch_on.wav differ diff --git a/cromemcosim/conf_3d/fan.wav b/cromemcosim/conf_3d/fan.wav new file mode 100644 index 00000000..f219989d Binary files /dev/null and b/cromemcosim/conf_3d/fan.wav differ diff --git a/cromemcosim/conf_3d/panel.conf b/cromemcosim/conf_3d/panel.conf index 0a4deed7..3797ae82 100644 --- a/cromemcosim/conf_3d/panel.conf +++ b/cromemcosim/conf_3d/panel.conf @@ -483,36 +483,36 @@ n 0.996996 -0.052685 -0.056775 # front panel switches -switch SW_15 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=1.05,2.218,0. size=1.00,1.2,1.0 -switch SW_14 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=1.70,2.218,0. size=1.00,1.2,1.0 -switch SW_13 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=2.35,2.218,0. size=1.00,1.2,1.0 -switch SW_12 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=2.99,2.218,0. size=1.00,1.2,1.0 +switch SW_15 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=1.05,2.218,0. size=1.00,1.2,1.0 +switch SW_14 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=1.70,2.218,0. size=1.00,1.2,1.0 +switch SW_13 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=2.35,2.218,0. size=1.00,1.2,1.0 +switch SW_12 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=2.99,2.218,0. size=1.00,1.2,1.0 -switch SW_11 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=3.67,2.218,0. size=1.00,1.2,1.0 -switch SW_10 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=4.32,2.218,0. size=1.00,1.2,1.0 -switch SW_09 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=4.97,2.218,0. size=1.00,1.2,1.0 -switch SW_08 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=5.62,2.218,0. size=1.00,1.2,1.0 +switch SW_11 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=3.67,2.218,0. size=1.00,1.2,1.0 +switch SW_10 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=4.32,2.218,0. size=1.00,1.2,1.0 +switch SW_09 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=4.97,2.218,0. size=1.00,1.2,1.0 +switch SW_08 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=5.62,2.218,0. size=1.00,1.2,1.0 -switch SW_07 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=6.885,2.218,0. size=1.00,1.2,1.0 -switch SW_06 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=7.550,2.218,0. size=1.00,1.2,1.0 -switch SW_05 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=8.192,2.218,0. size=1.00,1.2,1.0 -switch SW_04 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=8.85,2.218,0. size=1.00,1.2,1.0 +switch SW_07 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=6.885,2.218,0. size=1.00,1.2,1.0 +switch SW_06 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=7.550,2.218,0. size=1.00,1.2,1.0 +switch SW_05 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=8.192,2.218,0. size=1.00,1.2,1.0 +switch SW_04 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=8.85,2.218,0. size=1.00,1.2,1.0 -switch SW_03 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=9.50,2.218,0. size=1.00,1.2,1.0 -switch SW_02 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=10.15,2.218,0. size=1.00,1.2,1.0 -switch SW_01 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=10.82,2.218,0. size=1.00,1.2,1.0 -switch SW_00 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=11.47,2.218,0. size=1.00,1.2,1.0 +switch SW_03 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=9.50,2.218,0. size=1.00,1.2,1.0 +switch SW_02 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=10.15,2.218,0. size=1.00,1.2,1.0 +switch SW_01 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=10.82,2.218,0. size=1.00,1.2,1.0 +switch SW_00 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=11.47,2.218,0. size=1.00,1.2,1.0 -switch SW_EXAMINE type=object operate=mom_off_mom objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=12.80,2.218,0. size=1.0,1.2,1 +switch SW_EXAMINE type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=12.80,2.218,0. size=1.0,1.2,1 -switch SW_DEPOSIT type=object operate=mom_off_mom objects=sw3d_red_down,sw3d_red_up,sw3d_red pos=13.45,2.218,0. size=1.0,1.2,1 +switch SW_DEPOSIT type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red_up,sw3d_red pos=13.45,2.218,0. size=1.0,1.2,1 -switch SW_RESET type=object operate=mom_off_mom objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=14.10,2.218,0. size=1.0,1.2,1 +switch SW_RESET type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=14.10,2.218,0. size=1.0,1.2,1 -switch SW_RUN type=object operate=mom_off_mom objects=sw3d_red_down,sw3d_red_up,sw3d_red pos=14.74,2.218,0. size=1.0,1.2,1 +switch SW_RUN type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red_up,sw3d_red pos=14.74,2.218,0. size=1.0,1.2,1 -switch SW_STEP type=object operate=mom_off_mom objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=15.37,2.218,0. size=1.0,1.2,1 -switch SW_PWR type=object operate=toggle objects=pwr_sw_dn,pwr_sw_up pos=16.05,2.15,0.05 size=1.05,1.05,1.0 +switch SW_STEP type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=15.37,2.218,0. size=1.0,1.2,1 +switch SW_PWR type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=pwr_sw_dn,pwr_sw_up pos=16.05,2.15,0.05 size=1.05,1.05,1.0 # address lights @@ -574,4 +574,6 @@ light LED_INTEN pos=14.034,3.85 light LED_WAIT pos=15.29,3.85 light LED_HOLD pos=15.94,3.85 +fansound fan.wav + # end of file diff --git a/cromemcosim/conf_3d/switch_off.wav b/cromemcosim/conf_3d/switch_off.wav new file mode 100644 index 00000000..de22804c Binary files /dev/null and b/cromemcosim/conf_3d/switch_off.wav differ diff --git a/cromemcosim/conf_3d/switch_on.wav b/cromemcosim/conf_3d/switch_on.wav new file mode 100644 index 00000000..360b8043 Binary files /dev/null and b/cromemcosim/conf_3d/switch_on.wav differ diff --git a/cromemcosim/srcsim/Makefile b/cromemcosim/srcsim/Makefile index d797200a..94957ece 100644 --- a/cromemcosim/srcsim/Makefile +++ b/cromemcosim/srcsim/Makefile @@ -58,6 +58,7 @@ include $(CORE_DIR)/Makefile.in-os ### ifeq ($(WANT_SDL),YES) PLAT_DEFS = -DWANT_SDL +PLAT_SRCS = simsdl.c ifeq ($(TARGET_OS),BSD) PLAT_INCS = -I/usr/local/include/SDL2 PLAT_LDFLAGS = -L/usr/local/lib @@ -96,9 +97,12 @@ FP_DEFS = -DFRONTPANEL FP_LIB = $(FP_DIR)/libfrontpanel.a ifeq ($(WANT_SDL),YES) ifeq ($(TARGET_OS),OSX) -FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework OpenGL +FP_INCS = -I/Library/Frameworks/SDL2_image.framework/Headers \ + -I/Library/Frameworks/SDL2_mixer.framework/Headers +FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework SDL2_mixer \ + -framework OpenGL else -FP_LDLIBS = -lfrontpanel -lSDL2_image -lGL +FP_LDLIBS = -lfrontpanel -lSDL2_image -lSDL2_mixer -lGL endif else FP_LDLIBS = -lfrontpanel -ljpeg -lGL @@ -112,7 +116,7 @@ DEFS = -DCONFDIR=\"$(CONF_DIR)\" -DDISKSDIR=\"$(DISKS_DIR)\" \ -DBOOTROM=\"$(ROMS_DIR)\" -DSYSDOCROOT=\"$(DOCROOT_DIR)\" $(FP_DEFS) \ $(PLAT_DEFS) INCS = -I. -I$(CORE_DIR) -I$(IO_DIR) -I$(FP_DIR) -I$(NET_DIR) \ - -I$(CIV_DIR)/include $(PLAT_INCS) + -I$(CIV_DIR)/include $(PLAT_INCS) $(FP_INCS) CPPFLAGS = $(DEFS) $(INCS) CSTDS = -std=c99 -D_DEFAULT_SOURCE # -D_XOPEN_SOURCE=700L @@ -142,9 +146,9 @@ 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 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) + 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) $(PLAT_SRCS) OBJS = $(SRCS:.c=.o) DEPS = $(SRCS:.c=.d) @@ -185,10 +189,10 @@ uninstall: clean: _rm_obj _rm_deps _rm_obj: - rm -f $(OBJS) + rm -f *.o _rm_deps: - rm -f $(DEPS) + rm -f *.d distclean: clean rm -f $(SIM) diff --git a/cromemcosim/srcsim/simctl.c b/cromemcosim/srcsim/simctl.c index 73530cbf..97ee05b4 100644 --- a/cromemcosim/srcsim/simctl.c +++ b/cromemcosim/srcsim/simctl.c @@ -66,7 +66,7 @@ static BYTE fp_led_wait; static BYTE fp_led_speed; static int cpu_switch; static int reset; -static int power; +static BYTE power; static void run_clicked(int state, int val), step_clicked(int state, int val); static void reset_clicked(int state, int val); @@ -119,6 +119,7 @@ void mon(void) fp_framerate(fp_fps); fp_bindSimclock(&fp_clock); fp_bindRunFlag(&cpu_state); + fp_bindPowerFlag(&power); /* bind frontpanel LED's to variables */ fp_bindLight16("LED_ADDR_{00-15}", &fp_led_address, 1); @@ -237,6 +238,7 @@ void mon(void) #ifdef FRONTPANEL if (F_flag) { /* all LED's off and update front panel */ + power = 0; cpu_bus = 0; bus_request = 0; IFF = 0; @@ -491,7 +493,7 @@ static void power_clicked(int state, int val) case FP_SW_UP: if (power) break; - power++; + power = 1; cpu_bus = CPU_WO | CPU_M1 | CPU_MEMR; fp_led_address = PC; fp_led_data = getmem(PC); @@ -504,7 +506,7 @@ static void power_clicked(int state, int val) case FP_SW_DOWN: if (!power) break; - power--; + power = 0; cpu_switch = 0; cpu_state = ST_STOPPED; cpu_error = POWEROFF; @@ -519,7 +521,7 @@ static void power_clicked(int state, int val) */ static void quit_callback(void) { - power--; + power = 0; cpu_switch = 0; cpu_state = ST_STOPPED; cpu_error = POWEROFF; diff --git a/doc/README-debian.txt b/doc/README-debian.txt index 41ae708b..86e3e319 100644 --- a/doc/README-debian.txt +++ b/doc/README-debian.txt @@ -4,4 +4,4 @@ sudo apt install libjpeg9-dev libgl1-mesa-dev libglu1-mesa-dev and for SDL2: -sudo apt install libsdl2-dev libsdl2-image-dev +sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev diff --git a/doc/README-osx.txt b/doc/README-osx.txt index 185076d6..1dce3291 100644 --- a/doc/README-osx.txt +++ b/doc/README-osx.txt @@ -24,9 +24,11 @@ Install the SDL2 and SDL2_image frameworks from https://github.com/libsdl-org/SDL/releases/ and https://github.com/libsdl-org/SDL_image/releases/ +and +https://github.com/libsdl-org/SDL_mixer/releases/ -Grab the latest SDL2-2.x.x.dmg and SDL2_image-2.x.x.dmg, and copy -the framework bundles into /Library/Frameworks (create this directory +Grab the latest SDL2-2.x.x.dmg, SDL2_image-2.x.x.dmg, and SDL2_mixer-2.x.x.dmg +and copy the framework bundles into /Library/Frameworks (create this directory if it doesn't exist). Now you are all set and should be able to build the z80pack machines diff --git a/doc/README-wsl.txt b/doc/README-wsl.txt index bd60ce6c..60fd85b8 100644 --- a/doc/README-wsl.txt +++ b/doc/README-wsl.txt @@ -17,7 +17,7 @@ For using X11, enter: sudo apt install gcc make libjpeg-turbo8-dev libgl1-mesa-dev libglu1-mesa-dev Or for SDL2, enter: -sudo apt install gcc make libsdl2-dev libsdl2-image-dev +sudo apt install gcc make libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev Now unpack the z80pack source distribution and follow, for example, "README-frontpanel.txt". diff --git a/frontpanel/Makefile b/frontpanel/Makefile index aadc1c8c..335b7a97 100644 --- a/frontpanel/Makefile +++ b/frontpanel/Makefile @@ -3,7 +3,11 @@ WANT_SDL ?= NO LIB = libfrontpanel.a -SRCS = jpeg.c lpanel.c lp_gfx.c lp_main.c lp_utils.c lp_window.c \ +ifneq ($(WANT_SDL),YES) +JPEGC = jpeg.c +endif + +SRCS = $(JPEGC) lpanel.c lp_gfx.c lp_main.c lp_utils.c lp_window.c \ lp_switch.c lp_font.c lp_materials.c CORE_DIR = ../z80core @@ -21,7 +25,8 @@ else ifeq ($(TARGET_OS),LINUX) PLAT_INCS = -I/usr/include/SDL2 else ifeq ($(TARGET_OS),OSX) PLAT_INCS = -F/Library/Frameworks -I/Library/Frameworks/SDL2.framework/Headers \ - -I/Library/Frameworks/SDL2_image.framework/Headers + -I/Library/Frameworks/SDL2_image.framework/Headers \ + -I/Library/Frameworks/SDL2_mixer.framework/Headers endif else ifeq ($(TARGET_OS),BSD) @@ -79,10 +84,10 @@ clean: _rm_obj _rm_deps rm -f $(LIB) _rm_obj: - rm -f $(OBJS) + rm -f *.o _rm_deps: - rm -f $(DEPS) + rm -f *.d distclean: clean diff --git a/frontpanel/frontpanel.h b/frontpanel/frontpanel.h index fc098034..33fd8f2d 100644 --- a/frontpanel/frontpanel.h +++ b/frontpanel/frontpanel.h @@ -54,6 +54,7 @@ extern void fp_quit(void); /* data binding functions */ +extern void fp_bindPowerFlag(uint8_t *addr); extern void fp_bindSimclock(uint64_t *addr); extern void fp_bindRunFlag(uint8_t *addr); diff --git a/frontpanel/jpeg.c b/frontpanel/jpeg.c index a8849f3c..8032728f 100644 --- a/frontpanel/jpeg.c +++ b/frontpanel/jpeg.c @@ -1,7 +1,5 @@ // jpeg -#ifndef WANT_SDL - #include #include #include @@ -278,5 +276,3 @@ read_jpeg (char *fname, int *width, int *height, int *num_components) return pixels; } - -#endif /* !WANT_SDL */ diff --git a/frontpanel/jpeg.h b/frontpanel/jpeg.h index 8301eaf4..79531efd 100644 --- a/frontpanel/jpeg.h +++ b/frontpanel/jpeg.h @@ -3,13 +3,9 @@ #ifndef _JPEG_DEFS #define _JPEG_DEFS -#ifndef WANT_SDL - #include "jpeglib.h" EXTERN(unsigned char *) read_jpeg JPP((char *fname, int *width, int *height, int *num_components)); -#endif - #endif /* !_JPEG_DEFS */ diff --git a/frontpanel/lp_main.c b/frontpanel/lp_main.c index e43502a2..b0422979 100644 --- a/frontpanel/lp_main.c +++ b/frontpanel/lp_main.c @@ -91,6 +91,12 @@ static void *lp_mainloop_thread(void *n) pthread_mutex_unlock(&data_lock); // sleep remainder of fps time +#if defined(__MINGW32__) || defined(_WIN32) || defined(_WIN32_) || defined(__WIN32__) + SwapBuffers(panel->hDC); + // UpdateWindow(panel->hWnd); +#else + glXSwapBuffers(panel->dpy, panel->window); +#endif glFinish(); framerate_wait(); t2 = frate_gettime(); @@ -201,6 +207,11 @@ int fp_smoothLight(const char *name, int nframes) return 1; } +void fp_bindPowerFlag(uint8_t *addr) +{ + Lpanel_bindPowerFlag(panel, addr); +} + void fp_bindRunFlag(uint8_t *addr) { Lpanel_bindRunFlag(panel, addr); @@ -309,6 +320,7 @@ void fp_draw(bool tick) SDL_LockMutex(data_sample_lock); Lpanel_draw(panel); SDL_UnlockMutex(data_sample_lock); + SDL_GL_SwapWindow(panel->window); glFinish(); framecount++; if (tick) { @@ -334,6 +346,12 @@ void fp_procEvents(void) void fp_draw(void) { Lpanel_draw(panel); +#if defined(__MINGW32__) || defined(_WIN32) || defined(_WIN32_) || defined(__WIN32__) + SwapBuffers(panel->hDC); + // UpdateWindow(panel->hWnd); +#else + glXSwapBuffers(panel->dpy, panel->window); +#endif } #endif /* !WANT_SDL */ diff --git a/frontpanel/lp_switch.c b/frontpanel/lp_switch.c index 3841d267..2514a00a 100644 --- a/frontpanel/lp_switch.c +++ b/frontpanel/lp_switch.c @@ -22,6 +22,7 @@ #include #include #ifdef WANT_SDL +#include #include #else #include @@ -41,6 +42,8 @@ static parser_rules_t switch_parse_rules[] = { { "pos", 2, 3, PARSER_FLOAT }, { "size", 2, 3, PARSER_FLOAT }, { "objects", 1, 3, PARSER_STRING }, + { "onsound", 1, 1, PARSER_STRING }, + { "offsound", 1, 1, PARSER_STRING }, { NULL, 0, 0, 0 } }; @@ -194,12 +197,22 @@ void lpSwitch_init(lpSwitch_t *p) p->select_up_name = p->select_dn_name = 0; p->callback = NULL; p->userdata = 0; +#ifdef WANT_SDL + p->on_sound = NULL; + p->off_sound = NULL; +#endif } void lpSwitch_fini(lpSwitch_t *p) { int i; +#ifdef WANT_SDL + if (p->on_sound) + Mix_FreeChunk(p->on_sound); + if (p->off_sound) + Mix_FreeChunk(p->off_sound); +#endif if (p->name) free(p->name); if (p->parms) @@ -225,11 +238,22 @@ void lpSwitch_action(lpSwitch_t *p, int val) if (p->operation == LP_SWITCH_OP_OFF_MOM) break; +#ifdef WANT_SDL + if (p->state != LP_SWITCH_DOWN) { + if (p->operation == LP_SWITCH_OP_ON_OFF) { + if (p->off_sound) + Mix_PlayChannel(-1, p->off_sound, 0); + } else { + if (p->on_sound) + Mix_PlayChannel(-1, p->on_sound, 0); + } + } +#endif + p->state = LP_SWITCH_DOWN; switch (p->operation) { case LP_SWITCH_OP_MOM_OFF_MOM: - p->panel->mom_switch_pressed = p; if (p->dataptr[p->state]) @@ -297,6 +321,13 @@ void lpSwitch_action(lpSwitch_t *p, int val) case 1: // up +#ifdef WANT_SDL + if (p->state != LP_SWITCH_UP) { + if (p->on_sound) + Mix_PlayChannel(-1, p->on_sound, 0); + } +#endif + p->state = LP_SWITCH_UP; switch (p->operation) { @@ -340,6 +371,11 @@ void lpSwitch_action(lpSwitch_t *p, int val) case 2: // release mom switch +#ifdef WANT_SDL + if (p->off_sound) + Mix_PlayChannel(-1, p->off_sound, 0); +#endif + switch (p->operation) { case LP_SWITCH_OP_MOM_OFF_MOM: case LP_SWITCH_OP_OFF_MOM: @@ -596,7 +632,6 @@ int Lpanel_addSwitch(Lpanel_t *p, const char *name, lp_obj_parm_t *obj, const ch if (n != PARSER_DONE) { // printf("\nresult %s\n", switch_parse_rules[result->cmd_idx]); -#if 1 if (!strcmp(switch_parse_rules[result->cmd_idx].cmd, "objects")) { sw->object_ref_names = (char **) malloc(sizeof(char *) * result->num_args); @@ -642,8 +677,51 @@ int Lpanel_addSwitch(Lpanel_t *p, const char *name, lp_obj_parm_t *obj, const ch "of 'toggle, paddle, object'\n"); return 0; } - } + } else if (!strcmp(switch_parse_rules[result->cmd_idx].cmd, "onsound")) { +#ifdef WANT_SDL + char *sound_path; + int len; + + len = strlen(p->config_root_path) + strlen(result->strings[0]) + 1; + + sound_path = (char *) malloc(len + 1); + strcpy(sound_path, p->config_root_path); + strcat(sound_path, "/"); + strcat(sound_path, result->strings[0]); + sound_path[len] = 0; + + if ((sw->on_sound = Mix_LoadWAV(sound_path)) == NULL) { + printf("Could not load switch 'onsound' '%s'.\n", + sound_path); + free(sound_path); + return 0; + } + + free(sound_path); #endif + } else if (!strcmp(switch_parse_rules[result->cmd_idx].cmd, "offsound")) { +#ifdef WANT_SDL + char *sound_path; + int len; + + len = strlen(p->config_root_path) + strlen(result->strings[0]) + 1; + + sound_path = (char *) malloc(len + 1); + strcpy(sound_path, p->config_root_path); + strcat(sound_path, "/"); + strcat(sound_path, result->strings[0]); + sound_path[len] = 0; + + if ((sw->off_sound = Mix_LoadWAV(sound_path)) == NULL) { + printf("Could not load switch 'offsound' '%s'.\n", + sound_path); + free(sound_path); + return 0; + } + + free(sound_path); +#endif + } } if (n == PARSER_DONE) diff --git a/frontpanel/lp_switch.h b/frontpanel/lp_switch.h index a963b659..eb01b847 100644 --- a/frontpanel/lp_switch.h +++ b/frontpanel/lp_switch.h @@ -22,6 +22,7 @@ #include #ifdef WANT_SDL +#include #include #else #include @@ -97,6 +98,11 @@ typedef struct lpSwitch { down_target[4][3]; lp_switch_df_t drawFunc; + +#ifdef WANT_SDL + Mix_Chunk *on_sound; + Mix_Chunk *off_sound; +#endif } lpSwitch_t; extern lpSwitch_t *lpSwitch_new(void); diff --git a/frontpanel/lp_window.c b/frontpanel/lp_window.c index 81267a26..629b334d 100644 --- a/frontpanel/lp_window.c +++ b/frontpanel/lp_window.c @@ -25,6 +25,7 @@ #ifdef WANT_SDL #include #include +#include #include #else /* !WANT_SDL */ #if defined(__MINGW32__) || defined(_WIN32) || defined(_WIN32_) || defined(__WIN32__) @@ -353,7 +354,7 @@ LRESULT CALLBACK Lpanel_WndProc(Lpanel_t *p, UINT msg, WPARAM wParam, LPARAM lPa case VK_DOWN: if (p->do_cursor) - Lpanel_inc_cursor(p, 0., -cursor_inc); + Lpanel_inc_cursor(p, 0., -p->cursor_inc); else { if (p->shift_key_pressed) p->view.pan[1] += 0.1; @@ -437,27 +438,27 @@ LRESULT CALLBACK Lpanel_WndProc(Lpanel_t *p, UINT msg, WPARAM wParam, LPARAM lPa case 'v': case 'V': if (p->view.projection == LP_ORTHO) - view.projection = LP_PERSPECTIVE; + p->view.projection = LP_PERSPECTIVE; else - view.projection = LP_ORTHO; + p->view.projection = LP_ORTHO; - view.redo_projections = true; + p->view.redo_projections = true; break; case 'z': - view.pan[2] -= .1; - view.redo_projections = true; + p->view.pan[2] -= .1; + p->view.redo_projections = true; break; case 'Z': - view.pan[2] += .1; - view.redo_projections = true; + p->view.pan[2] += .1; + p->view.redo_projections = true; break; case '1': break; } - break; + return 0; case WM_MOUSEWHEEL: p->view.pan[2] += (float) GET_WHEEL_DELTA_WPARAM(wParam) / 250.0; @@ -486,8 +487,8 @@ LRESULT CALLBACK Lpanel_WndProc(Lpanel_t *p, UINT msg, WPARAM wParam, LPARAM lPa p->view.pan[0] += ((float) LOWORD(lParam) - (float) omx) * .02; p->view.pan[1] -= ((float) HIWORD(lParam) - (float) omy) * .02; } else { - view.rot[1] += ((float) LOWORD(lParam) - (float) omx) * .2; - view.rot[0] += ((float) HIWORD(lParam) - (float) omy) * .2; + p->view.rot[1] += ((float) LOWORD(lParam) - (float) omx) * .2; + p->view.rot[0] += ((float) HIWORD(lParam) - (float) omy) * .2; } mousex = LOWORD(lParam); @@ -523,8 +524,8 @@ LRESULT CALLBACK Lpanel_WndProc(Lpanel_t *p, UINT msg, WPARAM wParam, LPARAM lPa case WM_DESTROY: UnregisterClass(FPClassName, p->hInstance); PostQuitMessage(0); - if (quit_callbackfunc) - (*quit_callbackfunc)(); + if (p->quit_callbackfunc) + (*p->quit_callbackfunc)(); else exit(EXIT_SUCCESS); return 0; @@ -801,10 +802,11 @@ int Lpanel_openWindow(Lpanel_t *p, const char *title) #ifdef WANT_SDL - if (IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG) == 0) { - fprintf(stderr, "Can't initialize SDL_image: %s\n", IMG_GetError()); - return 0; - } + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); p->window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, p->window_xsize, p->window_ysize, @@ -814,16 +816,13 @@ int Lpanel_openWindow(Lpanel_t *p, const char *title) return 0; } - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); if ((p->cx = SDL_GL_CreateContext(p->window)) == NULL) { fprintf(stderr, "Can't create context: %s\n", SDL_GetError()); return 0; } + SDL_GL_ResetAttributes(); + if (SDL_GL_MakeCurrent(p->window, p->cx) < 0) { fprintf(stderr, "Can't make window current to context: %s\n", SDL_GetError()); return 0; @@ -1013,12 +1012,14 @@ void Lpanel_destroyWindow(Lpanel_t *p) glFinish(); #ifdef WANT_SDL + if (p->fan_sound && *p->powerflag) + Mix_HaltChannel(p->fan_channel); + if (SDL_GL_MakeCurrent(NULL, NULL) < 0) { printf("lightpanel: destroyWindow: Can't release context\n"); } SDL_GL_DeleteContext(p->cx); SDL_DestroyWindow(p->window); - IMG_Quit(); p->cx = NULL; p->window = NULL; #else /* !WANT_SDL */ @@ -1083,6 +1084,10 @@ void Lpanel_setProjection(Lpanel_t *p, bool dopick) .1, 1000.); break; +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + case LP_PERSPECTIVE: { // gluPerspective(p->view.fovy, p->view.aspect, p->view.znear, p->view.zfar); double deltaz = p->view.zfar - p->view.znear; @@ -1207,7 +1212,7 @@ void Lpanel_draw_stats(Lpanel_t *p) glColor3f(1., 1., 0.); snprintf(p->perf_txt, sizeof(p->perf_txt), "fps:%d sps:%d", p->frames_per_second, p->samples_per_second); - printStringAt(p->perf_txt, p->bbox.xyz_min[0] + .2, p->bbox.xyz_min[1] + .2); + printStringAt(p->perf_txt, 0, 0); glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -1241,9 +1246,9 @@ void Lpanel_draw_cursor(Lpanel_t *p) glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); - glTranslatef(200., 0., -10.); + glTranslatef(0., 0., -10.); - printStringAt(p->cursor_txt, p->cursor_textpos[0], p->cursor_textpos[1]); + printStringAt(p->cursor_txt, 200, 0); glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -1267,8 +1272,6 @@ void Lpanel_inc_cursor(Lpanel_t *p, float x, float y) void Lpanel_make_cursor_text(Lpanel_t *p) { - p->cursor_textpos[0] = (p->bbox.xyz_max[0] + p->bbox.xyz_min[0]) * .5; - p->cursor_textpos[1] = p->bbox.xyz_min[1] + .1; snprintf(p->cursor_txt, sizeof(p->cursor_txt), "cursor position=%7.3f,%7.3f", p->cursor[0], p->cursor[1]); } diff --git a/frontpanel/lpanel.c b/frontpanel/lpanel.c index 61749704..dbfeb108 100644 --- a/frontpanel/lpanel.c +++ b/frontpanel/lpanel.c @@ -26,6 +26,7 @@ #include #ifdef WANT_SDL #include +#include #include #else /* !WANT_SDL */ #if defined(__MINGW32__) || defined(_WIN32) || defined(_WIN32_) || defined(__WIN32__) @@ -318,6 +319,9 @@ void Lpanel_init(Lpanel_t *p) // initializer p->default_runflag = 0; p->runflag = &p->default_runflag; + p->default_powerflag = 0; + p->old_powerflag = 0; + p->powerflag = &p->default_powerflag; // init light groups @@ -405,6 +409,11 @@ void Lpanel_fini(Lpanel_t *p) // finalizer { int i; +#ifdef WANT_SDL + if (p->fan_sound) + Mix_FreeChunk(p->fan_sound); +#endif + for (i = 0; i < p->num_lights; i++) if (p->lights[i]) lpLight_delete(p->lights[i]); @@ -947,6 +956,11 @@ bool Lpanel_bindLight64invert(Lpanel_t *p, const char *name, void *loc, int star return status; } +void Lpanel_bindPowerFlag(Lpanel_t *p, uint8_t *addr) +{ + p->powerflag = (uint8_t *) addr; +} + void Lpanel_bindRunFlag(Lpanel_t *p, uint8_t *addr) { int i; @@ -973,6 +987,16 @@ void Lpanel_draw(Lpanel_t *p) int i; #ifdef WANT_SDL + if (*p->powerflag != p->old_powerflag) { + p->old_powerflag = *p->powerflag; + if (p->fan_sound) { + if (p->old_powerflag) + p->fan_channel = Mix_PlayChannel(-1, p->fan_sound, -1); + else + Mix_HaltChannel(p->fan_channel); + } + } + SDL_GL_MakeCurrent(p->window, p->cx); #endif @@ -1020,17 +1044,6 @@ void Lpanel_draw(Lpanel_t *p) if (p->do_stats) Lpanel_draw_stats(p); glDisable(GL_POLYGON_OFFSET_LINE); - -#ifdef WANT_SDL - SDL_GL_SwapWindow(p->window); -#else -#if defined(__MINGW32__) || defined(_WIN32) || defined(_WIN32_) || defined(__WIN32__) - SwapBuffers(p->hDC); - // UpdateWindow(p->hWnd); -#else - glXSwapBuffers(p->dpy, p->window); -#endif -#endif } void Lpanel_growLights(Lpanel_t *p) @@ -1193,6 +1206,35 @@ bool Lpanel_readConfig(Lpanel_t *p, const char *_fname) p->envmap_detected = true; p->curr_object->envmapped = true; } + } else if (!strcmp(token, "fansound")) { + if (!gtoken(buffer, token, TOKENSIZE, &pos)) { + printf("Error on line %d of config file %s\n", lineno, fname); + printf("fansound with no path to sound file defined.\n"); + bailout = true; + break; + } +#ifdef WANT_SDL + char *sound_path; + int len; + + len = strlen(p->config_root_path) + strlen(token) + 1; + + sound_path = (char *) malloc(len + 1); + strcpy(sound_path, p->config_root_path); + strcat(sound_path, "/"); + strcat(sound_path, token); + sound_path[len] = 0; + + if ((p->fan_sound = Mix_LoadWAV(sound_path)) == NULL) { + printf("Error on line %d of config file %s\n", + lineno, fname); + printf("could not load sound '%s'.\n", sound_path); + bailout = true; + break; + } + + free(sound_path); +#endif } else if (!strcmp(token, "instance")) { char s[100]; @@ -1500,8 +1542,7 @@ bool Lpanel_readConfig(Lpanel_t *p, const char *_fname) if (!(p->curr_object->texture_num = lpTextures_addTexture(&p->textures, texture_path))) { - printf("Error on line %d of config file %s\n", - lineno, texture_path); + printf("Error on line %d of config file %s\n", lineno, fname); printf("could not load texture '%s'.\n", texture_path); bailout = true; break; diff --git a/frontpanel/lpanel.h b/frontpanel/lpanel.h index f13670bf..27806ac5 100644 --- a/frontpanel/lpanel.h +++ b/frontpanel/lpanel.h @@ -24,6 +24,7 @@ #include #ifdef WANT_SDL #include +#include #include #else /* !WANT_SDL */ #if defined(__MINGW32__) || defined(_WIN32) || defined(_WIN32_) || defined(__WIN32__) @@ -149,6 +150,13 @@ typedef struct Lpanel { old_clock; int clock_warp; bool ignore_bind_errors; + uint8_t default_powerflag, + *powerflag, + old_powerflag; +#ifdef WANT_SDL + Mix_Chunk *fan_sound; + int fan_channel; +#endif uint8_t default_runflag, *runflag; lpSwitch_t *mom_switch_pressed; @@ -183,7 +191,6 @@ typedef struct Lpanel { char perf_txt[30]; char cursor_txt[60]; - float cursor_textpos[2]; bool do_cursor, do_stats; float cursor[3], cursor_inc; bool shift_key_pressed; @@ -222,6 +229,7 @@ extern bool Lpanel_addSwitchCallback(Lpanel_t *p, const char *name, lp_switch_cbf_t cbfunc, int userval); extern void Lpanel_addQuitCallback(Lpanel_t *p, lp_quit_cbf_t cbfunc); +extern void Lpanel_bindPowerFlag(Lpanel_t *p, uint8_t *addr); extern void Lpanel_bindSimclock(Lpanel_t *p, uint64_t *addr); extern void Lpanel_bindRunFlag(Lpanel_t *p, uint8_t *addr); diff --git a/imsaisim/conf_2d/fan.wav b/imsaisim/conf_2d/fan.wav new file mode 100644 index 00000000..f219989d Binary files /dev/null and b/imsaisim/conf_2d/fan.wav differ diff --git a/imsaisim/conf_2d/panel.conf b/imsaisim/conf_2d/panel.conf index fa63f2a7..7f2def6b 100644 --- a/imsaisim/conf_2d/panel.conf +++ b/imsaisim/conf_2d/panel.conf @@ -144,32 +144,32 @@ v 0 1 #switches -switch SW_15 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=.7,1.6,0. size=.65,1.2,1 -switch SW_14 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=1.37,1.6,0. size=.65,1.2,1 -switch SW_13 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=2.02,1.6,0. size=.65,1.2,1 -switch SW_12 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=2.67,1.6,0. size=.65,1.2,1 - -switch SW_11 type=object operate=toggle objects=red_sw_down,red_sw_up pos=3.32,1.6,0. size=.65,1.2,1 -switch SW_10 type=object operate=toggle objects=red_sw_down,red_sw_up pos=3.97,1.6,0. size=.65,1.2,1 -switch SW_09 type=object operate=toggle objects=red_sw_down,red_sw_up pos=4.64,1.6,0. size=.65,1.2,1 -switch SW_08 type=object operate=toggle objects=red_sw_down,red_sw_up pos=5.31,1.6,0. size=.65,1.2,1 - -switch SW_07 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=6.65,1.6,0. size=.65,1.2,1 -switch SW_06 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=7.33,1.6,0. size=.65,1.2,1 -switch SW_05 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=7.98,1.6,0. size=.65,1.2,1 -switch SW_04 type=object operate=toggle objects=blue_sw_down,blue_sw_up pos=8.63,1.6,0. size=.65,1.2,1 - -switch SW_03 type=object operate=toggle objects=red_sw_down,red_sw_up pos=9.28,1.6,0. size=.65,1.2,1 -switch SW_02 type=object operate=toggle objects=red_sw_down,red_sw_up pos=9.95,1.6,0. size=.65,1.2,1 -switch SW_01 type=object operate=toggle objects=red_sw_down,red_sw_up pos=10.62,1.6,0. size=.65,1.2,1 -switch SW_00 type=object operate=toggle objects=red_sw_down,red_sw_up pos=11.28,1.6,0. size=.65,1.2,1 - -switch SW_EXAMINE type=object operate=mom_off_mom objects=blue_sw_down,blue_sw_up,blue_sw_center pos=12.65,1.6,0. size=.6,1.2,1 -switch SW_DEPOSIT type=object operate=mom_off_mom objects=red_sw_down,red_sw_up,red_sw_center pos=13.30,1.6,0. size=.6,1.2,1 -switch SW_RESET type=object operate=mom_off_mom objects=blue_sw_down,blue_sw_up,blue_sw_center pos=13.95,1.6,0. size=.6,1.2,1 -switch SW_RUN type=object operate=mom_off_mom objects=red_sw_down,red_sw_up,red_sw_center pos=14.60,1.6,0. size=.6,1.2,1 -switch SW_STEP type=object operate=mom_off_mom objects=blue_sw_down,blue_sw_up,blue_sw_center pos=15.25,1.6,0. size=.6,1.2,1 -switch SW_PWR type=object operate=toggle objects=pwr_sw_dn,pwr_sw_up pos=15.90,1.6,0. size=.7,1.2,1 +switch SW_15 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=.7,1.6,0. size=.65,1.2,1 +switch SW_14 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=1.37,1.6,0. size=.65,1.2,1 +switch SW_13 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=2.02,1.6,0. size=.65,1.2,1 +switch SW_12 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=2.67,1.6,0. size=.65,1.2,1 + +switch SW_11 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=3.32,1.6,0. size=.65,1.2,1 +switch SW_10 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=3.97,1.6,0. size=.65,1.2,1 +switch SW_09 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=4.64,1.6,0. size=.65,1.2,1 +switch SW_08 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=5.31,1.6,0. size=.65,1.2,1 + +switch SW_07 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=6.65,1.6,0. size=.65,1.2,1 +switch SW_06 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=7.33,1.6,0. size=.65,1.2,1 +switch SW_05 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=7.98,1.6,0. size=.65,1.2,1 +switch SW_04 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up pos=8.63,1.6,0. size=.65,1.2,1 + +switch SW_03 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=9.28,1.6,0. size=.65,1.2,1 +switch SW_02 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=9.95,1.6,0. size=.65,1.2,1 +switch SW_01 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=10.62,1.6,0. size=.65,1.2,1 +switch SW_00 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up pos=11.28,1.6,0. size=.65,1.2,1 + +switch SW_EXAMINE type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up,blue_sw_center pos=12.65,1.6,0. size=.6,1.2,1 +switch SW_DEPOSIT type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up,red_sw_center pos=13.30,1.6,0. size=.6,1.2,1 +switch SW_RESET type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up,blue_sw_center pos=13.95,1.6,0. size=.6,1.2,1 +switch SW_RUN type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=red_sw_down,red_sw_up,red_sw_center pos=14.60,1.6,0. size=.6,1.2,1 +switch SW_STEP type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=blue_sw_down,blue_sw_up,blue_sw_center pos=15.25,1.6,0. size=.6,1.2,1 +switch SW_PWR type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=pwr_sw_dn,pwr_sw_up pos=15.90,1.6,0. size=.7,1.2,1 #address lights @@ -230,3 +230,5 @@ light LED_RUN pos=14.95,3.85 light LED_INTEN pos=14.30,3.85 light LED_WAIT pos=15.50,3.85 light LED_HOLD pos=16.10,3.85 + +fansound fan.wav diff --git a/imsaisim/conf_2d/switch_off.wav b/imsaisim/conf_2d/switch_off.wav new file mode 100644 index 00000000..de22804c Binary files /dev/null and b/imsaisim/conf_2d/switch_off.wav differ diff --git a/imsaisim/conf_2d/switch_on.wav b/imsaisim/conf_2d/switch_on.wav new file mode 100644 index 00000000..360b8043 Binary files /dev/null and b/imsaisim/conf_2d/switch_on.wav differ diff --git a/imsaisim/conf_3d/fan.wav b/imsaisim/conf_3d/fan.wav new file mode 100644 index 00000000..f219989d Binary files /dev/null and b/imsaisim/conf_3d/fan.wav differ diff --git a/imsaisim/conf_3d/panel.conf b/imsaisim/conf_3d/panel.conf index fb31eb4f..f66c403b 100644 --- a/imsaisim/conf_3d/panel.conf +++ b/imsaisim/conf_3d/panel.conf @@ -483,36 +483,36 @@ n 0.996996 -0.052685 -0.056775 # front panel switches -switch SW_15 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=1.05,2.218,0. size=1.00,1.2,1.0 -switch SW_14 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=1.70,2.218,0. size=1.00,1.2,1.0 -switch SW_13 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=2.35,2.218,0. size=1.00,1.2,1.0 -switch SW_12 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=2.99,2.218,0. size=1.00,1.2,1.0 +switch SW_15 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=1.05,2.218,0. size=1.00,1.2,1.0 +switch SW_14 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=1.70,2.218,0. size=1.00,1.2,1.0 +switch SW_13 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=2.35,2.218,0. size=1.00,1.2,1.0 +switch SW_12 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=2.99,2.218,0. size=1.00,1.2,1.0 -switch SW_11 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=3.67,2.218,0. size=1.00,1.2,1.0 -switch SW_10 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=4.32,2.218,0. size=1.00,1.2,1.0 -switch SW_09 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=4.97,2.218,0. size=1.00,1.2,1.0 -switch SW_08 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=5.62,2.218,0. size=1.00,1.2,1.0 +switch SW_11 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=3.67,2.218,0. size=1.00,1.2,1.0 +switch SW_10 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=4.32,2.218,0. size=1.00,1.2,1.0 +switch SW_09 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=4.97,2.218,0. size=1.00,1.2,1.0 +switch SW_08 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=5.62,2.218,0. size=1.00,1.2,1.0 -switch SW_07 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=6.885,2.218,0. size=1.00,1.2,1.0 -switch SW_06 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=7.550,2.218,0. size=1.00,1.2,1.0 -switch SW_05 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=8.192,2.218,0. size=1.00,1.2,1.0 -switch SW_04 type=object operate=toggle objects=sw3d_blue_down,sw3d_blue pos=8.85,2.218,0. size=1.00,1.2,1.0 +switch SW_07 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=6.885,2.218,0. size=1.00,1.2,1.0 +switch SW_06 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=7.550,2.218,0. size=1.00,1.2,1.0 +switch SW_05 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=8.192,2.218,0. size=1.00,1.2,1.0 +switch SW_04 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue pos=8.85,2.218,0. size=1.00,1.2,1.0 -switch SW_03 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=9.50,2.218,0. size=1.00,1.2,1.0 -switch SW_02 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=10.15,2.218,0. size=1.00,1.2,1.0 -switch SW_01 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=10.82,2.218,0. size=1.00,1.2,1.0 -switch SW_00 type=object operate=toggle objects=sw3d_red_down,sw3d_red pos=11.47,2.218,0. size=1.00,1.2,1.0 +switch SW_03 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=9.50,2.218,0. size=1.00,1.2,1.0 +switch SW_02 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=10.15,2.218,0. size=1.00,1.2,1.0 +switch SW_01 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=10.82,2.218,0. size=1.00,1.2,1.0 +switch SW_00 type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red pos=11.47,2.218,0. size=1.00,1.2,1.0 -switch SW_EXAMINE type=object operate=mom_off_mom objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=12.80,2.218,0. size=1.0,1.2,1 +switch SW_EXAMINE type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=12.80,2.218,0. size=1.0,1.2,1 -switch SW_DEPOSIT type=object operate=mom_off_mom objects=sw3d_red_down,sw3d_red_up,sw3d_red pos=13.45,2.218,0. size=1.0,1.2,1 +switch SW_DEPOSIT type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red_up,sw3d_red pos=13.45,2.218,0. size=1.0,1.2,1 -switch SW_RESET type=object operate=mom_off_mom objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=14.10,2.218,0. size=1.0,1.2,1 +switch SW_RESET type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=14.10,2.218,0. size=1.0,1.2,1 -switch SW_RUN type=object operate=mom_off_mom objects=sw3d_red_down,sw3d_red_up,sw3d_red pos=14.74,2.218,0. size=1.0,1.2,1 +switch SW_RUN type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_red_down,sw3d_red_up,sw3d_red pos=14.74,2.218,0. size=1.0,1.2,1 -switch SW_STEP type=object operate=mom_off_mom objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=15.37,2.218,0. size=1.0,1.2,1 -switch SW_PWR type=object operate=toggle objects=pwr_sw_dn,pwr_sw_up pos=16.05,2.15,0.05 size=1.05,1.05,1.0 +switch SW_STEP type=object operate=mom_off_mom onsound=switch_on.wav offsound=switch_off.wav objects=sw3d_blue_down,sw3d_blue_up,sw3d_blue pos=15.37,2.218,0. size=1.0,1.2,1 +switch SW_PWR type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=pwr_sw_dn,pwr_sw_up pos=16.05,2.15,0.05 size=1.05,1.05,1.0 # address lights @@ -574,4 +574,6 @@ light LED_INTEN pos=14.034,3.85 light LED_WAIT pos=15.29,3.85 light LED_HOLD pos=15.94,3.85 +fansound fan.wav + # end of file diff --git a/imsaisim/conf_3d/switch_off.wav b/imsaisim/conf_3d/switch_off.wav new file mode 100644 index 00000000..de22804c Binary files /dev/null and b/imsaisim/conf_3d/switch_off.wav differ diff --git a/imsaisim/conf_3d/switch_on.wav b/imsaisim/conf_3d/switch_on.wav new file mode 100644 index 00000000..360b8043 Binary files /dev/null and b/imsaisim/conf_3d/switch_on.wav differ diff --git a/imsaisim/srcsim/Makefile b/imsaisim/srcsim/Makefile index 220552ff..349b9cc0 100644 --- a/imsaisim/srcsim/Makefile +++ b/imsaisim/srcsim/Makefile @@ -59,6 +59,7 @@ include $(CORE_DIR)/Makefile.in-os ### ifeq ($(WANT_SDL),YES) PLAT_DEFS = -DWANT_SDL +PLAT_SRCS = simsdl.c ifeq ($(TARGET_OS),BSD) PLAT_INCS = -I/usr/local/include/SDL2 PLAT_LDFLAGS = -L/usr/local/lib @@ -97,9 +98,12 @@ FP_DEFS = -DFRONTPANEL FP_LIB = $(FP_DIR)/libfrontpanel.a ifeq ($(WANT_SDL),YES) ifeq ($(TARGET_OS),OSX) -FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework OpenGL +FP_INCS = -I/Library/Frameworks/SDL2_image.framework/Headers \ + -I/Library/Frameworks/SDL2_mixer.framework/Headers +FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework SDL2_mixer \ + -framework OpenGL else -FP_LDLIBS = -lfrontpanel -lSDL2_image -lGL +FP_LDLIBS = -lfrontpanel -lSDL2_image -lSDL2_mixer -lGL endif else FP_LDLIBS = -lfrontpanel -ljpeg -lGL @@ -113,7 +117,7 @@ DEFS = -DCONFDIR=\"$(CONF_DIR)\" -DDISKSDIR=\"$(DISKS_DIR)\" \ -DBOOTROM=\"$(ROMS_DIR)\" -DSYSDOCROOT=\"$(DOCROOT_DIR)\" $(FP_DEFS) \ $(PLAT_DEFS) INCS = -I. -I$(CORE_DIR) -I$(IO_DIR) -I$(FP_DIR) -I$(NET_DIR) \ - -I$(CIV_DIR)/include $(PLAT_INCS) + -I$(CIV_DIR)/include $(PLAT_INCS) $(FP_INCS) CPPFLAGS = $(DEFS) $(INCS) CSTDS = -std=c99 -D_DEFAULT_SOURCE # -D_XOPEN_SOURCE=700L @@ -143,9 +147,9 @@ 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 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) + 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) $(PLAT_SRCS) OBJS = $(SRCS:.c=.o) DEPS = $(SRCS:.c=.d) @@ -186,10 +190,10 @@ uninstall: clean: _rm_obj _rm_deps _rm_obj: - rm -f $(OBJS) + rm -f *.o _rm_deps: - rm -f $(DEPS) + rm -f *.d distclean: clean rm -f $(SIM) diff --git a/imsaisim/srcsim/simctl.c b/imsaisim/srcsim/simctl.c index 937a6569..1e4992f1 100644 --- a/imsaisim/srcsim/simctl.c +++ b/imsaisim/srcsim/simctl.c @@ -71,7 +71,7 @@ static const char *TAG = "system"; static BYTE fp_led_wait; static int cpu_switch; static int reset; -static int power; +static BYTE power; static void run_clicked(int state, int val), step_clicked(int state, int val); static void reset_clicked(int state, int val); @@ -125,6 +125,7 @@ void mon(void) fp_framerate(fp_fps); fp_bindSimclock(&fp_clock); fp_bindRunFlag(&cpu_state); + fp_bindPowerFlag(&power); /* bind frontpanel LED's to variables */ fp_bindLight16("LED_ADDR_{00-15}", &fp_led_address, 1); @@ -239,6 +240,7 @@ void mon(void) #ifdef FRONTPANEL if (F_flag) { /* all LED's off and update front panel */ + power = 0; cpu_bus = 0; bus_request = 0; IFF = 0; @@ -491,7 +493,7 @@ static void power_clicked(int state, int val) case FP_SW_UP: if (power) break; - power++; + power = 1; cpu_bus = CPU_WO | CPU_M1 | CPU_MEMR; fp_led_address = PC; fp_led_data = getmem(PC); @@ -505,7 +507,7 @@ static void power_clicked(int state, int val) case FP_SW_DOWN: if (!power) break; - power--; + power = 0; cpu_switch = 0; cpu_state = ST_STOPPED; cpu_error = POWEROFF; @@ -520,7 +522,7 @@ static void power_clicked(int state, int val) */ static void quit_callback(void) { - power--; + power = 0; cpu_switch = 0; cpu_state = ST_STOPPED; cpu_error = POWEROFF; diff --git a/intelmdssim/conf/fan.wav b/intelmdssim/conf/fan.wav new file mode 100644 index 00000000..f219989d Binary files /dev/null and b/intelmdssim/conf/fan.wav differ diff --git a/intelmdssim/conf/panel.conf b/intelmdssim/conf/panel.conf index 68b708df..b80862b7 100644 --- a/intelmdssim/conf/panel.conf +++ b/intelmdssim/conf/panel.conf @@ -103,20 +103,20 @@ v 0 1 # switches -switch SW_PWR type=object operate=toggle objects=power_off,power_on pos=1.430,7.171,0. size=1.430,1.388,1 +switch SW_PWR type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=power_off,power_on pos=1.430,7.171,0. size=1.430,1.388,1 -switch SW_INT_7 type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=2.146,1.977,0. size=.48,.75,1 -switch SW_INT_6 type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=2.861,1.977,0. size=.48,.75,1 -switch SW_INT_5 type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=3.555,1.977,0. size=.48,.75,1 -switch SW_INT_4 type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=4.249,1.977,0. size=.48,.75,1 -switch SW_INT_3 type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=4.944,1.977,0. size=.48,.75,1 -switch SW_INT_2 type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=5.659,1.977,0. size=.48,.75,1 -switch SW_INT_1 type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=6.353,1.977,0. size=.48,.75,1 -switch SW_INT_0 type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=7.068,1.977,0. size=.48,.75,1 +switch SW_INT_7 type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=2.146,1.977,0. size=.48,.75,1 +switch SW_INT_6 type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=2.861,1.977,0. size=.48,.75,1 +switch SW_INT_5 type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=3.555,1.977,0. size=.48,.75,1 +switch SW_INT_4 type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=4.249,1.977,0. size=.48,.75,1 +switch SW_INT_3 type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=4.944,1.977,0. size=.48,.75,1 +switch SW_INT_2 type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=5.659,1.977,0. size=.48,.75,1 +switch SW_INT_1 type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=6.353,1.977,0. size=.48,.75,1 +switch SW_INT_0 type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=7.068,1.977,0. size=.48,.75,1 -switch SW_BOOT type=object operate=toggle objects=switch_down,switch_up pos=8.204,1.977,0. size=.48,.75,1 +switch SW_BOOT type=object operate=toggle onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up pos=8.204,1.977,0. size=.48,.75,1 -switch SW_RESET type=object operate=off_mom objects=switch_down,switch_up,switch_down pos=9.698,1.977,0. size=.48,.75,1 +switch SW_RESET type=object operate=off_mom onsound=switch_on.wav offsound=switch_off.wav objects=switch_down,switch_up,switch_down pos=9.698,1.977,0. size=.48,.75,1 lightsize .147 .084 @@ -136,3 +136,5 @@ light LED_INT_0 pos=7.321,3.764 group=0 light LED_PWR pos=3.344,7.759 light LED_HALT pos=4.333,7.759 light LED_RUN pos=5.322,7.759 + +fansound fan.wav diff --git a/intelmdssim/conf/switch_off.wav b/intelmdssim/conf/switch_off.wav new file mode 100644 index 00000000..de22804c Binary files /dev/null and b/intelmdssim/conf/switch_off.wav differ diff --git a/intelmdssim/conf/switch_on.wav b/intelmdssim/conf/switch_on.wav new file mode 100644 index 00000000..360b8043 Binary files /dev/null and b/intelmdssim/conf/switch_on.wav differ diff --git a/intelmdssim/srcsim/Makefile b/intelmdssim/srcsim/Makefile index c84de4b3..7c16120c 100644 --- a/intelmdssim/srcsim/Makefile +++ b/intelmdssim/srcsim/Makefile @@ -50,6 +50,7 @@ include $(CORE_DIR)/Makefile.in-os ### ifeq ($(WANT_SDL),YES) PLAT_DEFS = -DWANT_SDL +PLAT_SRCS = simsdl.c ifeq ($(TARGET_OS),BSD) PLAT_INCS = -I/usr/local/include/SDL2 PLAT_LDFLAGS = -L/usr/local/lib @@ -88,9 +89,12 @@ FP_DEFS = -DFRONTPANEL FP_LIB = $(FP_DIR)/libfrontpanel.a ifeq ($(WANT_SDL),YES) ifeq ($(TARGET_OS),OSX) -FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework OpenGL +FP_INCS = -I/Library/Frameworks/SDL2_image.framework/Headers \ + -I/Library/Frameworks/SDL2_mixer.framework/Headers +FP_LDLIBS = -lfrontpanel -framework SDL2_image -framework SDL2_mixer \ + -framework OpenGL else -FP_LDLIBS = -lfrontpanel -lSDL2_image -lGL +FP_LDLIBS = -lfrontpanel -lSDL2_image -lSDL2_mixer -lGL endif else FP_LDLIBS = -lfrontpanel -ljpeg -lGL @@ -102,7 +106,7 @@ endif DEFS = -DCONFDIR=\"$(CONF_DIR)\" -DDISKSDIR=\"$(DISKS_DIR)\" \ -DBOOTROM=\"$(ROMS_DIR)\" $(FP_DEFS) $(PLAT_DEFS) -INCS = -I. -I$(CORE_DIR) -I$(IO_DIR) -I$(FP_DIR) $(PLAT_INCS) +INCS = -I. -I$(CORE_DIR) -I$(IO_DIR) -I$(FP_DIR) $(PLAT_INCS) $(FP_INCS) CPPFLAGS = $(DEFS) $(INCS) CSTDS = -std=c99 -D_DEFAULT_SOURCE # -D_XOPEN_SOURCE=700L @@ -132,9 +136,9 @@ 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 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) + 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) $(PLAT_SRCS) OBJS = $(SRCS:.c=.o) DEPS = $(SRCS:.c=.d) @@ -167,10 +171,10 @@ uninstall: clean: _rm_obj _rm_deps _rm_obj: - rm -f $(OBJS) + rm -f *.o _rm_deps: - rm -f $(DEPS) + rm -f *.d distclean: clean rm -f $(SIM) diff --git a/intelmdssim/srcsim/simctl.c b/intelmdssim/srcsim/simctl.c index f93a4378..e6bcd206 100644 --- a/intelmdssim/srcsim/simctl.c +++ b/intelmdssim/srcsim/simctl.c @@ -92,6 +92,7 @@ void mon(void) fp_framerate(fp_fps); fp_bindSimclock(&fp_clock); fp_bindRunFlag(&cpu_state); + fp_bindPowerFlag(&power); /* bind frontpanel LED's to variables */ fp_bindLight8("LED_INT_{0-7}", &int_requests, 1); @@ -172,10 +173,10 @@ void mon(void) #ifdef FRONTPANEL if (F_flag) { /* all LED's off and update front panel */ + power = 0; cpu_bus = 0; bus_request = 0; IFF = 0; - power = 0; int_requests = 0; fp_sampleData(); @@ -273,14 +274,14 @@ static void power_clicked(int state, int val) case FP_SW_DOWN: if (!power) break; - power--; + power = 0; cpu_state = ST_STOPPED; cpu_error = POWEROFF; break; case FP_SW_UP: if (power) break; - power++; + power = 1; cpu_wait = 1; if (!isatty(fileno(stdout)) || (system("tput clear") == -1)) puts("\r\n\r\n\r\n"); diff --git a/mosteksim/srcsim/Makefile b/mosteksim/srcsim/Makefile index c8049cd5..a2d785e5 100644 --- a/mosteksim/srcsim/Makefile +++ b/mosteksim/srcsim/Makefile @@ -71,8 +71,8 @@ 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 simsdl.c simz80.c simz80-cb.c simz80-dd.c simz80-ddcb.c \ - simz80-ed.c simz80-fd.c simz80-fdcb.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) OBJS = $(SRCS:.c=.o) DEPS = $(SRCS:.c=.d) @@ -101,10 +101,10 @@ uninstall: clean: _rm_obj _rm_deps _rm_obj: - rm -f $(OBJS) + rm -f *.o _rm_deps: - rm -f $(DEPS) + rm -f *.d distclean: clean rm -f $(SIM) diff --git a/picosim/srcsim/CMakeLists.txt b/picosim/srcsim/CMakeLists.txt index 3cd00b28..6a9148f6 100644 --- a/picosim/srcsim/CMakeLists.txt +++ b/picosim/srcsim/CMakeLists.txt @@ -50,13 +50,13 @@ add_executable(${PROJECT_NAME} ${Z80PACK}/z80core/simdis.c ${Z80PACK}/z80core/simglb.c ${Z80PACK}/z80core/simice.c + ${Z80PACK}/z80core/simz80.c ${Z80PACK}/z80core/simz80-cb.c ${Z80PACK}/z80core/simz80-dd.c ${Z80PACK}/z80core/simz80-ddcb.c ${Z80PACK}/z80core/simz80-ed.c ${Z80PACK}/z80core/simz80-fd.c ${Z80PACK}/z80core/simz80-fdcb.c - ${Z80PACK}/z80core/simz80.c ) # generate the header file into the source tree diff --git a/z80asm/Makefile b/z80asm/Makefile index ebcad814..2129477e 100644 --- a/z80asm/Makefile +++ b/z80asm/Makefile @@ -73,7 +73,7 @@ uninstall: rm -f $(DESTDIR)$(BINDIR)/z80asm clean: - rm -f core $(OBJS) z80asm + rm -f *.o z80asm core distclean: clean diff --git a/z80core/simsdl.c b/z80core/simsdl.c index 76e2a021..3db71c9f 100644 --- a/z80core/simsdl.c +++ b/z80core/simsdl.c @@ -8,11 +8,13 @@ * This module contains the SDL2 integration for the simulator. */ -#ifdef WANT_SDL - #include #include #include +#ifdef FRONTPANEL +#include +#include +#endif #include #include "simsdl.h" @@ -47,15 +49,31 @@ int main(int argc, char *argv[]) args_t args = {argc, argv}; SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1"); - if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { + if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "Can't initialize SDL: %s\n", SDL_GetError()); return EXIT_FAILURE; } +#ifdef FRONTPANEL + i = IMG_INIT_JPG | IMG_INIT_PNG; + if ((IMG_Init(i) & i) == 0) { + fprintf(stderr, "Can't initialize SDL_image: %s\n", IMG_GetError()); + SDL_Quit(); + return EXIT_FAILURE; + } + if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) { + fprintf(stderr, "Can't initialize SDL_mixer: %s\n", Mix_GetError()); + } +#endif sim_finished = false; sim_thread = SDL_CreateThread(sim_thread_func, "Simulator", &args); if (sim_thread == NULL) { fprintf(stderr, "Can't create simulator thread: %s\n", SDL_GetError()); +#ifdef FRONTPANEL + Mix_CloseAudio(); + Mix_Quit(); + IMG_Quit(); +#endif SDL_Quit(); return EXIT_FAILURE; } @@ -106,6 +124,11 @@ int main(int argc, char *argv[]) if (win[i].in_use) (*win[i].funcs->close)(); +#ifdef FRONTPANEL + Mix_CloseAudio(); + Mix_Quit(); + IMG_Quit(); +#endif SDL_Quit(); return status; @@ -151,5 +174,3 @@ static int sim_thread_func(void *data) return status; } - -#endif /* WANT_SDL */ diff --git a/z80core/simsdl.h b/z80core/simsdl.h index e3a0e5d6..ffc78f0e 100644 --- a/z80core/simsdl.h +++ b/z80core/simsdl.h @@ -7,8 +7,6 @@ #ifndef SIMSDL_INC #define SIMSDL_INC -#ifdef WANT_SDL - #include #include @@ -22,6 +20,4 @@ typedef struct win_funcs { extern int simsdl_create(win_funcs_t *funcs); extern void simsdl_destroy(int i); -#endif /* WANT_SDL */ - #endif /* !SIMSDL_INC */ diff --git a/z80sim/srcsim/Makefile b/z80sim/srcsim/Makefile index f0a4060a..686cb1d3 100644 --- a/z80sim/srcsim/Makefile +++ b/z80sim/srcsim/Makefile @@ -63,8 +63,8 @@ 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 simsdl.c simz80.c simz80-cb.c simz80-dd.c simz80-ddcb.c \ - simz80-ed.c simz80-fd.c simz80-fdcb.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) OBJS = $(SRCS:.c=.o) DEPS = $(SRCS:.c=.d) @@ -93,10 +93,10 @@ uninstall: clean: _rm_obj _rm_deps _rm_obj: - rm -f $(OBJS) + rm -f *.o _rm_deps: - rm -f $(DEPS) + rm -f *.d distclean: clean rm -f $(SIM)