Common code: various bugfixes; Mac "Classic" and OS/2 support has been removed
This commit is contained in:
parent
86a995b863
commit
4562408a5f
8 changed files with 124 additions and 395 deletions
|
@ -490,7 +490,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_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_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_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.
|
# Interdata 32-bit CPU.
|
||||||
|
|
34
makefile
34
makefile
|
@ -111,12 +111,32 @@ ifneq (,${GREP_OPTIONS})
|
||||||
$(info unset the GREP_OPTIONS environment variable to use this makefile)
|
$(info unset the GREP_OPTIONS environment variable to use this makefile)
|
||||||
$(error 1)
|
$(error 1)
|
||||||
endif
|
endif
|
||||||
ifeq (old,$(shell gmake --version /dev/null 2>&1 | grep 'GNU Make' | awk '{ if ($$3 < "3.81") {print "old"} }'))
|
ifneq ($(findstring Windows,${OS}),)
|
||||||
GMAKE_VERSION = $(shell gmake --version /dev/null 2>&1 | grep 'GNU Make' | awk '{ print $$3 }')
|
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 *** GNU Make Version $(GMAKE_VERSION) is too old to)
|
||||||
$(warning *** Warning *** fully process this makefile)
|
$(warning *** Warning *** fully process this makefile)
|
||||||
endif
|
endif
|
||||||
SIM_MAJOR=$(shell grep SIM_MAJOR sim_rev.h | awk '{ print $$3 }')
|
|
||||||
BUILD_SINGLE := ${MAKECMDGOALS} $(BLANK_SUFFIX)
|
BUILD_SINGLE := ${MAKECMDGOALS} $(BLANK_SUFFIX)
|
||||||
BUILD_MULTIPLE_VERB = is
|
BUILD_MULTIPLE_VERB = is
|
||||||
# building the pdp1, pdp11, tx-0, or any microvax simulator could use video support
|
# building the pdp1, pdp11, tx-0, or any microvax simulator could use video support
|
||||||
|
@ -195,6 +215,10 @@ ifneq ($(findstring Windows,${OS}),)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
ifeq (3,${SIM_MAJOR})
|
||||||
|
# simh v3 DOES not have any video support
|
||||||
|
VIDEO_USEFUL =
|
||||||
|
endif
|
||||||
|
|
||||||
find_exe = $(abspath $(strip $(firstword $(foreach dir,$(strip $(subst :, ,${PATH})),$(wildcard $(dir)/$(1))))))
|
find_exe = $(abspath $(strip $(firstword $(foreach dir,$(strip $(subst :, ,${PATH})),$(wildcard $(dir)/$(1))))))
|
||||||
find_lib = $(firstword $(abspath $(strip $(firstword $(foreach dir,$(strip ${LIBPATH}),$(foreach ext,$(strip ${LIBEXT}),$(wildcard $(dir)/lib$(1).$(ext))))))))
|
find_lib = $(firstword $(abspath $(strip $(firstword $(foreach dir,$(strip ${LIBPATH}),$(foreach ext,$(strip ${LIBEXT}),$(wildcard $(dir)/lib$(1).$(ext))))))))
|
||||||
|
@ -1206,6 +1230,7 @@ else
|
||||||
$(info Cloning the windows-build dependencies into $(abspath ..)/windows-build)
|
$(info Cloning the windows-build dependencies into $(abspath ..)/windows-build)
|
||||||
$(shell git clone https://github.com/simh/windows-build ../windows-build)
|
$(shell git clone https://github.com/simh/windows-build ../windows-build)
|
||||||
else
|
else
|
||||||
|
ifneq (3,${SIM_MAJOR})
|
||||||
$(info ***********************************************************************)
|
$(info ***********************************************************************)
|
||||||
$(info ***********************************************************************)
|
$(info ***********************************************************************)
|
||||||
$(info ** This build is operating without the required windows-build **)
|
$(info ** This build is operating without the required windows-build **)
|
||||||
|
@ -1219,6 +1244,7 @@ else
|
||||||
$(info ***********************************************************************)
|
$(info ***********************************************************************)
|
||||||
$(info .)
|
$(info .)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
# Version check on windows-build
|
# Version check on windows-build
|
||||||
WINDOWS_BUILD = $(word 2,$(shell findstr WINDOWS-BUILD ..\windows-build\Windows-Build_Versions.txt))
|
WINDOWS_BUILD = $(word 2,$(shell findstr WINDOWS-BUILD ..\windows-build\Windows-Build_Versions.txt))
|
||||||
|
@ -1819,7 +1845,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_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_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
|
${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 = ${SIMHD}/Interdata
|
ID32D = ${SIMHD}/Interdata
|
||||||
|
|
12
scp.c
12
scp.c
|
@ -23,6 +23,9 @@
|
||||||
used in advertising or otherwise to promote the sale, use or other dealings
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from Robert M Supnik.
|
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
|
21-Oct-21 RMS Fixed bug in byte deposits if aincr > 1
|
||||||
16-Feb-21 JDB Rewrote get_rval, put_rval to support arrays of structures
|
16-Feb-21 JDB Rewrote get_rval, put_rval to support arrays of structures
|
||||||
25-Jan-21 JDB REG "size" field now determines access size
|
25-Jan-21 JDB REG "size" field now determines access size
|
||||||
|
@ -2734,10 +2737,6 @@ t_bool register_check = FALSE;
|
||||||
t_stat stat = SCPE_OK;
|
t_stat stat = SCPE_OK;
|
||||||
CTAB *docmdp = NULL;
|
CTAB *docmdp = NULL;
|
||||||
|
|
||||||
#if defined (__MWERKS__) && defined (macintosh)
|
|
||||||
argc = ccommand (&argv);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure that argv has at least 10 elements and that it ends in a NULL pointer */
|
/* Make sure that argv has at least 10 elements and that it ends in a NULL pointer */
|
||||||
targv = (char **)calloc (1+MAX(10, argc), sizeof(*targv));
|
targv = (char **)calloc (1+MAX(10, argc), sizeof(*targv));
|
||||||
for (i=0; i<argc; i++)
|
for (i=0; i<argc; i++)
|
||||||
|
@ -2962,7 +2961,6 @@ if (docmdp) {
|
||||||
}
|
}
|
||||||
if (SCPE_BARE_STATUS(stat) == SCPE_OPENERR) /* didn't exist/can't open? */
|
if (SCPE_BARE_STATUS(stat) == SCPE_OPENERR) /* didn't exist/can't open? */
|
||||||
stat = SCPE_OK;
|
stat = SCPE_OK;
|
||||||
|
|
||||||
if (SCPE_BARE_STATUS(stat) != SCPE_EXIT)
|
if (SCPE_BARE_STATUS(stat) != SCPE_EXIT)
|
||||||
process_stdin_commands (SCPE_BARE_STATUS(stat), argv, FALSE);
|
process_stdin_commands (SCPE_BARE_STATUS(stat), argv, FALSE);
|
||||||
|
|
||||||
|
@ -10287,6 +10285,7 @@ return read_line_p (NULL, cptr, size, stream);
|
||||||
char *read_line_p (const char *prompt, char *cptr, int32 size, FILE *stream)
|
char *read_line_p (const char *prompt, char *cptr, int32 size, FILE *stream)
|
||||||
{
|
{
|
||||||
char *tptr;
|
char *tptr;
|
||||||
|
|
||||||
#if defined(HAVE_EDITLINE)
|
#if defined(HAVE_EDITLINE)
|
||||||
if (prompt) { /* interactive? */
|
if (prompt) { /* interactive? */
|
||||||
char *tmpc = readline (prompt); /* get cmd line */
|
char *tmpc = readline (prompt); /* get cmd line */
|
||||||
|
@ -10296,7 +10295,7 @@ if (prompt) { /* interactive? */
|
||||||
strlcpy (cptr, tmpc, size); /* copy result */
|
strlcpy (cptr, tmpc, size); /* copy result */
|
||||||
free (tmpc) ; /* free temp */
|
free (tmpc) ; /* free temp */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else cptr = fgets (cptr, size, stream); /* get cmd line */
|
else cptr = fgets (cptr, size, stream); /* get cmd line */
|
||||||
#else
|
#else
|
||||||
if (prompt) { /* interactive? */
|
if (prompt) { /* interactive? */
|
||||||
|
@ -10332,7 +10331,6 @@ if ((*cptr == ';') || (*cptr == '#')) { /* ignore comment */
|
||||||
if (prompt && *cptr) /* Save non blank lines in history */
|
if (prompt && *cptr) /* Save non blank lines in history */
|
||||||
add_history (cptr);
|
add_history (cptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return cptr;
|
return cptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
302
sim_console.c
302
sim_console.c
|
@ -1,6 +1,6 @@
|
||||||
/* sim_console.c: simulator console I/O library
|
/* sim_console.c: simulator console I/O library
|
||||||
|
|
||||||
Copyright (c) 1993-2014, Robert M Supnik
|
Copyright (c) 1993-2022, Robert M Supnik
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -23,6 +23,15 @@
|
||||||
used in advertising or otherwise to promote the sale, use or other dealings
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from Robert M Supnik.
|
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
|
||||||
|
18-Mar-18 RMS Fixed deboff not to close stdout or stderr (Dave Bryan)
|
||||||
|
31-Mar-15 RMS Backported parity feature from GitHub master
|
||||||
|
10-Nov-14 JDB Added -N option to SET CONSOLE LOG and SET CONSOLE DEBUG
|
||||||
02-Jan-14 RMS Added tab stop routines
|
02-Jan-14 RMS Added tab stop routines
|
||||||
18-Mar-12 RMS Removed unused reference to sim_switches (Dave Bryan)
|
18-Mar-12 RMS Removed unused reference to sim_switches (Dave Bryan)
|
||||||
07-Dec-11 MP Added sim_ttisatty to support reasonable behaviour (i.e.
|
07-Dec-11 MP Added sim_ttisatty to support reasonable behaviour (i.e.
|
||||||
|
@ -117,6 +126,13 @@
|
||||||
sim_set_noconsole_port Enable automatic WRU console polling
|
sim_set_noconsole_port Enable automatic WRU console polling
|
||||||
sim_set_stable_registers_state Declare that all registers are always stable
|
sim_set_stable_registers_state Declare that all registers are always stable
|
||||||
|
|
||||||
|
sim_ttinit - called once to get initial terminal state
|
||||||
|
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
|
||||||
|
|
||||||
The first group is OS-independent; the second group is OS-dependent.
|
The first group is OS-independent; the second group is OS-dependent.
|
||||||
|
|
||||||
|
@ -177,7 +193,7 @@ int32 sim_dbg_int_char = 0; /* SIGINT char under deb
|
||||||
static t_bool sigint_message_issued = FALSE;
|
static t_bool sigint_message_issued = FALSE;
|
||||||
int32 sim_brk_char = 000; /* break character */
|
int32 sim_brk_char = 000; /* break character */
|
||||||
int32 sim_tt_pchar = 0x00002780;
|
int32 sim_tt_pchar = 0x00002780;
|
||||||
#if defined (_WIN32) || defined (__OS2__) || (defined (__MWERKS__) && defined (macintosh))
|
#if defined (_WIN32)
|
||||||
int32 sim_del_char = '\b'; /* delete character */
|
int32 sim_del_char = '\b'; /* delete character */
|
||||||
#else
|
#else
|
||||||
int32 sim_del_char = 0177;
|
int32 sim_del_char = 0177;
|
||||||
|
@ -309,6 +325,10 @@ static t_stat sim_con_detach (UNIT *uptr)
|
||||||
return sim_set_notelnet (0, NULL);
|
return sim_set_notelnet (0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Forward declaratations */
|
||||||
|
|
||||||
|
static t_stat sim_os_fd_isatty (int fd);
|
||||||
|
|
||||||
/* Set/show data structures */
|
/* Set/show data structures */
|
||||||
|
|
||||||
static CTAB set_con_tab[] = {
|
static CTAB set_con_tab[] = {
|
||||||
|
@ -3736,284 +3756,6 @@ if (ch != 0177) {
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OS/2 routines, from Bruce Ray and Holger Veit */
|
|
||||||
|
|
||||||
#elif defined (__OS2__)
|
|
||||||
|
|
||||||
#include <conio.h>
|
|
||||||
|
|
||||||
static t_stat sim_os_ttinit (void)
|
|
||||||
{
|
|
||||||
return SCPE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_ttrun (void)
|
|
||||||
{
|
|
||||||
return SCPE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_ttcmd (void)
|
|
||||||
{
|
|
||||||
return SCPE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_ttclose (void)
|
|
||||||
{
|
|
||||||
return SCPE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_bool sim_os_fd_isatty (int fd)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_poll_kbd (void)
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
|
|
||||||
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_poll_kbd()\n");
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_bool sim_os_poll_kbd_ready (int ms_timeout) /* Don't know how to do this on this platform */
|
|
||||||
{
|
|
||||||
sim_os_ms_sleep (MIN(20,ms_timeout)); /* Wait a little */
|
|
||||||
return TRUE; /* force a poll */
|
|
||||||
}
|
|
||||||
|
|
||||||
static 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 <console.h>
|
|
||||||
#include <Mactypes.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sioux.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <siouxglobals.h>
|
|
||||||
#include <Traps.h>
|
|
||||||
#include <LowMem.h>
|
|
||||||
|
|
||||||
/* 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 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 */
|
|
||||||
|
|
||||||
static t_stat sim_os_ttinit (void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttinit()\n");
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
strlcat(title, sim_name, sizeof(title));
|
|
||||||
strlcat(title, " Simulator", sizeof(title));
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_ttrun (void)
|
|
||||||
{
|
|
||||||
return SCPE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_ttcmd (void)
|
|
||||||
{
|
|
||||||
return SCPE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_ttclose (void)
|
|
||||||
{
|
|
||||||
return SCPE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_bool sim_os_fd_isatty (int fd)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_poll_kbd (void)
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
|
|
||||||
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_poll_kbd()\n");
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_bool sim_os_poll_kbd_ready (int ms_timeout) /* Don't know how to do this on this platform */
|
|
||||||
{
|
|
||||||
sim_os_ms_sleep (MIN(20,ms_timeout)); /* Wait a little */
|
|
||||||
return TRUE; /* force a poll */
|
|
||||||
}
|
|
||||||
|
|
||||||
static t_stat sim_os_putchar (int32 c)
|
|
||||||
{
|
|
||||||
if (c != 0177) {
|
|
||||||
putchar (c);
|
|
||||||
fflush (stdout);
|
|
||||||
}
|
|
||||||
return SCPE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BSD UNIX routines */
|
|
||||||
|
|
||||||
#elif defined (BSDTTY)
|
#elif defined (BSDTTY)
|
||||||
|
|
||||||
#include <sgtty.h>
|
#include <sgtty.h>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* sim_console.h: simulator console I/O library headers
|
/* sim_console.h: simulator console I/O library headers
|
||||||
|
|
||||||
Copyright (c) 1993-2014, Robert M Supnik
|
Copyright (c) 1993-2022, Robert M Supnik
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -23,6 +23,8 @@
|
||||||
used in advertising or otherwise to promote the sale, use or other dealings
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from Robert M Supnik.
|
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
|
02-Jan-14 RMS Added tab stop routines
|
||||||
17-Jan-11 MP Added buffered line capabilities
|
17-Jan-11 MP Added buffered line capabilities
|
||||||
22-Jun-06 RMS Implemented SET/SHOW PCHAR
|
22-Jun-06 RMS Implemented SET/SHOW PCHAR
|
||||||
|
|
17
sim_defs.h
17
sim_defs.h
|
@ -23,6 +23,17 @@
|
||||||
used in advertising or otherwise to promote the sale, use or other dealings
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from Robert M Supnik.
|
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
|
||||||
|
16-Feb-21 JDB Added "stride" to REG to support arrays of structures
|
||||||
|
Modified REG macros to initialize strides
|
||||||
|
21-Jan-21 JDB Added "size" and "maxval" fields to the REG structure
|
||||||
|
Modified REG macros to initialize access sizes
|
||||||
|
09-Nov-20 RMS More V4.X compatibility hooks (Mark Pizzolato)
|
||||||
|
26-Oct-19 RMS Removed MTAB_VAL definition
|
||||||
|
23-Jun-17 RMS Added #include sim_rev.h (Mark Pizzolato)
|
||||||
25-Sep-16 RMS Removed KBD_WAIT and friends
|
25-Sep-16 RMS Removed KBD_WAIT and friends
|
||||||
08-Mar-16 RMS Added shutdown invisible switch
|
08-Mar-16 RMS Added shutdown invisible switch
|
||||||
24-Dec-14 JDB Added T_ADDR_FMT
|
24-Dec-14 JDB Added T_ADDR_FMT
|
||||||
|
@ -647,8 +658,10 @@ struct UNIT {
|
||||||
#define UNIT_WLK 0100000 /* hardware write lock */
|
#define UNIT_WLK 0100000 /* hardware write lock */
|
||||||
#define UNIT_WPRT (UNIT_WLK|UNIT_RO)/* write protect */
|
#define UNIT_WPRT (UNIT_WLK|UNIT_RO)/* write protect */
|
||||||
|
|
||||||
/* Unused/meaningless flags */
|
/* Deleted or deprecated */
|
||||||
#define UNIT_TEXT 0000000 /* text mode - no effect */
|
|
||||||
|
// #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_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_UFMASK (((1u << UNIT_V_RSV) - 1) & ~((1u << UNIT_V_UF) - 1))
|
||||||
|
|
31
sim_tape.c
31
sim_tape.c
|
@ -2370,7 +2370,36 @@ return r;
|
||||||
|
|
||||||
Implementation notes:
|
Implementation notes:
|
||||||
|
|
||||||
1. Erase gaps are currently supported only in SIMH (MTUF_F_STD) tape format.
|
1. Erase gaps are currently supported only in standard and extended SIMH
|
||||||
|
tape formats.
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
3. The area scan is necessary for tape image integrity to ensure that a data
|
||||||
|
record straddling the end of the erasure is truncated appropriately. The
|
||||||
|
scan is guaranteed to succeed only if it begins at a valid metadatum. If
|
||||||
|
it begins in the middle of a previously overwritten data record, then the
|
||||||
|
scan will interpret old data values as tape formatting markers. The data
|
||||||
|
record sanity checks attempt to recover from this situation, but it is
|
||||||
|
still possible to corrupt valid data that follows an erasure of an
|
||||||
|
invalid area (e.g., if the leading and trailing length words happen
|
||||||
|
to match but actually represent previously recorded data rather than
|
||||||
|
record metadata). If an application knows that the erased area will
|
||||||
|
not contain valid formatting, the "sim_tape_erase" routine should be used
|
||||||
|
instead, as it erases without first scanning the area.
|
||||||
|
|
||||||
|
4. Truncating an existing data record corresponds to overwriting part of a
|
||||||
|
record on a real tape. Reading such a record on a real drive would
|
||||||
|
produce CRC errors, due to the lost portion. In simulation, we could
|
||||||
|
change a good record (Class 0) to a bad record (Class 8). However, this
|
||||||
|
is not possible for private or reserved record classes, as that would
|
||||||
|
change the classification (consider that a private class that had
|
||||||
|
been ignored would not be once it had been truncated and changed to Class
|
||||||
|
8). Given that there is no good general solution, we do not modify
|
||||||
|
classes for truncated records, as reading a partially erased record is an
|
||||||
|
"all bets are off" operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static t_stat tape_erase_fwd (UNIT *uptr, t_mtrlnt gap_size)
|
static t_stat tape_erase_fwd (UNIT *uptr, t_mtrlnt gap_size)
|
||||||
|
|
93
sim_timer.c
93
sim_timer.c
|
@ -1,6 +1,6 @@
|
||||||
/* sim_timer.c: simulator timer library
|
/* sim_timer.c: simulator timer library
|
||||||
|
|
||||||
Copyright (c) 1993-2010, Robert M Supnik
|
Copyright (c) 1993-2022, Robert M Supnik
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -23,6 +23,11 @@
|
||||||
used in advertising or otherwise to promote the sale, use or other dealings
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from Robert M Supnik.
|
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
|
||||||
|
28-Mar-15 RMS Revised to use sim_printf
|
||||||
21-Oct-11 MP Fixed throttling in several ways:
|
21-Oct-11 MP Fixed throttling in several ways:
|
||||||
- Sleep for the observed clock tick size while throttling
|
- Sleep for the observed clock tick size while throttling
|
||||||
- Recompute the throttling wait once every 10 seconds
|
- Recompute the throttling wait once every 10 seconds
|
||||||
|
@ -536,92 +541,6 @@ return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined (__OS2__)
|
|
||||||
|
|
||||||
/* OS/2 routines, from Bruce Ray */
|
|
||||||
|
|
||||||
const t_bool rtc_avail = FALSE;
|
|
||||||
|
|
||||||
uint32 sim_os_msec (void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void sim_os_sleep (unsigned int sec)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 sim_os_ms_sleep_init (void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 sim_os_ms_sleep (unsigned int msec)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Metrowerks CodeWarrior Macintosh routines, from Ben Supnik */
|
|
||||||
|
|
||||||
#elif defined (__MWERKS__) && defined (macintosh)
|
|
||||||
|
|
||||||
#include <Timer.h>
|
|
||||||
#include <Mactypes.h>
|
|
||||||
#include <sioux.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <siouxglobals.h>
|
|
||||||
#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);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 sim_os_ms_sleep_init (void)
|
|
||||||
{
|
|
||||||
return _compute_minimum_sleep ();
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(NEED_CLOCK_GETTIME)
|
|
||||||
int clock_gettime(int clk_id, struct timespec *tp)
|
|
||||||
{
|
|
||||||
struct timeval cur;
|
|
||||||
|
|
||||||
if (clk_id != CLOCK_REALTIME)
|
|
||||||
return -1;
|
|
||||||
gettimeofday (&cur, NULL);
|
|
||||||
tp->tv_sec = cur.tv_sec;
|
|
||||||
tp->tv_nsec = cur.tv_usec*1000;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* UNIX routines */
|
/* UNIX routines */
|
||||||
|
|
Loading…
Add table
Reference in a new issue