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 1 commit
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
Prev Previous commit
Next Next commit
Add mouse expansion port option
  • Loading branch information
sam-astro committed Aug 25, 2022
commit e73efa34c6f749f10f8438d2e1836ffae5824e8c
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.
41 changes: 30 additions & 11 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
usingKeyboard = false;
}
cout << to_string(compileOnly) << " " << to_string(assembleOnly) << " " << to_string(runAstroExecutable) << " " << endl;

Expand Down Expand Up @@ -562,17 +566,32 @@ 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 << " expansionPort: " << (int)(event.key.keysym.scancode) << endl;
// Keyboard support
expansionPort = 168; // Keyboard idle state is 168 (max value), since 0 is reserved for space
}
}
else if (event.type == SDL_KEYUP) {
// If using the mouse in the expansion port
else if (!usingKeyboard) {
if (event.type == SDL_MOUSEMOTION) {

// Keyboard support
expansionPort = 168; // Keyboard idle state is 168 (max value), since 0 is reserved for space
// Mouse support
//if(event.motion.x)
expansionPort = (event.motion.x << 8) + event.motion.y;

cout << "\n" << (int)(event.motion.x) << " " << (int)(event.motion.y);
cout << "\n" << expansionPort;
}
}
}
}
Expand Down Expand Up @@ -1101,7 +1120,7 @@ vector<std::string> parseCode(const std::string& input)
myStream << processedOutput;

return outputBytes;
}
}

void ComputeStepInstructions(const std::string& stepContents, char* stepComputedInstruction) {

Expand Down Expand Up @@ -1264,7 +1283,7 @@ void GenerateMicrocode()
}
}

}
}

// Do actual processing
#if DEV_MODE
Expand Down Expand Up @@ -1339,7 +1358,7 @@ void GenerateMicrocode()
output[BinToDec(startaddress + midaddress + charToString(newendaddress))] = BinToHexFilled(stepComputedInstruction, 5);
}
}
}
}

// Print the output
std::string processedOutput = "";
Expand Down Expand Up @@ -1370,7 +1389,7 @@ void GenerateMicrocode()
fstream myStream;
myStream.open("./microinstructions_cpu", ios::out);
myStream << processedOutput;
}
}

vector<string> vars;
vector<string> labels;
Expand Down
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.
28 changes: 25 additions & 3 deletions Astro8-Emulator/x64/Release/Astro8-Emulator.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
 Generating code
10 of 1088 functions ( 0.9%) were compiled, the rest were copied from previous compilation.
 main.cpp
D:\Code\Astro8-Computer\Astro8-Emulator\processing.h(71,30): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\processing.h(134,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\processing.h(135,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\processing.h(136,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
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(296,24): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(536,24): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(631,24): warning C5051: attribute 'likely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(649,10): warning C4244: '=': conversion from 'uint64_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(661,32): warning C5051: attribute 'unlikely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(792,5): warning C5051: attribute 'likely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(821,32): warning C5051: attribute 'unlikely' requires at least '/std:c++20'; ignored
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(935,45): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(935,32): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1218,42): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1549,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1552,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1555,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1760,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.
0 functions were new in current compilation
5 functions had inline decision re-evaluated but remain unchanged
0 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 not shown.
Binary file modified Astro8-Emulator/x64/Release/main.obj
Binary file not shown.
Loading