mirror of
https://github.com/simh/simh.git
synced 2026-02-09 09:42:43 +00:00
VAX: Change to load ROMs or other boot code directly from built in memory arrays.
Prior logic attempted to load the desired file from the current default directory and if that failed wrote the in memory boot code image to the desired file and then retried the desired load.. A user can still explicitly load a ROM image with a "LOAD -R romfile.bin" command prior to a BOOT attempt if they want to test or otherwise run with a different ROM.
This commit is contained in:
44
scp.c
44
scp.c
@@ -5048,22 +5048,55 @@ return r;
|
||||
du[mp] filename {arg} dump to specified file
|
||||
*/
|
||||
|
||||
/* Memory File use (for internal memory static ROM images)
|
||||
|
||||
when used to read ROM image with internally generated
|
||||
load commands, calling code setups with sim_set_memory_file()
|
||||
sim_load uses Fgetc() instead of fgetc() or getc()
|
||||
*/
|
||||
|
||||
static const unsigned char *mem_data = NULL;
|
||||
static size_t mem_data_size = 0;
|
||||
|
||||
t_stat sim_set_memory_load_file (const unsigned char *data, size_t size)
|
||||
{
|
||||
mem_data = data;
|
||||
mem_data_size = size;
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
int Fgetc (FILE *f)
|
||||
{
|
||||
if (mem_data) {
|
||||
if (mem_data_size == 0)
|
||||
return EOF;
|
||||
--mem_data_size;
|
||||
return (int)(*mem_data++);
|
||||
}
|
||||
else
|
||||
return fgetc (f);
|
||||
}
|
||||
|
||||
|
||||
t_stat load_cmd (int32 flag, char *cptr)
|
||||
{
|
||||
char gbuf[CBUFSIZE];
|
||||
FILE *loadfile;
|
||||
FILE *loadfile = NULL;
|
||||
t_stat reason;
|
||||
|
||||
GET_SWITCHES (cptr); /* get switches */
|
||||
if (*cptr == 0) /* must be more */
|
||||
return SCPE_2FARG;
|
||||
cptr = get_glyph_nc (cptr, gbuf, 0); /* get file name */
|
||||
loadfile = sim_fopen (gbuf, flag? "wb": "rb"); /* open for wr/rd */
|
||||
if (loadfile == NULL)
|
||||
return SCPE_OPENERR;
|
||||
if (!mem_data) {
|
||||
loadfile = sim_fopen (gbuf, flag? "wb": "rb"); /* open for wr/rd */
|
||||
if (loadfile == NULL)
|
||||
return SCPE_OPENERR;
|
||||
}
|
||||
GET_SWITCHES (cptr); /* get switches */
|
||||
reason = sim_load (loadfile, cptr, gbuf, flag); /* load or dump */
|
||||
fclose (loadfile);
|
||||
if (loadfile)
|
||||
fclose (loadfile);
|
||||
return reason;
|
||||
}
|
||||
|
||||
@@ -9933,7 +9966,6 @@ va_end (args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Hierarchical help presentation
|
||||
*
|
||||
* Device help can be presented hierarchically by calling
|
||||
|
||||
Reference in New Issue
Block a user