1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-02-26 16:53:58 +00:00

SCP: Updated to current.

This commit is contained in:
Richard Cornwell
2021-09-27 21:19:33 -04:00
parent 846b36a6cb
commit b26460bf01
5 changed files with 64 additions and 24 deletions

56
scp.c
View File

@@ -2708,6 +2708,7 @@ int32 i, sw;
t_bool lookswitch;
t_bool register_check = FALSE;
t_stat stat = SCPE_OK;
CTAB *docmdp = NULL;
#if defined (__MWERKS__) && defined (macintosh)
argc = ccommand (&argv);
@@ -2896,14 +2897,15 @@ if (cptr == NULL) {
}
else
cptr2 = NULL;
docmdp = find_cmd ("DO");
if (cptr && (sizeof (nbuf) > strlen (cptr) + strlen ("/simh.ini") + 3)) {
snprintf(nbuf, sizeof (nbuf), "\"%s%s%ssimh.ini\"", cptr2 ? cptr2 : "", cptr, strchr (cptr, '/') ? "/" : "\\");
stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* simh.ini proc cmd file */
stat = docmdp->action (-1, nbuf) & ~SCPE_NOMESSAGE; /* simh.ini proc cmd file */
}
if (SCPE_BARE_STATUS(stat) == SCPE_OPENERR)
stat = do_cmd (-1, "simh.ini"); /* simh.ini proc cmd file */
stat = docmdp->action (-1, "simh.ini"); /* simh.ini proc cmd file */
if (*cbuf) /* cmd file arg? */
stat = do_cmd (0, cbuf); /* proc cmd file */
stat = docmdp->action (0, cbuf); /* proc cmd file */
else if (*argv[0]) { /* sim name arg? */
char *np; /* "path.ini" */
nbuf[0] = '"'; /* starting " */
@@ -2911,7 +2913,7 @@ else if (*argv[0]) { /* sim name arg? */
if ((np = (char *)match_ext (nbuf, "EXE"))) /* remove .exe */
*np = 0;
strlcat (nbuf, ".ini\"", sizeof (nbuf)); /* add .ini" */
stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* proc default cmd file */
stat = docmdp->action (-1, nbuf) & ~SCPE_NOMESSAGE; /* proc default cmd file */
if (stat == SCPE_OPENERR) { /* didn't exist/can't open? */
np = strrchr (nbuf, '/'); /* stript path and try again in cwd */
if (np == NULL)
@@ -2920,7 +2922,7 @@ else if (*argv[0]) { /* sim name arg? */
np = strrchr (nbuf, ']'); /* VMS path separator */
if (np != NULL) {
*np = '"';
stat = do_cmd (-1, np) & ~SCPE_NOMESSAGE; /* proc default cmd file */
stat = docmdp->action (-1, np) & ~SCPE_NOMESSAGE;/* proc default cmd file */
}
}
}
@@ -3402,7 +3404,24 @@ if (dptr->modifiers) {
if (mptr->mstring) {
fprint_header (st, &found, header);
snprintf (buf, sizeof (buf), "set %s %s%s", sim_dname (dptr), mptr->mstring, (strchr(mptr->mstring, '=')) ? "" : (MODMASK(mptr,MTAB_VALR) ? "=val" : (MODMASK(mptr,MTAB_VALO) ? "{=val}" : "")));
fprint_wrapped (st, buf, 30, gap, mptr->help, 80);
if ((mptr->valid != NULL) && (mptr->disp != NULL) && (mptr->help != NULL)) {
char gbuf[CBUFSIZE];
const char *rem;
rem = get_glyph (mptr->help, gbuf, 0);
if ((strcasecmp (gbuf, "Display") == 0) ||
(strcasecmp (gbuf, "Show") == 0)) {
char *thelp = (char *)malloc (9 + strlen (rem));
sprintf (thelp, "Specify %s", rem);
fprint_wrapped (st, buf, 30, gap, thelp, 80);
free (thelp);
}
else
fprint_wrapped (st, buf, 30, gap, mptr->help, 80);
}
else
fprint_wrapped (st, buf, 30, gap, mptr->help, 80);
}
}
}
@@ -3485,7 +3504,24 @@ if ((dptr->modifiers) && (dptr->units)) { /* handle unit specific modifiers */
if (mptr->mstring) {
fprint_header (st, &found, header);
snprintf (buf, sizeof (buf), "set %s %s%s", unit_spec, mptr->mstring, (strchr(mptr->mstring, '=')) ? "" : (MODMASK(mptr,MTAB_VALR) ? "=val" : (MODMASK(mptr,MTAB_VALO) ? "{=val}": "")));
fprint_wrapped (st, buf, 30, gap, mptr->help, 80);
if ((mptr->valid != NULL) && (mptr->disp != NULL) && (mptr->help != NULL)) {
char gbuf[CBUFSIZE];
const char *rem;
rem = get_glyph (mptr->help, gbuf, 0);
if ((strcasecmp (gbuf, "Display") == 0) ||
(strcasecmp (gbuf, "Show") == 0)) {
char *thelp = (char *)malloc (9 + strlen (rem));
sprintf (thelp, "Specify %s", rem);
fprint_wrapped (st, buf, 30, gap, thelp, 80);
free (thelp);
}
else
fprint_wrapped (st, buf, 30, gap, mptr->help, 80);
}
else
fprint_wrapped (st, buf, 30, gap, mptr->help, 80);
}
}
}
@@ -4129,11 +4165,11 @@ do {
if ((cmdp = find_cmd (gbuf))) { /* lookup command */
if (cmdp->action == &return_cmd) /* RETURN command? */
break; /* done! */
if (cmdp->action == &do_cmd) { /* DO command? */
if (strcmp (cmdp->name, "DO") == 0) { /* DO command? */
if (sim_do_depth >= MAX_DO_NEST_LVL) /* nest too deep? */
stat = SCPE_NEST;
else
stat = do_cmd (sim_do_depth+1, cptr); /* exec DO cmd */
stat = cmdp->action (sim_do_depth+1, cptr);/* exec DO cmd */
}
else
if (cmdp->action == &shift_cmd) /* SHIFT command */
@@ -13772,7 +13808,7 @@ return stat | ((stat != SCPE_OK) ? SCPE_NOMESSAGE : 0);
Callers should be calling sim_debug() which is a macro
defined in scp.h which evaluates the action condition before
incurring call overhead. */
static void _sim_vdebug (uint32 dbits, DEVICE* dptr, UNIT *uptr, const char* fmt, va_list arglist)
void _sim_vdebug (uint32 dbits, DEVICE* dptr, UNIT *uptr, const char* fmt, va_list arglist)
{
if (sim_deb && dptr && ((dptr->dctrl | (uptr ? uptr->dctrl : 0)) & dbits)) {
TMLN *saved_oline = sim_oline;

1
scp.h
View File

@@ -259,6 +259,7 @@ void sim_debug_bits (uint32 dbits, DEVICE* dptr, BITFIELD* bitdefs,
#if defined (__DECC) && defined (__VMS) && (defined (__VAX) || (__DECC_VER < 60590001))
#define CANT_USE_MACRO_VA_ARGS 1
#endif
void _sim_vdebug (uint32 dbits, DEVICE* dptr, UNIT *uptr, const char* fmt, va_list arglist);
#ifdef CANT_USE_MACRO_VA_ARGS
#define _sim_debug_device sim_debug
void sim_debug (uint32 dbits, DEVICE* dptr, const char *fmt, ...) GCC_FMT_ATTR(3, 4);

View File

@@ -1709,7 +1709,7 @@ switch (dev->devtype) {
case SCSI_CDROM:
return sim_disk_attach_ex (uptr, cptr, dev->block_size, sizeof (uint16), (uptr->flags & SCSI_NOAUTO), SCSI_DBG_DSK, dev->name, 0, 0, drivetypes);
case SCSI_TAPE:
return sim_tape_attach (uptr, cptr);
return sim_tape_attach_ex (uptr, cptr, SCSI_DBG_TAP, 0);
default:
return SCPE_NOFNC;
}

View File

@@ -65,6 +65,7 @@
#define SCSI_DBG_MSG 0x02000000 /* SCSI messages */
#define SCSI_DBG_BUS 0x04000000 /* bus activity */
#define SCSI_DBG_DSK 0x08000000 /* disk activity */
#define SCSI_DBG_TAP 0x10000000 /* disk activity */
#define SCSI_V_NOAUTO ((DKUF_V_UF > MTUF_V_UF) ? DKUF_V_UF : MTUF_V_UF)/* noautosize */
#define SCSI_V_UF (SCSI_V_NOAUTO + 1)

View File

@@ -371,6 +371,8 @@ DEVICE *vid_dev;
t_bool vid_key_state[SDL_NUM_SCANCODES];
VID_DISPLAY *next;
t_bool vid_blending;
SDL_Rect *vid_dst_last;
uint32 *vid_data_last;
};
SDL_Thread *vid_thread_handle = NULL; /* event thread handle */
@@ -868,22 +870,20 @@ uint32 vid_map_rgba_window (VID_DISPLAY *vptr, uint8 r, uint8 g, uint8 b, uint8
return SDL_MapRGBA (vptr->vid_format, r, g, b, a);
}
static SDL_Rect *vid_dst_last;
static uint32 *vid_data_last;
void vid_draw_window (VID_DISPLAY *vptr, int32 x, int32 y, int32 w, int32 h, uint32 *buf)
{
SDL_Event user_event;
SDL_Rect *vid_dst;
SDL_Rect *vid_dst, *last;
uint32 *vid_data;
sim_debug (SIM_VID_DBG_VIDEO, vptr->vid_dev, "vid_draw(%d, %d, %d, %d)\n", x, y, w, h);
SDL_LockMutex (vptr->vid_draw_mutex); /* Synchronize to check region dimensions */
if (vid_dst_last && /* As yet unprocessed draw rectangle? */
(vid_dst_last->x == x) && (vid_dst_last->y == y) && /* AND identical position? */
(vid_dst_last->w == w) && (vid_dst_last->h == h)) { /* AND identical dimensions? */
memcpy (vid_data_last, buf, w*h*sizeof(*buf)); /* Replace region contents */
last = vptr->vid_dst_last;
if (last && /* As yet unprocessed draw rectangle? */
(last->x == x) && (last->y == y) && /* AND identical position? */
(last->w == w) && (last->h == h)) { /* AND identical dimensions? */
memcpy (vptr->vid_data_last, buf, w*h*sizeof(*buf));/* Replace region contents */
SDL_UnlockMutex (vptr->vid_draw_mutex); /* Done */
return;
}
@@ -911,8 +911,8 @@ user_event.user.code = EVENT_DRAW;
user_event.user.data1 = (void *)vid_dst;
user_event.user.data2 = (void *)vid_data;
SDL_LockMutex (vptr->vid_draw_mutex); /* protect vid_dst_last & vid_data_last */
vid_dst_last = vid_dst;
vid_data_last = vid_data;
vptr->vid_dst_last = vid_dst;
vptr->vid_data_last = vid_data;
SDL_UnlockMutex (vptr->vid_draw_mutex); /* done protection */
if (SDL_PushEvent (&user_event) < 0) {
sim_printf ("%s: vid_draw() SDL_PushEvent error: %s\n", vid_dname(vptr->vid_dev), SDL_GetError());
@@ -1706,9 +1706,9 @@ uint32 *buf = (uint32 *)event->data2;
sim_debug (SIM_VID_DBG_VIDEO, vptr->vid_dev, "Draw Region Event: (%d,%d,%d,%d)\n", vid_dst->x, vid_dst->x, vid_dst->w, vid_dst->h);
SDL_LockMutex (vptr->vid_draw_mutex);
if (vid_dst == vid_dst_last) {
vid_dst_last = NULL;
vid_data_last = NULL;
if (vid_dst == vptr->vid_dst_last) {
vptr->vid_dst_last = NULL;
vptr->vid_data_last = NULL;
}
SDL_UnlockMutex (vptr->vid_draw_mutex);
@@ -1780,6 +1780,8 @@ else
SDL_SetWindowTitle (vptr->vid_window, vptr->vid_title);
memset (&vptr->vid_key_state, 0, sizeof(vptr->vid_key_state));
vptr->vid_dst_last = NULL;
vptr->vid_data_last = NULL;
vid_active++;
return 1;