Added support for embedded ROM images in simulators.
This allows a single simulator executable to be a completely useful component (for those simulators which dynamically load ROM or other boot code). Meanwhile, we continues to allow the explicit use of a user's preferred ROM or other boot code as well. A build option is provided in the makefile to not build with the included ROM functionality if desired.
This commit is contained in:
parent
312bc9a967
commit
cb35f6c97b
11 changed files with 12067 additions and 602 deletions
|
@ -36,6 +36,10 @@
|
||||||
|
|
||||||
#include "vax_defs.h"
|
#include "vax_defs.h"
|
||||||
|
|
||||||
|
#ifndef DONT_USE_INTERNAL_ROM
|
||||||
|
#include "vax780_vmb_exe.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 11/780 specific IPRs */
|
/* 11/780 specific IPRs */
|
||||||
|
|
||||||
/* Writeable control store */
|
/* Writeable control store */
|
||||||
|
@ -694,8 +698,26 @@ printf ("Loading boot code from vmb.exe\n");
|
||||||
if (sim_log)
|
if (sim_log)
|
||||||
fprintf (sim_log, "Loading boot code from vmb.exe\n");
|
fprintf (sim_log, "Loading boot code from vmb.exe\n");
|
||||||
r = load_cmd (0, "-O vmb.exe 200");
|
r = load_cmd (0, "-O vmb.exe 200");
|
||||||
if (r != SCPE_OK)
|
if (r != SCPE_OK) {
|
||||||
|
#ifndef DONT_USE_INTERNAL_ROM
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
if (f = sim_fopen ("vmb.exe", "wb")) {
|
||||||
|
printf ("Saving boot code to vmb.exe\n");
|
||||||
|
if (sim_log)
|
||||||
|
fprintf (sim_log, "Saving boot code to vmb.exe\n");
|
||||||
|
sim_fwrite (vax780_vmb_exe, sizeof(vax780_vmb_exe[0]), sizeof(vax780_vmb_exe)/sizeof(vax780_vmb_exe[0]), f);
|
||||||
|
fclose (f);
|
||||||
|
printf ("Loading boot code from vmb.exe\n");
|
||||||
|
if (sim_log)
|
||||||
|
fprintf (sim_log, "Loading boot code from vmb.exe\n");
|
||||||
|
r = load_cmd (0, "-O vmb.exe 200");
|
||||||
|
if (r == SCPE_OK)
|
||||||
|
SP = PC = 512;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
SP = PC = 512;
|
SP = PC = 512;
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
2790
VAX/vax780_vmb_exe.h
Normal file
2790
VAX/vax780_vmb_exe.h
Normal file
File diff suppressed because it is too large
Load diff
8198
VAX/vax_ka655x_bin.h
Normal file
8198
VAX/vax_ka655x_bin.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -54,6 +54,10 @@
|
||||||
|
|
||||||
#include "vax_defs.h"
|
#include "vax_defs.h"
|
||||||
|
|
||||||
|
#ifndef DONT_USE_INTERNAL_ROM
|
||||||
|
#include "vax_ka655x_bin.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define UNIT_V_NODELAY (UNIT_V_UF + 0) /* ROM access equal to RAM access */
|
#define UNIT_V_NODELAY (UNIT_V_UF + 0) /* ROM access equal to RAM access */
|
||||||
#define UNIT_NODELAY (1u << UNIT_V_NODELAY)
|
#define UNIT_NODELAY (1u << UNIT_V_NODELAY)
|
||||||
|
|
||||||
|
@ -1555,8 +1559,24 @@ if (*rom == 0) { /* no boot? */
|
||||||
if (sim_log)
|
if (sim_log)
|
||||||
fprintf (sim_log, "Loading boot code from ka655x.bin\n");
|
fprintf (sim_log, "Loading boot code from ka655x.bin\n");
|
||||||
r = load_cmd (0, "-R ka655x.bin");
|
r = load_cmd (0, "-R ka655x.bin");
|
||||||
if (r != SCPE_OK)
|
if (r != SCPE_OK) {
|
||||||
|
#ifndef DONT_USE_INTERNAL_ROM
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
if (f = sim_fopen ("ka655x.bin", "wb")) {
|
||||||
|
printf ("Saving boot code to ka655x.bin\n");
|
||||||
|
if (sim_log)
|
||||||
|
fprintf (sim_log, "Saving boot code to ka655x.bin\n");
|
||||||
|
sim_fwrite (vax_ka655x_bin, sizeof(vax_ka655x_bin[0]), sizeof(vax_ka655x_bin)/sizeof(vax_ka655x_bin[0]), f);
|
||||||
|
fclose (f);
|
||||||
|
printf ("Loading boot code from ka655x.bin\n");
|
||||||
|
if (sim_log)
|
||||||
|
fprintf (sim_log, "Loading boot code from ka655x.bin\n");
|
||||||
|
r = load_cmd (0, "-R ka655x.bin");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sysd_powerup ();
|
sysd_powerup ();
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
|
|
206
Visual Studio Projects/BuildROMs.vcproj
Normal file
206
Visual Studio Projects/BuildROMs.vcproj
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="BuildROMs"
|
||||||
|
ProjectGUID="{D40F3AF1-EEE7-4432-9807-2AD287B490F8}"
|
||||||
|
RootNamespace="BuildROMs"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="131072"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="..\BIN\NT\$(PlatformName)-$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="..\BIN\NT\Project\simh\BuildROMs\$(PlatformName)-$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="./;../"
|
||||||
|
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="wsock32.lib winmm.lib"
|
||||||
|
OutputFile="$(OutDir)\BuildROMs.exe"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
ProgramDatabaseFile="$(OutDir)\BuildROMs.pdb"
|
||||||
|
SubSystem="1"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="..\BIN\NT\$(PlatformName)-$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="..\BIN\NT\Project\simh\BuildROMs\$(PlatformName)-$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
AdditionalIncludeDirectories="./;../"
|
||||||
|
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||||
|
StringPooling="true"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="wsock32.lib winmm.lib"
|
||||||
|
OutputFile="$(OutDir)\BuildROMs.exe"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\sim_BuildROMs.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
|
@ -2,8 +2,14 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
# Visual C++ Express 2008
|
# Visual C++ Express 2008
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VAX", "VAX.vcproj", "{D5D873F7-D286-43E7-958A-3D838FAA0856}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VAX", "VAX.vcproj", "{D5D873F7-D286-43E7-958A-3D838FAA0856}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VAX780", "VAX780.vcproj", "{D5D873F7-D286-43E7-958A-3D83DEADBEEF}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VAX780", "VAX780.vcproj", "{D5D873F7-D286-43E7-958A-3D83DEADBEEF}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AltairZ80", "AltairZ80.vcproj", "{BC7F37AD-7414-43C3-829D-214CD1113D67}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AltairZ80", "AltairZ80.vcproj", "{BC7F37AD-7414-43C3-829D-214CD1113D67}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -57,6 +63,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I7094", "I7094.vcproj", "{9
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SWTP", "SWTP.vcproj", "{0ABAF350-853E-4A8F-8435-B583E29FB78C}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SWTP", "SWTP.vcproj", "{0ABAF350-853E-4A8F-8435-B583E29FB78C}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BuildROMs", "BuildROMs.vcproj", "{D40F3AF1-EEE7-4432-9807-2AD287B490F8}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
|
@ -175,6 +183,10 @@ Global
|
||||||
{0ABAF350-853E-4A8F-8435-B583E29FB78C}.Debug|Win32.Build.0 = Debug|Win32
|
{0ABAF350-853E-4A8F-8435-B583E29FB78C}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{0ABAF350-853E-4A8F-8435-B583E29FB78C}.Release|Win32.ActiveCfg = Release|Win32
|
{0ABAF350-853E-4A8F-8435-B583E29FB78C}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{0ABAF350-853E-4A8F-8435-B583E29FB78C}.Release|Win32.Build.0 = Release|Win32
|
{0ABAF350-853E-4A8F-8435-B583E29FB78C}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{D40F3AF1-EEE7-4432-9807-2AD287B490F8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{D40F3AF1-EEE7-4432-9807-2AD287B490F8}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{D40F3AF1-EEE7-4432-9807-2AD287B490F8}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{D40F3AF1-EEE7-4432-9807-2AD287B490F8}.Release|Win32.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
Description="Build Dependent ROM include File(s)"
|
||||||
|
CommandLine="pushd ..
$(TargetDir)BuildROMs
popd"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
@ -110,6 +112,8 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
Description="Build Dependent ROM include File(s)"
|
||||||
|
CommandLine="pushd ..
$(TargetDir)BuildROMs
popd"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
Description="Build Dependent ROM include File(s)"
|
||||||
|
CommandLine="pushd ..
$(TargetDir)BuildROMs
popd"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
@ -109,6 +111,8 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
Description="Build Dependent ROM include File(s)"
|
||||||
|
CommandLine="pushd ..
$(TargetDir)BuildROMs
popd"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
|
|
1203
descrip.mms
1203
descrip.mms
File diff suppressed because it is too large
Load diff
44
makefile
44
makefile
|
@ -21,7 +21,11 @@ ifeq ($(WIN32),)
|
||||||
ifeq (Darwin,$(shell uname))
|
ifeq (Darwin,$(shell uname))
|
||||||
LIBEXT = dylib
|
LIBEXT = dylib
|
||||||
else
|
else
|
||||||
LIBEXT = a
|
ifeq (Linux,$(shell uname))
|
||||||
|
LIBEXT = so
|
||||||
|
else
|
||||||
|
LIBEXT = a
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
OS_CCDEFS = -D_GNU_SOURCE
|
OS_CCDEFS = -D_GNU_SOURCE
|
||||||
ifeq (libm,$(shell if $(TEST) -e /usr/lib/libm.$(LIBEXT); then echo libm; fi))
|
ifeq (libm,$(shell if $(TEST) -e /usr/lib/libm.$(LIBEXT); then echo libm; fi))
|
||||||
|
@ -42,17 +46,12 @@ ifeq ($(WIN32),)
|
||||||
OS_LDFLAGS += -lpthread
|
OS_LDFLAGS += -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq (readline,$(shell if $(TEST) -e /usr/lib/libreadline.$(LIBEXT) -o -e /opt/sfw/lib/libreadline.a; then echo readline; fi))
|
ifeq (readline,$(shell if $(TEST) -e /usr/lib/libreadline.$(LIBEXT) -o -e /opt/sfw/lib/libreadline.a; then echo readline; fi))
|
||||||
# Use Locally installed and available readline support
|
|
||||||
ifeq (ncurses,$(shell if $(TEST) -e /usr/lib/libncurses.$(LIBEXT) -o -e /opt/sfw/lib/libncurses.a; then echo ncurses; fi))
|
|
||||||
OS_CCDEFS += -DHAVE_READLINE
|
|
||||||
OS_LDFLAGS += -lreadline -lncurses
|
|
||||||
else
|
|
||||||
OS_CCDEFS += -DHAVE_READLINE
|
|
||||||
OS_LDFLAGS += -lreadline
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
ifeq (readline_h,$(shell if $(TEST) -e /usr/include/readline/readline.h; then echo readline_h; fi))
|
ifeq (readline_h,$(shell if $(TEST) -e /usr/include/readline/readline.h; then echo readline_h; fi))
|
||||||
ifeq (Linux,$(shell uname))
|
# Use Locally installed and available readline support
|
||||||
|
ifeq (ncurses,$(shell if $(TEST) -e /usr/lib/libncurses.$(LIBEXT) -o -e /opt/sfw/lib/libncurses.a; then echo ncurses; fi))
|
||||||
|
OS_CCDEFS += -DHAVE_READLINE
|
||||||
|
OS_LDFLAGS += -lreadline -lncurses
|
||||||
|
else
|
||||||
OS_CCDEFS += -DHAVE_READLINE
|
OS_CCDEFS += -DHAVE_READLINE
|
||||||
OS_LDFLAGS += -lreadline
|
OS_LDFLAGS += -lreadline
|
||||||
endif
|
endif
|
||||||
|
@ -113,8 +112,14 @@ else
|
||||||
NETWORK_OPT = -DUSE_SHARED
|
NETWORK_OPT = -DUSE_SHARED
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(DONT_USE_ROMS),)
|
||||||
|
ROMS_OPT = -DDONT_USE_INTERNAL_ROM
|
||||||
|
else
|
||||||
|
BUILD_ROMS = ${BIN}BuildROMs${EXE}
|
||||||
|
endif
|
||||||
|
|
||||||
CC = gcc -std=c99 -U__STRICT_ANSI__ -g -I . $(NETWORK_CCDEFS) $(NETWORK_TAP_CCDEFS) $(OS_CCDEFS)
|
|
||||||
|
CC = gcc -std=c99 -U__STRICT_ANSI__ -g -I . $(NETWORK_CCDEFS) $(NETWORK_TAP_CCDEFS) $(OS_CCDEFS) $(ROMS_OPT)
|
||||||
LDFLAGS = $(OS_LDFLAGS) $(NETWORK_LDFLAGS)
|
LDFLAGS = $(OS_LDFLAGS) $(NETWORK_LDFLAGS)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -364,6 +369,17 @@ else
|
||||||
if exist BIN rmdir BIN
|
if exist BIN rmdir BIN
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
${BIN}BuildROMs${EXE} :
|
||||||
|
${MKDIRBIN}
|
||||||
|
${CC} sim_BuildROMs.c -o $@
|
||||||
|
ifeq ($(WIN32),)
|
||||||
|
$@
|
||||||
|
${RM} $@
|
||||||
|
else
|
||||||
|
$(@D)\$(@F)
|
||||||
|
del $(@D)\$(@F)
|
||||||
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# Individual builds
|
# Individual builds
|
||||||
#
|
#
|
||||||
|
@ -417,13 +433,13 @@ ${BIN}pdp11${EXE} : ${PDP11} ${SIM}
|
||||||
|
|
||||||
vax : ${BIN}vax${EXE}
|
vax : ${BIN}vax${EXE}
|
||||||
|
|
||||||
${BIN}vax${EXE} : ${VAX} ${SIM}
|
${BIN}vax${EXE} : ${VAX} ${SIM} ${BUILD_ROMS}
|
||||||
${MKDIRBIN}
|
${MKDIRBIN}
|
||||||
${CC} ${VAX} ${SIM} ${VAX_OPT} -o $@ ${LDFLAGS}
|
${CC} ${VAX} ${SIM} ${VAX_OPT} -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
vax780 : ${BIN}vax780${EXE}
|
vax780 : ${BIN}vax780${EXE}
|
||||||
|
|
||||||
${BIN}vax780${EXE} : ${VAX780} ${SIM}
|
${BIN}vax780${EXE} : ${VAX780} ${SIM} ${BUILD_ROMS}
|
||||||
${MKDIRBIN}
|
${MKDIRBIN}
|
||||||
${CC} ${VAX780} ${SIM} ${VAX780_OPT} -o $@ ${LDFLAGS}
|
${CC} ${VAX780} ${SIM} ${VAX780_OPT} -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
|
|
162
sim_BuildROMs.c
Normal file
162
sim_BuildROMs.c
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
/* sim_buildROMs.c: Boot ROM / Boot program load internal support
|
||||||
|
|
||||||
|
Copyright (c) 2011, Mark Pizzolato
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the name of Robert M Supnik shall not be
|
||||||
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
|
in this Software without prior written authorization from Robert M Supnik.
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
This program builds C include files which can be used to contain the contents
|
||||||
|
of ROM or other boot code needed by simulators.
|
||||||
|
|
||||||
|
Current Internal ROM files being built:
|
||||||
|
|
||||||
|
ROM/Boot File: Include File:
|
||||||
|
=======================================
|
||||||
|
VAX/ka655x.bin VAX/vax_ka655x_bin.h
|
||||||
|
VAX/vmb.exe VAX/vax780_vmb_exe.h
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <sys/utime.h>
|
||||||
|
#define utimbuf _utimbuf
|
||||||
|
#define utime _utime
|
||||||
|
#else
|
||||||
|
#include <utime.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int sim_make_ROM_include(const char *rom_filename,
|
||||||
|
const char *include_filename,
|
||||||
|
const char *rom_array_name)
|
||||||
|
{
|
||||||
|
FILE *rFile;
|
||||||
|
FILE *iFile;
|
||||||
|
time_t now;
|
||||||
|
int bytes_written = 0;
|
||||||
|
int c;
|
||||||
|
struct stat statb;
|
||||||
|
unsigned char *ROMData = NULL;
|
||||||
|
|
||||||
|
if (NULL == (rFile = fopen (rom_filename, "rb"))) {
|
||||||
|
printf ("Error Opening '%s' for input: %s\n", rom_filename, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (stat (rom_filename, &statb)) {
|
||||||
|
printf ("Error Stating '%s': %s\n", rom_filename, strerror(errno));
|
||||||
|
fclose (rFile);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ROMData = malloc (statb.st_size);
|
||||||
|
if (statb.st_size != fread (ROMData, sizeof(*ROMData), statb.st_size, rFile)) {
|
||||||
|
printf ("Error Stating '%s': %s\n", rom_filename, strerror(errno));
|
||||||
|
fclose (rFile);
|
||||||
|
free (ROMData);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fclose (rFile);
|
||||||
|
/*
|
||||||
|
* If the target include file already exists, determine if it contains the exact
|
||||||
|
* data in the base ROM image. If so, then we are already done
|
||||||
|
*/
|
||||||
|
if (iFile = fopen (include_filename, "r")) {
|
||||||
|
unsigned char *IncludeData = NULL;
|
||||||
|
char line[256];
|
||||||
|
int Difference = 0;
|
||||||
|
|
||||||
|
IncludeData = malloc (statb.st_size);
|
||||||
|
|
||||||
|
while (fgets (line, sizeof(line), iFile)) {
|
||||||
|
int byte;
|
||||||
|
char *c;
|
||||||
|
|
||||||
|
if (memcmp ("0x",line,2))
|
||||||
|
continue;
|
||||||
|
c = line;
|
||||||
|
while (1 == sscanf (c, "0x%2Xd,", &byte)) {
|
||||||
|
if (bytes_written >= statb.st_size)
|
||||||
|
Difference = 1;
|
||||||
|
else
|
||||||
|
IncludeData[bytes_written++] = byte;
|
||||||
|
c += 5;
|
||||||
|
}
|
||||||
|
if ((strchr (line,'}')) || Difference)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fclose (iFile);
|
||||||
|
if (!Difference)
|
||||||
|
Difference = memcmp (IncludeData, ROMData, statb.st_size);
|
||||||
|
free (IncludeData);
|
||||||
|
if (!Difference) {
|
||||||
|
free (ROMData);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL == (iFile = fopen (include_filename, "w"))) {
|
||||||
|
printf ("Error Opening '%s' for output: %s\n", include_filename, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
time (&now);
|
||||||
|
fprintf (iFile, "#ifndef ROM_%s_H\n", rom_array_name);
|
||||||
|
fprintf (iFile, "#define ROM_%s_H 0\n", rom_array_name);
|
||||||
|
fprintf (iFile, "/*\n");
|
||||||
|
fprintf (iFile, " %s produced at %s", include_filename, ctime(&now));
|
||||||
|
fprintf (iFile, " from %s which was last modified at %s", rom_filename, ctime(&statb.st_mtime));
|
||||||
|
fprintf (iFile, " file size: %d (0x%X)\n", statb.st_size, statb.st_size);
|
||||||
|
fprintf (iFile, "*/\n");
|
||||||
|
fprintf (iFile, "unsigned char %s[] = {", rom_array_name);
|
||||||
|
for (bytes_written=0;bytes_written<statb.st_size; ++bytes_written) {
|
||||||
|
c = ROMData[bytes_written];
|
||||||
|
if (0 == bytes_written%16)
|
||||||
|
fprintf (iFile,"\n");
|
||||||
|
fprintf (iFile,"0x%02X,", c&0xFF);
|
||||||
|
}
|
||||||
|
free (ROMData);
|
||||||
|
fprintf (iFile,"};\n");
|
||||||
|
fprintf (iFile, "#endif /* ROM_%s_H */\n", rom_array_name);
|
||||||
|
fclose (iFile);
|
||||||
|
if (1) { /* Set Modification Time on the include file to be the modification time of the ROM file */
|
||||||
|
struct utimbuf times;
|
||||||
|
|
||||||
|
times.modtime = statb.st_mtime;
|
||||||
|
times.actime = statb.st_atime;
|
||||||
|
utime (include_filename, ×);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
sim_make_ROM_include ("VAX/ka655x.bin", "VAX/vax_ka655x_bin.h", "vax_ka655x_bin");
|
||||||
|
sim_make_ROM_include ("VAX/vmb.exe", "VAX/vax780_vmb_exe.h", "vax780_vmb_exe");
|
||||||
|
exit(0);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue