1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-01-11 23:52:48 +00:00

SCP: Updated to latest SCP, edited makefile to only build local simulators.

This commit is contained in:
Richard Cornwell 2017-12-28 13:53:00 -05:00
parent 87ebb9f403
commit 9080577ae8
22 changed files with 1588 additions and 1598 deletions

View File

@ -640,10 +640,18 @@
RelativePath="..\VAX\vax_defs.h"
>
</File>
<File
RelativePath="..\VAX\vax_lk.h"
>
</File>
<File
RelativePath="..\VAX\vax_mmu.h"
>
</File>
<File
RelativePath="..\VAX\vax_vs.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"

View File

@ -640,10 +640,18 @@
RelativePath="..\VAX\vax_defs.h"
>
</File>
<File
RelativePath="..\VAX\vax_lk.h"
>
</File>
<File
RelativePath="..\VAX\vax_mmu.h"
>
</File>
<File
RelativePath="..\VAX\vax_vs.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"

View File

@ -27,7 +27,7 @@
<Tool
Name="VCPreBuildEventTool"
Description="Check for required build dependencies &amp; git commit id"
CommandLine="Pre-Build-Event.cmd BUILD"
CommandLine="Pre-Build-Event.cmd LIBPCRE ROM BUILD LIBSDL"
/>
<Tool
Name="VCCustomBuildTool"
@ -108,7 +108,7 @@
<Tool
Name="VCPreBuildEventTool"
Description="Check for required build dependencies &amp; git commit id"
CommandLine="Pre-Build-Event.cmd BUILD"
CommandLine="Pre-Build-Event.cmd LIBPCRE ROM BUILD LIBSDL"
/>
<Tool
Name="VCCustomBuildTool"

View File

@ -56,16 +56,21 @@ echo.
if ERRORLEVEL 1 exit /B 1
echo warning: Adding Windows XP suppport to all project files at %TIME%
echo Set objFSO = CreateObject("Scripting.FileSystemObject") >>%1.fix.vbs
echo Set objFile = objFSO.OpenTextFile(Wscript.Arguments(0), 1) >>%1.fix.vbs
echo. >>%1.fix.vbs
echo strText = objFile.ReadAll >>%1.fix.vbs
echo objFile.Close >>%1.fix.vbs
echo strNewText = Replace(strText, "</PlatformToolset>", "_xp</PlatformToolset>") >>%1.fix.vbs
echo. >>%1.fix.vbs
echo Set objFile = objFSO.OpenTextFile(Wscript.Arguments(0), 2) >>%1.fix.vbs
echo objFile.Write strNewText >>%1.fix.vbs
echo objFile.Close >>%1.fix.vbs
call :FindVCVersion _VC_VER
echo Set objFSO = CreateObject("Scripting.FileSystemObject") >>%1.fix.vbs
echo Set objFile = objFSO.OpenTextFile(Wscript.Arguments(0), 1) >>%1.fix.vbs
echo. >>%1.fix.vbs
echo strText = objFile.ReadAll >>%1.fix.vbs
echo objFile.Close >>%1.fix.vbs
echo strText = Replace(strText, "</PlatformToolset>", "_xp</PlatformToolset>") >>%1.fix.vbs
echo. >>%1.fix.vbs
if %_VC_VER% GEQ 14 echo strText = Replace(strText, _>>%1.fix.vbs
if %_VC_VER% GEQ 14 echo "__CLEANUP_C</PreprocessorDefinitions>", _>>%1.fix.vbs
if %_VC_VER% GEQ 14 echo "__CLEANUP_C;_USING_V110_SDK71_</PreprocessorDefinitions>") _>>%1.fix.vbs
if %_VC_VER% GEQ 14 echo. >>%1.fix.vbs
echo Set objFile = objFSO.OpenTextFile(Wscript.Arguments(0), 2) >>%1.fix.vbs
echo objFile.Write strText >>%1.fix.vbs
echo objFile.Close >>%1.fix.vbs
call :_Fix_PlatformToolset %1 %1
for %%f in (*.vcxproj) do call :_Fix_PlatformToolset %1 %%f
@ -118,8 +123,8 @@ if not "%_X_LIBPCRE%" == "" set _X_BUILD=BUILD
:_do_rom
if "%_X_ROM%" == "" goto _done_rom
pushd ..
if "%_X_ROM%" == "" goto _done_rom
SET _BLD=
if exist BIN\NT\Win32-Debug\BuildROMs.exe SET _BLD=BIN\NT\Win32-Debug\BuildROMs.exe
if exist BIN\NT\Win32-Release\BuildROMs.exe SET _BLD=BIN\NT\Win32-Release\BuildROMs.exe
@ -131,8 +136,13 @@ if "%_BLD%" == "" echo ************************************************
if "%_BLD%" == "" echo ************************************************
if "%_BLD%" == "" exit 1
%_BLD%
if not errorlevel 1 goto _done_rom
if not exist "BIN\NT\Win32-Release\BuildROMs.exe" exit 1
del "BIN\NT\Win32-Release\BuildROMs.exe"
popd
goto _do_rom
:_done_rom
popd
:_check_build
if "%_X_BUILD%" == "" goto _done_build
@ -152,13 +162,15 @@ if not exist ../../windows-build/pthreads/pthread.h goto _notice1
findstr "/c:_MSC_VER >= 1900" ..\..\windows-build\pthreads\pthread.h >NUL
if ERRORLEVEL 1 goto _notice2
if "%_X_LIBSDL%" == "" goto _done_libsdl
if not exist ../../windows-build/libSDL/SDL2-2.0.3/include/SDL.h goto _notice2
if not exist ../../windows-build/libSDL/SDL2-2.0.5/include/SDL.h goto _notice2
if not exist "..\..\windows-build\libpng-1.6.18\projects\vstudio\Release Library\*" goto _notice2
if not exist "../../windows-build/libSDL/Microsoft DirectX SDK (June 2010)/Lib/x86/dxguid.lib" goto _notice2
findstr "/c:LIBSDL_FTOL2_SSE" ..\..\windows-build\Windows-Build_Versions.txt >NUL
if ERRORLEVEL 1 goto _notice2
findstr "/c:LIBSDL_ALLMUL" ..\..\windows-build\Windows-Build_Versions.txt >NUL
if ERRORLEVEL 1 goto _notice2
findstr "/c:LIBSDL_ALLSHR" ..\..\windows-build\Windows-Build_Versions.txt >NUL
if ERRORLEVEL 1 goto _notice2
:_done_libsdl
if "%_X_LIBPCRE%" == "" goto _done_libpcre
if not exist ../../windows-build/PCRE/include/pcreposix.h goto _notice2
@ -189,7 +201,7 @@ if %_VC_VER% GEQ 14 goto _check_new_library
if %_LIB_VC_VER% LSS 14 goto _done_library
goto _setup_library
:_check_new_library
if %_LIB_VC_VER% GEQ 14 godo _done_library
if %_LIB_VC_VER% GEQ 14 goto _done_library
:_setup_library
if %_VC_VER% LSS 14 set _VCLIB_DIR_=vstudio 2008
if %_VC_VER% GEQ 14 set _VCLIB_DIR_=vstudio

View File

@ -228,21 +228,63 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HP3000", "HP3000.vcproj", "
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I7090", "I7090.vcproj", "{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDC1700", "CDC1700.vcproj", "{2D532F83-02F3-4169-9778-23E52D951FDE}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I7010", "I7010.vcproj", "{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "isys8030", "isys8030.vcproj", "{4980F98D-7887-4272-B156-8E7C8AAA4F50}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I7070", "I7070.vcproj", "{F55D43D3-AD63-4B19-B67A-47064227F3E3}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "isys8024", "isys8024.vcproj", "{ACCC3A24-56CD-4543-81F3-5F6A5E24F338}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I704", "I704.vcproj", "{91A7D475-1238-4872-BEAE-143E1FCEA297}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imds-225", "imds-225.vcproj", "{A66F0D85-174F-4AFE-A44E-7FAE3D3727BC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ibmpc", "ibmpc.vcproj", "{76EF8599-7AB0-4C8D-997B-AAEEE724A5D0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ibmpcxt", "ibmpcxt.vcproj", "{0026A4C2-655A-4C03-B6CA-B1EAF79FA4D1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scelbi", "scelbi.vcproj", "{1E92CC4B-9ED5-4CD4-BD35-061F25126523}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3B2", "3B2.vcproj", "{56178F08-8783-4ADA-820C-20C06412678E}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I701", "I701.vcproj", "{F1F44607-FB9E-428C-AD8F-56F98699D121}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I7090", "I7090.vcproj", "{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I704", "I704.vcproj", "{91A7D475-1238-4872-BEAE-143E1FCEA297}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I7080", "I7080.vcproj", "{BF1E708D-D374-4DE1-A0D3-6D8DB4B4F7FA}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PDP10-KA", "PDP10-KA.vcproj", "{01F75DE5-8049-4C73-A325-B1F9964CE709}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I7070", "I7070.vcproj", "{F55D43D3-AD63-4B19-B67A-47064227F3E3}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PDP10-KI", "PDP10-KI.vcproj", "{0BA63EC5-BD4F-44FB-AE89-7DD2C84CB1D9}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "I7010", "I7010.vcproj", "{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}"
ProjectSection(ProjectDependencies) = postProject
{D40F3AF1-EEE7-4432-9807-2AD287B490F8} = {D40F3AF1-EEE7-4432-9807-2AD287B490F8}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -434,38 +476,62 @@ Global
{B3E35063-CB41-4F77-BFCA-49BB316B0EDB}.Debug|Win32.Build.0 = Debug|Win32
{B3E35063-CB41-4F77-BFCA-49BB316B0EDB}.Release|Win32.ActiveCfg = Release|Win32
{B3E35063-CB41-4F77-BFCA-49BB316B0EDB}.Release|Win32.Build.0 = Release|Win32
{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}.Debug|Win32.ActiveCfg = Debug|Win32
{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}.Debug|Win32.Build.0 = Debug|Win32
{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}.Release|Win32.ActiveCfg = Release|Win32
{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}.Release|Win32.Build.0 = Release|Win32
{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}.Debug|Win32.ActiveCfg = Debug|Win32
{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}.Debug|Win32.Build.0 = Debug|Win32
{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}.Release|Win32.ActiveCfg = Release|Win32
{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}.Release|Win32.Build.0 = Release|Win32
{F55D43D3-AD63-4B19-B67A-47064227F3E3}.Debug|Win32.ActiveCfg = Debug|Win32
{F55D43D3-AD63-4B19-B67A-47064227F3E3}.Debug|Win32.Build.0 = Debug|Win32
{F55D43D3-AD63-4B19-B67A-47064227F3E3}.Release|Win32.ActiveCfg = Release|Win32
{F55D43D3-AD63-4B19-B67A-47064227F3E3}.Release|Win32.Build.0 = Release|Win32
{91A7D475-1238-4872-BEAE-143E1FCEA297}.Debug|Win32.ActiveCfg = Debug|Win32
{91A7D475-1238-4872-BEAE-143E1FCEA297}.Debug|Win32.Build.0 = Debug|Win32
{91A7D475-1238-4872-BEAE-143E1FCEA297}.Release|Win32.ActiveCfg = Release|Win32
{91A7D475-1238-4872-BEAE-143E1FCEA297}.Release|Win32.Build.0 = Release|Win32
{2D532F83-02F3-4169-9778-23E52D951FDE}.Debug|Win32.ActiveCfg = Debug|Win32
{2D532F83-02F3-4169-9778-23E52D951FDE}.Debug|Win32.Build.0 = Debug|Win32
{2D532F83-02F3-4169-9778-23E52D951FDE}.Release|Win32.ActiveCfg = Release|Win32
{2D532F83-02F3-4169-9778-23E52D951FDE}.Release|Win32.Build.0 = Release|Win32
{4980F98D-7887-4272-B156-8E7C8AAA4F50}.Debug|Win32.ActiveCfg = Debug|Win32
{4980F98D-7887-4272-B156-8E7C8AAA4F50}.Debug|Win32.Build.0 = Debug|Win32
{4980F98D-7887-4272-B156-8E7C8AAA4F50}.Release|Win32.ActiveCfg = Release|Win32
{4980F98D-7887-4272-B156-8E7C8AAA4F50}.Release|Win32.Build.0 = Release|Win32
{ACCC3A24-56CD-4543-81F3-5F6A5E24F338}.Debug|Win32.ActiveCfg = Debug|Win32
{ACCC3A24-56CD-4543-81F3-5F6A5E24F338}.Debug|Win32.Build.0 = Debug|Win32
{ACCC3A24-56CD-4543-81F3-5F6A5E24F338}.Release|Win32.ActiveCfg = Release|Win32
{ACCC3A24-56CD-4543-81F3-5F6A5E24F338}.Release|Win32.Build.0 = Release|Win32
{A66F0D85-174F-4AFE-A44E-7FAE3D3727BC}.Debug|Win32.ActiveCfg = Debug|Win32
{A66F0D85-174F-4AFE-A44E-7FAE3D3727BC}.Debug|Win32.Build.0 = Debug|Win32
{A66F0D85-174F-4AFE-A44E-7FAE3D3727BC}.Release|Win32.ActiveCfg = Release|Win32
{A66F0D85-174F-4AFE-A44E-7FAE3D3727BC}.Release|Win32.Build.0 = Release|Win32
{76EF8599-7AB0-4C8D-997B-AAEEE724A5D0}.Debug|Win32.ActiveCfg = Debug|Win32
{76EF8599-7AB0-4C8D-997B-AAEEE724A5D0}.Debug|Win32.Build.0 = Debug|Win32
{76EF8599-7AB0-4C8D-997B-AAEEE724A5D0}.Release|Win32.ActiveCfg = Release|Win32
{76EF8599-7AB0-4C8D-997B-AAEEE724A5D0}.Release|Win32.Build.0 = Release|Win32
{0026A4C2-655A-4C03-B6CA-B1EAF79FA4D1}.Debug|Win32.ActiveCfg = Debug|Win32
{0026A4C2-655A-4C03-B6CA-B1EAF79FA4D1}.Debug|Win32.Build.0 = Debug|Win32
{0026A4C2-655A-4C03-B6CA-B1EAF79FA4D1}.Release|Win32.ActiveCfg = Release|Win32
{0026A4C2-655A-4C03-B6CA-B1EAF79FA4D1}.Release|Win32.Build.0 = Release|Win32
{1E92CC4B-9ED5-4CD4-BD35-061F25126523}.Debug|Win32.ActiveCfg = Debug|Win32
{1E92CC4B-9ED5-4CD4-BD35-061F25126523}.Debug|Win32.Build.0 = Debug|Win32
{1E92CC4B-9ED5-4CD4-BD35-061F25126523}.Release|Win32.ActiveCfg = Release|Win32
{1E92CC4B-9ED5-4CD4-BD35-061F25126523}.Release|Win32.Build.0 = Release|Win32
{56178F08-8783-4ADA-820C-20C06412678E}.Debug|Win32.ActiveCfg = Debug|Win32
{56178F08-8783-4ADA-820C-20C06412678E}.Debug|Win32.Build.0 = Debug|Win32
{56178F08-8783-4ADA-820C-20C06412678E}.Release|Win32.ActiveCfg = Release|Win32
{56178F08-8783-4ADA-820C-20C06412678E}.Release|Win32.Build.0 = Release|Win32
{F1F44607-FB9E-428C-AD8F-56F98699D121}.Debug|Win32.ActiveCfg = Debug|Win32
{F1F44607-FB9E-428C-AD8F-56F98699D121}.Debug|Win32.Build.0 = Debug|Win32
{F1F44607-FB9E-428C-AD8F-56F98699D121}.Release|Win32.ActiveCfg = Release|Win32
{F1F44607-FB9E-428C-AD8F-56F98699D121}.Release|Win32.Build.0 = Release|Win32
{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}.Debug|Win32.ActiveCfg = Debug|Win32
{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}.Debug|Win32.Build.0 = Debug|Win32
{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}.Release|Win32.ActiveCfg = Release|Win32
{33EE34FC-A12F-47FE-9FD6-8B74D08718C7}.Release|Win32.Build.0 = Release|Win32
{91A7D475-1238-4872-BEAE-143E1FCEA297}.Debug|Win32.ActiveCfg = Debug|Win32
{91A7D475-1238-4872-BEAE-143E1FCEA297}.Debug|Win32.Build.0 = Debug|Win32
{91A7D475-1238-4872-BEAE-143E1FCEA297}.Release|Win32.ActiveCfg = Release|Win32
{91A7D475-1238-4872-BEAE-143E1FCEA297}.Release|Win32.Build.0 = Release|Win32
{BF1E708D-D374-4DE1-A0D3-6D8DB4B4F7FA}.Debug|Win32.ActiveCfg = Debug|Win32
{BF1E708D-D374-4DE1-A0D3-6D8DB4B4F7FA}.Debug|Win32.Build.0 = Debug|Win32
{BF1E708D-D374-4DE1-A0D3-6D8DB4B4F7FA}.Release|Win32.ActiveCfg = Release|Win32
{BF1E708D-D374-4DE1-A0D3-6D8DB4B4F7FA}.Release|Win32.Build.0 = Release|Win32
{01F75DE5-8049-4C73-A325-B1F9964CE709}.Debug|Win32.ActiveCfg = Debug|Win32
{01F75DE5-8049-4C73-A325-B1F9964CE709}.Debug|Win32.Build.0 = Debug|Win32
{01F75DE5-8049-4C73-A325-B1F9964CE709}.Release|Win32.ActiveCfg = Release|Win32
{01F75DE5-8049-4C73-A325-B1F9964CE709}.Release|Win32.Build.0 = Release|Win32
{0BA63EC5-BD4F-44FB-AE89-7DD2C84CB1D9}.Debug|Win32.ActiveCfg = Debug|Win32
{0BA63EC5-BD4F-44FB-AE89-7DD2C84CB1D9}.Debug|Win32.Build.0 = Debug|Win32
{0BA63EC5-BD4F-44FB-AE89-7DD2C84CB1D9}.Release|Win32.ActiveCfg = Release|Win32
{0BA63EC5-BD4F-44FB-AE89-7DD2C84CB1D9}.Release|Win32.Build.0 = Release|Win32
{F55D43D3-AD63-4B19-B67A-47064227F3E3}.Debug|Win32.ActiveCfg = Debug|Win32
{F55D43D3-AD63-4B19-B67A-47064227F3E3}.Debug|Win32.Build.0 = Debug|Win32
{F55D43D3-AD63-4B19-B67A-47064227F3E3}.Release|Win32.ActiveCfg = Release|Win32
{F55D43D3-AD63-4B19-B67A-47064227F3E3}.Release|Win32.Build.0 = Release|Win32
{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}.Debug|Win32.ActiveCfg = Debug|Win32
{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}.Debug|Win32.Build.0 = Debug|Win32
{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}.Release|Win32.ActiveCfg = Release|Win32
{55A727F0-B5C8-48E8-9EF2-D5DAF679C520}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -636,10 +636,18 @@
RelativePath="..\VAX\vax_defs.h"
>
</File>
<File
RelativePath="..\VAX\vax_lk.h"
>
</File>
<File
RelativePath="..\VAX\vax_mmu.h"
>
</File>
<File
RelativePath="..\VAX\vax_vs.h"
>
</File>
<File
RelativePath="..\VAX\vaxmod_defs.h"
>

999
makefile

File diff suppressed because it is too large Load Diff

226
scp.c
View File

@ -582,6 +582,7 @@ static int32 sim_do_echo = 0; /* the echo status of th
static int32 sim_show_message = 1; /* the message display status of the currently open do file */
static int32 sim_on_inherit = 0; /* the inherit status of on state and conditions when executing do files */
static int32 sim_do_depth = 0;
static t_bool sim_cmd_echoed = FALSE; /* Command was emitted already prior to message output */
static int32 sim_on_check[MAX_DO_NEST_LVL+1];
static char *sim_on_actions[MAX_DO_NEST_LVL+1][SCPE_MAX_ERR+1];
@ -985,7 +986,7 @@ static const char simh_help[] =
" attached read only, its contents can be examined but not modified.\n"
"5-q\n"
" If the -q switch is specified when creating a new file (-n) or opening one\n"
" read only (-r), the message announcing this fact is suppressed.\n"
" read only (-r), any messages announcing these facts will be suppressed.\n"
"5-f\n"
" For simulated magnetic tapes, the ATTACH command can specify the format of\n"
" the attached tape image file:\n\n"
@ -1074,10 +1075,11 @@ static const char simh_help[] =
#define HLP_SET_CONSOLE "*Commands SET CONSOLE"
"3Console\n"
"+set console arg{,arg...} set console options\n"
"+set console WRU specify console drop to simh character\n"
"+set console BRK specify console Break character\n"
"+set console DEL specify console delete character\n"
"+set console PCHAR specify console printable characters\n"
"+set console WRU=value specify console drop to simh character\n"
"+set console BRK=value specify console Break character\n"
"+set console DEL=value specify console delete character\n"
"+set console PCHAR=bitmask bit mask of printable characters in\n"
"++++++++ range [31,0]\n"
"+set console SPEED=speed{*factor}\n"
"++++++++ specify console input data rate\n"
"+set console TELNET=port specify console telnet port\n"
@ -1178,6 +1180,9 @@ static const char simh_help[] =
"+set clock nocatchup disable catchup clock ticks\n"
"+set clock catchup enable catchup clock ticks\n"
"+set clock calib=n%% specify idle calibration skip %%\n"
"+set clock stop=n stop execution after n instructions\n\n"
" The set clock stop command allows execution to have a bound when\n"
" execution starts with a BOOT, NEXT or CONTINUE command.\n"
#define HLP_SET_ASYNCH "*Commands SET Asynch"
"3Asynch\n"
"+set asynch enable asynchronous I/O\n"
@ -1371,7 +1376,8 @@ static const char simh_help[] =
" %%CTIME%%, %%DATE_YYYY%%, %%DATE_YY%%, %%DATE_YC%%, %%DATE_MM%%, %%DATE_MMM%%,\n"
" %%DATE_MONTH%%, %%DATE_DD%%, %%DATE_D%%, %%DATE_WYYYY%%, %%DATE_WW%%,\n"
" %%TIME_HH%%, %%TIME_MM%%, %%TIME_SS%%, %%STATUS%%, %%TSTATUS%%, %%SIM_VERIFY%%,\n"
" %%SIM_QUIET%%, %%SIM_MESSAGE%%\n\n"
" %%SIM_QUIET%%, %%SIM_MESSAGE%% %%SIM_MESSAGE%%\n"
" %%SIM_NAME%%, %%SIM_BIN_NAME%%, %%SIM_BIN_PATH%%m %%SIM_OSTYPE%%\n\n"
"+Token %%0 expands to the command file name.\n"
"+Token %%n (n being a single digit) expands to the n'th argument\n"
"+Token %%* expands to the whole set of arguments (%%1 ... %%9)\n\n"
@ -1410,7 +1416,11 @@ static const char simh_help[] =
"++%%SIM_VERIFY%% The Verify/Verbose mode of the current Do command file\n"
"++%%SIM_VERBOSE%% The Verify/Verbose mode of the current Do command file\n"
"++%%SIM_QUIET%% The Quiet mode of the current Do command file\n"
"++%%SIM_MESSAGE%% The message display status of the current Do command file\n\n"
"++%%SIM_MESSAGE%% The message display status of the current Do command file\n"
"++%%SIM_NAME%% The name of the current simulator\n"
"++%%SIM_BIN_NAME%% The program name of the current simulator\n"
"++%%SIM_BIN_PATH%% The program path that invoked the current simulator\n"
"++%%SIM_OSTYPE%% The Operating System running the current simulator\n\n"
"+Environment variable lookups are done first with the precise name between\n"
"+the %% characters and if that fails, then the name between the %% characters\n"
"+is upcased and a lookup of that valus is attempted.\n\n"
@ -1616,15 +1626,20 @@ ASSERT failure have several different actions:
" The SEND command provides a way to insert input into the console device of\n"
" a simulated system as if it was entered by a user.\n\n"
"++SEND {-t} {after=nn,}{delay=nn,}\"<string>\"\n\n"
"++NOSEND\n\n"
"++SHOW SEND\n\n"
" The string argument must be delimited by quote characters. Quotes may\n"
" be either single or double but the opening and closing quote characters\n"
" must match. Data in the string may contain escaped character strings.\n\n"
" The SEND command can also insert input into any serial device on a\n"
" simulated system as if it was entered by a user.\n\n"
"++SEND {-t} {<dev>:line} {after=nn,}{delay=nn,}\"<string>\"\n"
"++SEND {-t} {<dev>:line} {after=nn,}{delay=nn,}\"<string>\"\n\n"
"++NOSEND {<dev>:line}\n\n"
"++SHOW SEND {<dev>:line}\n\n"
" The NOSEND command removes any undelivered input data which may be\n"
" pending on a line.\n"
" pending on the CONSOLE or a specific multiplexer line.\n\n"
" The SHOW SEND command displays any pending SEND activity for the\n"
" CONSOLE or a specific multiplexer line.\n"
"4Delay\n"
" Specifies an integer (>=0) representing a minimal instruction delay\n"
" between characters being sent. The delay parameter can be set by\n"
@ -1674,6 +1689,7 @@ ASSERT failure have several different actions:
" when specific output has been generated by the simulated system.\n\n"
"++EXPECT {dev:line} {[count]} {HALTAFTER=n,}\"<string>\" {actioncommand {; actioncommand}...}\n\n"
"++NOEXPECT {dev:line} \"<string>\"\n\n"
"++SHOW EXPECT {dev:line}\n\n"
" The string argument must be delimited by quote characters. Quotes may\n"
" be either single or double but the opening and closing quote characters\n"
" must match. Data in the string may contain escaped character strings.\n"
@ -1691,7 +1707,10 @@ ASSERT failure have several different actions:
" to match other expect rules which may already be defined.\n"
" Data which is output prior to the definition of an expect rule is not\n"
" eligible to be matched against.\n\n"
" The NOEXPECT command removes a previously defined EXPECT command.\n"
" The NOEXPECT command removes a previously defined EXPECT command for the\n"
" console or a specific multiplexer line.\n\n"
" The SHOW EXPECT command displays all of the pending EXPECT state for\n"
" the console or a specific multiplexer line.\n"
/***************** 80 character line width template *************************/
"4Switches\n"
" Switches can be used to influence the behavior of EXPECT rules\n\n"
@ -1774,6 +1793,16 @@ ASSERT failure have several different actions:
" delay has expired, only a single EXPECT rule can be defined if a non-zero\n"
" HaltAfter parameter has been set.\n"
/***************** 80 character line width template *************************/
#define HLP_SLEEP "*Commands Executing_Command_Files Pausing_Command_Execution"
"3Pausing Command Execution\n"
" A simulator command file may wait for a specific period of time with the\n\n"
"++SLEEP NUMBER[SUFFIX]...\n\n"
" Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default),\n"
" 'm' for minutes, 'h' for hours or 'd' for days. NUMBER may be an\n"
" arbitrary floating point number. Given two or more arguments, pause\n"
" for the amount of time specified by the sum of their values.\n"
" NOTE: A SLEEP command is interruptable with SIGINT (^C).\n\n"
/***************** 80 character line width template *************************/
#define HLP_ASSERT "*Commands Executing_Command_Files Testing_Simulator_State"
#define HLP_IF "*Commands Executing_Command_Files Testing_Simulator_State"
"3Testing Simulator State\n"
@ -1966,6 +1995,7 @@ static CTAB cmd_table[] = {
{ "NOSEND", &send_cmd, 0, HLP_SEND },
{ "EXPECT", &expect_cmd, 1, HLP_EXPECT },
{ "NOEXPECT", &expect_cmd, 0, HLP_EXPECT },
{ "SLEEP", &sleep_cmd, 0, HLP_SLEEP },
{ "!", &spawn_cmd, 0, HLP_SPAWN },
{ "HELP", &help_cmd, 0, HLP_HELP },
#if defined(USE_SIM_VIDEO)
@ -2139,7 +2169,7 @@ for (i = 1; i < argc; i++) { /* loop thru args */
return 0;
}
if (*cbuf) /* concat args */
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 */
}
@ -2188,6 +2218,7 @@ if (!sim_quiet) {
printf ("\n");
show_version (stdout, NULL, NULL, 0, NULL);
}
show_version (stdnul, NULL, NULL, 1, NULL); /* Quietly set SIM_OSTYPE */
if (sim_dflt_dev == NULL) /* if no default */
sim_dflt_dev = sim_devices[0];
if (((sim_dflt_dev->flags & DEV_DEBUG) == 0) && /* default device without debug? */
@ -2208,6 +2239,7 @@ if (*argv[0]) { /* sim name arg? */
np = strrchr (nbuf, ']'); /* VMS path separator */
if (np != NULL)
setenv ("SIM_BIN_NAME", np+1, 1); /* Publish simulator binary name */
setenv ("SIM_BIN_PATH", argv[0], 1);
}
sim_argv = argv;
cptr = getenv("HOME");
@ -2231,7 +2263,7 @@ else if (*argv[0]) { /* sim name arg? */
strncpy (nbuf + 1, argv[0], PATH_MAX + 1); /* copy sim name */
if ((np = (char *)match_ext (nbuf, "EXE"))) /* remove .exe */
*np = 0;
strlcat (nbuf, ".ini\"", sizeof(nbuf)); /* add .ini" */
strlcat (nbuf, ".ini\"", sizeof (nbuf)); /* add .ini" */
stat = do_cmd (-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 */
@ -2283,6 +2315,7 @@ while (stat != SCPE_EXIT) { /* in case exit */
}
if (*cptr == 0) /* ignore blank */
continue;
sim_cmd_echoed = TRUE;
sim_sub_args (cbuf, sizeof(cbuf), argv);
if (sim_log) /* log cmd */
fprintf (sim_log, "%s%s\n", sim_prompt, cptr);
@ -2323,7 +2356,7 @@ if ((!cptr) || (*cptr == '\0'))
cptr = get_glyph_nc (cptr, gbuf, '"'); /* get quote delimited token */
if (gbuf[0] == '\0') { /* Token started with quote */
gbuf[sizeof (gbuf)-1] = '\0';
strncpy (gbuf, cptr, sizeof (gbuf)-1);
strlcpy (gbuf, cptr, sizeof (gbuf));
gptr = strchr (gbuf, '"');
if (gptr)
*gptr = '\0';
@ -3001,7 +3034,7 @@ sim_on_inherit =(sim_switches & SWMASK ('O')) || sim_on_inherit; /* -o means inh
errabort = sim_switches & SWMASK ('E'); /* -e means abort on error */
abuf[sizeof(abuf)-1] = '\0';
strncpy (abuf, fcptr, sizeof(abuf)-1);
strlcpy (abuf, fcptr, sizeof(abuf));
c = abuf;
do_arg[10] = NULL; /* make sure the argument list always ends with a NULL */
for (nargs = 0; nargs < 10; ) { /* extract arguments */
@ -3089,6 +3122,7 @@ do {
continue;
if (echo) /* echo if -v */
sim_printf("%s> %s\n", do_position(), cptr);
sim_cmd_echoed = echo;
if (*cptr == ':') /* ignore label */
continue;
cptr = get_glyph_cmd (cptr, gbuf); /* get command glyph */
@ -3137,7 +3171,7 @@ do {
}
if ((stat >= SCPE_BASE) && (stat != SCPE_EXIT) && /* error from cmd? */
(stat != SCPE_STEP)) {
if (!echo && !sim_quiet && /* report if not echoing */
if (!echo && /* report if not echoing */
!stat_nomessage && /* and not suppressing messages */
!(cmdp && cmdp->message)) { /* and not handling them specially */
sim_printf("%s> %s\n", do_position(), sim_do_ocptr[sim_do_depth]);
@ -3171,8 +3205,8 @@ if (flag >= 0) {
sim_do_echo = saved_sim_do_echo; /* restore echo state we entered with */
sim_show_message = saved_sim_show_message; /* restore message display state we entered with */
sim_on_inherit = saved_sim_on_inherit; /* restore ON inheritance state we entered with */
sim_quiet = saved_sim_quiet; /* restore quiet mode we entered with */
}
sim_quiet = saved_sim_quiet; /* restore quiet mode we entered with */
if ((flag >= 0) || (!sim_on_inherit)) {
for (i=0; i<SCPE_MAX_ERR; i++) { /* release any on commands */
free (sim_on_actions[sim_do_depth][i]);
@ -3902,7 +3936,7 @@ tptr = get_glyph (cptr, gbuf, ',');
if (sim_isalpha(gbuf[0]) && (strchr (gbuf, ':'))) {
r = tmxr_locate_line_expect (gbuf, &exp);
if (r != SCPE_OK)
return r;
return sim_messagef (r, "No such active line: %s\n", gbuf);
cptr = tptr;
}
else
@ -3940,6 +3974,57 @@ return sim_exp_show (st, exp, gbuf);
}
/* Sleep command */
t_stat sleep_cmd (int32 flag, CONST char *cptr)
{
char *tptr;
double wait;
stop_cpu = 0;
signal (SIGINT, int_handler);
while (*cptr) {
wait = strtod (cptr, &tptr);
switch (*tptr) {
case ' ':
case '\t':
case '\0':
break;
case 's':
case 'S':
++tptr;
break;
case 'm':
case 'M':
++tptr;
wait *= 60.0;
break;
case 'h':
case 'H':
++tptr;
wait *= (60.0*60.0);
break;
case 'd':
case 'D':
++tptr;
wait *= (24.0*60.0*60.0);
break;
default:
signal (SIGINT, SIG_DFL); /* cancel WRU */
return sim_messagef (SCPE_ARG, "Invalid Sleep unit '%c'\n", *cptr);
}
wait *= 1000.0; /* Convert to Milliseconds */
cptr = tptr;
while ((wait > 1000.0) && (!stop_cpu))
wait -= sim_os_ms_sleep (1000);
if ((wait > 0.0) && (!stop_cpu))
sim_os_ms_sleep ((unsigned)wait);
}
signal (SIGINT, SIG_DFL); /* cancel WRU */
stop_cpu = 0;
return SCPE_OK;
}
/* Goto command */
t_stat goto_cmd (int32 flag, CONST char *fcptr)
@ -4774,6 +4859,7 @@ fprintf (st, " %s", SIM_VERSION_MODE);
if (flag) {
t_bool idle_capable;
uint32 os_ms_sleep_1, os_tick_size;
char os_type[128] = "Unknown";
fprintf (st, "\n Simulator Framework Capabilities:");
fprintf (st, "\n %s", sim_si64);
@ -4867,6 +4953,8 @@ if (flag) {
#else
"VAX";
#endif
strlcpy (os_type, "OpenVMS ", sizeof (os_type));
strlcat (os_type, arch, sizeof (os_type));
fprintf (st, "\n OS: OpenVMS %s %s", arch, __VMS_VERSION);
}
#elif defined(_WIN32)
@ -4892,6 +4980,7 @@ if (flag) {
fprintf (st, "\n OS: %s", osversion);
fprintf (st, "\n Architecture: %s%s%s, Processors: %s", arch, proc_arch3264 ? " on " : "", proc_arch3264 ? proc_arch3264 : "", procs);
fprintf (st, "\n Processor Id: %s, Level: %s, Revision: %s", proc_id ? proc_id : "", proc_level ? proc_level : "", proc_rev ? proc_rev : "");
strlcpy (os_type, "Windows", sizeof (os_type));
}
#else
if (1) {
@ -4899,17 +4988,29 @@ if (flag) {
FILE *f;
if ((f = popen ("uname -a", "r"))) {
memset (osversion, 0, sizeof(osversion));
memset (osversion, 0, sizeof (osversion));
do {
if (NULL == fgets (osversion, sizeof(osversion)-1, f))
if (NULL == fgets (osversion, sizeof (osversion)-1, f))
break;
sim_trim_endspc (osversion);
} while (osversion[0] == '\0');
pclose (f);
}
fprintf (st, "\n OS: %s", osversion);
if ((f = popen ("uname", "r"))) {
memset (os_type, 0, sizeof (os_type));
do {
if (NULL == fgets (os_type, sizeof (os_type)-1, f))
break;
sim_trim_endspc (os_type);
} while (os_type[0] == '\0');
pclose (f);
}
}
#endif
if ((!strcmp (os_type, "Unknown")) && (getenv ("OSTYPE")))
strlcpy (os_type, getenv ("OSTYPE"), sizeof (os_type));
setenv ("SIM_OSTYPE", os_type, 1);
}
#if defined(SIM_GIT_COMMIT_ID)
#define S_xstr(a) S_str(a)
@ -5235,7 +5336,7 @@ if (sim_is_running)
if ((!cptr) || (*cptr == 0))
return SCPE_2FARG;
gbuf[sizeof(gbuf)-1] = '\0';
strncpy (gbuf, cptr, sizeof(gbuf)-1);
strlcpy (gbuf, cptr, sizeof(gbuf));
sim_trim_endspc(gbuf);
if (chdir(gbuf) != 0)
return sim_messagef(SCPE_IOERR, "Unable to directory change to: %s\n", gbuf);
@ -5327,19 +5428,19 @@ strlcpy (WildName, cptr, sizeof(WildName));
cptr = WildName;
sim_trim_endspc (WildName);
if ((!stat (WildName, &filestat)) && (filestat.st_mode & S_IFDIR))
strlcat (WildName, "/*", sizeof(WildName));
strlcat (WildName, "/*", sizeof (WildName));
if ((*cptr != '/') || (0 == memcmp (cptr, "./", 2)) || (0 == memcmp (cptr, "../", 3))) {
#if defined (VMS)
getcwd (WholeName, sizeof(WholeName)-1, 0);
getcwd (WholeName, sizeof (WholeName)-1, 0);
#else
getcwd (WholeName, sizeof(WholeName)-1);
getcwd (WholeName, sizeof (WholeName)-1);
#endif
strlcat (WholeName, "/", sizeof(WholeName));
strlcat (WholeName, cptr, sizeof(WholeName));
strlcat (WholeName, "/", sizeof (WholeName));
strlcat (WholeName, cptr, sizeof (WholeName));
sim_trim_endspc (WholeName);
}
else
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, "//")))
@ -5360,14 +5461,14 @@ if (c) {
}
else {
#if defined (VMS)
getcwd (WholeName, sizeof(WholeName)-1, 0);
getcwd (WholeName, sizeof (WholeName)-1, 0);
#else
getcwd (WholeName, sizeof(WholeName)-1);
getcwd (WholeName, sizeof (WholeName)-1);
#endif
}
cptr = WholeName;
#if defined (HAVE_GLOB)
memset (&paths, 0, sizeof(paths));
memset (&paths, 0, sizeof (paths));
if (0 == glob (cptr, 0, NULL, &paths)) {
#else
dir = opendir(DirName[0] ? DirName : "/.");
@ -5531,7 +5632,7 @@ char lbuf[4*CBUFSIZE];
if ((!cptr) || (*cptr == 0))
return SCPE_2FARG;
lbuf[sizeof(lbuf)-1] = '\0';
strncpy (lbuf, cptr, sizeof(lbuf)-1);
strlcpy (lbuf, cptr, sizeof(lbuf));
sim_trim_endspc(lbuf);
file = sim_fopen (lbuf, "r");
if (file == NULL) { /* open failed? */
@ -5668,7 +5769,7 @@ if (uptr == NULL)
return SCPE_IERR;
max = uptr->capac - 1;
abuf[sizeof(abuf)-1] = '\0';
strncpy (abuf, cptr, sizeof(abuf)-1);
strlcpy (abuf, cptr, sizeof(abuf));
if ((aptr = strchr (abuf, ';'))) { /* ;action? */
cptr += aptr - abuf + 1;
if (flg != SSH_ST) /* only on SET */
@ -5919,7 +6020,7 @@ if (uptr->flags & UNIT_ATT) { /* already attached? */
}
}
gbuf[sizeof(gbuf)-1] = '\0';
strncpy (gbuf, cptr, sizeof(gbuf)-1);
strlcpy (gbuf, cptr, sizeof(gbuf));
sim_trim_endspc (gbuf); /* trim trailing spc */
return scp_attach_unit (dptr, uptr, gbuf); /* attach */
}
@ -5928,6 +6029,8 @@ return scp_attach_unit (dptr, uptr, gbuf); /* attach */
t_stat scp_attach_unit (DEVICE *dptr, UNIT *uptr, const char *cptr)
{
if (uptr->flags & UNIT_DIS) /* disabled? */
return SCPE_UDIS;
if (dptr->attach != NULL) /* device routine? */
return dptr->attach (uptr, (CONST char *)cptr); /* call it */
return attach_unit (uptr, (CONST char *)cptr); /* no, std routine */
@ -5939,8 +6042,6 @@ t_stat attach_unit (UNIT *uptr, CONST char *cptr)
{
DEVICE *dptr;
if (uptr->flags & UNIT_DIS) /* disabled? */
return SCPE_UDIS;
if (!(uptr->flags & UNIT_ATTABLE)) /* not attachable? */
return SCPE_NOATT;
if ((dptr = find_dev_from_unit (uptr)) == NULL)
@ -5948,7 +6049,7 @@ if ((dptr = find_dev_from_unit (uptr)) == NULL)
uptr->filename = (char *) calloc (CBUFSIZE, sizeof (char)); /* alloc name buf */
if (uptr->filename == NULL)
return SCPE_MEM;
strncpy (uptr->filename, cptr, CBUFSIZE); /* save name */
strlcpy (uptr->filename, cptr, CBUFSIZE); /* save name */
if ((sim_switches & SWMASK ('R')) || /* read only? */
((uptr->flags & UNIT_RO) != 0)) {
if (((uptr->flags & UNIT_ROABLE) == 0) && /* allowed? */
@ -5958,18 +6059,14 @@ if ((sim_switches & SWMASK ('R')) || /* read only? */
if (uptr->fileref == NULL) /* open fail? */
return attach_err (uptr, SCPE_OPENERR); /* yes, error */
uptr->flags = uptr->flags | UNIT_RO; /* set rd only */
if (!sim_quiet && !(sim_switches & SWMASK ('Q'))) {
sim_printf ("%s: unit is read only\n", sim_dname (dptr));
}
sim_messagef (SCPE_OK, "%s: unit is read only\n", sim_dname (dptr));
}
else {
if (sim_switches & SWMASK ('N')) { /* new file only? */
uptr->fileref = sim_fopen (cptr, "wb+"); /* open new file */
if (uptr->fileref == NULL) /* open fail? */
return attach_err (uptr, SCPE_OPENERR); /* yes, error */
if (!sim_quiet && !(sim_switches & SWMASK ('Q'))) {
sim_printf ("%s: creating new file\n", sim_dname (dptr));
}
sim_messagef (SCPE_OK, "%s: creating new file\n", sim_dname (dptr));
}
else { /* normal */
uptr->fileref = sim_fopen (cptr, "rb+"); /* open r/w */
@ -5985,9 +6082,7 @@ else {
if (uptr->fileref == NULL) /* open fail? */
return attach_err (uptr, SCPE_OPENERR); /* yes, error */
uptr->flags = uptr->flags | UNIT_RO; /* set rd only */
if (!sim_quiet) {
sim_printf ("%s: unit is read only\n", sim_dname (dptr));
}
sim_messagef (SCPE_OK, "%s: unit is read only\n", sim_dname (dptr));
}
else { /* doesn't exist */
if (sim_switches & SWMASK ('E')) /* must exist? */
@ -5995,9 +6090,7 @@ else {
uptr->fileref = sim_fopen (cptr, "wb+");/* open new file */
if (uptr->fileref == NULL) /* open fail? */
return attach_err (uptr, SCPE_OPENERR); /* yes, error */
if (!sim_quiet) {
sim_printf ("%s: creating new file\n", sim_dname (dptr));
}
sim_messagef (SCPE_OK, "%s: creating new file\n", sim_dname (dptr));
}
} /* end if null */
} /* end else */
@ -6008,9 +6101,7 @@ if (uptr->flags & UNIT_BUFABLE) { /* buffer? */
uptr->filebuf = calloc (cap, SZ_D (dptr)); /* allocate */
if (uptr->filebuf == NULL) /* no buffer? */
return attach_err (uptr, SCPE_MEM); /* error */
if (!sim_quiet) {
sim_printf ("%s: buffering file in memory\n", sim_dname (dptr));
}
sim_messagef (SCPE_OK, "%s: buffering file in memory\n", sim_dname (dptr));
uptr->hwmark = (uint32)sim_fread (uptr->filebuf, /* read file */
SZ_D (dptr), cap, uptr->fileref);
uptr->flags = uptr->flags | UNIT_BUF; /* set buffered */
@ -6126,9 +6217,7 @@ if ((dptr = find_dev_from_unit (uptr)) == NULL)
if ((uptr->flags & UNIT_BUF) && (uptr->filebuf)) {
uint32 cap = (uptr->hwmark + dptr->aincr - 1) / dptr->aincr;
if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) {
if (!sim_quiet) {
sim_printf ("%s: writing buffer to file\n", sim_dname (dptr));
}
sim_messagef (SCPE_OK, "%s: writing buffer to file\n", sim_dname (dptr));
rewind (uptr->fileref);
sim_fwrite (uptr->filebuf, SZ_D (dptr), cap, uptr->fileref);
if (ferror (uptr->fileref))
@ -6263,7 +6352,7 @@ GET_SWITCHES (cptr); /* get switches */
if (*cptr == 0) /* must be more */
return SCPE_2FARG;
gbuf[sizeof(gbuf)-1] = '\0';
strncpy (gbuf, cptr, sizeof(gbuf)-1);
strlcpy (gbuf, cptr, sizeof(gbuf));
sim_trim_endspc (gbuf);
if ((sfile = sim_fopen (gbuf, "wb")) == NULL)
return SCPE_OPENERR;
@ -6418,7 +6507,7 @@ GET_SWITCHES (cptr); /* get switches */
if (*cptr == 0) /* must be more */
return SCPE_2FARG;
gbuf[sizeof(gbuf)-1] = '\0';
strncpy (gbuf, cptr, sizeof(gbuf)-1);
strlcpy (gbuf, cptr, sizeof(gbuf));
sim_trim_endspc (gbuf);
if ((rfile = sim_fopen (gbuf, "rb")) == NULL)
return SCPE_OPENERR;
@ -6819,7 +6908,8 @@ if ((flag == RU_RUN) || (flag == RU_GO)) { /* run or go */
(flag == RU_RUN) ? "RUN" : "GO", gbuf, cptr);
sim_switches = 0;
GET_SWITCHES (cptr);
if ((*cptr == '\'') || (*cptr == '"')) { /* Expect UNTIL condition */
if (((*cptr == '\'') || (*cptr == '"')) || /* Expect UNTIL condition */
(!sim_strncasecmp(cptr, "HALTAFTER=", 10))) {
r = expect_cmd (1, cptr);
if (r != SCPE_OK)
return r;
@ -7640,7 +7730,6 @@ else PUT_RVAL (t_uint64, rptr, idx, val, mask);
#else
else PUT_RVAL (uint32, rptr, idx, val, mask);
#endif
return;
}
/* Examine address routine
@ -7938,7 +8027,7 @@ if (prompt) { /* interactive? */
if (tmpc == NULL) /* bad result? */
cptr = NULL;
else {
strncpy (cptr, tmpc, size); /* copy result */
strlcpy (cptr, tmpc, size); /* copy result */
free (tmpc) ; /* free temp */
}
}
@ -8291,7 +8380,7 @@ CONST char *tptr;
*status = SCPE_OK;
val = strtotv ((CONST char *)cptr, &tptr, radix);
if ((cptr == tptr) || ((max > 0) && (val > max)))
if ((cptr == tptr) || (val > max))
*status = SCPE_ARG;
else {
while (sim_isspace (*tptr)) tptr++;
@ -10113,7 +10202,7 @@ if ((act != NULL) && (*act != 0)) { /* new action? */
char *newp = (char *) calloc (CBUFSIZE+1, sizeof (char)); /* alloc buf */
if (newp == NULL) /* mem err? */
return SCPE_MEM;
strncpy (newp, act, CBUFSIZE); /* copy action */
strlcpy (newp, act, CBUFSIZE); /* copy action */
bp->act = newp; /* set pointer */
}
sim_brk_summ = sim_brk_summ | (sw & ~BRK_TYP_TEMP);
@ -10341,7 +10430,7 @@ if ((ep = strchr (sim_brk_act[sim_do_depth], ';'))) { /* cmd delimiter? */
sim_brk_act[sim_do_depth] += lnt + 1; /* adv ptr */
}
else {
strncpy (buf, sim_brk_act[sim_do_depth], size); /* copy action */
strlcpy (buf, sim_brk_act[sim_do_depth], size); /* copy action */
sim_brk_clract (); /* no more */
}
return buf;
@ -10728,7 +10817,7 @@ return SCPE_OK;
t_stat sim_exp_show_tab (FILE *st, const EXPECT *exp, const EXPTAB *ep)
{
const char *dev_name = dev_name = tmxr_expect_line_name (exp);
const char *dev_name = tmxr_expect_line_name (exp);
uint32 default_haltafter = get_default_env_parameter (dev_name, "SIM_EXPECT_HALTAFTER", 0);
if (!ep)
@ -10756,7 +10845,7 @@ return SCPE_OK;
t_stat sim_exp_show (FILE *st, CONST EXPECT *exp, const char *match)
{
CONST EXPTAB *ep = (CONST EXPTAB *)sim_exp_fnd (exp, match, 0);
const char *dev_name = dev_name = tmxr_expect_line_name (exp);
const char *dev_name = tmxr_expect_line_name (exp);
uint32 default_haltafter = get_default_env_parameter (dev_name, "SIM_EXPECT_HALTAFTER", 0);
if (exp->buf_size) {
@ -11314,6 +11403,8 @@ int32 len;
va_list arglist;
t_bool inhibit_message = (!sim_show_message || (stat & SCPE_NOMESSAGE));
if ((stat == SCPE_OK) && (sim_quiet || (sim_switches & SWMASK ('Q'))))
return stat;
while (1) { /* format passed string, args */
va_start (arglist, fmt);
#if defined(NO_vsnprintf)
@ -11340,10 +11431,11 @@ while (1) { /* format passed string, arg
break;
}
if ((sim_do_ocptr[sim_do_depth]) &&
((stat & ~SCPE_NOMESSAGE) != SCPE_OK)) {
if (!sim_do_echo && !sim_quiet && !inhibit_message)
if (sim_do_ocptr[sim_do_depth]) {
if (!sim_do_echo && !inhibit_message && !sim_cmd_echoed) {
sim_printf("%s> %s\n", do_position(), sim_do_ocptr[sim_do_depth]);
sim_cmd_echoed = TRUE;
}
else {
if (sim_deb) { /* Always put context in debug output */
TMLN *saved_oline = sim_oline;
@ -12418,7 +12510,7 @@ if (fp == NULL) {
* of the executable. Failing that, we're out of luck.
*/
fbuf[sizeof(fbuf)-1] = '\0';
strncpy (fbuf, sim_argv[0], sizeof (fbuf)-1);
strlcpy (fbuf, sim_argv[0], sizeof (fbuf));
if ((p = (char *)match_ext (fbuf, "EXE")))
*p = '\0';
if ((p = strrchr (fbuf, '\\'))) {

2
scp.h
View File

@ -103,6 +103,7 @@ t_stat noop_cmd (int32 flag, CONST char *ptr);
t_stat assert_cmd (int32 flag, CONST char *ptr);
t_stat send_cmd (int32 flag, CONST char *ptr);
t_stat expect_cmd (int32 flag, CONST char *ptr);
t_stat sleep_cmd (int32 flag, CONST char *ptr);
t_stat help_cmd (int32 flag, CONST char *ptr);
t_stat screenshot_cmd (int32 flag, CONST char *ptr);
t_stat spawn_cmd (int32 flag, CONST char *ptr);
@ -251,6 +252,7 @@ const char *sim_fmt_secs (double seconds);
const char *sim_fmt_numeric (double number);
const char *sprint_capac (DEVICE *dptr, UNIT *uptr);
char *read_line (char *cptr, int32 size, FILE *stream);
char *read_line_p (const char *prompt, char *ptr, int32 size, FILE *stream);
void fprint_reg_help (FILE *st, DEVICE *dptr);
void fprint_set_help (FILE *st, DEVICE *dptr);
void fprint_show_help (FILE *st, DEVICE *dptr);

View File

@ -48,6 +48,7 @@ struct ROM_File_Descriptor {
{"VAX/vmb.exe", "VAX/vax_vmb_exe.h", 44544, 0xFFC014BB, "vax_vmb_exe"},
{"PDP11/lunar11/lunar.lda", "PDP11/pdp11_vt_lunar_rom.h", 13824 , 0xFFF15D00, "lunar_lda"},
{"swtp6800/swtp6800/swtbug.bin", "swtp6800/swtp6800/swtp_swtbug_bin.h", 1024, 0xFFFE4FBC, "swtp_swtbug_bin"},
{"3B2/rom_400.bin", "3B2/rom_400_bin.h", 32768, 0xFFD55762, "rom_400_bin"},
};

View File

@ -480,6 +480,7 @@ struct BITSAMPLE {
typedef struct BITSAMPLE_REG BITSAMPLE_REG;
struct BITSAMPLE_REG {
REG *reg; /* Register to be sampled */
uint32 idx; /* Register index */
t_bool indirect; /* Register value points at memory */
DEVICE *dptr; /* Device register is part of */
UNIT *uptr; /* Unit Register is related to */
@ -503,6 +504,7 @@ struct REMOTE {
t_bool repeat_pending; /* repeat delivery pending */
char *repeat_action; /* command(s) to repeatedly execute */
int smp_sample_interval; /* cycles between samples */
int smp_sample_dither_pct; /* dithering of cycles interval */
uint32 smp_reg_count; /* sample register count */
BITSAMPLE_REG *smp_regs; /* registers being sampled */
};
@ -533,7 +535,10 @@ if (rem->smp_reg_count == 0) {
for (reg = 0; reg < rem->smp_reg_count; reg++) {
uint32 bit;
fprintf (st, "}%s %s%s %d:", rem->smp_regs[reg].dptr->name, rem->smp_regs[reg].reg->name, rem->smp_regs[reg].indirect ? " -I" : "", rem->smp_regs[reg].bits[0].depth);
if (rem->smp_regs[reg].reg->depth > 1)
fprintf (st, "}%s %s[%d] %s %d:", rem->smp_regs[reg].dptr->name, rem->smp_regs[reg].reg->name, rem->smp_regs[reg].idx, rem->smp_regs[reg].indirect ? " -I" : "", rem->smp_regs[reg].bits[0].depth);
else
fprintf (st, "}%s %s%s %d:", rem->smp_regs[reg].dptr->name, rem->smp_regs[reg].reg->name, rem->smp_regs[reg].indirect ? " -I" : "", rem->smp_regs[reg].bits[0].depth);
for (bit = 0; bit < rem->smp_regs[reg].width; bit++)
fprintf (st, "%s%d", (bit != 0) ? "," : "", rem->smp_regs[reg].bits[bit].tot);
fprintf (st, "\n");
@ -614,14 +619,20 @@ for (i=connections=0; i<sim_rem_con_tmxr.lines; i++) {
uint32 reg;
DEVICE *dptr = NULL;
fprintf (st, "Register Bit Sampling is occurring every %d cycles\n", rem->smp_sample_interval);
if (rem->smp_sample_dither_pct)
fprintf (st, "Register Bit Sampling is occurring every %d cycles (dithered %d percent)\n", rem->smp_sample_interval, rem->smp_sample_dither_pct);
else
fprintf (st, "Register Bit Sampling is occurring every %d cycles\n", rem->smp_sample_interval);
fprintf (st, " Registers being sampled are: ");
for (reg = 0; reg < rem->smp_reg_count; reg++) {
if (rem->smp_regs[reg].indirect)
fprintf (st, " indirect ");
if (dptr != rem->smp_regs[reg].dptr)
fprintf (st, "%s ", rem->smp_regs[reg].dptr->name);
fprintf (st, "%s%s", rem->smp_regs[reg].reg->name, ((reg + 1) < rem->smp_reg_count) ? ", " : "");
if (rem->smp_regs[reg].reg->depth > 1)
fprintf (st, "%s[%d]%s", rem->smp_regs[reg].reg->name, rem->smp_regs[reg].idx, ((reg + 1) < rem->smp_reg_count) ? ", " : "");
else
fprintf (st, "%s%s", rem->smp_regs[reg].reg->name, ((reg + 1) < rem->smp_reg_count) ? ", " : "");
dptr = rem->smp_regs[reg].dptr;
}
fprintf (st, "\n");
@ -875,6 +886,8 @@ stat = sim_rem_active_command->action (sim_rem_active_command->arg, cptr);/* exe
if (stat != SCPE_OK)
stat = _sim_rem_message (gbuf, stat); /* display results */
sim_last_cmd_stat = SCPE_BARE_STATUS(stat);
if (sim_vm_post != NULL) /* optionally let the simulator know */
(*sim_vm_post) (TRUE); /* something might have changed */
if (!sim_processing_event) {
sim_ttrun (); /* set console mode */
sim_cancel (rem_con_data_unit); /* force immediate activation of sim_rem_con_data_svc */
@ -1027,7 +1040,7 @@ return stat;
static t_stat sim_rem_collect_cmd_setup (int32 line, CONST char **iptr)
{
char gbuf[CBUFSIZE];
int32 samples, cycles;
int32 samples, cycles, dither_pct;
t_bool all_stop = FALSE;
t_stat stat = SCPE_OK;
CONST char *cptr = *iptr;
@ -1073,6 +1086,7 @@ if ((stat != SCPE_OK) || (samples <= 0)) { /* error? */
}
else {
const char *tptr;
int32 event_time = rem->smp_sample_interval;
cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */
if (MATCH_CMD (gbuf, "SAMPLES") != 0) {
@ -1095,6 +1109,23 @@ else {
*iptr = cptr;
return sim_messagef (SCPE_ARG, "Expected CYCLES found: %s\n", gbuf);
}
cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */
if ((MATCH_CMD (gbuf, "DITHER") != 0) || (*cptr == 0)) {
*iptr = cptr;
return sim_messagef (SCPE_ARG, "Expected DITHER found: %s\n", gbuf);
}
cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */
dither_pct = (int32) get_uint (gbuf, 10, INT_MAX, &stat);
if ((stat != SCPE_OK) || /* error? */
(dither_pct < 0) || (dither_pct > 25)) {
*iptr = cptr;
return sim_messagef (SCPE_ARG, "Expected value found: %s\n", gbuf);
}
cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */
if ((MATCH_CMD (gbuf, "PERCENT") != 0) || (*cptr == 0)) {
*iptr = cptr;
return sim_messagef (SCPE_ARG, "Expected PERCENT found: %s\n", gbuf);
}
tptr = strcpy (gbuf, "STOP"); /* Start from a clean slate */
sim_rem_collect_cmd_setup (rem->line, &tptr);
rem->smp_sample_interval = cycles;
@ -1104,6 +1135,7 @@ else {
char tbuf[2*CBUFSIZE];
uint32 bit, width;
REG *reg;
uint32 idx;
int32 saved_switches = sim_switches;
t_bool indirect = FALSE;
BITSAMPLE_REG *smp_regs;
@ -1132,6 +1164,25 @@ else {
stat = sim_messagef (SCPE_NXREG, "Nonexistent Register: %s\n", gbuf);
break;
}
if (*tptr == '[') { /* subscript? */
const char *tgptr = ++tptr;
if (reg->depth <= 1) { /* array register? */
stat = sim_messagef (SCPE_SUB, "Not Array Register: %s\n", reg->name);
break;
}
idx = (uint32) strtotv (tgptr, &tptr, 10); /* convert index */
if ((tgptr == tptr) || (*tptr++ != ']')) {
stat = sim_messagef (SCPE_SUB, "Missing or Invalid Register Subscript: %s[%s\n", reg->name, tgptr);
break;
}
if (idx >= reg->depth) { /* validate subscript */
stat = sim_messagef (SCPE_SUB, "Invalid Register Subscript: %s[%d]\n", reg->name, idx);
break;
}
}
else
idx = 0; /* not array */
smp_regs = (BITSAMPLE_REG *)realloc (rem->smp_regs, (rem->smp_reg_count + 1) * sizeof(*smp_regs));
if (smp_regs == NULL) {
stat = SCPE_MEM;
@ -1139,6 +1190,7 @@ else {
}
rem->smp_regs = smp_regs;
smp_regs[rem->smp_reg_count].reg = reg;
smp_regs[rem->smp_reg_count].idx = idx;
smp_regs[rem->smp_reg_count].dptr = sim_dfdev;
smp_regs[rem->smp_reg_count].uptr = sim_dfunit;
smp_regs[rem->smp_reg_count].indirect = indirect;
@ -1167,7 +1219,9 @@ else {
sim_rem_collect_cmd_setup (line, &cptr);/* Cleanup mess */
return stat;
}
sim_activate (&rem_con_smp_smpl_units[rem->line], rem->smp_sample_interval);
if (rem->smp_sample_dither_pct)
event_time = (((rand() % (2 * rem->smp_sample_dither_pct)) - rem->smp_sample_dither_pct) * event_time) / 100;
sim_activate (&rem_con_smp_smpl_units[rem->line], event_time);
}
*iptr = cptr;
return stat;
@ -1178,7 +1232,7 @@ t_stat sim_rem_con_repeat_svc (UNIT *uptr)
int line = uptr - rem_con_repeat_units;
REMOTE *rem = &sim_rem_consoles[line];
sim_debug (DBG_REP, &sim_remote_console, "sim_rem_con_repeat_svc(line=%d) - interval=%d\n", line, rem->repeat_interval);
sim_debug (DBG_REP, &sim_remote_console, "sim_rem_con_repeat_svc(line=%d) - interval=%d usecs\n", line, rem->repeat_interval);
if (rem->repeat_interval) {
rem->repeat_pending = TRUE;
sim_activate_after (uptr, rem->repeat_interval); /* reschedule */
@ -1209,7 +1263,7 @@ for (i = 0; i < bit->depth; i++) /* set all value bits */
static void sim_rem_collect_reg_bits (BITSAMPLE_REG *reg)
{
uint32 i;
t_value val = get_rval (reg->reg, 0);
t_value val = get_rval (reg->reg, reg->idx);
if (reg->indirect)
val = get_aval ((t_addr)val, reg->dptr, reg->uptr);
@ -1244,10 +1298,14 @@ t_stat sim_rem_con_smp_collect_svc (UNIT *uptr)
int line = uptr - rem_con_smp_smpl_units;
REMOTE *rem = &sim_rem_consoles[line];
sim_debug (DBG_SAM, &sim_remote_console, "sim_rem_con_smp_collect_svc(line=%d) - interval=%d\n", line, rem->smp_sample_interval);
sim_debug (DBG_SAM, &sim_remote_console, "sim_rem_con_smp_collect_svc(line=%d) - interval=%d, dither=%d%%\n", line, rem->smp_sample_interval, rem->smp_sample_dither_pct);
if (rem->smp_sample_interval && (rem->smp_reg_count != 0)) {
int32 event_time = rem->smp_sample_interval;
if (rem->smp_sample_dither_pct)
event_time = (((rand() % (2 * rem->smp_sample_dither_pct)) - rem->smp_sample_dither_pct) * event_time) / 100;
sim_rem_collect_registers (rem);
sim_activate (uptr, rem->smp_sample_interval); /* reschedule */
sim_activate (uptr, event_time); /* reschedule */
}
return SCPE_OK;
}
@ -1324,7 +1382,9 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
}
}
else {
if ((!rem->repeat_pending) || (rem->buf_ptr != 0)) {
if (((!rem->repeat_pending) && (rem->act == NULL)) || /* Repeat isn't pending AND no prior commands still active */
(rem->buf_ptr != 0) || /* OR Not at beginning of line */
(tmxr_input_pending_ln (lp))) { /* OR input available to read */
c = tmxr_getc_ln (lp);
if (!(TMXR_VALID & c))
continue;
@ -1403,10 +1463,12 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
break;
}
else {
if (rem->repeat_pending) {
if ((rem->repeat_pending) && /* New repeat pending */
(rem->act == NULL) && /* AND no prior still active */
(!tmxr_input_pending_ln (lp))) { /* AND no session input pending */
rem->repeat_pending = FALSE;
sim_rem_setact (i, rem->repeat_action);
sim_rem_getact (i, rem->buf, rem->buf_size);
sim_rem_setact (rem-sim_rem_consoles, rem->repeat_action);
sim_rem_getact (rem-sim_rem_consoles, rem->buf, rem->buf_size);
if (!master_session)
tmxr_linemsgf (lp, "%s%s\n", sim_prompt, rem->buf);
else
@ -1508,7 +1570,10 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
break;
}
c = 0;
if ((!got_command) && (rem->single_mode) && (tmxr_input_pending_ln (lp))) {
if ((!got_command) && /* No Command yet */
(rem->single_mode) && /* AND single command mode */
(tmxr_input_pending_ln (lp)) && /* AND something ready to read */
(rem->act == NULL)) { /* AND no prior still active */
c = tmxr_getc_ln (lp);
c = c & ~TMXR_VALID;
}
@ -1916,6 +1981,7 @@ if (sim_rem_master_mode) {
sim_printf ("Command input starting on Master Remote Console Session\n");
stat = sim_run_boot_prep (0);
sim_rem_master_was_enabled = TRUE;
sim_last_cmd_stat = SCPE_OK;
while (sim_rem_master_mode) {
sim_rem_consoles[0].single_mode = FALSE;
sim_cancel (rem_con_data_unit);
@ -1925,8 +1991,14 @@ if (sim_rem_master_mode) {
stat_nomessage = stat & SCPE_NOMESSAGE; /* extract possible message supression flag */
stat = _sim_rem_message ("RUN", stat);
}
sim_debug (DBG_MOD, &sim_remote_console, "Master Session Returned: Status - %d Active_Line: %d, Mode: %s, Active Cmd: %s\n", stat, sim_rem_cmd_active_line, sim_rem_consoles[0].single_mode ? "Single" : "^E Stopped", sim_rem_active_command ? sim_rem_active_command->name : "");
if (stat == SCPE_EXIT)
sim_rem_master_mode = FALSE;
sim_rem_cmd_active_line = 0; /* Make it look like */
sim_rem_consoles[0].single_mode = FALSE;
if (stat != SCPE_STEP)
sim_rem_active_command = &allowed_single_remote_cmds[0];/* Dummy */
sim_last_cmd_stat = SCPE_BARE_STATUS(stat); /* make exit status available to remote console */
}
sim_rem_master_was_enabled = FALSE;
sim_rem_master_was_connected = FALSE;

View File

@ -115,6 +115,10 @@
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf /* poor man's snprintf which will work most of the time but has different return value */
#endif
#if defined(__VAX)
extern int sim_vax_snprintf(char *buf, size_t buf_size, const char *fmt, ...);
#define snprintf sim_vax_snprintf
#endif
#include <stdarg.h>
#include <string.h>
#include <errno.h>
@ -231,9 +235,11 @@ typedef unsigned long t_uint64;
#if defined (USE_INT64) /* 64b data */
typedef t_int64 t_svalue; /* signed value */
typedef t_uint64 t_value; /* value */
#define T_VALUE_MAX 0xffffffffffffffffuLL
#else /* 32b data */
typedef int32 t_svalue;
typedef uint32 t_value;
#define T_VALUE_MAX 0xffffffffUL
#endif /* end 64b data */
#if defined (USE_INT64) && defined (USE_ADDR64) /* 64b address */
@ -648,9 +654,10 @@ struct REG {
uint32 depth; /* save depth */
const char *desc; /* description */
BITFIELD *fields; /* bit fields */
uint32 flags; /* flags */
uint32 qptr; /* circ q ptr */
size_t str_size; /* structure size */
/* NOTE: Flags MUST always be last since it is initialized outside of macro definitions */
uint32 flags; /* flags */
};
/* Register flags */
@ -855,111 +862,164 @@ struct MEMFILE {
#define UDATA(act,fl,cap) NULL,act,NULL,NULL,NULL,0,0,(fl),0,(cap),0,NULL,0,0
/* Internal use ONLY (see below) Generic Register declaration for all fields */
#define _REGDATANF(nm,loc,rdx,wd,off,dep,desc,flds,qptr,siz) \
nm, (loc), (rdx), (wd), (off), (dep), (desc), (flds), (qptr), (siz)
#if defined (__STDC__) || defined (_WIN32) /* Variants which depend on how macro arguments are convered to strings */
/* Generic Register declaration for all fields.
If the register structure is extended, this macro will be retained and a
new macro will be provided that populates the new register structure */
new internal macro will be provided that populates the new register structure */
#define REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
#nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz)
/* Internal use ONLY (see below) Generic Register declaration for all fields */
#define _REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz)
_REGDATANF(#nm,&(loc),rdx,wd,off,dep,desc,flds,qptr,siz),(fl)
#define REGDATAC(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
_REGDATANF(#nm,&(loc),rdx,wd,off,dep,desc,flds,qptr,siz),(fl)
/* Right Justified Octal Register Data */
#define ORDATA(nm,loc,wd) #nm, &(loc), 8, (wd), 0, 1, NULL, NULL
#define ORDATA(nm,loc,wd) \
_REGDATANF(#nm,&(loc),8,wd,0,1,NULL,NULL,0,0)
#define ORDATAD(nm,loc,wd,desc) \
_REGDATANF(#nm,&(loc),8,wd,0,1,desc,NULL,0,0)
#define ORDATADF(nm,loc,wd,desc,flds) \
_REGDATANF(#nm,&(loc),8,wd,0,1,desc,flds,0,0)
/* Right Justified Decimal Register Data */
#define DRDATA(nm,loc,wd) #nm, &(loc), 10, (wd), 0, 1, NULL, NULL
#define DRDATA(nm,loc,wd) \
_REGDATANF(#nm,&(loc),10,wd,0,1,NULL,NULL,0,0)
#define DRDATAD(nm,loc,wd,desc) \
_REGDATANF(#nm,&(loc),10,wd,0,1,desc,NULL,0,0)
#define DRDATADF(nm,loc,wd,desc,flds) \
_REGDATANF(#nm,&(loc),10,wd,0,1,desc,flds,0,0)
/* Right Justified Hexadecimal Register Data */
#define HRDATA(nm,loc,wd) #nm, &(loc), 16, (wd), 0, 1, NULL, NULL
#define HRDATA(nm,loc,wd) \
_REGDATANF(#nm,&(loc),16,wd,0,1,NULL,NULL,0,0)
#define HRDATAD(nm,loc,wd,desc) \
_REGDATANF(#nm,&(loc),16,wd,0,1,desc,NULL,0,0)
#define HRDATADF(nm,loc,wd,desc,flds) \
_REGDATANF(#nm,&(loc),16,wd,0,1,desc,flds,0,0)
/* Right Justified Binary Register Data */
#define BINRDATA(nm,loc,wd) #nm, &(loc), 2, (wd), 0, 1, NULL, NULL
#define BINRDATA(nm,loc,wd) \
_REGDATANF(#nm,&(loc),2,wd,0,1,NULL,NULL,0,0)
#define BINRDATAD(nm,loc,wd,desc) \
_REGDATANF(#nm,&(loc),2,wd,0,1,desc,NULL,0,0)
#define BINRDATADF(nm,loc,wd,desc,flds) \
_REGDATANF(#nm,&(loc),2,wd,0,1,desc,flds,0,0)
/* One-bit binary flag at an arbitrary offset in a 32-bit word Register */
#define FLDATA(nm,loc,pos) #nm, &(loc), 2, 1, (pos), 1, NULL, NULL
#define FLDATA(nm,loc,pos) \
_REGDATANF(#nm,&(loc),2,1,pos,1,NULL,NULL,0,0)
#define FLDATAD(nm,loc,pos,desc) \
_REGDATANF(#nm,&(loc),2,1,pos,1,desc,NULL,0,0)
#define FLDATADF(nm,loc,pos,desc,flds) \
_REGDATANF(#nm,&(loc),2,1,pos,1,desc,flds,0,0)
/* Arbitrary location and Radix Register */
#define GRDATA(nm,loc,rdx,wd,pos) #nm, &(loc), (rdx), (wd), (pos), 1, NULL, NULL
#define GRDATA(nm,loc,rdx,wd,pos) \
_REGDATANF(#nm,&(loc),rdx,wd,pos,1,NULL,NULL,0,0)
#define GRDATAD(nm,loc,rdx,wd,pos,desc) \
_REGDATANF(#nm,&(loc),rdx,wd,pos,1,desc,NULL,0,0)
#define GRDATADF(nm,loc,rdx,wd,pos,desc,flds) \
_REGDATANF(#nm,&(loc),rdx,wd,pos,1,desc,flds,0,0)
/* Arrayed register whose data is kept in a standard C array Register */
#define BRDATA(nm,loc,rdx,wd,dep) #nm, (loc), (rdx), (wd), 0, (dep), NULL, NULL
/* Same as above, but with additional description initializer */
#define ORDATAD(nm,loc,wd,desc) #nm, &(loc), 8, (wd), 0, 1, (desc), NULL
#define DRDATAD(nm,loc,wd,desc) #nm, &(loc), 10, (wd), 0, 1, (desc), NULL
#define HRDATAD(nm,loc,wd,desc) #nm, &(loc), 16, (wd), 0, 1, (desc), NULL
#define BINRDATAD(nm,loc,wd,desc) #nm, &(loc), 2, (wd), 0, 1, (desc), NULL
#define FLDATAD(nm,loc,pos,desc) #nm, &(loc), 2, 1, (pos), 1, (desc), NULL
#define GRDATAD(nm,loc,rdx,wd,pos,desc) #nm, &(loc), (rdx), (wd), (pos), 1, (desc), NULL
#define BRDATAD(nm,loc,rdx,wd,dep,desc) #nm, (loc), (rdx), (wd), 0, (dep), (desc), NULL
/* Same as above, but with additional description initializer, and bitfields */
#define ORDATADF(nm,loc,wd,desc,flds) #nm, &(loc), 8, (wd), 0, 1, (desc), (flds)
#define DRDATADF(nm,loc,wd,desc,flds) #nm, &(loc), 10, (wd), 0, 1, (desc), (flds)
#define HRDATADF(nm,loc,wd,desc,flds) #nm, &(loc), 16, (wd), 0, 1, (desc), (flds)
#define BINRDATADF(nm,loc,wd) #nm, &(loc), 2, (wd), 0, 1, NULL, NULL
#define FLDATADF(nm,loc,pos,desc,flds) #nm, &(loc), 2, 1, (pos), 1, (desc), (flds)
#define GRDATADF(nm,loc,rdx,wd,pos,desc,flds) #nm, &(loc), (rdx), (wd), (pos), 1, (desc), (flds)
#define BRDATADF(nm,loc,rdx,wd,dep,desc,flds) #nm, (loc), (rdx), (wd), 0, (dep), (desc), (flds)
#define BRDATA(nm,loc,rdx,wd,dep) \
_REGDATANF(#nm,loc,rdx,wd,0,dep,NULL,NULL,0,0)
#define BRDATAD(nm,loc,rdx,wd,dep,desc) \
_REGDATANF(#nm,loc,rdx,wd,0,dep,desc,NULL,0,0)
#define BRDATADF(nm,loc,rdx,wd,dep,desc,flds) \
_REGDATANF(#nm,loc,rdx,wd,0,dep,desc,flds,0,0)
/* Arrayed register whose data is part of the UNIT structure */
#define URDATA(nm,loc,rdx,wd,off,dep,fl) \
_REGDATANF(#nm,&(loc),rdx,wd,off,dep,NULL,NULL,0,0),((fl) | REG_UNIT)
#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \
_REGDATANF(#nm,&(loc),rdx,wd,off,dep,desc,NULL,0,0),((fl) | REG_UNIT)
#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \
_REGDATANF(#nm,&(loc),rdx,wd,off,dep,desc,flds,0,0),((fl) | REG_UNIT)
/* Arrayed register whose data is part of an arbitrary structure */
#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \
_REGDATANF(#nm,&(loc),rdx,wd,off,dep,NULL,NULL,0,siz),((fl) | REG_STRUCT)
#define STRDATAD(nm,loc,rdx,wd,off,dep,siz,fl,desc) \
_REGDATANF(#nm,&(loc),rdx,wd,off,dep,desc,NULL,0,siz),((fl) | REG_STRUCT)
#define STRDATADF(nm,loc,rdx,wd,off,dep,siz,fl,desc,flds) \
_REGDATANF(#nm,&(loc),rdx,wd,off,dep,desc,flds,0,siz),((fl) | REG_STRUCT)
#define BIT(nm) {#nm, 0xffffffff, 1} /* Single Bit definition */
#define BITNC {"", 0xffffffff, 1} /* Don't care Bit definition */
#define BITF(nm,sz) {#nm, 0xffffffff, sz} /* Bit Field definition */
#define BITNCF(sz) {"", 0xffffffff, sz} /* Don't care Bit Field definition */
#define BITFFMT(nm,sz,fmt) {#nm, 0xffffffff, sz, NULL, #fmt}/* Bit Field definition with Output format */
#define BITFNAM(nm,sz,names) {#nm, 0xffffffff, sz, names} /* Bit Field definition with value->name map */
#else /* For non-STD-C compiler which can't stringify macro arguments with # */
/* Generic Register declaration for all fields.
If the register structure is extended, this macro will be retained and a
new macro will be provided that populates the new register structure */
#define REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
_REGDATANF("nm",&(loc),rdx,wd,off,dep,desc,flds,qptr,siz),(fl)
#define REGDATAC(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
_REGDATANF("nm",&(loc),rdx,wd,off,dep,desc,flds,qptr,siz),(fl)
/* Right Justified Octal Register Data */
#define ORDATA(nm,loc,wd) \
_REGDATANF("nm",&(loc),8,wd,0,1,NULL,NULL,0,0)
#define ORDATAD(nm,loc,wd,desc) \
_REGDATANF("nm",&(loc),8,wd,0,1,desc,NULL,0,0)
#define ORDATADF(nm,loc,wd,desc,flds) \
_REGDATANF("nm",&(loc),8,wd,0,1,desc,flds,0,0)
/* Right Justified Decimal Register Data */
#define DRDATA(nm,loc,wd) \
_REGDATANF("nm",&(loc),10,wd,0,1,NULL,NULL,0,0)
#define DRDATAD(nm,loc,wd,desc) \
_REGDATANF("nm",&(loc),10,wd,0,1,desc,NULL,0,0)
#define DRDATADF(nm,loc,wd,desc,flds) \
_REGDATANF("nm",&(loc),10,wd,0,1,desc,flds,0,0)
/* Right Justified Hexadecimal Register Data */
#define HRDATA(nm,loc,wd) \
_REGDATANF("nm",&(loc),16,wd,0,1,NULL,NULL,0,0)
#define HRDATAD(nm,loc,wd,desc) \
_REGDATANF("nm",&(loc),16,wd,0,1,desc,NULL,0,0)
#define HRDATADF(nm,loc,wd,desc,flds) \
_REGDATANF("nm",&(loc),16,wd,0,1,desc,flds,0,0)
/* Right Justified Binary Register Data */
#define BINRDATA(nm,loc,wd) \
_REGDATANF("nm",&(loc),2,wd,0,1,NULL,NULL,0,0)
#define BINRDATAD(nm,loc,wd,desc) \
_REGDATANF("nm",&(loc),2,wd,0,1,desc,NULL,0,0)
#define BINRDATADF(nm,loc,wd,desc,flds) \
_REGDATANF("nm",&(loc),2,wd,0,1,desc,flds,0,0)
/* One-bit binary flag at an arbitrary offset in a 32-bit word Register */
#define FLDATA(nm,loc,pos) \
_REGDATANF("nm",&(loc),2,1,pos,1,NULL,NULL,0,0)
#define FLDATAD(nm,loc,pos,desc) \
_REGDATANF("nm",&(loc),2,1,pos,1,desc,NULL,0,0)
#define FLDATADF(nm,loc,pos,desc,flds) \
_REGDATANF("nm",&(loc),2,1,pos,1,desc,flds,0,0)
/* Arbitrary location and Radix Register */
#define GRDATA(nm,loc,rdx,wd,pos) \
_REGDATANF("nm",&(loc),rdx,wd,pos,1,NULL,NULL,0,0)
#define GRDATAD(nm,loc,rdx,wd,pos,desc) \
_REGDATANF("nm",&(loc),rdx,wd,pos,1,desc,NULL,0,0)
#define GRDATADF(nm,loc,rdx,wd,pos,desc,flds) \
_REGDATANF("nm",&(loc),rdx,wd,pos,1,desc,flds,0,0)
/* Arrayed register whose data is kept in a standard C array Register */
#define BRDATA(nm,loc,rdx,wd,dep) \
_REGDATANF("nm",loc,rdx,wd,0,dep,NULL,NULL,0,0)
#define BRDATAD(nm,loc,rdx,wd,dep,desc) \
_REGDATANF("nm",loc,rdx,wd,0,dep,desc,NULL,0,0)
#define BRDATADF(nm,loc,rdx,wd,dep,desc,flds) \
_REGDATANF("nm",loc,rdx,wd,0,dep,desc,flds,0,0)
/* Arrayed register whose data is part of the UNIT structure */
#define URDATA(nm,loc,rdx,wd,off,dep,fl) \
_REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_UNIT),0,0)
_REGDATANF("nm",&(loc),rdx,wd,off,dep,NULL,NULL,0,0),((fl) | REG_UNIT)
#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \
_REGDATANF("nm",&(loc),rdx,wd,off,dep,desc,NULL,0,0),((fl) | REG_UNIT)
#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \
_REGDATANF("nm",&(loc),rdx,wd,off,dep,desc,flds,0,0),((fl) | REG_UNIT)
/* Arrayed register whose data is part of an arbitrary structure */
#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \
_REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_STRUCT),0,(siz))
/* Same as above, but with additional description initializer */
#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \
_REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_UNIT),0,0)
_REGDATANF("nm",&(loc),rdx,wd,off,dep,NULL,NULL,0,siz),((fl) | REG_STRUCT)
#define STRDATAD(nm,loc,rdx,wd,off,dep,siz,fl,desc) \
_REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_STRUCT),0,(siz))
/* Same as above, but with additional description initializer, and bitfields */
#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \
_REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_UNIT),0,0)
_REGDATANF("nm",&(loc),rdx,wd,off,dep,desc,NULL,0,siz),((fl) | REG_STRUCT)
#define STRDATADF(nm,loc,rdx,wd,off,dep,siz,fl,desc,flds) \
_REGDATA(#nm,(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_STRUCT),0,(siz))
#else /* For non-STD-C compiler which can't stringify macro arguments with # */
#define REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
"nm", &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz)
#define _REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz)
#define ORDATA(nm,loc,wd) "nm", &(loc), 8, (wd), 0, 1, NULL, NULL
#define DRDATA(nm,loc,wd) "nm", &(loc), 10, (wd), 0, 1, NULL, NULL
#define HRDATA(nm,loc,wd) "nm", &(loc), 16, (wd), 0, 1, NULL, NULL
#define BINRDATA(nm,loc,wd) "nm", &(loc), 2, (wd), 0, 1, NULL, NULL
#define FLDATA(nm,loc,pos) "nm", &(loc), 2, 1, (pos), 1, NULL, NULL
#define GRDATA(nm,loc,rdx,wd,pos) "nm", &(loc), (rdx), (wd), (pos), 1, NULL, NULL
#define BRDATA(nm,loc,rdx,wd,dep) "nm", (loc), (rdx), (wd), 0, (dep), NULL, NULL
#define ORDATAD(nm,loc,wd,desc) "nm", &(loc), 8, (wd), 0, 1, (desc), NULL
#define DRDATAD(nm,loc,wd,desc) "nm", &(loc), 10, (wd), 0, 1, (desc), NULL
#define HRDATAD(nm,loc,wd,desc) "nm", &(loc), 16, (wd), 0, 1, (desc), NULL
#define BINRDATAD(nm,loc,wd,desc) "nm", &(loc), 2, (wd), 0, 1, (desc), NULL
#define FLDATAD(nm,loc,pos,desc) "nm", &(loc), 2, 1, (pos), 1, (desc), NULL
#define GRDATAD(nm,loc,rdx,wd,pos,desc) "nm", &(loc), (rdx), (wd), (pos), 1, (desc), NULL
#define BRDATAD(nm,loc,rdx,wd,dep,desc) "nm", (loc), (rdx), (wd), 0, (dep), (desc), NULL
#define ORDATADF(nm,loc,wd,desc,flds) "nm", &(loc), 8, (wd), 0, 1, (desc), (flds)
#define DRDATADF(nm,loc,wd,desc,flds) "nm", &(loc), 10, (wd), 0, 1, (desc), (flds)
#define HRDATADF(nm,loc,wd,desc,flds) "nm", &(loc), 16, (wd), 0, 1, (desc), (flds)
#define BINRDATADF(nm,loc,wd,desc,flds) "nm", &(loc), 2, (wd), 0, 1, (desc), (flds)
#define FLDATADF(nm,loc,pos,desc,flds) "nm", &(loc), 2, 1, (pos), 1, (desc), (flds)
#define GRDATADF(nm,loc,rdx,wd,pos,desc,flds) "nm", &(loc), (rdx), (wd), (pos), 1, (desc), (flds)
#define BRDATADF(nm,loc,rdx,wd,dep,desc,flds) "nm", (loc), (rdx), (wd), 0, (dep), (desc), (flds)
_REGDATANF("nm",&(loc),rdx,wd,off,dep,desc,flds,0,siz),((fl) | REG_STRUCT)
#define BIT(nm) {"nm", 0xffffffff, 1} /* Single Bit definition */
#define BITNC {"", 0xffffffff, 1} /* Don't care Bit definition */
#define BITF(nm,sz) {"nm", 0xffffffff, sz} /* Bit Field definition */
#define BITNCF(sz) {"", 0xffffffff, sz} /* Don't care Bit Field definition */
#define BITFFMT(nm,sz,fmt) {"nm", 0xffffffff, sz, NULL, "fmt"}/* Bit Field definition with Output format */
#define BITFNAM(nm,sz,names) {"nm", 0xffffffff, sz, names} /* Bit Field definition with value->name map */
#define URDATA(nm,loc,rdx,wd,off,dep,fl) \
_REGDATA("nm",(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_UNIT),0,0)
#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \
_REGDATA("nm",(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_STRUCT),0,(siz))
#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \
_REGDATA("nm",(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_UNIT),0,0)
#define STRDATAD(nm,loc,rdx,wd,off,dep,siz,fl,desc) \
_REGDATA("nm",(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_STRUCT),0,(siz))
#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \
_REGDATA("nm",(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_UNIT),0,0)
#define STRDATADF(nm,loc,rdx,wd,off,dep,siz,fl,desc,flds) \
_REGDATA("nm",(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_STRUCT),0,(siz))
#endif
#define ENDBITS {NULL} /* end of bitfield list */

View File

@ -1362,9 +1362,7 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
sim_switches = saved_sim_switches;
return sim_messagef (r, "Can't open source VHD: %s\n", cptr);
}
if (!sim_quiet) {
sim_printf ("%s%d: creating new virtual disk '%s'\n", sim_dname (dptr), (int)(uptr-dptr->units), gbuf);
}
sim_messagef (SCPE_OK, "%s%d: creating new virtual disk '%s'\n", sim_dname (dptr), (int)(uptr-dptr->units), gbuf);
capac_factor = ((dptr->dwidth / dptr->aincr) == 16) ? 2 : 1; /* capacity units (word: 2, byte: 1) */
vhd = sim_vhd_disk_create (gbuf, ((t_offset)uptr->capac)*capac_factor*((dptr->flags & DEV_SECTORS) ? 512 : 1));
if (!vhd) {
@ -1383,8 +1381,7 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
return SCPE_MEM;
}
for (lba = 0; (lba < total_sectors) && (r == SCPE_OK); lba += sects) {
if (!sim_quiet)
sim_printf ("%s%d: Copied %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
sim_messagef (SCPE_OK, "%s%d: Copied %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
sects = sectors_per_buffer;
if (lba + sects > total_sectors)
sects = total_sectors - lba;
@ -1400,12 +1397,10 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
uptr->flags = saved_unit_flags;
}
}
if (!sim_quiet) {
if (r == SCPE_OK)
sim_printf ("\n%s%d: Copied %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000));
else
sim_printf ("\n%s%d: Error copying: %s.\n", sim_dname (dptr), (int)(uptr-dptr->units), sim_error_text (r));
}
if (r == SCPE_OK)
sim_messagef (SCPE_OK, "\n%s%d: Copied %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000));
else
sim_messagef (r, "\n%s%d: Error copying: %s.\n", sim_dname (dptr), (int)(uptr-dptr->units), sim_error_text (r));
if ((r == SCPE_OK) && (sim_switches & SWMASK ('V'))) {
uint8 *verify_buf = (uint8*) malloc (1024*1024);
@ -1416,8 +1411,7 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
return SCPE_MEM;
}
for (lba = 0; (lba < total_sectors) && (r == SCPE_OK); lba += sects) {
if (!sim_quiet)
sim_printf ("%s%d: Verified %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
sim_messagef (SCPE_OK, "%s%d: Verified %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
sects = sectors_per_buffer;
if (lba + sects > total_sectors)
sects = total_sectors - lba;
@ -1439,7 +1433,7 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
}
if (!sim_quiet) {
if (r == SCPE_OK)
sim_printf ("\n%s%d: Verified %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000));
sim_messagef (r, "\n%s%d: Verified %dMB. Done.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)(((t_offset)lba*sector_size)/1000000));
else {
t_lba i;
uint32 save_dctrl = dptr->dctrl;
@ -1544,9 +1538,7 @@ if ((sim_switches & SWMASK ('R')) || /* read only? */
if (uptr->fileref == NULL) /* open fail? */
return _err_return (uptr, SCPE_OPENERR); /* yes, error */
uptr->flags = uptr->flags | UNIT_RO; /* set rd only */
if (!sim_quiet) {
sim_printf ("%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units));
}
sim_messagef (SCPE_OK, "%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units));
}
else { /* normal */
uptr->fileref = open_function (cptr, "rb+"); /* open r/w */
@ -1558,8 +1550,7 @@ else { /* normal */
if (uptr->fileref == NULL) /* open fail? */
return _err_return (uptr, SCPE_OPENERR);/* yes, error */
uptr->flags = uptr->flags | UNIT_RO; /* set rd only */
if (!sim_quiet)
sim_printf ("%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units));
sim_messagef (SCPE_OK, "%s%d: unit is read only\n", sim_dname (dptr), (int)(uptr-dptr->units));
}
else { /* doesn't exist */
if (sim_switches & SWMASK ('E')) /* must exist? */
@ -1570,8 +1561,7 @@ else { /* normal */
uptr->fileref = open_function (cptr, "wb+");/* open new file */
if (uptr->fileref == NULL) /* open fail? */
return _err_return (uptr, SCPE_OPENERR);/* yes, error */
if (!sim_quiet)
sim_printf ("%s%d: creating new file\n", sim_dname (dptr), (int)(uptr-dptr->units));
sim_messagef (SCPE_OK, "%s%d: creating new file\n", sim_dname (dptr), (int)(uptr-dptr->units));
created = TRUE;
}
} /* end if null */
@ -1655,11 +1645,9 @@ if ((created) && (!copied)) {
(void)remove (cptr); /* remove the created file */
return SCPE_OPENERR;
}
if (!sim_quiet)
sim_printf ("%s%d: Initialized To Sector Address %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
sim_messagef (SCPE_OK, "%s%d: Initialized To Sector Address %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
}
if (!sim_quiet)
sim_printf ("%s%d: Initialized To Sector Address %dMB. 100%% complete.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000));
sim_messagef (SCPE_OK, "%s%d: Initialized To Sector Address %dMB. 100%% complete.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000));
free (init_buf);
}
if (pdp11tracksize)
@ -1708,11 +1696,9 @@ if (sim_switches & SWMASK ('K')) {
}
}
}
if (!sim_quiet)
sim_printf ("%s%d: Verified containing Sector Address %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
sim_messagef (SCPE_OK, "%s%d: Verified containing Sector Address %dMB. %d%% complete.\r", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000), (int)((((float)lba)*100)/total_sectors));
}
if (!sim_quiet)
sim_printf ("%s%d: Verified containing Sector Address %dMB. 100%% complete.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000));
sim_messagef (SCPE_OK, "%s%d: Verified containing Sector Address %dMB. 100%% complete.\n", sim_dname (dptr), (int)(uptr-dptr->units), (int)((((float)lba)*sector_size)/1000000));
free (verify_buf);
uptr->dynflags |= UNIT_DISK_CHK;
}
@ -2157,7 +2143,7 @@ if ((dwStatus >= ERROR_INVALID_STARTING_CODESEG) && (dwStatus <= ERROR_INFLOOP_I
}
errno = EINVAL;
}
#if defined(__GNUC__)
#if defined(__GNUC__) && defined(HAVE_NTDDDISK_H)
#include <ddk/ntddstor.h>
#include <ddk/ntdddisk.h>
#else
@ -3643,8 +3629,7 @@ static FILE *sim_vhd_disk_merge (const char *szVHDPath, char **ParentVHD)
continue;
++BlocksToMerge;
}
if (!sim_quiet)
sim_printf ("Merging %s\ninto %s\n", szVHDPath, hVHD->ParentVHDPath);
sim_messagef (SCPE_OK, "Merging %s\ninto %s\n", szVHDPath, hVHD->ParentVHDPath);
for (BlockNumber=NeededBlock=0; BlockNumber < NtoHl (hVHD->Dynamic.MaxTableEntries); ++BlockNumber) {
uint32 BlockSectors = SectorsPerBlock;
@ -3667,8 +3652,7 @@ static FILE *sim_vhd_disk_merge (const char *szVHDPath, char **ParentVHD)
SectorSize,
SectorsPerBlock*BlockNumber))
break;
if (!sim_quiet)
sim_printf ("Merged %dMB. %d%% complete.\r", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000), (int)((((float)NeededBlock)*100)/BlocksToMerge));
sim_messagef (SCPE_OK, "Merged %dMB. %d%% complete.\r", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000), (int)((((float)NeededBlock)*100)/BlocksToMerge));
hVHD->BAT[BlockNumber] = VHD_BAT_FREE_ENTRY;
}
if (BlockNumber < NtoHl (hVHD->Dynamic.MaxTableEntries)) {
@ -3676,8 +3660,7 @@ static FILE *sim_vhd_disk_merge (const char *szVHDPath, char **ParentVHD)
}
else {
Status = 0;
if (!sim_quiet)
sim_printf ("Merged %dMB. 100%% complete.\n", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000));
sim_messagef (SCPE_OK, "Merged %dMB. 100%% complete.\n", (int)((((float)NeededBlock)*SectorsPerBlock)*SectorSize/1000000));
fclose (hVHD->File);
hVHD->File = NULL;
(void)remove (szVHDPath);

View File

@ -599,3 +599,20 @@ free (shmem);
}
#endif
#if defined(__VAX)
/*
* We privide a 'basic' snprintf, which 'might' overrun a buffer, but
* the actual use cases don't on other platforms and none of the callers
* care about the function return value.
*/
int sim_vax_snprintf(char *buf, size_t buf_size, const char *fmt, ...)
{
va_list arglist;
va_start (arglist, fmt);
vsprintf (buf, fmt, arglist);
va_end (arglist);
return 0;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,7 @@ extern "C" {
#if !defined(__VAX) /* Unsupported platform */
#define SIM_FRONTPANEL_VERSION 4
#define SIM_FRONTPANEL_VERSION 11
/**
@ -68,7 +68,7 @@ extern "C" {
device_panel_count the number of sub panels for connected devices
Note 1: - The path specified must be either a fully specified path or
it could be merey the simulator name if the simulator binary
it could be merely the simulator name if the simulator binary
is located in the current PATH.
- The simulator binary must be built from the same version
simh source code that the frontpanel API was acquired fron
@ -194,7 +194,7 @@ sim_panel_add_register_indirect_bits (PANEL *panel,
the values contained in the set of registers it has declared interest in via
the sim_panel_add_register APIs.
1) The values can be polled (when ever it is desired) by calling
1) The values can be polled (whenever it is desired) by calling
sim_panel_get_registers().
2) The panel can call sim_panel_set_display_callback_interval() to
specify a callback routine and a periodic rate that the callback
@ -229,22 +229,32 @@ sim_panel_set_display_callback_interval (PANEL *panel,
When a front panel application wants to get averaged bit sample
values, it must first declare the sampling parameters that will
be used while collecting the bit values.
be used while collecting the bit values. The dithering
percentage must be 25% or less and when non 0 causes the sample
frequency to vary by plus or minus a random percentage value up
to the specified value.
sim_panel_set_sampling_parameters
sim_panel_set_sampling_parameters_ex
sample_frequency cycles/instructions between sample captures
sample_dither_pct percentage of sample_frequency to vary randomly
sample_depth how many samples to accumulate in the rolling
average for each bit sample. Returned bit
sample values will range from 0 thru this
value.
*/
int
sim_panel_set_sampling_parameters_ex (PANEL *panel,
unsigned int sample_frequency,
unsigned int sample_dither_pct,
unsigned int sample_depth);
int
sim_panel_set_sampling_parameters (PANEL *panel,
unsigned int sample_frequency,
unsigned int sample_depth);
/**
When a front panel application needs to change the running
@ -254,6 +264,8 @@ sim_panel_set_sampling_parameters (PANEL *panel,
sim_panel_exec_halt - Stop instruction execution
sim_panel_exec_boot - Boot a simulator from a specific device
sim_panel_exec_run - Start/Resume a simulator running instructions
sim_panel_exec_start - Start a simulator running instructions
after resetting all devices
sim_panel_exec_step - Have a simulator execute a single step
*/
@ -263,6 +275,9 @@ sim_panel_exec_halt (PANEL *panel);
int
sim_panel_exec_boot (PANEL *panel, const char *device);
int
sim_panel_exec_start (PANEL *panel);
int
sim_panel_exec_run (PANEL *panel);
@ -307,12 +322,14 @@ sim_panel_break_output_clear (PANEL *panel, const char *condition);
memory or a register one of the following routines should
be called:
sim_panel_gen_examine - Examine register or memory
sim_panel_gen_deposit - Deposit to register or memory
sim_panel_mem_examine - Examine memory location
sim_panel_mem_deposit - Deposit to memory location
sim_panel_set_register_value - Deposit to a register or memory
location
sim_panel_gen_examine - Examine register or memory
sim_panel_gen_deposit - Deposit to register or memory
sim_panel_mem_examine - Examine memory location
sim_panel_mem_deposit - Deposit to memory location
sim_panel_mem_deposit_instruction - Deposit instruction to memory
location
sim_panel_set_register_value - Deposit to a register or memory
location
*/
@ -332,6 +349,7 @@ sim_panel_gen_examine (PANEL *panel,
const char *name_or_addr,
size_t size,
void *value);
/**
sim_panel_gen_deposit
@ -393,6 +411,25 @@ sim_panel_mem_deposit (PANEL *panel,
size_t value_size,
const void *value);
/**
sim_panel_mem_deposit_instruction
addr_size the size (in local storage) of the buffer which
contains the memory address of the data to be deposited
into the simulator
addr a pointer to the buffer containing the memory address
of the data to be deposited into the simulator
instruction a pointer to the buffer that contains the mnemonic
instruction to be deposited at the indicated address
*/
int
sim_panel_mem_deposit_instruction (PANEL *panel,
size_t addr_size,
const void *addr,
const char *instruction);
/**
sim_panel_set_register_value
@ -408,6 +445,33 @@ sim_panel_set_register_value (PANEL *panel,
const char *name,
const char *value);
/**
A front panel application might want to have access to the
instruction execution history that a simulator may be capable
of providing. If this functionality is desired, enabling of
recording instruction history should be explicitly enabled
in the sim_config file that the simulator is started with.
*/
/**
sim_panel_get_history
count the number of instructions to return
size the size (in local storage) of the buffer which will
receive the data returned when examining the simulator
buffer a pointer to the buffer which will be loaded with the
instruction history returned from the simulator
*/
int
sim_panel_get_history (PANEL *panel,
int count,
size_t size,
char *buffer);
/**
When a front panel application needs to change the media
@ -459,10 +523,12 @@ sim_panel_get_state (PANEL *panel);
/**
All APIs routines which return an int return 0 for
All API routines which return an int return 0 for
success and -1 for an error.
An API which returns an error (-1), will not change the panel state.
An API which returns an error (-1), will not change the panel state
except to possibly set the panel state to Error if the panel
condition is no longer useful.
sim_panel_get_error - the details of the most recent error
sim_panel_clear_error - clears the error buffer
@ -475,22 +541,24 @@ void sim_panel_clear_error (void);
The panek<->simulator wire protocol can be traced if protocol problems arise.
sim_panel_set_debug_file - Specifies the log file to record debug traffic
sim_panel_set_debug_mode - Specifies the debug detail to be recorded
sim_panel_flush_debug - Flushes debug output to disk
sim_panel_debug - Write message to the debug file
*/
void
sim_panel_set_debug_file (PANEL *panel, const char *debug_file);
#define DBG_XMT 1 /* Transmit Data */
#define DBG_RCV 2 /* Receive Data */
#define DBG_REQ 4 /* Request Data */
#define DBG_RSP 8 /* Response Data */
#define DBG_THR 16 /* Thread Activities */
#define DBG_APP 32 /* Application Activities */
void
sim_panel_set_debug_mode (PANEL *panel, int debug_bits);
void
sim_panel_debug (PANEL *panel, const char *fmt, ...);
void
sim_panel_flush_debug (PANEL *panel);

View File

@ -1,6 +1,6 @@
/* sim_serial.c: OS-dependent serial port routines
Copyright (c) 2008, J. David Bryan
Copyright (c) 2008, J. David Bryan, Mark Pizzolato
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@ -27,6 +27,7 @@
UNIX-specific code and testing.
07-Oct-08 JDB [serial] Created file
22-Apr-12 MP Adapted from code originally written by J. David Bryan
This module provides OS-dependent routines to access serial ports on the host
@ -879,8 +880,6 @@ return read; /* return the number of
int32 sim_write_serial (SERHANDLE port, char *buffer, int32 count)
{
if (WaitForSingleObject (port->oWriteReady.hEvent, 0) == WAIT_TIMEOUT)
return 0;
if ((!WriteFile (port->hPort, (LPVOID) buffer, /* write the buffer to the serial port */
(DWORD) count, NULL, &port->oWriteSync)) &&
(GetLastError () != ERROR_IO_PENDING)) {
@ -888,12 +887,6 @@ if ((!WriteFile (port->hPort, (LPVOID) buffer, /* write the buffer to the seri
(int) GetLastError ());
return -1; /* return failure to caller */
}
if ((!WaitCommEvent (port->hPort, &port->dwEvtMask, &port->oWriteReady)) &&
(GetLastError () != ERROR_IO_PENDING)) {
sim_error_serial ("WaitCommEvent", /* function failed; report unexpected error */
(int) GetLastError ());
return -1; /* return failure to caller */
}
return count; /* return number of characters written/queued */
}

View File

@ -1,6 +1,6 @@
/* sim_serial.h: OS-dependent serial port routines header file
Copyright (c) 2008, J. David Bryan
Copyright (c) 2008, J. David Bryan, Mark Pizzolato
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@ -24,6 +24,8 @@
in this Software without prior written authorization from the author.
07-Oct-08 JDB [serial] Created file
22-Apr-12 MP Adapted from code originally written by J. David Bryan
*/

View File

@ -378,8 +378,7 @@ return FALSE;
t_stat sim_tape_set_async (UNIT *uptr, int latency)
{
#if !defined(SIM_ASYNCH_IO)
sim_printf ("Tape: can't operate asynchronously\r\n");
return SCPE_NOFNC;
return sim_messagef (SCPE_NOFNC, "Tape: can't operate asynchronously\r\n");
#else
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
pthread_attr_t attr;

View File

@ -1313,7 +1313,7 @@ t_value stop_time;
if (cptr == NULL)
return SCPE_ARG;
stop_time = get_uint (cptr, 10, 0, &r);
stop_time = get_uint (cptr, 10, T_VALUE_MAX, &r);
if (r != SCPE_OK)
return r;
if (stop_time <= (t_value)sim_gtime())

View File

@ -464,7 +464,7 @@ lp->dstb = 0; /* default bin mode */
lp->rxbpr = lp->rxbpi = lp->rxcnt = lp->rxpcnt = 0; /* init receive indexes */
if (!lp->txbfd || lp->notelnet) /* if not buffered telnet */
lp->txbpr = lp->txbpi = lp->txcnt = lp->txpcnt = 0; /* init transmit indexes */
lp->txdrp = 0;
lp->txdrp = lp->txstall = 0;
tmxr_set_get_modem_bits (lp, 0, 0, NULL);
if ((!lp->mp->buffered) && (!lp->txbfd)) {
lp->txbfd = 0;
@ -532,7 +532,7 @@ if ((!lp->notelnet) || (sim_switches & SWMASK ('V'))) {
if (!mp->buffered) {
lp->txbpi = 0; /* init buf pointers */
lp->txbpr = (int32)(lp->txbsz - strlen (msgbuf));
lp->rxcnt = lp->txcnt = lp->txdrp = 0; /* init counters */
lp->rxcnt = lp->txcnt = lp->txdrp = lp->txstall = 0;/* init counters */
lp->rxpcnt = lp->txpcnt = 0;
}
else
@ -543,11 +543,20 @@ else
psave = lp->txbpi; /* save insertion pointer */
lp->txbpi = lp->txbpr; /* insert connection message */
if ((lp->serport) && (!sim_is_running)) {
sim_os_ms_sleep (TMXR_DTR_DROP_TIME); /* Wait for DTR to be noticed */
lp->ser_connect_pending = FALSE; /* Mark line as ready for action */
lp->conn = TRUE;
}
tmxr_linemsg (lp, msgbuf); /* beginning of buffer */
lp->txbpi = psave; /* restore insertion pointer */
unwritten = tmxr_send_buffered_data (lp); /* send the message */
if ((lp->serport) && (!sim_is_running)) {
lp->ser_connect_pending = TRUE; /* Mark line as not yet ready for action */
lp->conn = FALSE;
}
if (unwritten == 0) /* buffer now empty? */
lp->xmte = 1; /* reenable transmission if paused */
@ -697,11 +706,11 @@ if (lp->loopback)
return loop_write (lp, &(lp->txb[i]), length);
if (lp->serport) { /* serial port connection? */
if (sim_gtime () < lp->txnexttime)
if ((sim_gtime () < lp->txnexttime) && (sim_is_running))
return 0;
written = sim_write_serial (lp->serport, &(lp->txb[i]), length);
if (written > 0)
lp->txnexttime = floor (sim_gtime () + (lp->txdelta * sim_timer_inst_per_sec ()));
if ((written > 0) && (sim_is_running))
lp->txnexttime = floor (sim_gtime () + (written * lp->txdelta * sim_timer_inst_per_sec ()));
return written;
}
else { /* Telnet connection */
@ -1970,7 +1979,8 @@ for (i = 0; i < mp->lines; i++) { /* loop thru lines */
lp->notelnet = FALSE;
tmxr_putc_ln (lp, TN_WONT);
tmxr_putc_ln (lp, tmp);
lp->telnet_sent_opts[tmp] |= TNOS_WONT;/* Record WONT sent */
if (lp->conn) /* Still connected ? */
lp->telnet_sent_opts[tmp] |= TNOS_WONT;/* Record WONT sent */
}
}
case TNS_SKIP: default: /* skip char */
@ -2063,7 +2073,7 @@ if ((lp->txbfd && !lp->notelnet) || (TXBUF_AVAIL(lp) > 1)) {/* room for char (+
}
return SCPE_OK; /* char sent */
}
++lp->txdrp; lp->xmte = 0; /* no room, dsbl line */
++lp->txstall; lp->xmte = 0; /* no room, dsbl line */
return SCPE_STALL; /* char not sent */
}
@ -2394,7 +2404,6 @@ CONST char *tptr = cptr;
t_bool nolog, notelnet, listennotelnet, modem_control, loopback, datagram, packet;
TMLN *lp;
t_stat r = SCPE_OK;
t_bool not_quiet = (!sim_quiet) && (0 == (sim_switches & SWMASK ('Q')));
if (*tptr == '\0')
return SCPE_ARG;
@ -2448,7 +2457,7 @@ while (*tptr) {
if (0 == MATCH_CMD (gbuf, "LOG")) {
if ((NULL == cptr) || ('\0' == *cptr))
return sim_messagef (SCPE_2FARG, "Missing Log Specifier\n");
strncpy(logfiletmpl, cptr, sizeof(logfiletmpl)-1);
strlcpy(logfiletmpl, cptr, sizeof(logfiletmpl));
continue;
}
if (0 == MATCH_CMD (gbuf, "LOOPBACK")) {
@ -2514,14 +2523,14 @@ while (*tptr) {
if (0 == MATCH_CMD (gbuf, "CONNECT")) {
if ((NULL == cptr) || ('\0' == *cptr))
return sim_messagef (SCPE_2FARG, "Missing Connect Specifier\n");
strncpy (destination, cptr, sizeof(destination)-1);
strlcpy (destination, cptr, sizeof(destination));
continue;
}
if (0 == MATCH_CMD (gbuf, "SPEED")) {
if ((NULL == cptr) || ('\0' == *cptr) ||
(_tmln_speed_delta (cptr) < 0))
return sim_messagef (SCPE_ARG, "Invalid Speed Specifier: %s\n", (cptr ? cptr : ""));
strncpy (speed, cptr, sizeof(speed)-1);
strlcpy (speed, cptr, sizeof(speed));
continue;
}
cptr = get_glyph (gbuf, port, ';');
@ -2572,7 +2581,7 @@ while (*tptr) {
char *eptr;
memset (hostport, '\0', sizeof(hostport));
strncpy (hostport, destination, sizeof(hostport)-1);
strlcpy (hostport, destination, sizeof(hostport));
if ((eptr = strchr (hostport, ';')))
*(eptr++) = '\0';
if (eptr) {
@ -2599,16 +2608,17 @@ while (*tptr) {
if (modem_control != mp->modem_control)
return SCPE_ARG;
if (logfiletmpl[0]) {
strncpy(mp->logfiletmpl, logfiletmpl, sizeof(mp->logfiletmpl)-1);
strlcpy(mp->logfiletmpl, logfiletmpl, sizeof(mp->logfiletmpl));
for (i = 0; i < mp->lines; i++) {
lp = mp->ldsc + i;
sim_close_logfile (&lp->txlogref);
lp->txlog = NULL;
lp->txlogname = (char *)realloc(lp->txlogname, CBUFSIZE);
lp->txlogname[CBUFSIZE-1] = '\0';
if (mp->lines > 1)
sprintf(lp->txlogname, "%s_%d", mp->logfiletmpl, i);
snprintf(lp->txlogname, CBUFSIZE-1, "%s_%d", mp->logfiletmpl, i);
else
strcpy (lp->txlogname, mp->logfiletmpl);
strlcpy (lp->txlogname, mp->logfiletmpl, CBUFSIZE);
r = sim_open_logfile (lp->txlogname, TRUE, &lp->txlog, &lp->txlogref);
if (r != SCPE_OK) {
free (lp->txlogname);
@ -2659,8 +2669,7 @@ while (*tptr) {
free (mp->port);
mp->port = NULL;
}
if (not_quiet)
sim_printf ("Listening on port %s\n", listen);
sim_messagef (SCPE_OK, "Listening on port %s\n", listen);
mp->port = (char *)realloc (mp->port, 1 + strlen (listen));
strcpy (mp->port, listen); /* save port */
mp->master = sock; /* save master socket */
@ -2693,8 +2702,7 @@ while (*tptr) {
if (loopback) {
if (mp->lines > 1)
return sim_messagef (SCPE_ARG, "Ambiguous Loopback specification\n");
if (not_quiet)
sim_printf ("Operating in loopback mode\n");
sim_messagef (SCPE_OK, "Operating in loopback mode\n");
for (i = 0; i < mp->lines; i++) {
lp = mp->ldsc + i;
tmxr_set_line_loopback (lp, loopback);
@ -2725,10 +2733,8 @@ while (*tptr) {
if (!lp->mp->modem_control) /* raise DTR and RTS for non modem control lines */
sim_control_serial (lp->serport, TMXR_MDM_DTR|TMXR_MDM_RTS, 0, NULL);
lp->cnms = sim_os_msec (); /* record time of connection */
if (sim_switches & SWMASK ('V')) { /* -V flag reports connection on port */
sim_os_ms_sleep (TMXR_DTR_DROP_TIME);
if (sim_switches & SWMASK ('V')) /* -V flag reports connection on port */
tmxr_report_connection (mp, lp); /* report the connection to the line */
}
}
else {
lp->datagram = datagram;
@ -2812,8 +2818,7 @@ while (*tptr) {
if (sock == INVALID_SOCKET) /* open error */
return sim_messagef (SCPE_OPENERR, "Can't listen on port: %s\n", listen);
_mux_detach_line (lp, TRUE, FALSE);
if (not_quiet)
sim_printf ("Line %d Listening on port %s\n", line, listen);
sim_messagef (SCPE_OK, "Line %d Listening on port %s\n", line, listen);
lp->port = (char *)realloc (lp->port, 1 + strlen (listen));
strcpy (lp->port, listen); /* save port */
lp->master = sock; /* save master socket */
@ -2835,10 +2840,8 @@ while (*tptr) {
if (!lp->mp->modem_control) /* raise DTR and RTS for non modem control lines */
sim_control_serial (lp->serport, TMXR_MDM_DTR|TMXR_MDM_RTS, 0, NULL);
lp->cnms = sim_os_msec (); /* record time of connection */
if (sim_switches & SWMASK ('V')) { /* -V flag reports connection on port */
sim_os_ms_sleep (TMXR_DTR_DROP_TIME);
if (sim_switches & SWMASK ('V')) /* -V flag reports connection on port */
tmxr_report_connection (mp, lp); /* report the connection to the line */
}
}
else {
lp->datagram = datagram;
@ -2871,8 +2874,7 @@ while (*tptr) {
}
if (loopback) {
tmxr_set_line_loopback (lp, loopback);
if (not_quiet)
sim_printf ("Line %d operating in loopback mode\n", line);
sim_messagef (SCPE_OK, "Line %d operating in loopback mode\n", line);
}
lp->modem_control = modem_control;
if (speed[0] && (!datagram) && (!lp->serport))
@ -3624,7 +3626,7 @@ for (i=0; i<tmxr_open_device_count; ++i)
if (tmxr_open_devices[i]->lines > 1)
snprintf (line_name, sizeof (line_name), "%s:%d", tmxr_open_devices[i]->ldsc[j].send.dptr->name, j);
else
strncpy (line_name, tmxr_open_devices[i]->ldsc[j].send.dptr->name, sizeof (line_name));
strlcpy (line_name, tmxr_open_devices[i]->ldsc[j].send.dptr->name, sizeof (line_name));
break;
}
return line_name;
@ -3665,6 +3667,9 @@ t_stat tmxr_attach_ex (TMXR *mp, UNIT *uptr, CONST char *cptr, t_bool async)
t_stat r;
int32 i;
if (mp->dptr == NULL) /* has device been set? */
mp->dptr = find_dev_from_unit (uptr); /* no, so set device now */
r = tmxr_open_master (mp, cptr); /* open master socket */
if (r != SCPE_OK) /* error? */
return r;
@ -3685,9 +3690,6 @@ if (!async || (uptr->flags & TMUF_NOASYNCH)) /* if asynch disabled */
uptr->dynflags |= TMUF_NOASYNCH; /* tag as no asynch */
#endif
if (mp->dptr == NULL) /* has device been set? */
mp->dptr = find_dev_from_unit (uptr); /* no, so set device now */
if (mp->dptr) {
for (i=0; i<mp->lines; i++) {
mp->ldsc[i].expect.dptr = mp->dptr;
@ -4404,6 +4406,8 @@ if (lp->txcnt || lp->txbpi)
((lp->txcnt > 0) && (lp->txcnt > lp->txbsz)) ? lp->txbsz : lp->txbpi);
if (lp->txdrp)
fprintf (st, " dropped = %d\n", lp->txdrp);
if (lp->txstall)
fprintf (st, " stalled = %d\n", lp->txstall);
return;
}
@ -4453,7 +4457,9 @@ if (lp == NULL) /* bad line numb
if ((lp->sock) || (lp->serport)) { /* connection active? */
if (!lp->notelnet)
tmxr_linemsg (lp, "\r\nOperator disconnected line\r\n\n");/* report closure */
tmxr_reset_ln_ex (lp, (sim_switches & SWMASK ('C'))); /* drop the line */
if (lp->serport && (sim_switches & SWMASK ('C')))
return tmxr_detach_ln (lp);
return tmxr_reset_ln_ex (lp, FALSE); /* drop the line */
}
return SCPE_OK;
@ -4477,7 +4483,7 @@ if (lp->txlog) /* close existing log */
lp->txlogname = (char *) calloc (CBUFSIZE, sizeof (char)); /* alloc namebuf */
if (lp->txlogname == NULL) /* can't? */
return SCPE_MEM;
strncpy (lp->txlogname, cptr, CBUFSIZE); /* save file name */
strlcpy (lp->txlogname, cptr, CBUFSIZE); /* save file name */
sim_open_logfile (cptr, TRUE, &lp->txlog, &lp->txlogref);/* open log */
if (lp->txlog == NULL) { /* error? */
free (lp->txlogname); /* free buffer */

View File

@ -153,6 +153,7 @@ struct tmln {
int32 txcnt; /* xmt count */
int32 txpcnt; /* xmt packet count */
int32 txdrp; /* xmt drop count */
int32 txstall; /* xmt stall count */
int32 txbsz; /* xmt buffer size */
int32 txbfd; /* xmt buffered flag */
t_bool modem_control; /* line supports modem control behaviors */