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
Next Next commit
Fix un-addressable memory with set/define, and you can now use `=…
…` with `define`
  • Loading branch information
sam-astro committed Aug 24, 2022
commit 7594fee20cb40bc7ff42e3d58f0aa9313adb84db
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.
12 changes: 6 additions & 6 deletions Astro8-Emulator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,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 +1020,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 @@ -1983,8 +1983,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 +2002,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
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.
4 changes: 2 additions & 2 deletions Astro8-Emulator/x64/Release/Astro8-Emulator.log
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1535,28): warning C4244: '+=':
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
Generating code
1 of 1088 functions (<0.1%) were compiled, the rest were copied from previous compilation.
2 of 1088 functions ( 0.2%) 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
20 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