From 998b7a35cf0c4d9d172e343bcb38a593e294c8da Mon Sep 17 00:00:00 2001 From: Andrew Jacobs Date: Thu, 26 Apr 2018 17:11:44 +0100 Subject: [PATCH] Added S19 and updated to VS2017 --- emu816.vcxproj | 12 ++++++------ emu816.vcxproj.user | 4 ++++ program.cc | 45 ++++++++++++++++++++++++++++++++------------- 3 files changed, 42 insertions(+), 19 deletions(-) diff --git a/emu816.vcxproj b/emu816.vcxproj index 0032bb9..ad316e1 100644 --- a/emu816.vcxproj +++ b/emu816.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -22,32 +22,32 @@ {49047D22-8F3C-48BB-B93A-36CC9981114E} Win32Proj emu816 - 8.1 + 10.0.16299.0 Application true - v140 + v141 Unicode Application false - v140 + v141 true Unicode Application true - v140 + v141 Unicode Application false - v140 + v141 true Unicode diff --git a/emu816.vcxproj.user b/emu816.vcxproj.user index 7c95a27..cb5077d 100644 --- a/emu816.vcxproj.user +++ b/emu816.vcxproj.user @@ -8,4 +8,8 @@ examples/simple/simple.s28 WindowsLocalDebugger + + examples\simple\simple.s28 + WindowsLocalDebugger + \ No newline at end of file diff --git a/program.cc b/program.cc index 842719b..daf6702 100644 --- a/program.cc +++ b/program.cc @@ -27,7 +27,7 @@ using namespace std; #include -#ifdef WIN32 +#if defined(_WIN32) || defined (_WIN64) #include "Windows.h" #else #include @@ -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); }