diff --git a/descrip.mms b/descrip.mms index f90e3568..d5c1932b 100644 --- a/descrip.mms +++ b/descrip.mms @@ -341,7 +341,7 @@ ID16_SOURCE = $(ID16_DIR)ID16_CPU.C,$(ID16_DIR)ID16_SYS.C,$(ID16_DIR)ID_DP.C,\ $(ID16_DIR)ID_IO.C,$(ID16_DIR)ID_LP.C,$(ID16_DIR)ID_MT.C,\ $(ID16_DIR)ID_PAS.C,$(ID16_DIR)ID_PT.C,$(ID16_DIR)ID_TT.C,\ $(ID16_DIR)ID_UVC.C,$(ID16_DIR)ID16_DBOOT.C,$(ID16_DIR)ID_TTP.C -ID16_OPTIONS = /INCL=($(SIMH_DIR),$(ID16_DIR))/DEF=($(CC_DEFS)) +ID16_OPTIONS = /INCL=($(SIMH_DIR),$(ID16_DIR))/DEF=($(CC_DEFS),"IFP_IN_MEM=1") # # Interdata 32-bit CPU. diff --git a/makefile b/makefile index 2c0376ae..ddbb1731 100644 --- a/makefile +++ b/makefile @@ -95,12 +95,32 @@ ifneq (,${GREP_OPTIONS}) $(info unset the GREP_OPTIONS environment variable to use this makefile) $(error 1) endif -ifeq (old,$(shell gmake --version /dev/null 2>&1 | grep 'GNU Make' | awk '{ if ($$3 < "3.81") {print "old"} }')) - GMAKE_VERSION = $(shell gmake --version /dev/null 2>&1 | grep 'GNU Make' | awk '{ print $$3 }') +ifneq ($(findstring Windows,${OS}),) + ifeq ($(findstring .exe,${SHELL}),.exe) + # MinGW + WIN32 := 1 + # Tests don't run under MinGW + TESTS := 0 + else # Msys or cygwin + ifeq (MINGW,$(findstring MINGW,$(shell uname))) + $(info *** This makefile can not be used with the Msys bash shell) + $(error Use build_mingw.bat ${MAKECMDGOALS} from a Windows command prompt) + endif + endif +endif +ifeq ($(WIN32),) + SIM_MAJOR=$(shell grep SIM_MAJOR sim_rev.h | awk '{ print $$3 }') + GMAKE_VERSION = $(shell $(MAKE) --version /dev/null 2>&1 | grep 'GNU Make' | awk '{ print $$3 }') + OLD = $(shell echo $(GMAKE_VERSION) | awk '{ if ($$1 < "3.81") {print "old"} }') +else + SIM_MAJOR=$(shell for /F "tokens=3" %%i in ('findstr /c:"SIM_MAJOR" sim_rev.h') do echo %%i) + GMAKE_VERSION = $(shell for /F "tokens=3" %%i in ('$(MAKE) --version ^| findstr /c:"GNU Make"') do echo %%i) + OLD = $(shell cmd /e:on /c "if $(GMAKE_VERSION) LSS 3.81 echo old") +endif +ifeq ($(OLD),old) $(warning *** Warning *** GNU Make Version $(GMAKE_VERSION) is too old to) $(warning *** Warning *** fully process this makefile) endif -SIM_MAJOR=$(shell grep SIM_MAJOR sim_rev.h | awk '{ print $$3 }') BUILD_SINGLE := ${MAKECMDGOALS} $(BLANK_SUFFIX) BUILD_MULTIPLE_VERB = is # building the pdp1, pdp11, tx-0, or any microvax simulator could use video support @@ -168,19 +188,6 @@ ifeq (3,${SIM_MAJOR}) # simh v3 DOES not have any video support VIDEO_USEFUL = endif -ifneq ($(findstring Windows,${OS}),) - ifeq ($(findstring .exe,${SHELL}),.exe) - # MinGW - WIN32 := 1 - # Tests don't run under MinGW - TESTS := 0 - else # Msys or cygwin - ifeq (MINGW,$(findstring MINGW,$(shell uname))) - $(info *** This makefile can not be used with the Msys bash shell) - $(error Use build_mingw.bat ${MAKECMDGOALS} from a Windows command prompt) - endif - endif -endif find_exe = $(abspath $(strip $(firstword $(foreach dir,$(strip $(subst :, ,${PATH})),$(wildcard $(dir)/$(1)))))) find_lib = $(abspath $(strip $(firstword $(foreach dir,$(strip ${LIBPATH}),$(wildcard $(dir)/lib$(1).${LIBEXT}))))) @@ -599,6 +606,18 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) endif endif endif + ifneq (,$(call find_include,editline/readline)) + OS_CCDEFS += -DHAVE_EDITLINE + OS_LDFLAGS += -ledit + ifneq (Darwin,$(OSTYPE)) + # The doc says termcap is needed, though reality suggests + # otherwise. Put it in anyway, it can't hurt. + ifneq (,$(call find_lib,termcap)) + OS_LDFLAGS += -ltermcap + endif + endif + $(info using libedit: $(call find_include,editline/readline)) + endif ifneq (,$(call find_include,utime)) OS_CCDEFS += -DHAVE_UTIME endif @@ -1117,18 +1136,20 @@ else $(info Cloning the windows-build dependencies into $(abspath ..)/windows-build) $(shell git clone https://github.com/simh/windows-build ../windows-build) else - $(info ***********************************************************************) - $(info ***********************************************************************) - $(info ** This build is operating without the required windows-build **) - $(info ** components and therefore will produce less than optimal **) - $(info ** simulator operation and features. **) - $(info ** Download the file: **) - $(info ** https://github.com/simh/windows-build/archive/windows-build.zip **) - $(info ** Extract the windows-build-windows-build folder it contains to **) - $(info ** $(abspath ..\) **) - $(info ***********************************************************************) - $(info ***********************************************************************) - $(info .) + ifneq (3,${SIM_MAJOR}) + $(info ***********************************************************************) + $(info ***********************************************************************) + $(info ** This build is operating without the required windows-build **) + $(info ** components and therefore will produce less than optimal **) + $(info ** simulator operation and features. **) + $(info ** Download the file: **) + $(info ** https://github.com/simh/windows-build/archive/windows-build.zip **) + $(info ** Extract the windows-build-windows-build folder it contains to **) + $(info ** $(abspath ..\) **) + $(info ***********************************************************************) + $(info ***********************************************************************) + $(info .) + endif endif else # Version check on windows-build @@ -1444,7 +1465,7 @@ ID16 = ${ID16D}/id16_cpu.c ${ID16D}/id16_sys.c ${ID16D}/id_dp.c \ ${ID16D}/id_fd.c ${ID16D}/id_fp.c ${ID16D}/id_idc.c ${ID16D}/id_io.c \ ${ID16D}/id_lp.c ${ID16D}/id_mt.c ${ID16D}/id_pas.c ${ID16D}/id_pt.c \ ${ID16D}/id_tt.c ${ID16D}/id_uvc.c ${ID16D}/id16_dboot.c ${ID16D}/id_ttp.c -ID16_OPT = -I ${ID16D} +ID16_OPT = -DIFP_IN_MEM -I ${ID16D} ID32D = Interdata diff --git a/scp.c b/scp.c index 6bfbdc01..b26ac42e 100644 --- a/scp.c +++ b/scp.c @@ -23,6 +23,8 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 01-Oct-22 RMS Replaced readline with editline due to licensing issues (Paul Koning) + 15-Aug-22 RMS Fixed inconsistent SIM_HAVE_DLOPEN naming (Walter Mueller) 06-Mar-22 RMS Removed UNIT_RAW support 21-Oct-21 RMS Fixed bug in byte deposits if aincr > 1 20=Sep-21 RMS Fixed bug in nested DO recognition (per Mark Pizzolato) @@ -242,8 +244,8 @@ #include #include -#if defined(SIM_HAVE_DLOPEN) /* Dynamic Readline support */ -#include +#if defined(HAVE_EDITLINE) /* Editline command line editing */ +#include #endif /* Search definitions */ @@ -712,10 +714,6 @@ t_bool lookswitch; t_stat stat; CTAB *cmdp; -#if defined (__MWERKS__) && defined (macintosh) -argc = ccommand (&argv); -#endif - *cbuf = 0; /* init arg buffer */ sim_switches = 0; /* init switches */ lookswitch = TRUE; @@ -808,8 +806,13 @@ while (stat != SCPE_EXIT) { /* in case exit */ cptr = (*sim_vm_read) (cbuf, CBUFSIZE, stdin); } else cptr = read_line_p ("sim> ", cbuf, CBUFSIZE, stdin);/* read with prompt*/ - if (cptr == NULL) /* ignore EOF */ - continue; + if (cptr == NULL) { /* EOF? */ + if (sim_ttisatty ()) { /* on a real console? */ + printf ("\n"); /* ignore */ + continue; + } + else break; /* give up */ + } if (*cptr == 0) /* ignore blank */ continue; sub_args (cbuf, gbuf, CBUFSIZE, cmdargs); /* substitute arguments */ @@ -3696,43 +3699,15 @@ return read_line_p (NULL, cptr, size, stream); char *read_line_p (char *prompt, char *cptr, int32 size, FILE *stream) { char *tptr; -#if defined(SIM_HAVE_DLOPEN) -static int initialized = 0; -static char *(*p_readline)(const char *) = NULL; -static void (*p_add_history)(const char *) = NULL; -if (!initialized) { - initialized = 1; - void *handle; - -#define __STR_QUOTE(tok) #tok -#define __STR(tok) __STR_QUOTE(tok) - handle = dlopen("libncurses." __STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); - handle = dlopen("libcurses." __STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); - handle = dlopen("libreadline." __STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); - if (!handle) - handle = dlopen("libreadline." __STR(HAVE_DLOPEN) ".6", RTLD_NOW|RTLD_GLOBAL); - if (!handle) - handle = dlopen("libreadline." __STR(HAVE_DLOPEN) ".5", RTLD_NOW|RTLD_GLOBAL); - if (handle) { - p_readline = dlsym(handle, "readline"); - p_add_history = dlsym(handle, "add_history"); - } - } +#if defined(HAVE_EDITLINE) if (prompt) { /* interactive? */ - if (p_readline) { - char *tmpc = p_readline (prompt); /* get cmd line */ - if (tmpc == NULL) /* bad result? */ - cptr = NULL; - else { - strncpy (cptr, tmpc, size); /* copy result */ - free (tmpc) ; /* free temp */ - } - } + char *tmpc = readline (prompt); /* get cmd line */ + if (tmpc == NULL) /* bad result? */ + cptr = NULL; else { - printf ("%s", prompt); /* display prompt */ - fflush (stdout); - cptr = fgets (cptr, size, stream); /* get cmd line */ + strlcpy (cptr, tmpc, size); /* copy result */ + free (tmpc) ; /* free temp */ } } else cptr = fgets (cptr, size, stream); /* get cmd line */ @@ -3760,11 +3735,10 @@ while (isspace (*cptr)) /* trim leading spc */ if (*cptr == ';') /* ignore comment */ *cptr = 0; -#if defined (SIM_HAVE_DLOPEN) -if (prompt && p_add_history && *cptr) /* Save non blank lines in history */ - p_add_history (cptr); +#if defined (HAVE_EDITLINE) +if (prompt && *cptr) /* save non blank lines in history */ + add_history (cptr); #endif - return cptr; } diff --git a/sim_console.c b/sim_console.c index 7d244317..312a5401 100644 --- a/sim_console.c +++ b/sim_console.c @@ -1,6 +1,6 @@ /* sim_console.c: simulator console I/O library - Copyright (c) 1993-2019, Robert M Supnik + Copyright (c) 1993-2022, Robert M Supnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -23,6 +23,9 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 30-Nov-22 RMS Made definitions of sim_os_fd_isatty consistent (Dave Bryan) + 27-Sep-22 RMS Removed MacOS "Classic" and OS/2 support + Added sim_ttisatty 14-Jun-19 JDB Fixed argument passing in "sim_show_console" 01-Mar-19 JDB SET CONSOLE LOG now closes prior log before opening 27-Dec-18 JDB Added missing fall through comment in ControlHandler @@ -77,6 +80,7 @@ sim_ttrun - called to put terminal into run state sim_ttcmd - called to return terminal to command state sim_ttclose - called once before the simulator exits + sim_ttisatty - called to determine if running interactively sim_os_poll_kbd - poll for keyboard input sim_os_putchar - output character to console @@ -103,7 +107,7 @@ int32 sim_int_char = 005; /* interrupt character */ int32 sim_brk_char = 000; /* break character */ int32 sim_tt_pchar = 0x00002780; -#if defined (_WIN32) || defined (__OS2__) || (defined (__MWERKS__) && defined (macintosh)) +#if defined (_WIN32) int32 sim_del_char = '\b'; /* delete character */ #else int32 sim_del_char = 0177; @@ -111,6 +115,10 @@ int32 sim_del_char = 0177; TMLN sim_con_ldsc = { 0 }; /* console line descr */ TMXR sim_con_tmxr = { 1, 0, 0, &sim_con_ldsc }; /* console line mux */ +/* Forward declaratations */ + +static t_stat sim_os_fd_isatty (int fd); + /* Set/show data structures */ static CTAB set_con_tab[] = { @@ -617,6 +625,11 @@ fprintf (st, (any? "\n": "no tabs set\n")); return SCPE_OK; } +t_bool sim_ttisatty (void) +{ +return sim_os_fd_isatty (0); +} + /* VMS routines, from Ben Thomas, with fixes from Robert Alan Byer */ #if defined (VMS) @@ -700,6 +713,11 @@ t_stat sim_ttclose (void) return sim_ttcmd (); } +static t_bool sim_os_fd_isatty (int fd) +{ +return (t_bool)isatty (fd); +} + t_stat sim_os_poll_kbd (void) { unsigned int status, term[2]; @@ -823,6 +841,11 @@ t_stat sim_ttclose (void) return SCPE_OK; } +static t_bool sim_os_fd_isatty (int fd) +{ +return (t_bool)_isatty (fd); +} + t_stat sim_os_poll_kbd (void) { int c = -1; @@ -870,254 +893,6 @@ if (c != 0177) return SCPE_OK; } -/* OS/2 routines, from Bruce Ray and Holger Veit */ - -#elif defined (__OS2__) - -#include - -t_stat sim_ttinit (void) -{ -return SCPE_OK; -} - -t_stat sim_ttrun (void) -{ -return SCPE_OK; -} - -t_stat sim_ttcmd (void) -{ -return SCPE_OK; -} - -t_stat sim_ttclose (void) -{ -return SCPE_OK; -} - -t_stat sim_os_poll_kbd (void) -{ -int c; - -#if defined (__EMX__) -switch (c = _read_kbd(0,0,0)) { /* EMX has _read_kbd */ - - case -1: /* no char*/ - return SCPE_OK; - - case 0: /* char pending */ - c = _read_kbd(0,1,0); - break; - - default: /* got char */ - break; - } -#else -if (!kbhit ()) - return SCPE_OK; -c = getch(); -#endif -if ((c & 0177) == sim_del_char) - c = 0177; -if ((c & 0177) == sim_int_char) - return SCPE_STOP; -if (sim_brk_char && ((c & 0177) == sim_brk_char)) - return SCPE_BREAK; -return c | SCPE_KFLAG; -} - -t_stat sim_os_putchar (int32 c) -{ -if (c != 0177) { -#if defined (__EMX__) - putchar (c); -#else - putch (c); -#endif - fflush (stdout); - } -return SCPE_OK; -} - -/* Metrowerks CodeWarrior Macintosh routines, from Louis Chretien and - Peter Schorn */ - -#elif defined (__MWERKS__) && defined (macintosh) - -#include -#include -#include -#include -#include -#include -#include -#include - -/* function prototypes */ - -Boolean SIOUXIsAppWindow(WindowPtr window); -void SIOUXDoMenuChoice(long menuValue); -void SIOUXUpdateMenuItems(void); -void SIOUXUpdateScrollbar(void); -int ps_kbhit(void); -int ps_getch(void); - -extern char sim_name[]; -extern pSIOUXWin SIOUXTextWindow; -static CursHandle iBeamCursorH = NULL; /* contains the iBeamCursor */ - -static void updateCursor(void) { - WindowPtr window; - window = FrontWindow(); - if (SIOUXIsAppWindow(window)) { - GrafPtr savePort; - Point localMouse; - GetPort(&savePort); - SetPort(window); -#if TARGET_API_MAC_CARBON - GetGlobalMouse(&localMouse); -#else - localMouse = LMGetMouseLocation(); -#endif - GlobalToLocal(&localMouse); - if (PtInRect(localMouse, &(*SIOUXTextWindow->edit)->viewRect) && iBeamCursorH) { - SetCursor(*iBeamCursorH); - } - else { - SetCursor(&qd.arrow); - } - TEIdle(SIOUXTextWindow->edit); - SetPort(savePort); - } - else { - SetCursor(&qd.arrow); - TEIdle(SIOUXTextWindow->edit); - } - return; -} - -int ps_kbhit(void) { - EventRecord event; - int c; - updateCursor(); - SIOUXUpdateScrollbar(); - while (GetNextEvent(updateMask | osMask | mDownMask | mUpMask | activMask | - highLevelEventMask | diskEvt, &event)) { - SIOUXHandleOneEvent(&event); - } - if (SIOUXQuitting) { - exit(1); - } - if (EventAvail(keyDownMask,&event)) { - c = event.message&charCodeMask; - if ((event.modifiers & cmdKey) && (c > 0x20)) { - GetNextEvent(keyDownMask, &event); - SIOUXHandleOneEvent(&event); - if (SIOUXQuitting) { - exit(1); - } - return false; - } - return true; - } - else { - return false; - } -} - -int ps_getch(void) { - int c; - EventRecord event; - fflush(stdout); - updateCursor(); - while(!GetNextEvent(keyDownMask,&event)) { - if (GetNextEvent(updateMask | osMask | mDownMask | mUpMask | activMask | - highLevelEventMask | diskEvt, &event)) { - SIOUXUpdateScrollbar(); - SIOUXHandleOneEvent(&event); - } - } - if (SIOUXQuitting) { - exit(1); - } - c = event.message&charCodeMask; - if ((event.modifiers & cmdKey) && (c > 0x20)) { - SIOUXUpdateMenuItems(); - SIOUXDoMenuChoice(MenuKey(c)); - } - if (SIOUXQuitting) { - exit(1); - } - return c; -} - -/* Note that this only works if the call to sim_ttinit comes before any output to the console */ - -t_stat sim_ttinit (void) { - int i; - /* this blank will later be replaced by the number of characters */ - char title[50] = " "; - unsigned char ptitle[50]; - SIOUXSettings.autocloseonquit = TRUE; - SIOUXSettings.asktosaveonclose = FALSE; - SIOUXSettings.showstatusline = FALSE; - SIOUXSettings.columns = 80; - SIOUXSettings.rows = 40; - SIOUXSettings.toppixel = 42; - SIOUXSettings.leftpixel = 6; - iBeamCursorH = GetCursor(iBeamCursor); - strcat(title, sim_name); - strcat(title, " Simulator"); - title[0] = strlen(title) - 1; /* Pascal string done */ - for (i = 0; i <= title[0]; i++) { /* copy to unsigned char */ - ptitle[i] = title[i]; - } - SIOUXSetTitle(ptitle); - return SCPE_OK; -} - -t_stat sim_ttrun (void) -{ -return SCPE_OK; -} - -t_stat sim_ttcmd (void) -{ -return SCPE_OK; -} - -t_stat sim_ttclose (void) -{ -return SCPE_OK; -} - -t_stat sim_os_poll_kbd (void) -{ -int c; - -if (!ps_kbhit ()) - return SCPE_OK; -c = ps_getch(); -if ((c & 0177) == sim_del_char) - c = 0177; -if ((c & 0177) == sim_int_char) return SCPE_STOP; -if (sim_brk_char && ((c & 0177) == sim_brk_char)) - return SCPE_BREAK; -return c | SCPE_KFLAG; -} - -t_stat sim_os_putchar (int32 c) -{ -if (c != 0177) { - putchar (c); - fflush (stdout); - } -return SCPE_OK; -} - -/* BSD UNIX routines */ - #elif defined (BSDTTY) #include @@ -1188,6 +963,11 @@ t_stat sim_ttclose (void) return sim_ttcmd (); } +static t_bool sim_os_fd_isatty (int fd) +{ +return (t_bool)isatty (fd); +} + t_stat sim_os_poll_kbd (void) { int status; @@ -1295,6 +1075,11 @@ t_stat sim_ttclose (void) return sim_ttcmd (); } +static t_bool sim_os_fd_isatty (int fd) +{ +return (t_bool)isatty (fd); +} + t_stat sim_os_poll_kbd (void) { int status; diff --git a/sim_console.h b/sim_console.h index eec11408..aab158f3 100644 --- a/sim_console.h +++ b/sim_console.h @@ -1,6 +1,6 @@ /* sim_console.h: simulator console I/O library headers - Copyright (c) 1993-2015, Robert M Supnik + Copyright (c) 1993-2022, Robert M Supnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -23,6 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 27-Sep-22 RMS Added sim_ttisatty 14-Dec-14 JDB [4.0] Added sim_*_char externals 02-Jan-14 RMS Added tab stop routines 22-Jun-06 RMS Implemented SET/SHOW PCHAR @@ -90,6 +91,7 @@ t_stat sim_ttinit (void); t_stat sim_ttrun (void); t_stat sim_ttcmd (void); t_stat sim_ttclose (void); +t_bool sim_ttisatty (void); t_stat sim_os_poll_kbd (void); t_stat sim_os_putchar (int32 out); int32 sim_tt_inpcvt (int32 c, uint32 mode); diff --git a/sim_defs.h b/sim_defs.h index 2d5d278a..e97064b7 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -23,6 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 06-Jun-22 RMS Deprecated UNIT_TEXT, deleted UNIT_RAW 10-Mar-22 JDB Modified REG macros to fix "stringizing" problem 12-Nov-21 JDB Added UNIT_EXTEND dynamic flag 17-Mar-21 JDB Added UNIT_PIPE dynamic flag @@ -416,10 +417,13 @@ struct sim_unit { #define UNIT_ROABLE 001000 /* read only ok */ #define UNIT_DISABLE 002000 /* disable-able */ #define UNIT_DIS 004000 /* disabled */ -#define UNIT_RAW 010000 /* raw mode */ -#define UNIT_TEXT 020000 /* text mode */ #define UNIT_IDLE 040000 /* idle eligible */ +/* Deleted or deprecated */ + +// #define UNIT_RAW 000000 /* raw mode */ +#define UNIT_TEXT 000000 /* text mode */ + #define UNIT_UFMASK_31 (((1u << UNIT_V_RSV) - 1) & ~((1u << UNIT_V_UF_31) - 1)) #define UNIT_UFMASK (((1u << UNIT_V_RSV) - 1) & ~((1u << UNIT_V_UF) - 1)) #define UNIT_RFLAGS (UNIT_UFMASK|UNIT_DIS) /* restored flags */ diff --git a/sim_rev.h b/sim_rev.h index 9f06f716..83637a2b 100644 --- a/sim_rev.h +++ b/sim_rev.h @@ -29,7 +29,7 @@ #define SIM_MAJOR 3 #define SIM_MINOR 12 -#define SIM_PATCH 2 +#define SIM_PATCH 3 #define SIM_DELTA 0 /* V3.12 revision history @@ -39,6 +39,11 @@ patch date module(s) and fix(es) + 3 12-Dec-2022 Mac "Classic" and OS/2 support has been removed + PDP11: numerous 11/70 compatibility fixes + Sigma: numerous bug fixes + VAX and PDP11: restored VH11 after rework + 2 26-Mar-2022 sim_defs.h, scp.c - deprecated UNIT_RAW, UNIT_TEXT - dropped non-C_STD string support diff --git a/sim_tape.c b/sim_tape.c index 3ae2052a..f6a24114 100644 --- a/sim_tape.c +++ b/sim_tape.c @@ -1422,7 +1422,7 @@ else { /* otherwise the writes 1. Erase gaps are currently supported only in standard and extended SIMH tape formats. - 2. Metadatum reads either succeed and returns 1 or fail and returns 0. If a + 2. Metadatum reads either succeed and return 1 or fail and return 0. If a read fails, and "ferror" returns false, then it must have read into the end of the file (only these three outcomes are possible). diff --git a/sim_timer.c b/sim_timer.c index e1ff6bba..1276cbd5 100644 --- a/sim_timer.c +++ b/sim_timer.c @@ -1,6 +1,6 @@ /* sim_timer.c: simulator timer library - Copyright (c) 1993-2021, Robert M Supnik + Copyright (c) 1993-2022, Robert M Supnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -23,6 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 27-Sep-22 RMS Removed OS/2 and Mac "Classic" support 01-Feb-21 JDB Added cast for down-conversion 22-May-17 RMS Hacked for V4.0 CONST compatibility 23-Nov-15 RMS Fixed calibration lost path to reinitialize timer @@ -204,80 +205,6 @@ Sleep (msec); return sim_os_msec () - stime; } -/* OS/2 routines, from Bruce Ray */ - -#elif defined (__OS2__) - -const t_bool rtc_avail = FALSE; - -uint32 sim_os_msec () -{ -return 0; -} - -void sim_os_sleep (unsigned int sec) -{ -return; -} - -uint32 sim_os_ms_sleep_init (void) -{ -return FALSE; -} - -uint32 sim_os_ms_sleep (unsigned int msec) -{ -return 0; -} - -/* Metrowerks CodeWarrior Macintosh routines, from Ben Supnik */ - -#elif defined (__MWERKS__) && defined (macintosh) - -#include -#include -#include -#include -#include -#define NANOS_PER_MILLI 1000000 -#define MILLIS_PER_SEC 1000 - -const t_bool rtc_avail = TRUE; - -uint32 sim_os_msec (void) -{ -unsigned long long micros; -UnsignedWide macMicros; -unsigned long millis; - -Microseconds (&macMicros); -micros = *((unsigned long long *) &macMicros); -millis = micros / 1000LL; -return (uint32) millis; -} - -void sim_os_sleep (unsigned int sec) -{ -sleep (sec); -return; -} - -uint32 sim_os_ms_sleep_init (void) -{ -return 1; -} - -uint32 sim_os_ms_sleep (unsigned int milliseconds) -{ -uint32 stime = sim_os_msec (); -struct timespec treq; - -treq.tv_sec = milliseconds / MILLIS_PER_SEC; -treq.tv_nsec = (milliseconds % MILLIS_PER_SEC) * NANOS_PER_MILLI; -(void) nanosleep (&treq, NULL); -return sim_os_msec () - stime; -} - #else /* UNIX routines */