Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements and bug fixes #47

Merged
merged 7 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Astro8-Emulator/.vs/Astro8-Emulator/v17/.suo
Binary file not shown.
Binary file modified Astro8-Emulator/.vs/Astro8-Emulator/v17/Preview/Browse.VC.db
Binary file not shown.
Binary file added Astro8-Emulator/Astro8-Emulator.aps
Binary file not shown.
71 changes: 71 additions & 0 deletions Astro8-Emulator/Astro8-Emulator.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "icon.ico"

#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

7 changes: 7 additions & 0 deletions Astro8-Emulator/Astro8-Emulator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<ClInclude Include="color.hpp" />
<ClInclude Include="colorprint.h" />
<ClInclude Include="processing.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="..\char_set_memtape">
Expand All @@ -158,6 +159,12 @@
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Astro8-Emulator.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="icon.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
13 changes: 13 additions & 0 deletions Astro8-Emulator/Astro8-Emulator.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,21 @@
<ClInclude Include="assembler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="..\char_set_memtape" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Astro8-Emulator.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="icon.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>
Binary file added Astro8-Emulator/icon.ico
Binary file not shown.
43 changes: 28 additions & 15 deletions Astro8-Emulator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ using namespace std;

bool compileOnly, assembleOnly, runAstroExecutable;

bool usingKeyboard = true;


int AReg = 0;
int BReg = 0;
Expand Down Expand Up @@ -335,6 +337,8 @@ int main(int argc, char** argv)
assembleOnly = true;
else if (argval == "-r" || argval == "--run") // Run an already assembled program in AstroEXE format
runAstroExecutable = true;
else if (argval == "-nk" || argval == "--nokeyboard") // Use the mouse mode for the emulator (disables keyboard input)
usingKeyboard = false;
}
cout << to_string(compileOnly) << " " << to_string(assembleOnly) << " " << to_string(runAstroExecutable) << " " << endl;

Expand Down Expand Up @@ -562,18 +566,26 @@ int main(int argc, char** argv)
{
running = false;
}
else if (event.type == SDL_KEYDOWN) {
// If using the keyboard in the expansion port
if (usingKeyboard) {
if (event.type == SDL_KEYDOWN) {

// Keyboard support
expansionPort = ConvertAsciiToSdcii((int)(event.key.keysym.scancode));
// Keyboard support
expansionPort = ConvertAsciiToSdcii((int)(event.key.keysym.scancode));

cout << " expansionPort: " << (int)(event.key.keysym.scancode) << endl;
}
else if (event.type == SDL_KEYUP) {
cout << "\n expansionPort: " << expansionPort << endl;
}
else if (event.type == SDL_KEYUP) {

// Keyboard support
expansionPort = 168; // Keyboard idle state is 168 (max value), since 0 is reserved for space
// Keyboard support
expansionPort = 168; // Keyboard idle state is 168 (max value), since 0 is reserved for space
}
}
// If using the mouse in the expansion port
else if (!usingKeyboard)
if (event.type == SDL_MOUSEMOTION)
// Mouse support
expansionPort = (event.motion.x << 8) + event.motion.y;
}
}
}
Expand Down Expand Up @@ -796,6 +808,7 @@ void Update()
break;
case WRITE_WE:
expansionPort = bus;
PrintColored("\nProgram expansion port output: "+to_string(expansionPort)+"\n", brightBlueFGColor, "");
break;
}

Expand Down Expand Up @@ -1005,7 +1018,7 @@ vector<std::string> parseCode(const std::string& input)
{
int addr = stoi(splitBySpace[1]);
std::string hVal = DecToHexFilled(stoi(splitBySpace[2]), 4);
if (addr <= 16382)
if (addr <= 16382 || addr > 16527)
outputBytes[addr] = hVal;
else
charRam[clamp(addr - 16383, 0, 143)] = stoi(splitBySpace[2]);
Expand All @@ -1020,7 +1033,7 @@ vector<std::string> parseCode(const std::string& input)
{
int addr = memaddr;
std::string hVal = DecToHexFilled(stoi(splitBySpace[1]), 4);
if (addr <= 16382)
if (addr <= 16382 || addr > 16527)
outputBytes[addr] = hVal;
else
charRam[clamp(addr - 16383, 0, 143)] = stoi(splitBySpace[1]);
Expand Down Expand Up @@ -1578,7 +1591,7 @@ bool IsPointer(const string& in) {
return false;
}
bool IsDec(const string& in) {
if (!IsHex(in) && !IsBin(in) && !IsReg(in) && !IsVar(in) && !IsLabel(in) && !IsPointer(in))
if (!IsHex(in) && !IsReg(in) && !IsVar(in) && !IsLabel(in) && !IsPointer(in))
return true;
return false;
}
Expand Down Expand Up @@ -1983,8 +1996,8 @@ string CompileCode(const string& inputcode) {
// "set" command (set <addr> <value>)
if (command == "define")
{
string addrPre = trim(split(codelines[i], " ")[1]);
string valuePre = trim(split(codelines[i], " ")[2]);
string addrPre = split(trim(split(split(codelines[i], "define ")[1], "=")[0]), " ")[0];
string valuePre = split(trim(split(split(codelines[i], "define ")[1], "=")[1]), " ")[0];
PrintColored("ok. ", greenFGColor, "");
cout << "define: ";
PrintColored("'" + addrPre + "'", brightBlueFGColor, "");
Expand All @@ -2002,8 +2015,8 @@ string CompileCode(const string& inputcode) {
// "change" command (change <location> = <value or location>)
else if (command == "change")
{
string addrPre = trim(split(split(codelines[i], "change ")[1], " = ")[0]);
string valuePre = trim(split(split(codelines[i], "change ")[1], " = ")[1]);
string addrPre = trim(split(split(codelines[i], "change ")[1], "=")[0]);
string valuePre = trim(split(split(codelines[i], "change ")[1], "=")[1]);
PrintColored("ok. ", greenFGColor, "");
cout << "change: ";
PrintColored("'" + addrPre + "'", brightBlueFGColor, "");
Expand Down
16 changes: 16 additions & 0 deletions Astro8-Emulator/resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Astro8-Emulator.rc
//
#define IDI_ICON1 101

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Binary file modified Astro8-Emulator/x64/Release/Astro8-Emulator.exe
Binary file not shown.
Binary file modified Astro8-Emulator/x64/Release/Astro8-Emulator.iobj
Binary file not shown.
Binary file modified Astro8-Emulator/x64/Release/Astro8-Emulator.ipdb
Binary file not shown.
32 changes: 16 additions & 16 deletions Astro8-Emulator/x64/Release/Astro8-Emulator.log
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ D:\Code\Astro8-Computer\Astro8-Emulator\processing.h(136,30): warning C4267: '='
D:\Code\Astro8-Computer\Astro8-Emulator\processing.h(137,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\processing.h(138,29): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\processing.h(139,29): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(294,24): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(534,24): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(614,24): warning C5051: attribute 'likely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(632,10): warning C4244: '=': conversion from 'uint64_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(644,32): warning C5051: attribute 'unlikely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(775,5): warning C5051: attribute 'likely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(804,32): warning C5051: attribute 'unlikely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(918,45): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(918,32): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1201,42): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1532,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1535,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1538,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1743,32): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(296,24): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(538,24): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(626,24): warning C5051: attribute 'likely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(644,10): warning C4244: '=': conversion from 'uint64_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(656,32): warning C5051: attribute 'unlikely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(787,5): warning C5051: attribute 'likely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(817,32): warning C5051: attribute 'unlikely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(931,45): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(931,32): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1214,42): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1545,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1548,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1551,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1756,32): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
Generating code
1 of 1088 functions (<0.1%) were compiled, the rest were copied from previous compilation.
3 of 1088 functions ( 0.3%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
0 functions had inline decision re-evaluated but remain unchanged
6 functions had inline decision re-evaluated but remain unchanged
Finished generating code
Astro8-Emulator.vcxproj -> D:\Code\Astro8-Computer\Astro8-Emulator\x64\Release\Astro8-Emulator.exe
Binary file modified Astro8-Emulator/x64/Release/Astro8-Emulator.pdb
Binary file not shown.
Binary file added Astro8-Emulator/x64/Release/Astro8-Emulator.res
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Astro8-Emulator/x64/Release/Astro8-Emulator.tlog/link.read.1.tlog
Binary file not shown.
Binary file modified Astro8-Emulator/x64/Release/Astro8-Emulator.tlog/link.write.1.tlog
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion Astro8-Emulator/x64/Release/char_set_memtape

Large diffs are not rendered by default.

Binary file modified Astro8-Emulator/x64/Release/main.obj
Binary file not shown.
Loading