From 92fddad22780ec251a1581a31b24f963be8ddcbc Mon Sep 17 00:00:00 2001 From: Richard Cornwell Date: Wed, 30 Aug 2017 23:15:00 -0400 Subject: [PATCH] SCP: Updated to current version --- .gitignore | 1 + descrip.mms | 119 ++++++++++++++++--- makefile | 319 +++++++++++++++++++++++++++++++++++--------------- scp.c | 95 +++++++++++++-- scp.h | 2 +- sim_console.c | 23 ++-- sim_defs.h | 50 +++++--- sim_timer.c | 135 +++++++++++++++------ 8 files changed, 559 insertions(+), 185 deletions(-) diff --git a/.gitignore b/.gitignore index 6babf4a..a305e86 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ Thumbs.db *.lib *.sbr *.bak +*.save obj/ [Rr]elease*/ _ReSharper*/ diff --git a/descrip.mms b/descrip.mms index 48bec0e..4506097 100644 --- a/descrip.mms +++ b/descrip.mms @@ -20,6 +20,7 @@ # ALTAIRZ80 Just Build The MITS Altair Z80. # BESM6 Just Build The BESM-6. # B5500 Just Build The B5500. +# CDC1700 Just Build The CDC1700. # ECLIPSE Just Build The Data General Eclipse. # GRI Just Build The GRI Corporation GRI-909. # LGP Just Build The Royal-McBee LGP-30. @@ -275,9 +276,9 @@ PCAP_SIMH_INC = /INCL=($(PCAP_DIR)) @ 'MISS_SAY' "*** Error *** " @ 'MISS_SAY' "*** Error *** The vms-pcap.zip file can be downloaded from:" @ 'MISS_SAY' "*** Error *** " - @ 'MISS_SAY' "*** Error *** https://github.com/markpizz/simh/downloads" + @ 'MISS_SAY' "*** Error *** https://github.com/simh/simh/archive/vms-pcap.zip" @ 'MISS_SAY' "*** Error *** " - @ 'MISS_SAY' "*** Error *** Be sure to ""unzip -a vms-pcap"" to properly set the file attributes" + @ 'MISS_SAY' "*** Error *** Be sure to ""unzip -aa simh-vms-pcap.zip"" to properly set the file attributes" @ 'MISS_SAY' "*** Error *** " @ 'MISS_SAY' "*** Error *** The PCAP-VMS components are presumed (by this procedure) to be" @ 'MISS_SAY' "*** Error *** located in a directory at the same level as the directory" @@ -431,8 +432,10 @@ HP3000_DIR = SYS$DISK:[.HP3000] HP3000_LIB1 = $(LIB_DIR)HP3000L1-$(ARCH).OLB HP3000_SOURCE1 = $(HP3000_DIR)HP3000_ATC.C,$(HP3000_DIR)HP3000_CLK.C,\ $(HP3000_DIR)HP3000_CPU.C,$(HP3000_DIR)HP3000_CPU_BASE.C,\ - $(HP3000_DIR)HP3000_CPU_FP.C,$(HP3000_DIR)HP3000_DS.C,\ - $(HP3000_DIR)HP3000_IOP.C,$(HP3000_DIR)HP3000_MPX.C,\ + $(HP3000_DIR)HP3000_CPU_CIS.C,$(HP3000_DIR)HP3000_CPU_FP.C,\ + $(HP3000_DIR)HP3000_DS.C,$(HP3000_DIR)HP3000_LP.C,\ + $(HP3000_DIR)HP3000_IOP.C,$(HP3000_DIR)HP3000_MEM.C,\ + $(HP3000_DIR)HP3000_MPX.C,\ $(HP3000_DIR)HP3000_MS.C,$(HP3000_DIR)HP3000_SCMB.C,\ $(HP3000_DIR)HP3000_SEL.C,$(HP3000_DIR)HP3000_SYS.C HP3000_LIB2 = $(LIB_DIR)HP3000L2-$(ARCH).OLB @@ -661,7 +664,7 @@ BESM6_LIB = $(LIB_DIR)BESM6-$(ARCH).OLB BESM6_SOURCE = $(BESM6_DIR)BESM6_CPU.C,$(BESM6_DIR)BESM6_SYS.C,$(BESM6_DIR)BESM6_MMU.C,\ $(BESM6_DIR)BESM6_ARITH.C,$(BESM6_DIR)BESM6_DISK.C,$(BESM6_DIR)BESM6_DRUM.C,\ $(BESM6_DIR)BESM6_TTY.C,$(BESM6_DIR)BESM6_PANEL.C,$(BESM6_DIR)BESM6_PRINTER.C,\ - $(BESM6_DIR)BESM6_PUNCH.C + $(BESM6_DIR)BESM6_PUNCHCARD.C,$(BESM6_DIR)BESM6_PUNCH.C BESM6_OPTIONS = /INCL=($(SIMH_DIR),$(BESM6_DIR))/DEF=($(CC_DEFS),"USE_INT64=1") # @@ -674,6 +677,18 @@ B5500_SOURCE = $(B5500_DIR)B5500_CPU.C,$(B5500_DIR)B5500_DK.C,$(B5500_DIR)B5500_ $(B5500_DIR)B5500_SYS.C,$(B5500_DIR)B5500_UREC.C,$(SIMH_DIR)SIM_CARD.C B5500_OPTIONS = /INCL=($(SIMH_DIR),$(B5500_DIR))/DEF=($(CC_DEFS),"USE_INT64=1","USE_SIM_CARD=1") +# +# CDC1700 +# +CDC1700_DIR = SYS$DISK:[.CDC1700] +CDC1700_LIB = $(LIB_DIR)CDC1700-$(ARCH).OLB +CDC1700_SOURCE = $(CDC1700_DIR)CDC1700_CPU.C,$(CDC1700_DIR)CDC1700_DIS.C,$(CDC1700_DIR)CDC1700_IO.C,\ + $(CDC1700_DIR)CDC1700_SYS.C,$(CDC1700_DIR)CDC1700_DEV1.C,$(CDC1700_DIR)CDC1700_MT.C,\ + $(CDC1700_DIR)CDC1700_DC.C,$(CDC1700_DIR)CDC1700_IOFW.C,$(CDC1700_DIR)CDC1700_LP.C,\ + $(CDC1700_DIR)CDC1700_DP.C,$(CDC1700_DIR)CDC1700_CD.C,$(CDC1700_DIR)CDC1700_SYM.C,\ + $(CDC1700_DIR)CDC1700_RTC.C $(CDC1700_DIR)CDC1700_MSOS5.C +CDC1700_OPTIONS = /INCL=($(SIMH_DIR),$(CDC1700_DIR))/DEF=($(CC_DEFS)) + # # Digital Equipment VAX 3900 Simulator Definitions. # @@ -933,8 +948,8 @@ I7094_OPTIONS = /INCL=($(SIMH_DIR),$(I7094_DIR))/DEF=($(CC_DEFS)) # If we're not a VAX, Build Everything # .IFDEF ALPHA_OR_IA64 -ALL : ALTAIR ALTAIRZ80 ECLIPSE GRI LGP H316 HP2100 HP3000 I1401 I1620 IBM1130 ID16 \ - ID32 NOVA PDP1 PDP4 PDP7 PDP8 PDP9 PDP10 PDP11 PDP15 S3 \ +ALL : ALTAIR ALTAIRZ80 CDC1700 ECLIPSE GRI LGP H316 HP2100 HP3000 I1401 I1620 \ + IBM1130 ID16 ID32 NOVA PDP1 PDP4 PDP7 PDP8 PDP9 PDP10 PDP11 PDP15 S3 \ VAX MICROVAX3900 MICROVAX1 RTVAX1000 MICROVAX2 VAX730 VAX750 VAX780 VAX8600 \ SDS I7094 SWTP6800MP-A SWTP6800MP-A2 SSEM BESM6 B5500 $! No further actions necessary @@ -942,7 +957,7 @@ ALL : ALTAIR ALTAIRZ80 ECLIPSE GRI LGP H316 HP2100 HP3000 I1401 I1620 IBM1130 ID # # Else We Are On VAX And Build Everything EXCEPT the 64b simulators # -ALL : ALTAIR ALTAIRZ80 GRI H316 HP2100 I1401 I1620 IBM1130 ID16 ID32 \ +ALL : ALTAIR GRI H316 HP2100 I1401 I1620 IBM1130 ID16 ID32 \ NOVA PDP1 PDP4 PDP7 PDP8 PDP9 PDP11 PDP15 S3 \ VAX MICROVAX3900 MICROVAX1 RTVAX1000 MICROVAX2 VAX730 VAX750 VAX780 VAX8600 \ SDS SWTP6800MP-A SWTP6800MP-A2 SSEM @@ -1029,6 +1044,10 @@ $(ALTAIR_LIB) : $(ALTAIR_SOURCE) $ LIBRARY/REPLACE $(MMS$TARGET) $(BLD_DIR)*.OBJ $ DELETE/NOLOG/NOCONFIRM $(BLD_DIR)*.OBJ;* +# +# If Not On VAX, Build The AltairZ80 Library. +# +.IFDEF ALPHA_OR_IA64 $(ALTAIRZ80_LIB1) : $(ALTAIRZ80_SOURCE1) $! $! Building The $(ALTAIRZ80_LIB1) Library. @@ -1050,6 +1069,18 @@ $(ALTAIRZ80_LIB2) : $(ALTAIRZ80_SOURCE2) LIBRARY/CREATE $(MMS$TARGET) $ LIBRARY/REPLACE $(MMS$TARGET) $(BLD_DIR)*.OBJ $ DELETE/NOLOG/NOCONFIRM $(BLD_DIR)*.OBJ;* +.ELSE +# +# We Are On VAX And Due To The Use of INT64 We Can't Build It. +# +$(ALTAIRZ80_LIB1) : + $! Due To The Use Of INT64 We Can't Build The + $! $(MMS$TARGET) Library On VAX. + +$(ALTAIRZ80_LIB2) : + $! Due To The Use Of INT64 We Can't Build The + $! $(MMS$TARGET) Library On VAX. +.ENDIF # # If Not On VAX, Build The Eclipse Library. @@ -1429,11 +1460,33 @@ $(B5500_LIB) : $! $(MMS$TARGET) Library On VAX. .ENDIF +# +# If Not On VAX, Build The CDC 1700 Library. +# +.IFDEF ALPHA_OR_IA64 +$(CDC1700_LIB) : $(CDC1700_SOURCE) + $! + $! Building The $(CDC1700_LIB) Library. + $! + $ $(CC)$(CDC1700_OPTIONS) - + /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) + $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - + LIBRARY/CREATE $(MMS$TARGET) + $ LIBRARY/REPLACE $(MMS$TARGET) $(BLD_DIR)*.OBJ + $ DELETE/NOLOG/NOCONFIRM $(BLD_DIR)*.OBJ;* +.ELSE +# +# We Are On VAX And Due To The Use of INT64 We Can't Build It. +# +$(CDC1700_LIB) : + $! Due To The Use Of INT64 We Can't Build The + $! $(MMS$TARGET) Library On VAX. +.ENDIF + $(VAX_LIB1) : $(VAX_SOURCE1) $! $! Building The $(VAX_LIB1) Library. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(VAX_OPTIONS)/OBJ=$(VAX_DIR) - /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - @@ -1456,7 +1509,6 @@ $(VAX610_LIB1) : $(VAX610_SOURCE1) $! $! Building The $(VAX610_LIB1) Library. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(VAX610_OPTIONS)/OBJ=$(VAX610_DIR) - /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - @@ -1479,7 +1531,6 @@ $(VAX630_LIB1) : $(VAX630_SOURCE1) $! $! Building The $(VAX630_LIB1) Library. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(VAX630_OPTIONS)/OBJ=$(VAX630_DIR) - /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - @@ -1502,7 +1553,6 @@ $(VAX620_LIB1) : $(VAX620_SOURCE1) $! $! Building The $(VAX620_LIB1) Library. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(VAX620_OPTIONS)/OBJ=$(VAX620_DIR) - /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - @@ -1525,7 +1575,6 @@ $(VAX730_LIB1) : $(VAX730_SOURCE1) $! $! Building The $(VAX730_LIB1) Library. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(VAX730_OPTIONS)/OBJ=$(VAX730_DIR) - /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - @@ -1548,7 +1597,6 @@ $(VAX750_LIB1) : $(VAX750_SOURCE1) $! $! Building The $(VAX750_LIB1) Library. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(VAX750_OPTIONS)/OBJ=$(VAX750_DIR) - /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - @@ -1571,7 +1619,6 @@ $(VAX780_LIB1) : $(VAX780_SOURCE1) $! $! Building The $(VAX780_LIB1) Library. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(VAX780_OPTIONS)/OBJ=$(VAX780_DIR) - /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - @@ -1594,7 +1641,6 @@ $(VAX8600_LIB1) : $(VAX8600_SOURCE1) $! $! Building The $(VAX8600_LIB1) Library. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(VAX8600_OPTIONS)/OBJ=$(VAX8600_DIR) - /OBJ=$(BLD_DIR) $(MMS$CHANGED_LIST) $ IF (F$SEARCH("$(MMS$TARGET)").EQS."") THEN - @@ -1664,8 +1710,21 @@ $(BIN_DIR)ALTAIR-$(ARCH).EXE : $(SIMH_MAIN) $(SIMH_NONET_LIB) $(ALTAIR_LIB) $(BLD_DIR)SCP.OBJ,$(ALTAIR_LIB)/LIBRARY,$(SIMH_NONET_LIB)/LIBRARY $ DELETE/NOLOG/NOCONFIRM $(BLD_DIR)*.OBJ;* +# +# If Not On VAX, Build The AltairZ80 Simulator. +# +.IFDEF ALPHA_OR_IA64 ALTAIRZ80 : $(BIN_DIR)ALTAIRZ80-$(ARCH).EXE $! ALTAIRZ80 done +.ELSE +# +# Else We Are On VAX And Tell The User We Can't Build On VAX +# Due To The Use Of INT64. +# +ALTAIRZ80 : + $! Sorry, Can't Build $(BIN_DIR)ALTAIRZ80-$(ARCH).EXE Simulator + $! Because It Requires The Use Of INT64. +.ENDIF $(BIN_DIR)ALTAIRZ80-$(ARCH).EXE : $(SIMH_MAIN) $(SIMH_NONET_LIB) $(ALTAIRZ80_LIB1) $(ALTAIRZ80_LIB2) $! @@ -1676,6 +1735,7 @@ $(BIN_DIR)ALTAIRZ80-$(ARCH).EXE : $(SIMH_MAIN) $(SIMH_NONET_LIB) $(ALTAIRZ80_LIB $(BLD_DIR)SCP.OBJ,$(ALTAIRZ80_LIB1)/LIBRARY, - $(ALTAIRZ80_LIB2)/LIBRARY,$(SIMH_NONET_LIB)/LIBRARY $ DELETE/NOLOG/NOCONFIRM $(BLD_DIR)*.OBJ;* + # # If Not On VAX, Build The Eclipse Simulator. # @@ -1987,7 +2047,6 @@ $(BIN_DIR)SWTP6800MP-A-$(ARCH).EXE : $(SIMH_MAIN) $(SIMH_NONET_LIB) $(SWTP6800MP $! $! Building The $(BIN_DIR)SWTP6800MP-A-$(ARCH).EXE Simulator. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(SWTP6800MP_A_OPTIONS)/OBJ=$(BLD_DIR) SCP.C $ LINK $(LINK_DEBUG)/EXE=$(BIN_DIR)SWTP6800MP-A-$(ARCH).EXE - $(BLD_DIR)SCP.OBJ,$(SWTP6800MP_A_LIB)/LIBRARY,$(SIMH_NONET_LIB)/LIBRARY @@ -2000,7 +2059,6 @@ $(BIN_DIR)SWTP6800MP-A2-$(ARCH).EXE : $(SIMH_MAIN) $(SIMH_NONET_LIB) $(SWTP6800M $! $! Building The $(BIN_DIR)SWTP6800MP-A2-$(ARCH).EXE Simulator. $! - $ RUN/NODEBUG $(BIN_DIR)BuildROMs-$(ARCH).EXE $ $(CC)$(SWTP6800MP_A2_OPTIONS)/OBJ=$(BLD_DIR) SCP.C $ LINK $(LINK_DEBUG)/EXE=$(BIN_DIR)SWTP6800MP-A2-$(ARCH).EXE - $(BLD_DIR)SCP.OBJ,$(SWTP6800MP_A2_LIB)/LIBRARY,$(SIMH_NONET_LIB)/LIBRARY @@ -2058,6 +2116,31 @@ B5500 : .ENDIF +# +# If Not On VAX, Build The Burroughs B5500 Simulator. +# +.IFDEF ALPHA_OR_IA64 +CDC1700 : $(BIN_DIR)CDC1700-$(ARCH).EXE + $! CDC1700 done + +$(BIN_DIR)CDC1700-$(ARCH).EXE : $(SIMH_MAIN) $(SIMH_NONET_LIB) $(CDC1700_LIB) + $! + $! Building The $(BIN_DIR)CDC1700-$(ARCH).EXE Simulator. + $! + $ $(CC)$(CDC1700_OPTIONS)/OBJ=$(BLD_DIR) SCP.C + $ LINK $(LINK_DEBUG)/EXE=$(BIN_DIR)CDC1700-$(ARCH).EXE - + $(BLD_DIR)SCP.OBJ,$(CDC1700_LIB)/LIBRARY,$(SIMH_NONET_LIB)/LIBRARY + $ DELETE/NOLOG/NOCONFIRM $(BLD_DIR)*.OBJ;* +.ELSE +# +# Else We Are On VAX And Tell The User We Can't Build On VAX +# Due To The Use Of INT64. +# +CDC1700 : + $! Sorry, Can't Build $(BIN_DIR)CDC1700-$(ARCH).EXE Simulator + $! Because It Requires The Use Of INT64. +.ENDIF + VAX : MICROVAX3900 $! MICROVAX3900 aka VAX done diff --git a/makefile b/makefile index 72d7af7..b83043b 100644 --- a/makefile +++ b/makefile @@ -55,6 +55,9 @@ # Internal ROM support can be disabled if GNU make is invoked with # DONT_USE_ROMS=1 on the command line. # +# The use of pthreads for various things can be disabled if GNU make is +# invoked with NOPTHREADS=1 on the command line. +# # Asynchronous I/O support can be disabled if GNU make is invoked with # NOASYNCH=1 on the command line. # @@ -379,17 +382,10 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) OS_LDFLAGS += -lrt $(info using librt: $(call find_lib,rt)) endif - ifneq (,$(call find_include,pthread)) - ifneq (,$(call find_lib,pthread)) - OS_CCDEFS += -DUSE_READER_THREAD - ifeq (,$(NOASYNCH)) - OS_CCDEFS += -DSIM_ASYNCH_IO - endif - OS_LDFLAGS += -lpthread - $(info using libpthread: $(call find_lib,pthread) $(call find_include,pthread)) - else - LIBEXTSAVE := $(LIBEXT) - LIBEXT = a + ifneq (,$(NOPTHREADS)) + OS_CCDEFS += -DDONT_USE_READER_THREAD + else + ifneq (,$(call find_include,pthread)) ifneq (,$(call find_lib,pthread)) OS_CCDEFS += -DUSE_READER_THREAD ifeq (,$(NOASYNCH)) @@ -398,15 +394,26 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) OS_LDFLAGS += -lpthread $(info using libpthread: $(call find_lib,pthread) $(call find_include,pthread)) else - ifneq (,$(findstring Haiku,$(OSTYPE))) + LIBEXTSAVE := $(LIBEXT) + LIBEXT = a + ifneq (,$(call find_lib,pthread)) OS_CCDEFS += -DUSE_READER_THREAD ifeq (,$(NOASYNCH)) OS_CCDEFS += -DSIM_ASYNCH_IO endif - $(info using libpthread: $(call find_include,pthread)) + OS_LDFLAGS += -lpthread + $(info using libpthread: $(call find_lib,pthread) $(call find_include,pthread)) + else + ifneq (,$(findstring Haiku,$(OSTYPE))) + OS_CCDEFS += -DUSE_READER_THREAD + ifeq (,$(NOASYNCH)) + OS_CCDEFS += -DSIM_ASYNCH_IO + endif + $(info using libpthread: $(call find_include,pthread)) + endif endif + LIBEXT = $(LIBEXTSAVE) endif - LIBEXT = $(LIBEXTSAVE) endif endif # Find available RegEx library. Prefer libpcreposix. @@ -447,6 +454,9 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) endif endif endif + ifneq (,$(call find_include,utime)) + OS_CCDEFS += -DHAVE_UTIME + endif ifneq (,$(call find_include,png)) ifneq (,$(call find_lib,png)) OS_CCDEFS += -DHAVE_LIBPNG @@ -517,9 +527,9 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) $(info *** Info *** Install the development components of libSDL or libSDL2) $(info *** Info *** packaged for your operating system distribution for) $(info *** Info *** your Linux system:) - $(info *** Info *** # apt-get install libsdl2-dev) + $(info *** Info *** $$ sudo apt-get install libsdl2-dev) $(info *** Info *** or) - $(info *** Info *** # apt-get install libsdl-dev) + $(info *** Info *** $$ sudo apt-get install libsdl-dev) else $(info *** Info *** Install the development components of libSDL packaged by your) $(info *** Info *** operating system distribution and rebuild your simulator to) @@ -649,7 +659,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get))) $(info *** Warning *** should install the libpcap development components for) $(info *** Warning *** for your Linux system:) - $(info *** Warning *** # apt-get install libpcap-dev) + $(info *** Warning *** $$ sudo apt-get install libpcap-dev) else $(info *** Warning *** should read 0readme_ethernet.txt and follow the instructions) $(info *** Warning *** regarding the needed libpcap development components for your) @@ -700,7 +710,11 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get))) $(info *** Info *** should install the vde2 package to provide this) $(info *** Info *** functionality for your $(OSNAME) system:) - $(info *** Info *** # apt-get install vde2) + ifneq (,$(shell apt list 2>/dev/null| grep libvdeplug-dev)) + $(info *** Info *** $$ sudo apt-get install libvdeplug-dev) + else + $(info *** Info *** $$ sudo apt-get install vde2) + endif else $(info *** Info *** should read 0readme_ethernet.txt and follow the instructions) $(info *** Info *** regarding the needed libvdeplug components for your $(OSNAME)) @@ -751,6 +765,12 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) else ifeq (,$(shell grep 'define SIM_GIT_COMMIT_ID' sim_rev.h | grep 'Format:')) GIT_COMMIT_ID=$(shell grep 'define SIM_GIT_COMMIT_ID' sim_rev.h | awk '{ print $$3 }') + else + ifeq (git-submodule,$(if $(shell cd .. ; git rev-parse --git-dir 2>/dev/null),git-submodule)) + GIT_COMMIT_ID=$(shell cd .. ; git submodule status | grep "$(notdir $(realpath .))" | awk '{ print $$1 }') + else + GIT_COMMIT_ID=undetermined-git-id + endif endif endif else @@ -763,7 +783,11 @@ else endif GCC_VERSION = $(word 3,$(shell $(GCC) --version)) COMPILER_NAME = GCC Version: $(GCC_VERSION) - CC_STD = -std=gnu99 + ifeq (,$(findstring ++,$(GCC))) + CC_STD = -std=gnu99 + else + CPP_BUILD = 1 + endif LTO_EXCLUDE_VERSIONS = 4.5.2 ifeq (,$(PATH_SEPARATOR)) PATH_SEPARATOR := ; @@ -1166,27 +1190,25 @@ PDP10 = ${PDP10D}/pdp10_fe.c ${PDP11D}/pdp11_dz.c ${PDP10D}/pdp10_cpu.c \ ${PDP11D}/pdp11_xu.c PDP10_OPT = -DVM_PDP10 -DUSE_INT64 -I ${PDP10D} -I ${PDP11D} ${NETWORK_OPT} - KA10D = PDP10 KA10 = ${KA10D}/ka10_cpu.c ${KA10D}/ka10_sys.c ${KA10D}/ka10_df.c \ - ${KA10D}/ka10_dp.c ${KA10D}/ka10_mt.c ${KA10D}/ka10_cty.c \ - ${KA10D}/ka10_lp.c ${KA10D}/ka10_pt.c ${KA10D}/ka10_dc.c \ - ${KA10D}/ka10_rp.c ${KA10D}/ka10_rc.c ${KA10D}/ka10_dt.c \ - ${KA10D}/ka10_dk.c ${KA10D}/ka10_cr.c ${KA10D}/ka10_cp.c \ - ${KA10D}/ka10_tu.c ${KA10D}/ka10_rs.c + ${KA10D}/ka10_dp.c ${KA10D}/ka10_mt.c ${KA10D}/ka10_cty.c \ + ${KA10D}/ka10_lp.c ${KA10D}/ka10_pt.c ${KA10D}/ka10_dc.c \ + ${KA10D}/ka10_rp.c ${KA10D}/ka10_rc.c ${KA10D}/ka10_dt.c \ + ${KA10D}/ka10_dk.c ${KA10D}/ka10_cr.c ${KA10D}/ka10_cp.c \ + ${KA10D}/ka10_tu.c ${KA10D}/ka10_rs.c KA10_OPT = -DKA=1 -DUSE_INT64 -I $(KA10D) -DUSE_SIM_CARD KI10D = PDP10 KI10 = ${KA10D}/ka10_cpu.c ${KA10D}/ka10_sys.c ${KA10D}/ka10_df.c \ - ${KA10D}/ka10_dp.c ${KA10D}/ka10_mt.c ${KA10D}/ka10_cty.c \ - ${KA10D}/ka10_lp.c ${KA10D}/ka10_pt.c ${KA10D}/ka10_dc.c \ - ${KA10D}/ka10_rp.c ${KA10D}/ka10_rc.c ${KA10D}/ka10_dt.c \ - ${KA10D}/ka10_dk.c ${KA10D}/ka10_cr.c ${KA10D}/ka10_cp.c \ - ${KA10D}/ka10_tu.c ${KA10D}/ka10_rs.c + ${KA10D}/ka10_dp.c ${KA10D}/ka10_mt.c ${KA10D}/ka10_cty.c \ + ${KA10D}/ka10_lp.c ${KA10D}/ka10_pt.c ${KA10D}/ka10_dc.c \ + ${KA10D}/ka10_rp.c ${KA10D}/ka10_rc.c ${KA10D}/ka10_dt.c \ + ${KA10D}/ka10_dk.c ${KA10D}/ka10_cr.c ${KA10D}/ka10_cp.c \ + ${KA10D}/ka10_tu.c ${KA10D}/ka10_rs.c KI10_OPT = -DKI=1 -DUSE_INT64 -I $(KA10D) -DUSE_SIM_CARD - PDP8D = PDP8 PDP8 = ${PDP8D}/pdp8_cpu.c ${PDP8D}/pdp8_clk.c ${PDP8D}/pdp8_df.c \ ${PDP8D}/pdp8_dt.c ${PDP8D}/pdp8_lp.c ${PDP8D}/pdp8_mt.c \ @@ -1221,9 +1243,10 @@ HP2100_OPT = -DHAVE_INT64 -I ${HP2100D} HP3000D = HP3000 HP3000 = ${HP3000D}/hp_disclib.c ${HP3000D}/hp_tapelib.c ${HP3000D}/hp3000_atc.c \ ${HP3000D}/hp3000_clk.c ${HP3000D}/hp3000_cpu.c ${HP3000D}/hp3000_cpu_base.c \ - ${HP3000D}/hp3000_cpu_fp.c ${HP3000D}/hp3000_ds.c ${HP3000D}/hp3000_iop.c \ - ${HP3000D}/hp3000_mpx.c ${HP3000D}/hp3000_ms.c \ - ${HP3000D}/hp3000_scmb.c ${HP3000D}/hp3000_sel.c ${HP3000D}/hp3000_sys.c + ${HP3000D}/hp3000_cpu_fp.c ${HP3000D}/hp3000_cpu_cis.c ${HP3000D}/hp3000_ds.c \ + ${HP3000D}/hp3000_iop.c ${HP3000D}/hp3000_lp.c ${HP3000D}/hp3000_mem.c \ + ${HP3000D}/hp3000_mpx.c ${HP3000D}/hp3000_ms.c ${HP3000D}/hp3000_scmb.c \ + ${HP3000D}/hp3000_sel.c ${HP3000D}/hp3000_sys.c HP3000_OPT = -I ${HP3000D} @@ -1347,8 +1370,9 @@ ISYS8010C = Intel-Systems/common ISYS8010 = ${ISYS8010C}/i8080.c ${ISYS8010D}/isys8010_sys.c \ ${ISYS8010C}/i8251.c ${ISYS8010C}/i8255.c \ ${ISYS8010C}/ieprom.c ${ISYS8010C}/iram8.c \ - ${ISYS8010C}/multibus.c ${ISYS8010C}/isbc80-10.c \ - ${ISYS8010C}/isbc064.c ${ISYS8010C}/isbc208.c + ${ISYS8010C}/multibus.c ${ISYS8010D}/isbc8010.c \ + ${ISYS8010C}/isbc064.c ${ISYS8010C}/isbc202.c \ + ${ISYS8010C}/isbc201.c ${ISYS8010C}/zx200a.c ISYS8010_OPT = -I ${ISYS8010D} @@ -1357,15 +1381,74 @@ ISYS8020C = Intel-Systems/common ISYS8020 = ${ISYS8020C}/i8080.c ${ISYS8020D}/isys8020_sys.c \ ${ISYS8020C}/i8251.c ${ISYS8020C}/i8255.c \ ${ISYS8020C}/ieprom.c ${ISYS8020C}/iram8.c \ - ${ISYS8020C}/multibus.c ${ISYS8020C}/isbc80-20.c \ - ${ISYS8020C}/isbc064.c ${ISYS8020C}/isbc208.c \ - ${ISYS8020C}/i8259.c + ${ISYS8020C}/multibus.c ${ISYS8020D}/isbc8020.c \ + ${ISYS8020C}/isbc064.c ${ISYS8020C}/i8259.c \ + ${ISYS8010C}/isbc202.c ${ISYS8010C}/isbc201.c \ + ${ISYS8010C}/zx200a.c ISYS8020_OPT = -I ${ISYS8020D} +ISYS8024D = Intel-Systems/isys8024 +ISYS8024C = Intel-Systems/common +ISYS8024 = ${ISYS8024C}/i8080.c ${ISYS8024D}/isys8024_sys.c \ + ${ISYS8024C}/i8251.c ${ISYS8024C}/i8253.c \ + ${ISYS8024C}/i8255.c ${ISYS8024C}/i8259.c \ + ${ISYS8024C}/ieprom.c ${ISYS8024C}/iram8.c \ + ${ISYS8024C}/multibus.c ${ISYS8024D}/isbc8024.c \ + ${ISYS8024C}/isbc064.c ${ISYS8024C}/isbc208.c \ + ${ISYS8010C}/isbc202.c ${ISYS8010C}/isbc201.c \ + ${ISYS8010C}/zx200a.c +ISYS8024_OPT = -I ${ISYS8024D} + + +ISYS8030D = Intel-Systems/isys8030 +ISYS8030C = Intel-Systems/common +ISYS8030 = ${ISYS8030C}/i8080.c ${ISYS8030D}/isys8030_sys.c \ + ${ISYS8030C}/i8251.c ${ISYS8030C}/i8255.c \ + ${ISYS8030C}/i8259.c ${ISYS8030C}/i8253.c \ + ${ISYS8030C}/ieprom.c ${ISYS8030C}/iram8.c \ + ${ISYS8030C}/multibus.c ${ISYS8030D}/isbc8030.c \ + ${ISYS8010C}/isbc202.c ${ISYS8010C}/isbc201.c \ + ${ISYS8030C}/isbc064.c ${ISYS8010C}/zx200a.c +ISYS8030_OPT = -I ${ISYS8030D} + + +IMDS-225D = Intel-Systems/imds-225 +IMDS-225C = Intel-Systems/common +IMDS-225 = ${IMDS-225C}/i8080.c ${IMDS-225D}/imds-225_sys.c \ + ${IMDS-225C}/i8251.c ${IMDS-225C}/i8255.c \ + ${IMDS-225C}/i8259.c ${IMDS-225C}/i8253.c \ + ${IMDS-225C}/ieprom.c ${IMDS-225C}/iram8.c \ + ${IMDS-225C}/ipcmultibus.c ${IMDS-225D}/ipc.c \ + ${IMDS-225C}/ipc-cont.c ${IMDS-225C}/ioc-cont.c \ + ${IMDS-225C}/isbc202.c ${IMDS-225C}/isbc201.c \ + ${IMDS-225C}/zx200a.c +IMDS-225_OPT = -I ${IMDS-225D} + + +IBMPCD = Intel-Systems/ibmpc +IBMPCC = Intel-Systems/common +IBMPC = ${IBMPCC}/i8255.c ${IBMPCD}/ibmpc.c \ + ${IBMPCC}/i8088.c ${IBMPCD}/ibmpc_sys.c \ + ${IBMPCC}/i8253.c ${IBMPCC}/i8259.c \ + ${IBMPCC}/pceprom.c ${IBMPCC}/pcram8.c \ + ${IBMPCC}/i8237.c ${IBMPCC}/pcbus.c +IBMPC_OPT = -I ${IBMPCD} + + +IBMPCXTD = Intel-Systems/ibmpcxt +IBMPCXTC = Intel-Systems/common +IBMPCXT = ${IBMPCXTC}/i8088.c ${IBMPCXTD}/ibmpcxt_sys.c \ + ${IBMPCXTC}/i8253.c ${IBMPCXTC}/i8259.c \ + ${IBMPCXTC}/i8255.c ${IBMPCXTD}/ibmpcxt.c \ + ${IBMPCXTC}/pceprom.c ${IBMPCXTC}/pcram8.c \ + ${IBMPCXTC}/pcbus.c ${IBMPCXTC}/i8237.c +IBMPCXT_OPT = -I ${IBMPCXTD} + + TX0D = TX-0 TX0 = ${TX0D}/tx0_cpu.c ${TX0D}/tx0_dpy.c ${TX0D}/tx0_stddev.c \ - ${TX0D}/tx0_sys.c ${TX0D}/tx0_sys_orig.c ${DISPLAYL} + ${TX0D}/tx0_sys.c ${TX0D}/tx0_sys_orig.c ${DISPLAYL} TX0_OPT = -I ${TX0D} $(DISPLAY_OPT) @@ -1379,18 +1462,14 @@ B5500 = ${B5500D}/b5500_cpu.c ${B5500D}/b5500_io.c ${B5500D}/b5500_sys.c \ ${B5500D}/b5500_dr.c ${B5500D}/b5500_dtc.c B5500_OPT = -I.. -DUSE_INT64 -DB5500 -DUSE_SIM_CARD -### -### Experimental simulators -### - BESM6D = BESM6 BESM6 = ${BESM6D}/besm6_cpu.c ${BESM6D}/besm6_sys.c ${BESM6D}/besm6_mmu.c \ ${BESM6D}/besm6_arith.c ${BESM6D}/besm6_disk.c ${BESM6D}/besm6_drum.c \ ${BESM6D}/besm6_tty.c ${BESM6D}/besm6_panel.c ${BESM6D}/besm6_printer.c \ - ${BESM6D}/besm6_punch.c + ${BESM6D}/besm6_punch.c ${BESM6D}/besm6_punchcard.c -ifneq (,$(and ${VIDEO_LDFLAGS}, $(BESM6_BUILD))) - ifeq (,${FONTFILE}) +ifneq (,$(BESM6_BUILD)) + ifneq (,$(and ${VIDEO_LDFLAGS}, $(or $(and $(call find_include,SDL2/SDL_ttf),$(call find_lib,SDL2_ttf)), $(and $(call find_include,SDL/SDL_ttf),$(call find_lib,SDL_ttf))))) FONTPATH += /usr/share/fonts /Library/Fonts /usr/lib/jvm /System/Library/Frameworks/JavaVM.framework/Versions C:/Windows/Fonts FONTPATH := $(dir $(foreach dir,$(strip $(FONTPATH)),$(wildcard $(dir)/.))) FONTNAME += DejaVuSans.ttf LucidaSansRegular.ttf FreeSans.ttf AppleGothic.ttf tahoma.ttf @@ -1405,26 +1484,42 @@ ifneq (,$(and ${VIDEO_LDFLAGS}, $(BESM6_BUILD))) $(info *** No font file available, BESM-6 video panel disabled.) $(info ***) $(info *** To enable the panel display please specify one of:) - $(info *** a font path with FONTNAME=path) + $(info *** a font path with FONTPATH=path) $(info *** a font name with FONTNAME=fontname.ttf) $(info *** a font file with FONTFILE=path/fontname.ttf) $(info ***) endif endif + ifeq (,$(and ${VIDEO_LDFLAGS}, ${FONTFILE}, $(BESM6_BUILD))) + $(info *** No SDL ttf support available. BESM-6 video panel disabled.) + $(info ***) + BESM6_OPT = -I ${BESM6D} -DUSE_INT64 + else ifneq (,$(and $(findstring SDL2,${VIDEO_LDFLAGS}),$(call find_include,SDL2/SDL_ttf),$(call find_lib,SDL2_ttf))) + $(info using libSDL2_ttf: $(call find_lib,SDL2_ttf) $(call find_include,SDL2/SDL_ttf)) + $(info ***) + BESM6_OPT = -I ${BESM6D} -DFONTFILE=${FONTFILE} -DUSE_INT64 ${VIDEO_CCDEFS} ${VIDEO_LDFLAGS} -lSDL2_ttf + else ifneq (,$(and $(call find_include,SDL/SDL_ttf),$(call find_lib,SDL_ttf))) + $(info using libSDL_ttf: $(call find_lib,SDL_ttf) $(call find_include,SDL/SDL_ttf)) + $(info ***) + BESM6_OPT = -I ${BESM6D} -DFONTFILE=${FONTFILE} -DUSE_INT64 ${VIDEO_CCDEFS} ${VIDEO_LDFLAGS} -lSDL_ttf + else + BESM6_OPT = -I ${BESM6D} -DUSE_INT64 + endif endif -ifeq (,$(and ${VIDEO_LDFLAGS}, ${FONTFILE})) - BESM6_OPT = -I ${BESM6D} -DUSE_INT64 -else ifneq (,$(and $(findstring SDL2,${VIDEO_LDFLAGS}),$(call find_include,SDL2/SDL_ttf),$(call find_lib,SDL2_ttf))) - $(info using libSDL2_ttf: $(call find_lib,SDL2_ttf) $(call find_include,SDL2/SDL_ttf)) - $(info ***) - BESM6_OPT = -I ${BESM6D} -DFONTFILE=${FONTFILE} -DUSE_INT64 ${VIDEO_CCDEFS} ${VIDEO_LDFLAGS} -lSDL2_ttf -else ifneq (,$(and $(call find_include,SDL/SDL_ttf),$(call find_lib,SDL_ttf))) - $(info using libSDL_ttf: $(call find_lib,SDL_ttf) $(call find_include,SDL/SDL_ttf)) - $(info ***) - BESM6_OPT = -I ${BESM6D} -DFONTFILE=${FONTFILE} -DUSE_INT64 ${VIDEO_CCDEFS} ${VIDEO_LDFLAGS} -lSDL_ttf -else - BESM6_OPT = -I ${BESM6D} -DUSE_INT64 -endif + +### +### Experimental simulators +### + +CDC1700D = CDC1700 +CDC1700 = ${CDC1700D}/cdc1700_cpu.c ${CDC1700D}/cdc1700_dis.c \ + ${CDC1700D}/cdc1700_io.c ${CDC1700D}/cdc1700_sys.c \ + ${CDC1700D}/cdc1700_dev1.c ${CDC1700D}/cdc1700_mt.c \ + ${CDC1700D}/cdc1700_dc.c ${CDC1700D}/cdc1700_iofw.c \ + ${CDC1700D}/cdc1700_lp.c ${CDC1700D}/cdc1700_dp.c \ + ${CDC1700D}/cdc1700_cd.c ${CDC1700D}/cdc1700_sym.c \ + ${CDC1700D}/cdc1700_rtc.c ${CDC1700D}/cdc1700_msos5.c +CDC1700_OPT = -I ${CDC1700D} ### ### Unsupported/Incomplete simulators @@ -1459,68 +1554,71 @@ PDQ3 = ${PDQ3D}/pdq3_cpu.c ${PDQ3D}/pdq3_sys.c ${PDQ3D}/pdq3_stddev.c \ ${PDQ3D}/pdq3_mem.c ${PDQ3D}/pdq3_debug.c ${PDQ3D}/pdq3_fdc.c PDQ3_OPT = -I ${PDQ3D} -DUSE_SIM_IMD + # # Emulator source files and compile time options # I7000D = I7000 I7090 = ${I7000D}/i7090_cpu.c ${I7000D}/i7090_sys.c ${I7000D}/i7090_chan.c \ - ${I7000D}/i7090_cdr.c ${I7000D}/i7090_cdp.c ${I7000D}/i7090_lpr.c \ - ${I7000D}/i7000_chan.c ${I7000D}/i7000_mt.c ${I7000D}/i7090_drum.c \ - ${I7000D}/i7090_hdrum.c ${I7000D}/i7000_chron.c ${I7000D}/i7000_dsk.c \ - ${I7000D}/i7000_com.c ${I7000D}/i7000_ht.c + ${I7000D}/i7090_cdr.c ${I7000D}/i7090_cdp.c ${I7000D}/i7090_lpr.c \ + ${I7000D}/i7000_chan.c ${I7000D}/i7000_mt.c ${I7000D}/i7090_drum.c \ + ${I7000D}/i7090_hdrum.c ${I7000D}/i7000_chron.c ${I7000D}/i7000_dsk.c \ + ${I7000D}/i7000_com.c ${I7000D}/i7000_ht.c I7090_OPT = -I $(I7000D) -DUSE_INT64 -DI7090 -DUSE_SIM_CARD I7080D = I7000 I7080 = ${I7000D}/i7080_cpu.c ${I7000D}/i7080_sys.c ${I7000D}/i7080_chan.c \ - ${I7000D}/i7080_drum.c ${I7000D}/i7000_cdp.c ${I7000D}/i7000_cdr.c \ - ${I7000D}/i7000_con.c ${I7000D}/i7000_chan.c ${I7000D}/i7000_lpr.c \ - ${I7000D}/i7000_mt.c ${I7000D}/i7000_chron.c ${I7000D}/i7000_dsk.c \ - ${I7000D}/i7000_com.c ${I7000D}/i7000_ht.c + ${I7000D}/i7080_drum.c ${I7000D}/i7000_cdp.c ${I7000D}/i7000_cdr.c \ + ${I7000D}/i7000_con.c ${I7000D}/i7000_chan.c ${I7000D}/i7000_lpr.c \ + ${I7000D}/i7000_mt.c ${I7000D}/i7000_chron.c ${I7000D}/i7000_dsk.c \ + ${I7000D}/i7000_com.c ${I7000D}/i7000_ht.c I7080_OPT = -I $(I7000D) -DI7080 -DUSE_SIM_CARD I7070D = I7000 I7070 = ${I7000D}/i7070_cpu.c ${I7000D}/i7070_sys.c ${I7000D}/i7070_chan.c \ - ${I7000D}/i7000_cdp.c ${I7000D}/i7000_cdr.c ${I7000D}/i7000_con.c \ - ${I7000D}/i7000_chan.c ${I7000D}/i7000_lpr.c ${I7000D}/i7000_mt.c \ - ${I7000D}/i7000_chron.c ${I7000D}/i7000_dsk.c ${I7000D}/i7000_com.c \ - ${I7000D}/i7000_ht.c + ${I7000D}/i7000_cdp.c ${I7000D}/i7000_cdr.c ${I7000D}/i7000_con.c \ + ${I7000D}/i7000_chan.c ${I7000D}/i7000_lpr.c ${I7000D}/i7000_mt.c \ + ${I7000D}/i7000_chron.c ${I7000D}/i7000_dsk.c ${I7000D}/i7000_com.c \ + ${I7000D}/i7000_ht.c I7070_OPT = -I $(I7000D) -DUSE_INT64 -DI7070 -DUSE_SIM_CARD I7010D = I7000 I7010 = ${I7000D}/i7010_cpu.c ${I7000D}/i7010_sys.c ${I7000D}/i7010_chan.c \ - ${I7000D}/i7000_cdp.c ${I7000D}/i7000_cdr.c ${I7000D}/i7000_con.c \ - ${I7000D}/i7000_chan.c ${I7000D}/i7000_lpr.c ${I7000D}/i7000_mt.c \ - ${I7000D}/i7000_chron.c ${I7000D}/i7000_dsk.c ${I7000D}/i7000_com.c \ - ${I7000D}/i7000_ht.c + ${I7000D}/i7000_cdp.c ${I7000D}/i7000_cdr.c ${I7000D}/i7000_con.c \ + ${I7000D}/i7000_chan.c ${I7000D}/i7000_lpr.c ${I7000D}/i7000_mt.c \ + ${I7000D}/i7000_chron.c ${I7000D}/i7000_dsk.c ${I7000D}/i7000_com.c \ + ${I7000D}/i7000_ht.c I7010_OPT = -I $(I7010D) -DI7010 -DUSE_SIM_CARD I704D = I7000 I704 = ${I7000D}/i7090_cpu.c ${I7000D}/i7090_sys.c ${I7000D}/i7090_chan.c \ - ${I7000D}/i7090_cdr.c ${I7000D}/i7090_cdp.c ${I7000D}/i7090_lpr.c \ - ${I7000D}/i7000_mt.c ${I7000D}/i7090_drum.c ${I7000D}/i7000_chan.c + ${I7000D}/i7090_cdr.c ${I7000D}/i7090_cdp.c ${I7000D}/i7090_lpr.c \ + ${I7000D}/i7000_mt.c ${I7000D}/i7090_drum.c ${I7000D}/i7000_chan.c I704_OPT = -I $(I7000D) -DUSE_INT64 -DI704 -DUSE_SIM_CARD I701D = I7000 I701 = ${I7000D}/i701_cpu.c ${I7000D}/i701_sys.c ${I7000D}/i701_chan.c \ - ${I7000D}/i7090_cdr.c ${I7000D}/i7090_cdp.c ${I7000D}/i7090_lpr.c \ - ${I7000D}/i7000_mt.c ${I7000D}/i7090_drum.c ${I7000D}/i7000_chan.c + ${I7000D}/i7090_cdr.c ${I7000D}/i7090_cdp.c ${I7000D}/i7090_lpr.c \ + ${I7000D}/i7000_mt.c ${I7000D}/i7090_drum.c ${I7000D}/i7000_chan.c I701_OPT = -I $(I7000D) -DUSE_INT64 -DI701 -DUSE_SIM_CARD - # -# Build everything (not the unsupported/incomplete simulators) +# Build everything (not the unsupported/incomplete or experimental simulators) # ALL = pdp1 pdp4 pdp7 pdp8 pdp9 pdp15 pdp11 pdp10 \ vax microvax3900 microvax1 rtvax1000 microvax2 vax730 vax750 vax780 vax8600 \ nova eclipse hp2100 hp3000 i1401 i1620 s3 altair altairz80 gri \ - i7094 ibm1130 id16 id32 sds lgp h316 \ - swtp6800mp-a swtp6800mp-a2 tx-0 ssem isys8010 isys8020 \ - b5500 i7090 i7080 i7070 i7010 i704 i701 pdp10-ka pdp10-ki - + i7094 ibm1130 id16 id32 sds lgp h316 cdc1700 \ + swtp6800mp-a swtp6800mp-a2 tx-0 ssem b5500 isys8010 isys8020 \ + isys8030 isys8024 imds-225 all : ${ALL} +EXPERIMENTAL = cdc1700 + +experimental : $(EXPERIMENTAL) + clean : ifeq ($(WIN32),) ${RM} -r ${BIN} @@ -1811,26 +1909,47 @@ ${BIN}swtp6800mp-a2${EXE} : ${SWTP6800MP-A2} ${SIM} ${BUILD_ROMS} ${MKDIRBIN} ${CC} ${SWTP6800MP-A2} ${SIM} ${SWTP6800_OPT} $(CC_OUTSPEC) ${LDFLAGS} - isys8010: ${BIN}isys8010${EXE} ${BIN}isys8010${EXE} : ${ISYS8010} ${SIM} ${BUILD_ROMS} -ifneq (1,$(CPP_BUILD)$(CPP_FORCE)) ${MKDIRBIN} ${CC} ${ISYS8010} ${SIM} ${ISYS8010_OPT} $(CC_OUTSPEC) ${LDFLAGS} -else - $(info isys8010 can't be built using C++) -endif isys8020: ${BIN}isys8020${EXE} ${BIN}isys8020${EXE} : ${ISYS8020} ${SIM} ${BUILD_ROMS} -ifneq (1,$(CPP_BUILD)$(CPP_FORCE)) ${MKDIRBIN} ${CC} ${ISYS8020} ${SIM} ${ISYS8020_OPT} $(CC_OUTSPEC) ${LDFLAGS} -else - $(info isys8020 can't be built using C++) -endif + +isys8024: ${BIN}isys8024${EXE} + +${BIN}isys8024${EXE} : ${ISYS8024} ${SIM} ${BUILD_ROMS} + ${MKDIRBIN} + ${CC} ${ISYS8024} ${SIM} ${ISYS8024_OPT} $(CC_OUTSPEC) ${LDFLAGS} + +isys8030: ${BIN}isys8030${EXE} + +${BIN}isys8030${EXE} : ${ISYS8030} ${SIM} ${BUILD_ROMS} + ${MKDIRBIN} + ${CC} ${ISYS8030} ${SIM} ${ISYS8030_OPT} $(CC_OUTSPEC) ${LDFLAGS} + +imds-225: ${BIN}imds-225${EXE} + +${BIN}imds-225${EXE} : ${IMDS-225} ${SIM} ${BUILD_ROMS} + ${MKDIRBIN} + ${CC} ${IMDS-225} ${SIM} ${IMDS-225_OPT} $(CC_OUTSPEC) ${LDFLAGS} + +ibmpc: ${BIN}ibmpc${EXE} + +${BIN}ibmpc${EXE} : ${IBMPC} ${SIM} ${BUILD_ROMS} + ${MKDIRBIN} + ${CC} ${IBMPC} ${SIM} ${IBMPC_OPT} $(CC_OUTSPEC) ${LDFLAGS} + +ibmpcxt: ${BIN}ibmpcxt${EXE} + +${BIN}ibmpcxt${EXE} : ${IBMPCXT} ${SIM} ${BUILD_ROMS} + ${MKDIRBIN} + ${CC} ${IBMPCXT} ${SIM} ${IBMPCXT_OPT} $(CC_OUTSPEC) ${LDFLAGS} tx-0 : ${BIN}tx-0${EXE} @@ -1844,6 +1963,12 @@ ${BIN}ssem${EXE} : ${SSEM} ${SIM} ${MKDIRBIN} ${CC} ${SSEM} ${SIM} ${SSEM_OPT} $(CC_OUTSPEC) ${LDFLAGS} +cdc1700 : ${BIN}cdc1700${EXE} + +${BIN}cdc1700${EXE} : ${CDC1700} ${SIM} + ${MKDIRBIN} + ${CC} ${CDC1700} ${SIM} ${CDC1700_OPT} ${CC_OUTSPEC} ${LDFLAGS} + besm6 : ${BIN}besm6${EXE} ${BIN}besm6${EXE} : ${BESM6} ${SIM} @@ -1921,6 +2046,8 @@ ${BIN}i701${EXE} : ${I701} ${SIM} ${CC} ${I701} ${SIM} ${I701_OPT} $(CC_OUTSPEC) ${LDFLAGS} + + # Front Panel API Demo/Test program frontpaneltest : ${BIN}frontpaneltest${EXE} diff --git a/scp.c b/scp.c index f62dcd0..56b85bf 100644 --- a/scp.c +++ b/scp.c @@ -581,6 +581,13 @@ t_stat sim_last_cmd_stat; /* Command Status */ static SCHTAB sim_stabr; /* Register search specifier */ static SCHTAB sim_staba; /* Memory search specifier */ +static DEBTAB sim_dflt_debug[] = { + {"EVENT", SIM_DBG_EVENT, "Event Dispatching"}, + {"ACTIVATE", SIM_DBG_ACTIVATE, "Event Scheduling"}, + {"AIO_QUEUE", SIM_DBG_AIO_QUEUE, "Asynchronous Event Queueing"}, + {0} +}; + static UNIT sim_step_unit = { UDATA (&step_svc, 0, 0) }; static UNIT sim_expect_unit = { UDATA (&expect_svc, 0, 0) }; #if defined USE_INT64 @@ -1326,6 +1333,7 @@ static const char simh_help[] = " The DO command allows command files to contain substitutable arguments.\n" " The string %%n, where n is between 1 and 9, is replaced with argument n\n" " from the DO command line. The string %%0 is replaced with .\n" + " The string %%* is replaced by the whole set of arguments (%%1 ... %%9).\n" " The sequences \\%% and \\\\ are replaced with the literal characters %% and \\,\n" " respectively. Arguments with spaces can be enclosed in matching single\n" " or double quotation marks.\n\n" @@ -1344,6 +1352,59 @@ static const char simh_help[] = " for the called command file, otherwise quiet mode is inherited from the\n" " calling context.\n" /***************** 80 character line width template *************************/ + "3Variable_Insertion\n" + " Built In variables %%DATE%%, %%TIME%%, %%DATETIME%%, %%LDATE%%, %%LTIME%%,\n" + " %%CTIME%%, %%DATE_YYYY%%, %%DATE_YY%%, %%DATE_YC%%, %%DATE_MM%%, %%DATE_MMM%%,\n" + " %%DATE_MONTH%%, %%DATE_DD%%, %%DATE_D%%, %%DATE_WYYYY%%, %%DATE_WW%%,\n" + " %%TIME_HH%%, %%TIME_MM%%, %%TIME_SS%%, %%STATUS%%, %%TSTATUS%%, %%SIM_VERIFY%%,\n" + " %%SIM_QUIET%%, %%SIM_MESSAGE%%\n\n" + "+Token %%0 expands to the command file name.\n" + "+Token %%n (n being a single digit) expands to the n'th argument\n" + "+Token %%* expands to the whole set of arguments (%%1 ... %%9)\n\n" + "+The input sequence \"%%%%\" represents a literal \"%%\", and \"\\\\\" represents a\n" + "+literal \"\\\". All other character combinations are rendered literally.\n\n" + "+Omitted parameters result in null-string substitutions.\n\n" + "+Tokens preceeded and followed by %% characters are expanded as environment\n" + "+variables, and if an environment variable isn't found then it can be one of\n" + "+several special variables:\n\n" + "++%%DATE%% yyyy-mm-dd\n" + "++%%TIME%% hh:mm:ss\n" + "++%%DATETIME%% yyyy-mm-ddThh:mm:ss\n" + "++%%LDATE%% mm/dd/yy (Locale Formatted)\n" + "++%%LTIME%% hh:mm:ss am/pm (Locale Formatted)\n" + "++%%CTIME%% Www Mmm dd hh:mm:ss yyyy (Locale Formatted)\n" + "++%%UTIME%% nnnn (Unix time - seconds since 1/1/1970)\n" + "++%%DATE_YYYY%% yyyy (0000-9999)\n" + "++%%DATE_YY%% yy (00-99)\n" + "++%%DATE_MM%% mm (01-12)\n" + "++%%DATE_MMM%% mmm (JAN-DEC)\n" + "++%%DATE_MONTH%% month (January-December)\n" + "++%%DATE_DD%% dd (01-31)\n" + "++%%DATE_WW%% ww (01-53) ISO 8601 week number\n" + "++%%DATE_WYYYY%% yyyy (0000-9999) ISO 8601 week year number\n" + "++%%DATE_D%% d (1-7) ISO 8601 day of week\n" + "++%%DATE_JJJ%% jjj (001-366) day of year\n" + "++%%DATE_19XX_YY%% yy A year prior to 2000 with the same\n" + "++++++++++ calendar days as the current year\n" + "++%%DATE_19XX_YYYY%% yyyy A year prior to 2000 with the same\n" + "++++++++++ calendar days as the current year\n" + "++%%TIME_HH%% hh (00-23)\n" + "++%%TIME_MM%% mm (00-59)\n" + "++%%TIME_SS%% ss (00-59)\n" + "++%%STATUS%% Status value from the last command executed\n" + "++%%TSTATUS%% The text form of the last status value\n" + "++%%SIM_VERIFY%% The Verify/Verbose mode of the current Do command file\n" + "++%%SIM_VERBOSE%% The Verify/Verbose mode of the current Do command file\n" + "++%%SIM_QUIET%% The Quiet mode of the current Do command file\n" + "++%%SIM_MESSAGE%% The message display status of the current Do command file\n\n" + "+Environment variable lookups are done first with the precise name between\n" + "+the %% characters and if that fails, then the name between the %% characters\n" + "+is upcased and a lookup of that valus is attempted.\n\n" + "+The first Space delimited token on the line is extracted in uppercase and\n" + "+then looked up as an environment variable. If found it the value is\n" + "+supstituted for the original string before expanding everything else. If\n" + "+it is not found, then the original beginning token on the line is left\n" + "+untouched.\n" #define HLP_GOTO "*Commands Executing_Command_Files GOTO" "3GOTO\n" " Commands in a command file execute in sequence until either an error\n" @@ -2063,6 +2124,7 @@ for (i = 1; i < argc; i++) { /* loop thru args */ sim_quiet = sim_switches & SWMASK ('Q'); /* -q means quiet */ sim_on_inherit = sim_switches & SWMASK ('O'); /* -o means inherit on state */ + sim_init_sock (); /* init socket capabilities */ AIO_INIT; /* init Asynch I/O */ if (sim_vm_init != NULL) /* call once only */ @@ -2105,6 +2167,11 @@ if (!sim_quiet) { } if (sim_dflt_dev == NULL) /* if no default */ sim_dflt_dev = sim_devices[0]; +if (((sim_dflt_dev->flags & DEV_DEBUG) == 0) && /* default device without debug? */ + (sim_dflt_dev->debflags == NULL)) { + sim_dflt_dev->flags |= DEV_DEBUG; /* connect default event debugging */ + sim_dflt_dev->debflags = sim_dflt_debug; + } if (*argv[0]) { /* sim name arg? */ char *np; /* "path.ini" */ @@ -3111,7 +3178,7 @@ return stat | SCPE_NOMESSAGE; /* suppress message sinc instr_size = sizeof input string buffer do_arg[10] = arguments - Token "%0" expands to the command file name. + Token %0 expands to the command file name. Token %n (n being a single digit) expands to the n'th argument Tonen %* expands to the whole set of arguments (%1 ... %9) @@ -3120,13 +3187,15 @@ return stat | SCPE_NOMESSAGE; /* suppress message sinc Omitted parameters result in null-string substitutions. - A Tokens preceeded and followed by % characters are expanded as environment + Tokens preceeded and followed by % characters are expanded as environment variables, and if one isn't found then can be one of several special variables: %DATE% yyyy-mm-dd %TIME% hh:mm:ss + %DATETIME% yyyy-mm-ddThh:mm:ss %STIME% hh_mm_ss %CTIME% Www Mmm dd hh:mm:ss yyyy + %UTIME% nnn (Unix time - seconds since 1/1/1970) %STATUS% Status value from the last command executed %TSTATUS% The text form of the last status value %SIM_VERIFY% The Verify/Verbose mode of the current Do command file @@ -3226,7 +3295,7 @@ for (; *ip && (op < oend); ) { ap = rbuf; } /* Locale oriented formatted date/time info */ - if (!strcmp ("LDATE", gbuf)) { + else if (!strcmp ("LDATE", gbuf)) { strftime (rbuf, sizeof(rbuf), "%x", tmnow); ap = rbuf; } @@ -3251,6 +3320,10 @@ for (; *ip && (op < oend); ) { #endif ap = rbuf; } + else if (!strcmp ("UTIME", gbuf)) { + sprintf (rbuf, "%" LL_FMT "d", (LL_TYPE)now); + ap = rbuf; + } /* Separate Date/Time info */ else if (!strcmp ("DATE_YYYY", gbuf)) {/* Year (0000-9999) */ strftime (rbuf, sizeof(rbuf), "%Y", tmnow); @@ -6750,32 +6823,32 @@ for (i = 1; (dptr = sim_devices[i]) != NULL; i++) { /* reposition all */ } stop_cpu = 0; sim_is_running = 1; /* flag running */ -if (sim_ttrun () != SCPE_OK) { /* set console mode */ +if ((r = sim_ttrun ()) != SCPE_OK) { /* set console mode */ sim_is_running = 0; /* flag idle */ sim_ttcmd (); - return SCPE_TTYERR; + return sim_messagef (SCPE_TTYERR, "sim_ttrun() returned: %s\n", sim_error_text (r)); } if ((r = sim_check_console (30)) != SCPE_OK) { /* check console, error? */ sim_is_running = 0; /* flag idle */ sim_ttcmd (); - return r; + sim_messagef (r, "sim_check_console () returned: %s\n", sim_error_text (r)); } if (signal (SIGINT, int_handler) == SIG_ERR) { /* set WRU */ sim_is_running = 0; /* flag idle */ sim_ttcmd (); - return SCPE_SIGERR; + return sim_messagef (SCPE_SIGERR, "Can't establish SIGINT"); } #ifdef SIGHUP if (signal (SIGHUP, int_handler) == SIG_ERR) { /* set WRU */ sim_is_running = 0; /* flag idle */ sim_ttcmd (); - return SCPE_SIGERR; + return sim_messagef (SCPE_SIGERR, "Can't establish SIGHUP"); } #endif if (signal (SIGTERM, int_handler) == SIG_ERR) { /* set WRU */ sim_is_running = 0; /* flag idle */ sim_ttcmd (); - return SCPE_SIGERR; + return sim_messagef (SCPE_SIGERR, "Can't establish SIGTERM"); } if (sim_step) /* set step timer */ sim_activate (&sim_step_unit, sim_step); @@ -8103,7 +8176,7 @@ CONST char *tptr; *status = SCPE_OK; val = strtotv ((CONST char *)cptr, &tptr, radix); -if ((cptr == tptr) || (val > max)) +if ((cptr == tptr) || ((max > 0) && (val > max))) *status = SCPE_ARG; else { while (sim_isspace (*tptr)) tptr++; @@ -10876,7 +10949,7 @@ int32 offset = 0; if (dptr->debflags == 0) return debtab_none; -dbits &= dptr->dctrl; /* Look for just the bits tha matched */ +dbits &= dptr->dctrl; /* Look for just the bits that matched */ /* Find matching words for bitmask */ diff --git a/scp.h b/scp.h index ef91c44..433fe45 100644 --- a/scp.h +++ b/scp.h @@ -256,7 +256,7 @@ void sim_debug_bits (uint32 dbits, DEVICE* dptr, BITFIELD* bitdefs, void sim_debug (uint32 dbits, void* dptr, const char *fmt, ...) GCC_FMT_ATTR(3, 4); #else void _sim_debug (uint32 dbits, void* dptr, const char *fmt, ...) GCC_FMT_ATTR(3, 4); -#define sim_debug(dbits, dptr, ...) do { if (sim_deb && dptr && ((dptr)->dctrl & dbits)) _sim_debug (dbits, dptr, __VA_ARGS__);} while (0) +#define sim_debug(dbits, dptr, ...) do { if (sim_deb && dptr && ((dptr)->dctrl & (dbits))) _sim_debug (dbits, dptr, __VA_ARGS__);} while (0) #endif #else #ifdef CANT_USE_MACRO_VA_ARGS diff --git a/sim_console.c b/sim_console.c index 3d4eb65..4cbe6e0 100644 --- a/sim_console.c +++ b/sim_console.c @@ -2645,7 +2645,10 @@ if (!sim_rem_master_mode) { if ((sim_con_ldsc.rxbps) && /* rate limiting && */ (sim_gtime () < sim_con_ldsc.rxnexttime)) /* too soon? */ return SCPE_OK; /* not yet */ - c = sim_os_poll_kbd (); /* get character */ + if (sim_ttisatty ()) + c = sim_os_poll_kbd (); /* get character */ + else + c = SCPE_OK; if (c == SCPE_STOP) { /* ^E */ stop_cpu = 1; /* Force a stop (which is picked up by sim_process_event */ return SCPE_OK; @@ -2984,7 +2987,11 @@ return r2; t_bool sim_ttisatty (void) { -return sim_os_ttisatty (); +static int answer = -1; + +if (answer == -1) + answer = sim_os_ttisatty (); +return (t_bool)answer; } @@ -3220,13 +3227,14 @@ return SCPE_OK; static t_stat sim_os_ttrun (void) { -if ((std_input) && /* If Not Background process? */ +if ((sim_ttisatty ()) && + (std_input) && /* If Not Background process? */ (std_input != INVALID_HANDLE_VALUE)) { if (!GetConsoleMode(std_input, &saved_input_mode)) - return SCPE_TTYERR; + return sim_messagef (SCPE_TTYERR, "GetConsoleMode() error: 0x%X\n", (unsigned int)GetLastError ()); if ((!SetConsoleMode(std_input, ENABLE_VIRTUAL_TERMINAL_INPUT)) && (!SetConsoleMode(std_input, RAW_MODE))) - return SCPE_TTYERR; + return sim_messagef (SCPE_TTYERR, "SetConsoleMode() error: 0x%X\n", (unsigned int)GetLastError ()); } if ((std_output) && /* If Not Background process? */ (std_output != INVALID_HANDLE_VALUE)) { @@ -3249,7 +3257,8 @@ if (sim_log) { _setmode (_fileno (sim_log), _O_TEXT); } sim_os_set_thread_priority (PRIORITY_NORMAL); -if ((std_input) && /* If Not Background process? */ +if ((sim_ttisatty ()) && + (std_input) && /* If Not Background process? */ (std_input != INVALID_HANDLE_VALUE) && (!SetConsoleMode(std_input, saved_input_mode))) /* Restore Normal mode */ return SCPE_TTYERR; @@ -3886,7 +3895,7 @@ static t_bool sim_os_poll_kbd_ready (int ms_timeout) fd_set readfds; struct timeval timeout; -if (!sim_os_ttisatty()) { /* skip if !tty */ +if (!sim_ttisatty()) { /* skip if !tty */ sim_os_ms_sleep (ms_timeout); return FALSE; } diff --git a/sim_defs.h b/sim_defs.h index 761a110..328f02c 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -108,6 +108,7 @@ #ifndef SIM_DEFS_H_ #define SIM_DEFS_H_ 0 +#include "sim_rev.h" #include #include #include @@ -846,6 +847,9 @@ struct MEMFILE { new macro will be provided that populates the new register structure */ #define REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \ #nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz) +/* Internal use ONLY (see below) Generic Register declaration for all fields */ +#define _REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \ + nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz) /* Right Justified Octal Register Data */ #define ORDATA(nm,loc,wd) #nm, &(loc), 8, (wd), 0, 1, NULL, NULL /* Right Justified Decimal Register Data */ @@ -882,9 +886,27 @@ struct MEMFILE { #define BITNCF(sz) {"", 0xffffffff, sz} /* Don't care Bit Field definition */ #define BITFFMT(nm,sz,fmt) {#nm, 0xffffffff, sz, NULL, #fmt}/* Bit Field definition with Output format */ #define BITFNAM(nm,sz,names) {#nm, 0xffffffff, sz, names} /* Bit Field definition with value->name map */ +/* Arrayed register whose data is part of the UNIT structure */ +#define URDATA(nm,loc,rdx,wd,off,dep,fl) \ + _REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_UNIT),0,0) +/* Arrayed register whose data is part of an arbitrary structure */ +#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \ + _REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_STRUCT),0,(siz)) +/* Same as above, but with additional description initializer */ +#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \ + _REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_UNIT),0,0) +#define STRDATAD(nm,loc,rdx,wd,off,dep,siz,fl,desc) \ + _REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_STRUCT),0,(siz)) +/* Same as above, but with additional description initializer, and bitfields */ +#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \ + _REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_UNIT),0,0) +#define STRDATADF(nm,loc,rdx,wd,off,dep,siz,fl,desc,flds) \ + _REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_STRUCT),0,(siz)) #else /* For non-STD-C compiler which can't stringify macro arguments with # */ #define REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \ "nm", &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz) +#define _REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \ + nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz) #define ORDATA(nm,loc,wd) "nm", &(loc), 8, (wd), 0, 1, NULL, NULL #define DRDATA(nm,loc,wd) "nm", &(loc), 10, (wd), 0, 1, NULL, NULL #define HRDATA(nm,loc,wd) "nm", &(loc), 16, (wd), 0, 1, NULL, NULL @@ -912,25 +934,21 @@ struct MEMFILE { #define BITNCF(sz) {"", 0xffffffff, sz} /* Don't care Bit Field definition */ #define BITFFMT(nm,sz,fmt) {"nm", 0xffffffff, sz, NULL, "fmt"}/* Bit Field definition with Output format */ #define BITFNAM(nm,sz,names) {"nm", 0xffffffff, sz, names} /* Bit Field definition with value->name map */ +#define URDATA(nm,loc,rdx,wd,off,dep,fl) \ + _REGDATA("nm",(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_UNIT),0,0) +#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \ + _REGDATA("nm",(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_STRUCT),0,(siz)) +#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \ + _REGDATA("nm",(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_UNIT),0,0) +#define STRDATAD(nm,loc,rdx,wd,off,dep,siz,fl,desc) \ + _REGDATA("nm",(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_STRUCT),0,(siz)) +#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \ + _REGDATA("nm",(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_UNIT),0,0) +#define STRDATADF(nm,loc,rdx,wd,off,dep,siz,fl,desc,flds) \ + _REGDATA("nm",(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_STRUCT),0,(siz)) #endif #define ENDBITS {NULL} /* end of bitfield list */ -/* Arrayed register whose data is part of the UNIT structure */ -#define URDATA(nm,loc,rdx,wd,off,dep,fl) \ - REGDATA(nm,(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_UNIT),0,0) -/* Arrayed register whose data is part of an arbitrary structure */ -#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \ - REGDATA(nm,(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_STRUCT),0,(siz)) -/* Same as above, but with additional description initializer */ -#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \ - REGDATA(nm,(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_UNIT),0,0) -#define STRDATAD(nm,loc,rdx,wd,off,dep,siz,fl,desc) \ - REGDATA(nm,(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_STRUCT),0,(siz)) -/* Same as above, but with additional description initializer, and bitfields */ -#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \ - REGDATA(nm,(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_UNIT),0,0) -#define STRDATADF(nm,loc,rdx,wd,off,dep,siz,fl,desc,flds) \ - REGDATA(nm,(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_STRUCT),0,(siz)) /* Function prototypes */ diff --git a/sim_timer.c b/sim_timer.c index 41c06ed..25298a4 100644 --- a/sim_timer.c +++ b/sim_timer.c @@ -161,6 +161,7 @@ static uint32 sim_os_clock_resoluton_ms = 0; static uint32 sim_os_tick_hz = 0; static uint32 sim_idle_stable = SIM_IDLE_STDFLT; static uint32 sim_idle_calib_pct = 0; +static double sim_timer_stop_time = 0; static uint32 sim_rom_delay = 0; static uint32 sim_throt_ms_start = 0; static uint32 sim_throt_ms_stop = 0; @@ -760,11 +761,13 @@ static uint32 sim_idle_cyc_ms = 0; /* Cycles per millisecon UNIT sim_timer_units[SIM_NTIMERS+1]; /* Clock assist units */ /* one for each timer and one for an internal */ /* clock if no clocks are registered. */ +UNIT sim_stop_unit; /* Stop unit */ UNIT sim_internal_timer_unit; /* Internal calibration timer */ UNIT sim_throttle_unit; /* one for throttle */ t_stat sim_throt_svc (UNIT *uptr); t_stat sim_timer_tick_svc (UNIT *uptr); +t_stat sim_timer_stop_svc (UNIT *uptr); #define DBG_IDL TIMER_DBG_IDLE /* idling */ #define DBG_QUE TIMER_DBG_QUEUE /* queue activities */ @@ -775,6 +778,7 @@ t_stat sim_timer_tick_svc (UNIT *uptr); #define DBG_THR 0x040 /* throttle activities */ #define DBG_ACK 0x080 /* interrupt acknowledgement activities */ #define DBG_CHK 0x100 /* check scheduled activation time*/ +#define DBG_INT 0x200 /* internal timer activities */ DEBTAB sim_timer_debug[] = { {"TRACE", DBG_TRC, "Trace routine calls"}, {"IDLE", DBG_IDL, "Idling activities"}, @@ -782,6 +786,7 @@ DEBTAB sim_timer_debug[] = { {"IACK", DBG_ACK, "interrupt acknowledgement activities"}, {"CALIB", DBG_CAL, "Calibration activities"}, {"TIME", DBG_TIM, "Activation and scheduling activities"}, + {"INTER", DBG_INT, "Internal timer activities"}, {"THROT", DBG_THR, "Throttling activities"}, {"MUX", DBG_MUX, "Tmxr scheduling activities"}, {"CHECK", DBG_CHK, "Check scheduled activation time"}, @@ -791,6 +796,7 @@ DEBTAB sim_timer_debug[] = { /* Forward device declarations */ extern DEVICE sim_timer_dev; extern DEVICE sim_throttle_dev; +extern DEVICE sim_stop_dev; void sim_rtcn_init_all (void) @@ -900,18 +906,11 @@ if (rtc_ticks[tmr] < ticksper) /* 1 sec yet? */ return rtc_currd[tmr]; rtc_ticks[tmr] = 0; /* reset ticks */ rtc_elapsed[tmr] = rtc_elapsed[tmr] + 1; /* count sec */ -if (sim_throt_type != SIM_THROT_NONE) { - rtc_gtime[tmr] = sim_gtime(); /* save instruction time */ - rtc_currd[tmr] = (int32)(sim_throt_cps / ticksper); /* use throttle calibration */ - ++rtc_calibrations[tmr]; /* count calibrations */ - sim_debug (DBG_CAL, &sim_timer_dev, "using throttle calibrated value - result: %d\n", rtc_currd[tmr]); - return rtc_currd[tmr]; - } if (!rtc_avail) /* no timer? */ return rtc_currd[tmr]; if (sim_calb_tmr != tmr) { rtc_currd[tmr] = (int32)(sim_timer_inst_per_sec()/ticksper); - sim_debug (DBG_CAL, &sim_timer_dev, "calibrated calibrated tmr=%d against system tmr=%d, tickper=%d (result: %d)\n", tmr, sim_calb_tmr, ticksper, rtc_currd[tmr]); + sim_debug (DBG_CAL, &sim_timer_dev, "calibrated calibrated tmr=%d against internal system tmr=%d, tickper=%d (result: %d)\n", tmr, sim_calb_tmr, ticksper, rtc_currd[tmr]); return rtc_currd[tmr]; } new_rtime = sim_os_msec (); /* wall time */ @@ -1029,6 +1028,7 @@ for (tmr=0; tmr<=SIM_NTIMERS; tmr++) { sim_timer_units[tmr].flags = UNIT_DIS | UNIT_IDLE; sim_clock_cosched_queue[tmr] = QUEUE_LIST_END; } +sim_stop_unit.action = &sim_timer_stop_svc; SIM_INTERNAL_UNIT.flags = UNIT_IDLE; sim_register_internal_device (&sim_timer_dev); /* Register Clock Assist device */ sim_throttle_unit.action = &sim_throt_svc; @@ -1304,6 +1304,26 @@ sim_idle_calib_pct = (uint32)newpct; return SCPE_OK; } +/* Set stop time */ + +t_stat sim_timer_set_stop (int32 flag, CONST char *cptr) +{ +t_stat r; +t_value stop_time; + +if (cptr == NULL) + return SCPE_ARG; +stop_time = get_uint (cptr, 10, 0, &r); +if (r != SCPE_OK) + return r; +if (stop_time <= (t_value)sim_gtime()) + return SCPE_ARG; +sim_register_internal_device (&sim_stop_dev); /* Register Stop Device */ +sim_timer_stop_time = (double)stop_time; +sim_activate_abs (&sim_stop_unit, (int32)(sim_timer_stop_time - sim_gtime())); +return SCPE_OK; +} + /* Set/Clear asynch */ t_stat sim_timer_set_async (int32 flag, CONST char *cptr) @@ -1331,6 +1351,7 @@ static CTAB set_timer_tab[] = { { "CATCHUP", &sim_timer_set_catchup, 1 }, { "NOCATCHUP", &sim_timer_set_catchup, 0 }, { "CALIB", &sim_timer_set_idle_pct, 0 }, + { "STOP", &sim_timer_set_stop, 0 }, { NULL, NULL, 0 } }; @@ -1350,6 +1371,11 @@ static const char *sim_int_timer_description (DEVICE *dptr) return "Internal Timer"; } +static const char *sim_int_stop_description (DEVICE *dptr) +{ +return "Stop facility"; +} + static const char *sim_throttle_description (DEVICE *dptr) { return "Throttle facility"; @@ -1359,7 +1385,8 @@ DEVICE sim_timer_dev = { "INT-CLOCK", sim_timer_units, sim_timer_reg, sim_timer_mod, SIM_NTIMERS+1, 0, 0, 0, 0, 0, NULL, NULL, &sim_timer_clock_reset, NULL, NULL, NULL, - NULL, DEV_DEBUG | DEV_NOSAVE, 0, sim_timer_debug}; + NULL, DEV_DEBUG | DEV_NOSAVE, 0, + sim_timer_debug}; DEVICE sim_int_timer_dev = { "INT-TIMER", &sim_internal_timer_unit, NULL, NULL, @@ -1367,6 +1394,14 @@ DEVICE sim_int_timer_dev = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, DEV_NOSAVE}; +DEVICE sim_stop_dev = { + "INT-STOP", &sim_stop_unit, NULL, NULL, + 1, 0, 0, 0, 0, 0, + NULL, NULL, NULL, NULL, NULL, NULL, + NULL, DEV_NOSAVE, 0, + NULL, NULL, NULL, NULL, NULL, NULL, + sim_int_stop_description}; + DEVICE sim_throttle_dev = { "INT-THROTTLE", &sim_throttle_unit, sim_throttle_reg, NULL, 1}; @@ -1607,7 +1642,10 @@ else { } } sim_register_internal_device (&sim_throttle_dev); /* Register Throttle Device */ -sim_throt_cps = SIM_INITIAL_IPS; /* Initial value while correct one is determined */ +if (sim_throt_type == SIM_THROT_SPC) /* Set initial value while correct one is determined */ + sim_throt_cps = (int32)((1000.0 * sim_throt_val) / (double)sim_throt_sleep_time); +else + sim_throt_cps = SIM_INITIAL_IPS; return SCPE_OK; } @@ -1680,18 +1718,21 @@ int32 tmr; uint32 delta_ms; double a_cps, d_cps; -if (sim_throt_type == SIM_THROT_SPC) { /* Non dynamic? */ - sim_throt_state = SIM_THROT_STATE_THROTTLE; /* force state */ - sim_throt_wait = sim_throt_val; - } switch (sim_throt_state) { case SIM_THROT_STATE_INIT: /* take initial reading */ sim_idle_ms_sleep (sim_idle_rate_ms); /* start on a tick boundary to calibrate */ sim_throt_ms_start = sim_os_msec (); sim_throt_inst_start = sim_gtime(); - sim_throt_wait = SIM_THROT_WST; - sim_throt_state = SIM_THROT_STATE_TIME; /* next state */ + if (sim_throt_type != SIM_THROT_SPC) { /* dynamic? */ + sim_throt_wait = SIM_THROT_WST; + sim_throt_state = SIM_THROT_STATE_TIME; /* next state */ + } + else { /* Non dynamic? */ + sim_throt_wait = sim_throt_val; + sim_throt_state = SIM_THROT_STATE_THROTTLE; /* force state */ + sim_throt_cps = (int32)((1000.0 * sim_throt_val) / (double)sim_throt_sleep_time); + } sim_debug (DBG_THR, &sim_timer_dev, "sim_throt_svc(INIT) Starting. Values wait = %d\n", sim_throt_wait); break; /* reschedule */ @@ -1753,10 +1794,11 @@ switch (sim_throt_state) { case SIM_THROT_STATE_THROTTLE: /* throttling */ sim_idle_ms_sleep (sim_throt_sleep_time); delta_ms = sim_os_msec () - sim_throt_ms_start; - if (sim_throt_type != SIM_THROT_SPC) { /* when not dynamic throttling */ - if (delta_ms >= 10000) { /* recompute every 10 sec */ - double delta_insts = sim_gtime() - sim_throt_inst_start; - a_cps = (delta_insts * 1000.0) / (double) delta_ms; + if (delta_ms >= 10000) { /* recompute every 10 sec */ + double delta_insts = sim_gtime() - sim_throt_inst_start; + + a_cps = (delta_insts * 1000.0) / (double) delta_ms; + if (sim_throt_type != SIM_THROT_SPC) { /* when not dynamic throttling */ if (sim_throt_type == SIM_THROT_MCYC) /* calc desired cps */ d_cps = (double) sim_throt_val * 1000000.0; else if (sim_throt_type == SIM_THROT_KCYC) @@ -1768,12 +1810,15 @@ switch (sim_throt_state) { sim_debug (DBG_THR, &sim_timer_dev, "sim_throt_svc() Recalibrating throttle based on values a_cps = %f, d_cps = %f\n", a_cps, d_cps); } - sim_throt_ms_start = sim_os_msec (); sim_throt_inst_start = sim_gtime(); } + else { /* record instruction rate */ + sim_throt_cps = (int32)a_cps; + sim_debug (DBG_THR, &sim_timer_dev, "sim_throt_svc() Recalibrating Special %d/%u Cycles Per Second of %f\n", + sim_throt_wait, sim_throt_sleep_time, sim_throt_cps); + } + sim_throt_ms_start = sim_os_msec (); } - else /* record instruction rate */ - sim_throt_cps = (int32)((1000.0 * sim_throt_val) / (double)delta_ms); break; } @@ -1807,6 +1852,9 @@ if (sim_clock_cosched_queue[tmr] != QUEUE_LIST_END) if ((stat == SCPE_OK) && (sim_cosched_interval[tmr] <= 0) && (sim_clock_cosched_queue[tmr] != QUEUE_LIST_END)) { + UNIT *sptr = sim_clock_cosched_queue[tmr]; + UNIT *cptr = QUEUE_LIST_END; + if (rtc_clock_catchup_eligible[tmr]) { /* calibration started? */ struct timespec now; double skew; @@ -1817,34 +1865,45 @@ if ((stat == SCPE_OK) && if (fabs(skew) > fabs(rtc_clock_skew_max[tmr])) rtc_clock_skew_max[tmr] = skew; } + /* First gather the queued events that are scheduled for now */ do { - UNIT *cptr = sim_clock_cosched_queue[tmr]; + cptr = sim_clock_cosched_queue[tmr]; sim_clock_cosched_queue[tmr] = cptr->next; - cptr->next = NULL; - cptr->cancel = NULL; - cptr->time = 0; if (sim_clock_cosched_queue[tmr] != QUEUE_LIST_END) { sim_clock_cosched_queue[tmr]->time += sim_cosched_interval[tmr]; sim_cosched_interval[tmr] = sim_clock_cosched_queue[tmr]->time; } else sim_cosched_interval[tmr] = 0; + } while ((sim_cosched_interval[tmr] <= 0) && + (sim_clock_cosched_queue[tmr] != QUEUE_LIST_END)); + if (cptr != QUEUE_LIST_END) + cptr->next = QUEUE_LIST_END; + /* Now dispatch that list (in order). */ + while (sptr != QUEUE_LIST_END) { + cptr = sptr; + sptr = sptr->next; + cptr->next = NULL; + cptr->cancel = NULL; cptr->time = 0; - sim_debug (DBG_QUE, &sim_timer_dev, "sim_timer_tick_svc(tmr=%d) - coactivating %s", tmr, sim_uname (cptr)); if (cptr->usecs_remaining) { - sim_debug (DBG_QUE, &sim_timer_dev, " remnant: %.0f - next %s after cosched interval: %d ticks\n", cptr->usecs_remaining, (sim_clock_cosched_queue[tmr] != QUEUE_LIST_END) ? sim_uname (sim_clock_cosched_queue[tmr]) : "", sim_cosched_interval[tmr]); + sim_debug (DBG_QUE, &sim_timer_dev, " remnant: %.0f - next %s after cosched interval: %d ticks\n", cptr->usecs_remaining, (sptr != QUEUE_LIST_END) ? sim_uname (sptr) : "", sim_cosched_interval[tmr]); sim_timer_activate_after (cptr, cptr->usecs_remaining); } else { - sim_debug (DBG_QUE, &sim_timer_dev, " - next %s after cosched interval: %d ticks\n", (sim_clock_cosched_queue[tmr] != QUEUE_LIST_END) ? sim_uname (sim_clock_cosched_queue[tmr]) : "", sim_cosched_interval[tmr]); + sim_debug (DBG_QUE, &sim_timer_dev, " - next %s after cosched interval: %d ticks\n", (sptr != QUEUE_LIST_END) ? sim_uname (sptr) : "", sim_cosched_interval[tmr]); _sim_activate (cptr, 0); } - } while ((sim_cosched_interval[tmr] <= 0) && - (sim_clock_cosched_queue[tmr] != QUEUE_LIST_END)); + } } return stat; } +t_stat sim_timer_stop_svc (UNIT *uptr) +{ +return SCPE_STOP; +} + void sim_rtcn_get_time (struct timespec *now, int tmr) { sim_debug (DBG_CAL, &sim_timer_dev, "sim_rtcn_get_time(tmr=%d)\n", tmr); @@ -2074,6 +2133,7 @@ static int32 sim_int_clk_tps; static t_stat sim_timer_clock_tick_svc (UNIT *uptr) { +sim_debug(DBG_INT, &sim_timer_dev, "sim_timer_clock_tick_svc()\n"); sim_rtcn_calb (sim_int_clk_tps, SIM_INTERNAL_CLK); sim_activate_after (uptr, 1000000/sim_int_clk_tps); /* reactivate unit */ return SCPE_OK; @@ -2127,7 +2187,7 @@ if (tmr == SIM_NTIMERS) { /* None found? */ } /* Start the internal timer */ sim_calb_tmr = SIM_NTIMERS; - sim_debug (DBG_CAL, &sim_timer_dev, "_rtcn_configure_calibrated_clock(newtmr=%d) - Starting Internal Calibrated Timer at %dHz\n", newtmr, sim_int_clk_tps); + sim_debug (DBG_CAL|DBG_INT, &sim_timer_dev, "_rtcn_configure_calibrated_clock(newtmr=%d) - Starting Internal Calibrated Timer at %dHz\n", newtmr, sim_int_clk_tps); SIM_INTERNAL_UNIT.action = &sim_timer_clock_tick_svc; SIM_INTERNAL_UNIT.flags = UNIT_IDLE; sim_register_internal_device (&sim_int_timer_dev); /* Register Internal timer device */ @@ -2140,7 +2200,7 @@ if ((tmr == newtmr) && (sim_calb_tmr == newtmr)) /* already set? */ return; if (sim_calb_tmr == SIM_NTIMERS) { /* was old the internal timer? */ - sim_debug (DBG_CAL, &sim_timer_dev, "_rtcn_configure_calibrated_clock(newtmr=%d) - Stopping Internal Calibrated Timer, New Timer = %d (%dHz)\n", newtmr, tmr, rtc_hz[tmr]); + sim_debug (DBG_CAL|DBG_INT, &sim_timer_dev, "_rtcn_configure_calibrated_clock(newtmr=%d) - Stopping Internal Calibrated Timer, New Timer = %d (%dHz)\n", newtmr, tmr, rtc_hz[tmr]); rtc_initd[SIM_NTIMERS] = 0; rtc_hz[SIM_NTIMERS] = 0; sim_register_clock_unit_tmr (NULL, SIM_INTERNAL_CLK); @@ -2166,7 +2226,7 @@ else { } rtc_hz[sim_calb_tmr] = 0; /* back to 0 */ } - sim_debug (DBG_CAL, &sim_timer_dev, "_rtcn_configure_calibrated_clock(newtmr=%d) - Changing Calibrated Timer from %d (%dHz) to %d (%dHz)\n", newtmr, sim_calb_tmr, rtc_hz[sim_calb_tmr], tmr, rtc_hz[tmr]); + sim_debug (DBG_CAL|DBG_INT, &sim_timer_dev, "_rtcn_configure_calibrated_clock(newtmr=%d) - Changing Calibrated Timer from %d (%dHz) to %d (%dHz)\n", newtmr, sim_calb_tmr, rtc_hz[sim_calb_tmr], tmr, rtc_hz[tmr]); sim_calb_tmr = tmr; } sim_calb_tmr = tmr; @@ -2179,6 +2239,7 @@ _rtcn_configure_calibrated_clock (sim_calb_tmr); sim_timer_dev.description = &sim_timer_description; sim_throttle_dev.description = &sim_throttle_description; sim_int_timer_dev.description = &sim_int_timer_description; +sim_stop_dev.description = &sim_int_stop_description; if (sim_switches & SWMASK ('P')) { sim_cancel (&SIM_INTERNAL_UNIT); sim_calb_tmr = -1; @@ -2190,6 +2251,8 @@ void sim_start_timer_services (void) { sim_debug (DBG_TRC, &sim_timer_dev, "sim_start_timer_services()\n"); _rtcn_configure_calibrated_clock (sim_calb_tmr); +if (sim_timer_stop_time > sim_gtime()) + sim_activate_abs (&sim_stop_unit, (int32)(sim_timer_stop_time - sim_gtime())); #if defined(SIM_ASYNCH_CLOCKS) pthread_mutex_lock (&sim_timer_lock); if (sim_asynch_timer) { @@ -2360,7 +2423,7 @@ if ((sim_calb_tmr != -1) && (rtc_hz[sim_calb_tmr])) { /* Calibrated Timer uint32 usecs_til_calib = (uint32)ceil(inst_til_calib / inst_per_usec); if (uptr != &sim_timer_units[sim_calb_tmr]) { /* Not scheduling calibrated timer? */ - if (inst_delay_d >= (double)inst_til_calib) { /* long wait? */ + if (inst_delay_d > (double)inst_til_calib) { /* long wait? */ stat = sim_clock_coschedule_tmr (uptr, sim_calb_tmr, ticks_til_calib - 1); uptr->usecs_remaining = (stat == SCPE_OK) ? usec_delay - usecs_til_calib : 0.0; sim_debug (DBG_TIM, &sim_timer_dev, "sim_timer_activate_after(%s, %.0f usecs) - coscheduling with with calibrated timer(%d), ticks=%d, usecs_remaining=%.0f usecs, inst_til_tick=%d\n",