mirror of
https://github.com/rcornwell/sims.git
synced 2026-04-09 14:33:40 +00:00
SCP: Updated to current version
This commit is contained in:
10
README.md
10
README.md
@@ -1,3 +1,6 @@
|
||||
|
||||
[](https://scan.coverity.com/projects/rcornwell-sims)
|
||||
|
||||
# Development Simulators.
|
||||
|
||||
This is a working copy of my Burroughs B5500, KA10, KI10 and IBM7000 series
|
||||
@@ -14,7 +17,8 @@ These are still in the testing stages. Please report any issues that you find in
|
||||
|
||||
The KA10 sim has successfully run Tops 10 5.03 and Tops 10 6.03.
|
||||
The KI10 sim has successfully run Tops 10 6.03
|
||||
Started adding support for KA10 to boot ITS
|
||||
Support for ITS (untested).
|
||||
Support for BBN pager (untested).
|
||||
|
||||
Disk
|
||||
* RC10 RD10/RM10
|
||||
@@ -38,6 +42,10 @@ and transfering to the loaded value. RC10, RH10, TM10 support readin mode.
|
||||
|
||||
Possibly add in support for KL10A. (No extended addressing).
|
||||
|
||||
To do:
|
||||
* Add support for IBM 3330 drive to run Waits.
|
||||
* Add support for DC76 for ITS.
|
||||
|
||||
# IBM 7000 simulators.
|
||||
Latest status for I7000 Cpus:
|
||||
|
||||
|
||||
175
scp.c
175
scp.c
@@ -1161,10 +1161,19 @@ static const char simh_help[] =
|
||||
"3Asynch\n"
|
||||
"+set asynch enable asynchronous I/O\n"
|
||||
"+set noasynch disable asynchronous I/O\n"
|
||||
#define HLP_SET_ENVIRON "*Commands SET Asynch"
|
||||
#define HLP_SET_ENVIRON "*Commands SET Environment"
|
||||
"3Environment\n"
|
||||
"4Explicitily Changing A Variable\n"
|
||||
"+set environment name=val set environment variable\n"
|
||||
"+set environment name clear environment variable\n"
|
||||
"4Gathering Input From A User\n"
|
||||
" Input from a user can be obtained by:\n\n"
|
||||
"+set environment -p \"Prompt String\" name=default\n\n"
|
||||
" The -p switch indicates that the user should be prompted\n"
|
||||
" with the indicated prompt string and the input provided\n"
|
||||
" will be saved in the environment variable 'name'. If no\n"
|
||||
" input is provided, the value specified as 'default' will be\n"
|
||||
" used.\n"
|
||||
#define HLP_SET_ON "*Commands SET Command_Status_Trap_Dispatching"
|
||||
"3Command Status Trap Dispatching\n"
|
||||
"+set on enables error checking after command\n"
|
||||
@@ -1705,6 +1714,8 @@ ASSERT failure have several different actions:
|
||||
" CPU's \"A\" register for the expected value:\n\n"
|
||||
"++; OS bootstrap command file\n"
|
||||
"++;\n"
|
||||
"++IF EXIST \"os.disk\" echo os.disk exists\n"
|
||||
"++IF NOT EXIST os.disk echo os.disk not existing\n"
|
||||
"++ATTACH DS0 os.disk\n"
|
||||
"++BOOT DS\n"
|
||||
"++; A register contains error code; 0 = good boot\n"
|
||||
@@ -1720,7 +1731,7 @@ ASSERT failure have several different actions:
|
||||
"4IF\n"
|
||||
" The IF command tests a simulator state condition and executes additional\n"
|
||||
" commands if the condition is true:\n\n"
|
||||
"++IF <Simulator State Expressions> commandtoprocess{; additionalcommandtoprocess}...\n\n"
|
||||
"++IF <Conditional Expressions> commandtoprocess{; additionalcommandtoprocess}...\n\n"
|
||||
"5Examples:\n"
|
||||
" A command file might be used to bootstrap an operating system that\n"
|
||||
" halts after the initial load from disk. The ASSERT command is then\n"
|
||||
@@ -1728,6 +1739,8 @@ ASSERT failure have several different actions:
|
||||
" CPU's \"A\" register for the expected value:\n\n"
|
||||
"++; OS bootstrap command file\n"
|
||||
"++;\n"
|
||||
"++IF EXIST \"os.disk\" echo os.disk exists\n"
|
||||
"++IF NOT EXIST os.disk echo os.disk not existing\n"
|
||||
"++ATTACH DS0 os.disk\n"
|
||||
"++BOOT DS\n"
|
||||
"++; A register contains error code; 0 = good boot\n"
|
||||
@@ -1742,7 +1755,7 @@ ASSERT failure have several different actions:
|
||||
" failed\" message. Otherwise, the command file will continue to bring up\n"
|
||||
" the operating system.\n"
|
||||
"4Conditional Expressions\n"
|
||||
" The IF and ASSERT commands evaluate two different forms of conditional\n"
|
||||
" The IF and ASSERT commands evaluate three different forms of conditional\n"
|
||||
" expressions.:\n\n"
|
||||
"5Simulator State Expressions\n"
|
||||
" The values of simulator registers can be evaluated with:\n\n"
|
||||
@@ -1783,6 +1796,11 @@ ASSERT failure have several different actions:
|
||||
" comprised of all numeric digits, then the strings are converted to numbers\n"
|
||||
" and a numeric comparison is performed. For example: \"+1\" EQU \"1\" will be\n"
|
||||
" true.\n"
|
||||
"5File Existence Expressions\n"
|
||||
" File existence can be determined with:\n"
|
||||
"++{NOT} EXIST \"<filespec>\"\n\n"
|
||||
"++{NOT} EXIST <filespec>\n\n"
|
||||
" Specifies a true (false {NOT}) condition if the file exists.\n"
|
||||
/***************** 80 character line width template *************************/
|
||||
#define HLP_EXIT "*Commands Exiting_The_Simulator"
|
||||
"2Exiting The Simulator\n"
|
||||
@@ -2037,7 +2055,7 @@ for (i = 1; i < argc; i++) { /* loop thru args */
|
||||
return 0;
|
||||
}
|
||||
if (*cbuf) /* concat args */
|
||||
sim_strlcat (cbuf, " ", sizeof(cbuf));
|
||||
strlcat (cbuf, " ", sizeof(cbuf));
|
||||
sprintf(&cbuf[strlen(cbuf)], "%s%s%s", strchr(argv[i], ' ') ? "\"" : "", argv[i], strchr(argv[i], ' ') ? "\"" : "");
|
||||
lookswitch = FALSE; /* no more switches */
|
||||
}
|
||||
@@ -2441,7 +2459,7 @@ if (dptr->flags & DEV_DISABLE) {
|
||||
sprintf (buf, "set %s DISABLE", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tDisables device %s\n", buf, sim_dname (dptr));
|
||||
}
|
||||
if (dptr->flags & DEV_DEBUG) {
|
||||
if ((dptr->flags & DEV_DEBUG) || (dptr->debflags)) {
|
||||
fprint_header (st, &found, header);
|
||||
sprintf (buf, "set %s DEBUG", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tEnables debugging for device %s\n", buf, sim_dname (dptr));
|
||||
@@ -2519,7 +2537,7 @@ if (dptr->modifiers) {
|
||||
fprintf (st, "%-30s\t%s\n", buf, mptr->help ? mptr->help : "");
|
||||
}
|
||||
}
|
||||
if (dptr->flags & DEV_DEBUG) {
|
||||
if ((dptr->flags & DEV_DEBUG) || (dptr->debflags)) {
|
||||
fprint_header (st, &found, header);
|
||||
sprintf (buf, "show %s DEBUG", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tDisplays debugging status for device %s\n", buf, sim_dname (dptr));
|
||||
@@ -2948,8 +2966,8 @@ if (flag >= 0) { /* Only bump nesting fro
|
||||
}
|
||||
}
|
||||
|
||||
sim_strlcpy( sim_do_filename[sim_do_depth], do_arg[0],
|
||||
sizeof (sim_do_filename[sim_do_depth])); /* stash away do file name for possible use by 'call' command */
|
||||
strlcpy( sim_do_filename[sim_do_depth], do_arg[0],
|
||||
sizeof (sim_do_filename[sim_do_depth])); /* stash away do file name for possible use by 'call' command */
|
||||
sim_do_label[sim_do_depth] = label; /* stash away do label for possible use in messages */
|
||||
sim_goto_line[sim_do_depth] = 0;
|
||||
if (label) {
|
||||
@@ -3441,6 +3459,7 @@ uint32 idx;
|
||||
t_value val;
|
||||
t_stat r;
|
||||
t_bool Not = FALSE;
|
||||
t_bool Exist = FALSE;
|
||||
t_bool result;
|
||||
t_addr addr;
|
||||
t_stat reason;
|
||||
@@ -3454,8 +3473,13 @@ tptr = get_glyph (cptr, gbuf, 0); /* get token */
|
||||
if (!strcmp (gbuf, "NOT")) { /* Conditional Inversion? */
|
||||
Not = TRUE; /* remember that, and */
|
||||
cptr = (CONST char *)tptr;
|
||||
tptr = get_glyph (cptr, gbuf, 0); /* get next token */
|
||||
}
|
||||
if (*cptr == '"') { /* quoted string comparison? */
|
||||
if (!strcmp (gbuf, "EXIST")) { /* File Exist Test? */
|
||||
Exist = TRUE; /* remember that, and */
|
||||
cptr = (CONST char *)tptr;
|
||||
}
|
||||
if (Exist || (*cptr == '"')) { /* quoted string comparison? */
|
||||
char op[CBUFSIZE];
|
||||
static struct {
|
||||
const char *op;
|
||||
@@ -3485,29 +3509,37 @@ if (*cptr == '"') { /* quoted string compari
|
||||
cptr += strlen (gbuf);
|
||||
while (sim_isspace (*cptr)) /* skip spaces */
|
||||
++cptr;
|
||||
get_glyph (cptr, op, '"');
|
||||
for (optr = compare_ops; optr->op; optr++)
|
||||
if (0 == strcmp (op, optr->op))
|
||||
break;
|
||||
if (!optr->op)
|
||||
return sim_messagef (SCPE_ARG, "Invalid operator: %s\n", op);
|
||||
cptr += strlen (op);
|
||||
while (sim_isspace (*cptr)) /* skip spaces */
|
||||
++cptr;
|
||||
cptr = (CONST char *)get_glyph_gen (cptr, gbuf2, 0, (sim_switches & SWMASK ('I')), TRUE, '\\');
|
||||
/* get second string */
|
||||
if (*cptr) { /* more? */
|
||||
if (flag) /* ASSERT has no more args */
|
||||
return SCPE_2MARG;
|
||||
if (!Exist) {
|
||||
get_glyph (cptr, op, '"');
|
||||
for (optr = compare_ops; optr->op; optr++)
|
||||
if (0 == strcmp (op, optr->op))
|
||||
break;
|
||||
if (!optr->op)
|
||||
return sim_messagef (SCPE_ARG, "Invalid operator: %s\n", op);
|
||||
cptr += strlen (op);
|
||||
while (sim_isspace (*cptr)) /* skip spaces */
|
||||
++cptr;
|
||||
cptr = (CONST char *)get_glyph_gen (cptr, gbuf2, 0, (sim_switches & SWMASK ('I')), TRUE, '\\');
|
||||
/* get second string */
|
||||
if (*cptr) { /* more? */
|
||||
if (flag) /* ASSERT has no more args */
|
||||
return SCPE_2MARG;
|
||||
}
|
||||
else {
|
||||
if (!flag)
|
||||
return SCPE_2FARG; /* IF needs actions! */
|
||||
}
|
||||
result = sim_cmp_string (gbuf, gbuf2);
|
||||
result = ((result == optr->aval) || (result == optr->bval));
|
||||
if (optr->invert)
|
||||
result = !result;
|
||||
}
|
||||
else {
|
||||
if (!flag)
|
||||
return SCPE_2FARG; /* IF needs actions! */
|
||||
FILE *f = fopen (gbuf, "r");
|
||||
if (f)
|
||||
fclose (f);
|
||||
result = (f != NULL);
|
||||
}
|
||||
result = sim_cmp_string (gbuf, gbuf2);
|
||||
result = ((result == optr->aval) || (result == optr->bval));
|
||||
if (optr->invert)
|
||||
result = !result;
|
||||
}
|
||||
else {
|
||||
cptr = get_glyph (cptr, gbuf, 0); /* get register */
|
||||
@@ -3996,11 +4028,42 @@ return SCPE_OK;
|
||||
|
||||
t_stat sim_set_environment (int32 flag, CONST char *cptr)
|
||||
{
|
||||
char varname[CBUFSIZE];
|
||||
char varname[CBUFSIZE], prompt[CBUFSIZE], cbuf[CBUFSIZE];
|
||||
|
||||
if ((!cptr) || (*cptr == 0)) /* now eol? */
|
||||
return SCPE_2FARG;
|
||||
cptr = get_glyph (cptr, varname, '='); /* get environment variable name */
|
||||
if (sim_switches & SWMASK ('P')) {
|
||||
CONST char *deflt = NULL;
|
||||
|
||||
cptr = get_glyph_quoted (cptr, prompt, 0); /* get prompt */
|
||||
if (prompt[0] == '\0')
|
||||
return sim_messagef (SCPE_2FARG, "Missing Prompt and Environment Variable Name\n");
|
||||
if ((prompt[0] == '"') || (prompt[0] == '\'')) {
|
||||
prompt[strlen (prompt) - 1] = '\0';
|
||||
memmove (prompt, prompt + 1, strlen (prompt));
|
||||
}
|
||||
deflt = get_glyph (cptr, varname, '='); /* get environment variable name */
|
||||
if (deflt == NULL)
|
||||
deflt = "";
|
||||
if (*deflt) {
|
||||
strlcat (prompt, " [", sizeof (prompt));
|
||||
strlcat (prompt, deflt, sizeof (prompt));
|
||||
strlcat (prompt, "] ", sizeof (prompt));
|
||||
}
|
||||
else
|
||||
strlcat (prompt, " ", sizeof (prompt));
|
||||
if (sim_rem_cmd_active_line == -1) {
|
||||
cptr = read_line_p (prompt, cbuf, sizeof(cbuf), stdin);
|
||||
if ((cptr == NULL) || (*cptr == 0))
|
||||
cptr = deflt;
|
||||
else
|
||||
cptr = cbuf;
|
||||
}
|
||||
else
|
||||
cptr = deflt;
|
||||
}
|
||||
else
|
||||
cptr = get_glyph (cptr, varname, '='); /* get environment variable name */
|
||||
setenv(varname, cptr, 1);
|
||||
return SCPE_OK;
|
||||
}
|
||||
@@ -4841,7 +4904,7 @@ t_stat show_dev_debug (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST cha
|
||||
int32 any = 0;
|
||||
DEBTAB *dep;
|
||||
|
||||
if (dptr->flags & DEV_DEBUG) {
|
||||
if ((dptr->flags & DEV_DEBUG) || (dptr->debflags)) {
|
||||
if (dptr->dctrl == 0)
|
||||
fputs ("Debugging disabled", st);
|
||||
else if (dptr->debflags == NULL)
|
||||
@@ -5090,7 +5153,7 @@ char DirName[PATH_MAX + 1], WholeName[PATH_MAX + 1], WildName[PATH_MAX + 1];
|
||||
|
||||
memset (DirName, 0, sizeof(DirName));
|
||||
memset (WholeName, 0, sizeof(WholeName));
|
||||
sim_strlcpy (WildName, cptr, sizeof(WildName));
|
||||
strlcpy (WildName, cptr, sizeof(WildName));
|
||||
cptr = WildName;
|
||||
sim_trim_endspc (WildName);
|
||||
if ((!stat (WildName, &filestat)) && (filestat.st_mode & S_IFDIR))
|
||||
@@ -5106,7 +5169,7 @@ if ((*cptr != '/') || (0 == memcmp (cptr, "./", 2)) || (0 == memcmp (cptr, "../"
|
||||
sim_trim_endspc (WholeName);
|
||||
}
|
||||
else
|
||||
sim_strlcpy (WholeName, cptr, sizeof(WholeName));
|
||||
strlcpy (WholeName, cptr, sizeof(WholeName));
|
||||
while ((c = strstr (WholeName, "/./")))
|
||||
memmove (c + 1, c + 3, 1 + strlen (c + 3));
|
||||
while ((c = strstr (WholeName, "//")))
|
||||
@@ -5370,7 +5433,7 @@ char FullPath[PATH_MAX + 1];
|
||||
char dname[CBUFSIZE];\
|
||||
t_stat st;
|
||||
|
||||
sim_strlcpy (dname, ctx->destname, sizeof (dname));
|
||||
strlcpy (dname, ctx->destname, sizeof (dname));
|
||||
|
||||
sprintf (FullPath, "%s%s", directory, filename);
|
||||
|
||||
@@ -7031,7 +7094,7 @@ for (gptr = gbuf, reason = SCPE_OK;
|
||||
return SCPE_ARG;
|
||||
reason = exdep_reg_loop (ofile, sim_schrptr, flag, cptr,
|
||||
lowr, highr, (uint32) low, (uint32) high);
|
||||
if ((!sim_oline) && (sim_log && (ofile == stdout)))
|
||||
if ((flag & EX_E) && (!sim_oline) && (sim_log && (ofile == stdout)))
|
||||
exdep_reg_loop (sim_log, sim_schrptr, EX_E, cptr,
|
||||
lowr, highr, (uint32) low, (uint32) high);
|
||||
continue;
|
||||
@@ -7046,7 +7109,7 @@ for (gptr = gbuf, reason = SCPE_OK;
|
||||
return SCPE_ARG;
|
||||
reason = exdep_addr_loop (ofile, sim_schaptr, flag, cptr, low, high,
|
||||
sim_dfdev, sim_dfunit);
|
||||
if ((!sim_oline) && (sim_log && (ofile == stdout)))
|
||||
if ((flag & EX_E) && (!sim_oline) && (sim_log && (ofile == stdout)))
|
||||
exdep_addr_loop (sim_log, sim_schaptr, EX_E, cptr, low, high,
|
||||
sim_dfdev, sim_dfunit);
|
||||
} /* end for */
|
||||
@@ -10441,7 +10504,7 @@ t_stat sim_exp_show_tab (FILE *st, const EXPECT *exp, const EXPTAB *ep)
|
||||
{
|
||||
if (!ep)
|
||||
return SCPE_OK;
|
||||
fprintf (st, "EXPECT");
|
||||
fprintf (st, " EXPECT");
|
||||
if (ep->switches & EXP_TYP_PERSIST)
|
||||
fprintf (st, " -p");
|
||||
if (ep->switches & EXP_TYP_CLEARALL)
|
||||
@@ -10466,20 +10529,20 @@ CONST EXPTAB *ep = (CONST EXPTAB *)sim_exp_fnd (exp, match, 0);
|
||||
if (exp->buf_size) {
|
||||
char *bstr = sim_encode_quoted_string (exp->buf, exp->buf_ins);
|
||||
|
||||
fprintf (st, "Match Buffer Size: %d\n", exp->buf_size);
|
||||
fprintf (st, "Buffer Insert Offset: %d\n", exp->buf_ins);
|
||||
fprintf (st, "Buffer Contents: %s\n", bstr);
|
||||
fprintf (st, " Match Buffer Size: %d\n", exp->buf_size);
|
||||
fprintf (st, " Buffer Insert Offset: %d\n", exp->buf_ins);
|
||||
fprintf (st, " Buffer Contents: %s\n", bstr);
|
||||
free (bstr);
|
||||
}
|
||||
if (exp->after)
|
||||
fprintf (st, "Halt After: %d instructions\n", exp->after);
|
||||
if (exp->dptr && exp->dbit)
|
||||
fprintf (st, "Debugging via: SET %s DEBUG%s%s\n", sim_dname(exp->dptr), exp->dptr->debflags ? "=" : "", exp->dptr->debflags ? get_dbg_verb (exp->dbit, exp->dptr) : "");
|
||||
fprintf (st, "Match Rules:\n");
|
||||
fprintf (st, " Halt After: %d instructions\n", exp->after);
|
||||
if (exp->dptr && (exp->dbit & exp->dptr->dctrl))
|
||||
fprintf (st, " Expect Debugging via: SET %s DEBUG%s%s\n", sim_dname(exp->dptr), exp->dptr->debflags ? "=" : "", exp->dptr->debflags ? get_dbg_verb (exp->dbit, exp->dptr) : "");
|
||||
fprintf (st, " Match Rules:\n");
|
||||
if (!*match)
|
||||
return sim_exp_showall (st, exp);
|
||||
if (!ep) {
|
||||
fprintf (st, "No Rules match '%s'\n", match);
|
||||
fprintf (st, " No Rules match '%s'\n", match);
|
||||
return SCPE_ARG;
|
||||
}
|
||||
do {
|
||||
@@ -10708,25 +10771,25 @@ return SCPE_OK;
|
||||
t_stat sim_show_send_input (FILE *st, const SEND *snd)
|
||||
{
|
||||
if (snd->extoff < snd->insoff) {
|
||||
fprintf (st, "%d bytes of pending input Data:\n ", snd->insoff-snd->extoff);
|
||||
fprintf (st, " %d bytes of pending input Data:\n ", snd->insoff-snd->extoff);
|
||||
fprint_buffer_string (st, snd->buffer+snd->extoff, snd->insoff-snd->extoff);
|
||||
fprintf (st, "\n");
|
||||
}
|
||||
else
|
||||
fprintf (st, "No Pending Input Data\n");
|
||||
fprintf (st, " No Pending Input Data\n");
|
||||
if ((snd->next_time - sim_gtime()) > 0) {
|
||||
if ((snd->next_time - sim_gtime()) > (sim_timer_inst_per_sec()/1000000.0))
|
||||
fprintf (st, "Minimum of %d instructions (%d microseconds) before sending first character\n", (int)(snd->next_time - sim_gtime()),
|
||||
if (((snd->next_time - sim_gtime()) > (sim_timer_inst_per_sec()/1000000.0)) && ((sim_timer_inst_per_sec()/1000000.0) > 0.0))
|
||||
fprintf (st, " Minimum of %d instructions (%d microseconds) before sending first character\n", (int)(snd->next_time - sim_gtime()),
|
||||
(int)((snd->next_time - sim_gtime())/(sim_timer_inst_per_sec()/1000000.0)));
|
||||
else
|
||||
fprintf (st, "Minimum of %d instructions before sending first character\n", (int)(snd->next_time - sim_gtime()));
|
||||
fprintf (st, " Minimum of %d instructions before sending first character\n", (int)(snd->next_time - sim_gtime()));
|
||||
}
|
||||
if (snd->delay > (sim_timer_inst_per_sec()/1000000.0))
|
||||
fprintf (st, "Minimum of %d instructions (%d microseconds) between characters\n", (int)snd->delay, (int)(snd->delay/(sim_timer_inst_per_sec()/1000000.0)));
|
||||
if ((snd->delay > (sim_timer_inst_per_sec()/1000000.0)) && ((sim_timer_inst_per_sec()/1000000.0) > 0.0))
|
||||
fprintf (st, " Minimum of %d instructions (%d microseconds) between characters\n", (int)snd->delay, (int)(snd->delay/(sim_timer_inst_per_sec()/1000000.0)));
|
||||
else
|
||||
fprintf (st, "Minimum of %d instructions between characters\n", (int)snd->delay);
|
||||
if (snd->dptr && snd->dbit)
|
||||
fprintf (st, "Debugging via: SET %s DEBUG%s%s\n", sim_dname(snd->dptr), snd->dptr->debflags ? "=" : "", snd->dptr->debflags ? get_dbg_verb (snd->dbit, snd->dptr) : "");
|
||||
fprintf (st, " Minimum of %d instructions between characters\n", (int)snd->delay);
|
||||
if (snd->dptr && (snd->dbit & snd->dptr->dctrl))
|
||||
fprintf (st, " Send Debugging via: SET %s DEBUG%s%s\n", sim_dname(snd->dptr), snd->dptr->debflags ? "=" : "", snd->dptr->debflags ? get_dbg_verb (snd->dbit, snd->dptr) : "");
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
|
||||
8
scp.h
8
scp.h
@@ -160,10 +160,18 @@ int sim_strncasecmp (const char *string1, const char *string2, size_t len);
|
||||
int sim_strcasecmp (const char *string1, const char *string2);
|
||||
size_t sim_strlcat (char *dst, const char *src, size_t size);
|
||||
size_t sim_strlcpy (char *dst, const char *src, size_t size);
|
||||
#ifndef strlcpy
|
||||
#define strlcpy(dst, src, size) sim_strlcpy((dst), (src), (size))
|
||||
#endif
|
||||
#ifndef strlcat
|
||||
#define strlcat(dst, src, size) sim_strlcat((dst), (src), (size))
|
||||
#endif
|
||||
#ifndef strncasecmp
|
||||
#define strncasecmp(str1, str2, len) sim_strncasecmp((str1), (str2), (len))
|
||||
#endif
|
||||
#ifndef strcasecmp
|
||||
#define strcasecmp(str1, str2) sim_strcasecmp ((str1), (str2))
|
||||
#endif
|
||||
CONST char *get_sim_opt (int32 opt, CONST char *cptr, t_stat *st);
|
||||
const char *put_switches (char *buf, size_t bufsize, uint32 sw);
|
||||
CONST char *get_glyph (const char *iptr, char *optr, char mchar);
|
||||
|
||||
@@ -340,10 +340,10 @@ static SHTAB show_con_tab[] = {
|
||||
{ "DEBUG", &sim_show_cons_debug, 0 },
|
||||
{ "BUFFERED", &sim_show_cons_buff, 0 },
|
||||
{ "EXPECT", &sim_show_cons_expect, 0 },
|
||||
{ "HALT", &sim_show_cons_expect, 0 },
|
||||
{ "HALT", &sim_show_cons_expect, -1 },
|
||||
{ "INPUT", &sim_show_cons_send_input, 0 },
|
||||
{ "RESPONSE", &sim_show_cons_send_input, 0 },
|
||||
{ "DELAY", &sim_show_cons_expect, 0 },
|
||||
{ "RESPONSE", &sim_show_cons_send_input, -1 },
|
||||
{ "DELAY", &sim_show_cons_expect, -1 },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -411,7 +411,8 @@ int32 i;
|
||||
|
||||
if (*cptr == 0) { /* show all */
|
||||
for (i = 0; show_con_tab[i].name; i++)
|
||||
show_con_tab[i].action (st, dptr, uptr, show_con_tab[i].arg, cptr);
|
||||
if (show_con_tab[i].arg != -1)
|
||||
show_con_tab[i].action (st, dptr, uptr, show_con_tab[i].arg, cptr);
|
||||
return SCPE_OK;
|
||||
}
|
||||
while (*cptr != 0) {
|
||||
@@ -509,7 +510,6 @@ REMOTE *sim_rem_consoles = NULL;
|
||||
|
||||
static TMXR sim_rem_con_tmxr = { 0, 0, 0, NULL, NULL, &sim_remote_console };/* remote console line mux */
|
||||
static uint32 sim_rem_read_timeout = 30; /* seconds before automatic continue */
|
||||
static uint32 *sim_rem_read_timeouts = NULL;/* per line read timeout (default from sim_rem_read_timeout) */
|
||||
static int32 sim_rem_active_number = -1; /* -1 - not active, >= 0 is index of active console */
|
||||
int32 sim_rem_cmd_active_line = -1; /* step in progress on line # */
|
||||
static CTAB *sim_rem_active_command = NULL; /* active command */
|
||||
@@ -1349,7 +1349,7 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
|
||||
if (!master_session)
|
||||
tmxr_linemsg (lp, "\r\nSimulator paused.\r\n");
|
||||
if (!master_session && rem->read_timeout) {
|
||||
tmxr_linemsgf (lp, "Simulation will resume automatically if input is not received in %d seconds\n", sim_rem_read_timeouts[i]);
|
||||
tmxr_linemsgf (lp, "Simulation will resume automatically if input is not received in %d seconds\n", rem->read_timeout);
|
||||
tmxr_linemsgf (lp, "\r\n");
|
||||
tmxr_send_buffered_data (lp); /* flush any buffered data */
|
||||
}
|
||||
@@ -2206,7 +2206,7 @@ if (sim_deb) {
|
||||
fprintf (st, " Debug messages display time of day as seconds.msec%s\n", sim_deb_switches & SWMASK ('R') ? " relative to the start of debugging" : "");
|
||||
for (i = 0; (dptr = sim_devices[i]) != NULL; i++) {
|
||||
if (!(dptr->flags & DEV_DIS) &&
|
||||
(dptr->flags & DEV_DEBUG) &&
|
||||
((dptr->flags & DEV_DEBUG) || (dptr->debflags)) &&
|
||||
(dptr->dctrl)) {
|
||||
fprintf (st, "Device: %-6s ", dptr->name);
|
||||
show_dev_debug (st, dptr, NULL, 0, NULL);
|
||||
@@ -2214,7 +2214,7 @@ if (sim_deb) {
|
||||
}
|
||||
for (i = 0; sim_internal_device_count && (dptr = sim_internal_devices[i]); ++i) {
|
||||
if (!(dptr->flags & DEV_DIS) &&
|
||||
(dptr->flags & DEV_DEBUG) &&
|
||||
((dptr->flags & DEV_DEBUG) || (dptr->debflags)) &&
|
||||
(dptr->dctrl)) {
|
||||
fprintf (st, "Device: %-6s ", dptr->name);
|
||||
show_dev_debug (st, dptr, NULL, 0, NULL);
|
||||
@@ -2433,6 +2433,7 @@ return tmxr_close_master (&sim_con_tmxr); /* close master socket *
|
||||
|
||||
t_stat sim_show_cons_expect (FILE *st, DEVICE *dunused, UNIT *uunused, int32 flag, CONST char *cptr)
|
||||
{
|
||||
fprintf (st, "Console Expect processing:\n");
|
||||
return sim_exp_show (st, &sim_con_expect, cptr);
|
||||
}
|
||||
|
||||
@@ -2628,6 +2629,7 @@ return &sim_con_expect;
|
||||
|
||||
t_stat sim_show_cons_send_input (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr)
|
||||
{
|
||||
fprintf (st, "Console Send processing:\n");
|
||||
return sim_show_send_input (st, &sim_con_send);
|
||||
}
|
||||
|
||||
@@ -3229,7 +3231,8 @@ if ((std_input) && /* If Not Background pro
|
||||
if ((std_output) && /* If Not Background process? */
|
||||
(std_output != INVALID_HANDLE_VALUE)) {
|
||||
if (GetConsoleMode(std_output, &saved_output_mode))
|
||||
SetConsoleMode(std_output, ENABLE_VIRTUAL_TERMINAL_PROCESSING|ENABLE_PROCESSED_OUTPUT);
|
||||
if (!SetConsoleMode(std_output, ENABLE_VIRTUAL_TERMINAL_PROCESSING|ENABLE_PROCESSED_OUTPUT))
|
||||
SetConsoleMode(std_output, ENABLE_PROCESSED_OUTPUT);
|
||||
}
|
||||
if (sim_log) {
|
||||
fflush (sim_log);
|
||||
|
||||
@@ -409,7 +409,7 @@ typedef uint32 t_addr;
|
||||
|
||||
/* String match - at least one character required */
|
||||
|
||||
#define MATCH_CMD(ptr,cmd) ((NULL == (ptr)) || (!*(ptr)) || sim_strncasecmp ((ptr), (cmd), strlen (ptr)))
|
||||
#define MATCH_CMD(ptr,cmd) ((NULL == (ptr)) || (!*(ptr)) || strncasecmp ((ptr), (cmd), strlen (ptr)))
|
||||
|
||||
/* End of Linked List/Queue value */
|
||||
/* Chosen for 2 reasons: */
|
||||
|
||||
17
sim_ether.c
17
sim_ether.c
@@ -711,7 +711,7 @@ char* eth_getname_byname(const char* name, char* temp, char *desc)
|
||||
n = strlen(name);
|
||||
for (i=0; i<count && !found; i++) {
|
||||
if ((n == strlen(list[i].name)) &&
|
||||
(sim_strncasecmp(name, list[i].name, n) == 0)) {
|
||||
(strncasecmp(name, list[i].name, n) == 0)) {
|
||||
found = 1;
|
||||
strcpy(temp, list[i].name); /* only case might be different */
|
||||
strcpy(desc, list[i].desc);
|
||||
@@ -731,7 +731,7 @@ char* eth_getdesc_byname(char* name, char* temp)
|
||||
n = strlen(name);
|
||||
for (i=0; i<count && !found; i++) {
|
||||
if ((n == strlen(list[i].name)) &&
|
||||
(sim_strncasecmp(name, list[i].name, n) == 0)) {
|
||||
(strncasecmp(name, list[i].name, n) == 0)) {
|
||||
found = 1;
|
||||
strcpy(temp, list[i].desc);
|
||||
}
|
||||
@@ -1138,8 +1138,8 @@ int load_pcap(void) {
|
||||
BOOL(WINAPI *p_SetDllDirectory)(LPCTSTR);
|
||||
UINT(WINAPI *p_GetSystemDirectory)(LPTSTR lpBuffer, UINT uSize);
|
||||
|
||||
p_SetDllDirectory = (BOOL(WINAPI *)(LPCTSTR)) GetProcAddress(GetModuleHandle("kernel32.dll"), "SetDllDirectoryA");
|
||||
p_GetSystemDirectory = (UINT(WINAPI *)(LPTSTR, UINT)) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetSystemDirectoryA");
|
||||
p_SetDllDirectory = (BOOL(WINAPI *)(LPCTSTR)) GetProcAddress(GetModuleHandleA("kernel32.dll"), "SetDllDirectoryA");
|
||||
p_GetSystemDirectory = (UINT(WINAPI *)(LPTSTR, UINT)) GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetSystemDirectoryA");
|
||||
if (p_SetDllDirectory && p_GetSystemDirectory) {
|
||||
char npcap_path[512] = "";
|
||||
|
||||
@@ -1703,8 +1703,6 @@ _eth_callback((u_char *)opaque, &header, buf);
|
||||
#endif
|
||||
|
||||
#if defined (USE_READER_THREAD)
|
||||
#include <pthread.h>
|
||||
|
||||
static void *
|
||||
_eth_reader(void *arg)
|
||||
{
|
||||
@@ -3617,7 +3615,6 @@ t_stat eth_filter_hash(ETH_DEV* dev, int addr_count, ETH_MAC* const addresses,
|
||||
{
|
||||
int i;
|
||||
char buf[116+66*ETH_FILTER_MAX];
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
char mac[20];
|
||||
char* buf2;
|
||||
t_stat status;
|
||||
@@ -3762,6 +3759,7 @@ sim_debug(dev->dbit, dev->dptr, "BPF string is: |%s|\n", buf);
|
||||
|
||||
#ifdef USE_BPF
|
||||
if (dev->eth_api == ETH_API_PCAP) {
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
bpf_u_int32 bpf_subnet, bpf_netmask;
|
||||
|
||||
if (pcap_lookupnet(dev->name, &bpf_subnet, &bpf_netmask, errbuf)<0)
|
||||
@@ -3824,11 +3822,12 @@ int eth_host_devices(int used, int max, ETH_LIST* list)
|
||||
{
|
||||
pcap_t* conn = NULL;
|
||||
int i, j, datalink = 0;
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
for (i=0; i<used; ++i) {
|
||||
/* Cull any non-ethernet interface types */
|
||||
#if defined(HAVE_PCAP_NETWORK)
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
conn = pcap_open_live(list[i].name, ETH_MAX_PACKET, ETH_PROMISC, PCAP_READ_TIMEOUT, errbuf);
|
||||
if (NULL != conn)
|
||||
datalink = pcap_datalink(conn), pcap_close(conn);
|
||||
@@ -3925,7 +3924,7 @@ return used;
|
||||
int eth_devices(int max, ETH_LIST* list)
|
||||
{
|
||||
int i = 0;
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
char errbuf[PCAP_ERRBUF_SIZE] = "";
|
||||
#ifndef DONT_USE_PCAP_FINDALLDEVS
|
||||
pcap_if_t* alldevs;
|
||||
pcap_if_t* dev;
|
||||
|
||||
@@ -104,6 +104,7 @@ extern "C" {
|
||||
|
||||
/* set related values to have correct relationships */
|
||||
#if defined (USE_READER_THREAD)
|
||||
#include <pthread.h>
|
||||
#if defined (USE_SETNONBLOCK)
|
||||
#undef USE_SETNONBLOCK
|
||||
#endif /* USE_SETNONBLOCK */
|
||||
@@ -112,6 +113,8 @@ extern "C" {
|
||||
#if (!defined (xBSD) && !defined(_WIN32) && !defined(VMS) && !defined(__CYGWIN__)) || defined (HAVE_TAP_NETWORK) || defined (HAVE_VDE_NETWORK)
|
||||
#define MUST_DO_SELECT 1
|
||||
#endif
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif /* USE_READER_THREAD */
|
||||
|
||||
/* give priority to USE_NETWORK over USE_SHARED */
|
||||
|
||||
@@ -390,7 +390,7 @@ dwStatus = FormatMessageA (FORMAT_MESSAGE_FROM_SYSTEM|
|
||||
sizeof (szMsgBuffer) -1, // __in DWORD nSize,
|
||||
NULL); // __in_opt va_list *Arguments
|
||||
if (0 == dwStatus)
|
||||
snprintf(szMsgBuffer, sizeof(szMsgBuffer) - 1, "Error Code: 0x%X", dwError);
|
||||
snprintf(szMsgBuffer, sizeof(szMsgBuffer) - 1, "Error Code: 0x%lX", dwError);
|
||||
while (sim_isspace (szMsgBuffer[strlen (szMsgBuffer)-1]))
|
||||
szMsgBuffer[strlen (szMsgBuffer) - 1] = '\0';
|
||||
return szMsgBuffer;
|
||||
|
||||
@@ -302,7 +302,7 @@ found = 0;
|
||||
n = strlen(name);
|
||||
for (i=0; i<count && !found; i++) {
|
||||
if ((n == strlen(list[i].name)) &&
|
||||
(sim_strncasecmp(name, list[i].name, n) == 0)) {
|
||||
(strncasecmp(name, list[i].name, n) == 0)) {
|
||||
found = 1;
|
||||
strcpy(temp, list[i].name); /* only case might be different */
|
||||
}
|
||||
@@ -321,7 +321,7 @@ found = 0;
|
||||
n = strlen(name);
|
||||
for (i=0; i<count && !found; i++) {
|
||||
if ((n == strlen(list[i].name)) &&
|
||||
(sim_strncasecmp(name, list[i].name, n) == 0)) {
|
||||
(strncasecmp(name, list[i].name, n) == 0)) {
|
||||
found = 1;
|
||||
strcpy(temp, list[i].desc);
|
||||
}
|
||||
|
||||
705
sim_tape.c
705
sim_tape.c
File diff suppressed because it is too large
Load Diff
11
sim_timer.c
11
sim_timer.c
@@ -1602,6 +1602,8 @@ else {
|
||||
sim_throt_val = (uint32) (val * (1 + (sim_idle_rate_ms / val2)));
|
||||
}
|
||||
}
|
||||
sim_throt_state = SIM_THROT_STATE_THROTTLE; /* force state */
|
||||
sim_throt_wait = sim_throt_val;
|
||||
}
|
||||
}
|
||||
sim_register_internal_device (&sim_throttle_dev); /* Register Throttle Device */
|
||||
@@ -1635,7 +1637,8 @@ else {
|
||||
break;
|
||||
|
||||
case SIM_THROT_SPC:
|
||||
fprintf (st, "Throttle: sleep %d ms every %d cycles\n", sim_throt_sleep_time, sim_throt_val);
|
||||
fprintf (st, "Throttle: %d/%d\n", sim_throt_val, sim_throt_sleep_time);
|
||||
fprintf (st, "Throttling by sleeping for: %d ms every %d cycles\n", sim_throt_sleep_time, sim_throt_val);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1684,7 +1687,7 @@ if (sim_throt_type == SIM_THROT_SPC) { /* Non dynamic? */
|
||||
switch (sim_throt_state) {
|
||||
|
||||
case SIM_THROT_STATE_INIT: /* take initial reading */
|
||||
sim_idle_ms_sleep (sim_idle_rate_ms); /* start on a tick boundart to calibrate */
|
||||
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;
|
||||
@@ -2221,8 +2224,8 @@ for (tmr=0; tmr<=SIM_NTIMERS; tmr++) {
|
||||
if (clock_time < 0)
|
||||
clock_time = 0;
|
||||
/* Stop clock assist unit and make sure the clock unit has a tick queued */
|
||||
sim_cancel (&sim_timer_units[tmr]);
|
||||
if (rtc_hz[tmr]) {
|
||||
if (sim_is_active (&sim_timer_units[tmr])) {
|
||||
sim_cancel (&sim_timer_units[tmr]);
|
||||
sim_debug (DBG_QUE, &sim_timer_dev, "sim_stop_timer_services() - tmr=%d scheduling %s after %d\n", tmr, sim_uname (sim_clock_unit[tmr]), clock_time);
|
||||
_sim_activate (sim_clock_unit[tmr], clock_time);
|
||||
}
|
||||
|
||||
@@ -2056,6 +2056,11 @@ if ((lp->txbfd && !lp->notelnet) || (TXBUF_AVAIL(lp) > 1)) {/* room for char (+
|
||||
sim_oline = save_oline; /* resture output socket */
|
||||
}
|
||||
sim_exp_check (&lp->expect, chr); /* process expect rules as needed */
|
||||
if ((sim_interval > 0) && /* not called within sim_process_event? */
|
||||
(lp->txbps) && (lp->txdelta > 1000)) { /* and rate limiting output slower than 1000 cps */
|
||||
tmxr_send_buffered_data (lp); /* put data on wire */
|
||||
sim_os_ms_sleep((lp->txdelta - 1000) / 1000); /* wait an approximate character delay */
|
||||
}
|
||||
return SCPE_OK; /* char sent */
|
||||
}
|
||||
++lp->txdrp; lp->xmte = 0; /* no room, dsbl line */
|
||||
|
||||
26
sim_video.c
26
sim_video.c
@@ -31,8 +31,6 @@
|
||||
#include "scp.h"
|
||||
|
||||
t_bool vid_active = FALSE;
|
||||
int32 vid_mouse_xrel;
|
||||
int32 vid_mouse_yrel;
|
||||
int32 vid_cursor_x;
|
||||
int32 vid_cursor_y;
|
||||
t_bool vid_mouse_b1 = FALSE;
|
||||
@@ -96,7 +94,7 @@ static char tmp_key_name[40];
|
||||
* via SDL_GetError().
|
||||
*/
|
||||
#define SDL_SavePNG(surface, file) \
|
||||
SDL_SavePNG_RW(surface, SDL_RWFromFile(file, "wb"), 1)
|
||||
SDL_SavePNG_RW(surface, SDL_RWFromFile(file, "wb"), 1)
|
||||
|
||||
/*
|
||||
* SDL_SavePNG -- libpng-based SDL_Surface writer.
|
||||
@@ -523,8 +521,6 @@ if (!vid_active) {
|
||||
vid_height = height;
|
||||
vid_mouse_captured = FALSE;
|
||||
vid_cursor_visible = (vid_flags & SIM_VID_INPUTCAPTURED);
|
||||
vid_mouse_xrel = 0;
|
||||
vid_mouse_yrel = 0;
|
||||
|
||||
vid_key_events.head = 0;
|
||||
vid_key_events.tail = 0;
|
||||
@@ -717,6 +713,9 @@ void vid_set_cursor_position (int32 x, int32 y)
|
||||
int32 x_delta = vid_cursor_x - x;
|
||||
int32 y_delta = vid_cursor_y - y;
|
||||
|
||||
if (vid_flags & SIM_VID_INPUTCAPTURED)
|
||||
return;
|
||||
|
||||
if ((x_delta) || (y_delta)) {
|
||||
sim_debug (SIM_VID_DBG_CURSOR, vid_dev, "vid_set_cursor_position(%d, %d) - Cursor position changed\n", x, y);
|
||||
/* Any queued mouse motion events need to have their relative
|
||||
@@ -728,12 +727,8 @@ if ((x_delta) || (y_delta)) {
|
||||
for (i=0; i<vid_mouse_events.count; i++) {
|
||||
ev = &vid_mouse_events.events[(vid_mouse_events.head + i)%MAX_EVENTS];
|
||||
sim_debug (SIM_VID_DBG_CURSOR, vid_dev, "Pending Mouse Motion Event Adjusted from: (%d, %d) to (%d, %d)\n", ev->x_rel, ev->y_rel, ev->x_rel + x_delta, ev->y_rel + y_delta);
|
||||
vid_mouse_xrel -= ev->x_rel; /* remove previously accumulated relative position */
|
||||
vid_mouse_yrel -= ev->y_rel;
|
||||
ev->x_rel += x_delta;
|
||||
ev->y_rel += y_delta;
|
||||
vid_mouse_xrel += ev->x_rel; /* update cumulative x & y rel */
|
||||
vid_mouse_yrel += ev->y_rel;
|
||||
}
|
||||
if (SDL_SemPost (vid_mouse_events.sem))
|
||||
sim_printf ("%s: vid_set_cursor_position(): SDL_SemPost error: %s\n", vid_dev ? sim_dname(vid_dev) : "Video Device", SDL_GetError());
|
||||
@@ -1250,13 +1245,11 @@ if (SDL_SemWait (vid_mouse_events.sem) == 0) {
|
||||
event->xrel = (event->x - vid_cursor_x);
|
||||
event->yrel = (event->y - vid_cursor_y);
|
||||
}
|
||||
vid_mouse_xrel += event->xrel; /* update cumulative x rel */
|
||||
vid_mouse_yrel += event->yrel; /* update cumulative y rel */
|
||||
vid_mouse_b1 = (event->state & SDL_BUTTON(SDL_BUTTON_LEFT)) ? TRUE : FALSE;
|
||||
vid_mouse_b2 = (event->state & SDL_BUTTON(SDL_BUTTON_MIDDLE)) ? TRUE : FALSE;
|
||||
vid_mouse_b3 = (event->state & SDL_BUTTON(SDL_BUTTON_RIGHT)) ? TRUE : FALSE;
|
||||
sim_debug (SIM_VID_DBG_MOUSE, vid_dev, "Mouse Move Event: pos:(%d,%d) rel:(%d,%d) buttons:(%d,%d,%d) - Count: %d vid_mouse_rel:(%d,%d), vid_cursor:(%d,%d)\n",
|
||||
event->x, event->y, event->xrel, event->yrel, (event->state & SDL_BUTTON(SDL_BUTTON_LEFT)) ? 1 : 0, (event->state & SDL_BUTTON(SDL_BUTTON_MIDDLE)) ? 1 : 0, (event->state & SDL_BUTTON(SDL_BUTTON_RIGHT)) ? 1 : 0, vid_mouse_events.count, vid_mouse_xrel, vid_mouse_yrel, vid_cursor_x, vid_cursor_y);
|
||||
sim_debug (SIM_VID_DBG_MOUSE, vid_dev, "Mouse Move Event: pos:(%d,%d) rel:(%d,%d) buttons:(%d,%d,%d) - Count: %d vid_cursor:(%d,%d)\n",
|
||||
event->x, event->y, event->xrel, event->yrel, (event->state & SDL_BUTTON(SDL_BUTTON_LEFT)) ? 1 : 0, (event->state & SDL_BUTTON(SDL_BUTTON_MIDDLE)) ? 1 : 0, (event->state & SDL_BUTTON(SDL_BUTTON_RIGHT)) ? 1 : 0, vid_mouse_events.count, vid_cursor_x, vid_cursor_y);
|
||||
if (vid_mouse_events.count < MAX_EVENTS) {
|
||||
SIM_MOUSE_EVENT *tail = &vid_mouse_events.events[(vid_mouse_events.tail+MAX_EVENTS-1)%MAX_EVENTS];
|
||||
|
||||
@@ -1275,8 +1268,8 @@ if (SDL_SemWait (vid_mouse_events.sem) == 0) {
|
||||
tail->y_rel += ev.y_rel;
|
||||
tail->x_pos = ev.x_pos;
|
||||
tail->y_pos = ev.y_pos;
|
||||
sim_debug (SIM_VID_DBG_MOUSE, vid_dev, "Mouse Move Event: Coalesced into pending event: (%d,%d) vid_mouse_rel:(%d,%d)\n",
|
||||
tail->x_rel, tail->y_rel, vid_mouse_xrel, vid_mouse_yrel);
|
||||
sim_debug (SIM_VID_DBG_MOUSE, vid_dev, "Mouse Move Event: Coalesced into pending event: (%d,%d)\n",
|
||||
tail->x_rel, tail->y_rel);
|
||||
}
|
||||
else { /* Add a new event */
|
||||
vid_mouse_events.events[vid_mouse_events.tail++] = ev;
|
||||
@@ -1705,6 +1698,9 @@ while (vid_active) {
|
||||
if (vid_flags & SIM_VID_INPUTCAPTURED)
|
||||
SDL_WarpMouseInWindow (NULL, vid_width/2, vid_height/2); /* center position */
|
||||
break;
|
||||
case SDL_WINDOWEVENT_EXPOSED:
|
||||
vid_update ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -197,11 +197,6 @@ t_stat vid_screenshot (const char *filename);
|
||||
|
||||
extern t_bool vid_active;
|
||||
extern uint32 vid_mono_palette[2];
|
||||
extern int32 vid_mouse_xrel; /* mouse cumulative x rel */
|
||||
extern int32 vid_mouse_yrel; /* mouse cumulative y rel */
|
||||
extern t_bool vid_mouse_b1; /* mouse button 1 state */
|
||||
extern t_bool vid_mouse_b2; /* mouse button 2 state */
|
||||
extern t_bool vid_mouse_b3; /* mouse button 3 state */
|
||||
void vid_set_cursor_position (int32 x, int32 y); /* cursor position (set by calling code) */
|
||||
|
||||
#define SIM_VID_DBG_MOUSE 0x01000000
|
||||
|
||||
Reference in New Issue
Block a user