mirror of
https://github.com/andrew-jacobs/emu816.git
synced 2024-12-22 09:29:21 +00:00
Added S19 and updated to VS2017
This commit is contained in:
parent
4e7f0d73a1
commit
998b7a35cf
@ -1,5 +1,5 @@
|
||||
<?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">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@ -22,32 +22,32 @@
|
||||
<ProjectGuid>{49047D22-8F3C-48BB-B93A-36CC9981114E}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>emu816</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
@ -8,4 +8,8 @@
|
||||
<LocalDebuggerCommandArguments>examples/simple/simple.s28</LocalDebuggerCommandArguments>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerCommandArguments>examples\simple\simple.s28</LocalDebuggerCommandArguments>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
45
program.cc
45
program.cc
@ -27,7 +27,7 @@ using namespace std;
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include "Windows.h"
|
||||
#else
|
||||
#include <time.h>
|
||||
@ -60,7 +60,7 @@ INLINE void loop()
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// S28 Record Loader
|
||||
// S19/28 Record Loader
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
unsigned int toNybble(char ch)
|
||||
@ -79,6 +79,14 @@ unsigned int toByte(string &str, int &offset)
|
||||
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 h = toByte(str, offset) << 16;
|
||||
@ -88,10 +96,6 @@ unsigned long toAddr(string &str, int &offset)
|
||||
return (h | m | l);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Command Handler
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void load(char *filename)
|
||||
{
|
||||
ifstream file(filename);
|
||||
@ -102,13 +106,24 @@ void load(char *filename)
|
||||
|
||||
while (!file.eof()) {
|
||||
file >> line;
|
||||
if ((line[0] == 'S') && (line[1] == '2')) {
|
||||
if (line[0] == 'S') {
|
||||
int offset = 2;
|
||||
unsigned int count = toByte(line, offset);
|
||||
unsigned long addr = toAddr(line, offset);
|
||||
count -= 4;
|
||||
while (count-- > 0) {
|
||||
emu816::setByte(addr++, toByte(line, offset));
|
||||
|
||||
if (line[1] == '1') {
|
||||
unsigned int count = toByte(line, offset);
|
||||
unsigned long addr = toWord(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 index = 1;
|
||||
@ -135,7 +154,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (!strcmp(argv[index], "-?")) {
|
||||
cerr << "Usage: emu816 [-t] s28-file ..." << endl;
|
||||
cerr << "Usage: emu816 [-t] s19/28-file ..." << endl;
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user