Added S19 and updated to VS2017

This commit is contained in:
Andrew Jacobs 2018-04-26 17:11:44 +01:00
parent 4e7f0d73a1
commit 998b7a35cf
3 changed files with 42 additions and 19 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@ -22,32 +22,32 @@
<ProjectGuid>{49047D22-8F3C-48BB-B93A-36CC9981114E}</ProjectGuid> <ProjectGuid>{49047D22-8F3C-48BB-B93A-36CC9981114E}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>emu816</RootNamespace> <RootNamespace>emu816</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View File

@ -8,4 +8,8 @@
<LocalDebuggerCommandArguments>examples/simple/simple.s28</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>examples/simple/simple.s28</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>examples\simple\simple.s28</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project> </Project>

View File

@ -27,7 +27,7 @@ using namespace std;
#include <string.h> #include <string.h>
#ifdef WIN32 #if defined(_WIN32) || defined (_WIN64)
#include "Windows.h" #include "Windows.h"
#else #else
#include <time.h> #include <time.h>
@ -60,7 +60,7 @@ INLINE void loop()
} }
//============================================================================== //==============================================================================
// S28 Record Loader // S19/28 Record Loader
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
unsigned int toNybble(char ch) unsigned int toNybble(char ch)
@ -79,6 +79,14 @@ unsigned int toByte(string &str, int &offset)
return (h | l); return (h | l);
} }
unsigned int toWord(string &str, int &offset)
{
unsigned int h = toByte(str, offset) << 8;
unsigned int l = toByte(str, offset);
return (h | l);
}
unsigned long toAddr(string &str, int &offset) unsigned long toAddr(string &str, int &offset)
{ {
unsigned long h = toByte(str, offset) << 16; unsigned long h = toByte(str, offset) << 16;
@ -88,10 +96,6 @@ unsigned long toAddr(string &str, int &offset)
return (h | m | l); return (h | m | l);
} }
//==============================================================================
// Command Handler
//------------------------------------------------------------------------------
void load(char *filename) void load(char *filename)
{ {
ifstream file(filename); ifstream file(filename);
@ -102,13 +106,24 @@ void load(char *filename)
while (!file.eof()) { while (!file.eof()) {
file >> line; file >> line;
if ((line[0] == 'S') && (line[1] == '2')) { if (line[0] == 'S') {
int offset = 2; int offset = 2;
unsigned int count = toByte(line, offset);
unsigned long addr = toAddr(line, offset); if (line[1] == '1') {
count -= 4; unsigned int count = toByte(line, offset);
while (count-- > 0) { unsigned long addr = toWord(line, offset);
emu816::setByte(addr++, toByte(line, offset)); count -= 3;
while (count-- > 0) {
emu816::setByte(addr++, toByte(line, offset));
}
}
else if (line[1] == '2') {
unsigned int count = toByte(line, offset);
unsigned long addr = toAddr(line, offset);
count -= 4;
while (count-- > 0) {
emu816::setByte(addr++, toByte(line, offset));
}
} }
} }
} }
@ -119,6 +134,10 @@ void load(char *filename)
} }
//==============================================================================
// Command Handler
//------------------------------------------------------------------------------
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int index = 1; int index = 1;
@ -135,7 +154,7 @@ int main(int argc, char **argv)
} }
if (!strcmp(argv[index], "-?")) { if (!strcmp(argv[index], "-?")) {
cerr << "Usage: emu816 [-t] s28-file ..." << endl; cerr << "Usage: emu816 [-t] s19/28-file ..." << endl;
return (1); return (1);
} }