Skip to content

Commit 1fdc2c8

Browse files
committed
Optimizations
1 parent a761c97 commit 1fdc2c8

17 files changed

+1178
-119
lines changed
Binary file not shown.
Binary file not shown.

Astro8-Emulator/main.cpp

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ int pixelRamIndex = 0xefff;
5454
#define TARGET_CPU_FREQ 10000000
5555
#define TARGET_RENDER_FPS 60.0
5656

57-
uint64_t iterations = 0;
58-
5957
static vector<int> memoryBytes;
6058
static vector<int> charRam;
6159

@@ -473,14 +471,12 @@ static void Update()
473471
{
474472
// CR
475473
// AW
476-
memoryIndex = programCounter;
477474
// RM
478475
// IW
479-
InstructionReg = memoryBytes[memoryIndex];
476+
InstructionReg = memoryBytes[programCounter];
480477
// CE
481-
programCounter = programCounter + 1;
482-
step = 1;
483-
continue;
478+
programCounter += 1;
479+
step = 2;
484480
}
485481

486482
// Address in microcode ROM
@@ -490,9 +486,8 @@ static void Update()
490486

491487
// Check for any reads and execute if applicable
492488
MicroInstruction readInstr = mcode & READ_MASK;
493-
switch (readInstr)
489+
switch (readInstr)[[likely]]
494490
{
495-
[[likely]] default: break;
496491
case READ_RA:
497492
bus = AReg;
498493
break;
@@ -620,23 +615,11 @@ static void Update()
620615
{
621616
programCounter++;
622617
}
623-
if (mcode & STANDALONE_ST) [[unlikely]]
624-
{
625-
cout << ("\n== PAUSED from HLT ==\n\n");
626-
cout << ("FINAL VALUES |= A: " + to_string(AReg) + " B: " + to_string(BReg) + " C: " + to_string(CReg) + " bus: " + to_string(bus) + " Ins: " + to_string(InstructionReg) + " img:(" + to_string(imgX) + ", " + to_string(imgY) + ")\n");
627-
cout << "\n\nPress Enter to Exit...";
628-
cin.ignore();
629-
exit(1);
630-
}
631618
if (mcode & STANDALONE_EI)
632619
{
633620
break;
634621
}
635622
}
636-
637-
iterations += 1;
638-
if (iterations >= 0xFFFFFFFF)
639-
iterations = 1;
640623
}
641624

642625
static void DrawNextPixel() {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.ipdb
2+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.iobj
3+
d:\code\astro8-computer\astro8-emulator\x64\release\vc143.pdb
4+
d:\code\astro8-computer\astro8-emulator\x64\release\main.obj
5+
d:\code\astro8-computer\astro8-emulator\x64\release\char_set_memtape
6+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.exe
7+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.pdb
8+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\astro8-emulator.write.1u.tlog
9+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\cl.command.1.tlog
10+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\cl.read.1.tlog
11+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\cl.write.1.tlog
12+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\copyfile.command.1.tlog
13+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\copyfile.read.1.tlog
14+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\copyfile.write.1.tlog
15+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\link.command.1.tlog
16+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\link.read.1.tlog
17+
d:\code\astro8-computer\astro8-emulator\x64\release\astro8-emulator.tlog\link.write.1.tlog
-2.5 KB
Binary file not shown.
-62.4 KB
Binary file not shown.
-40.7 KB
Binary file not shown.
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
 main.cpp
22
D:\Code\Astro8-Computer\Astro8-Emulator\colorprint.h(89,30): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
3-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(411,24): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
4-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(745,45): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
5-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(745,32): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
6-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(845,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
7-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(846,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
8-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(847,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
9-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(848,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
10-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(849,29): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
11-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(850,29): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
12-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(954,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
13-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(957,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
14-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(960,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
15-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1203,32): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
16-
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(2120,42): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
3+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(409,24): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
4+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(489,23): warning C5051: attribute 'likely' requires at least '/std:c++20'; ignored
5+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(507,10): warning C4244: '=': conversion from 'uint64_t' to 'int', possible loss of data
6+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(519,32): warning C5051: attribute 'unlikely' requires at least '/std:c++20'; ignored
7+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(585,5): warning C5051: attribute 'likely' requires at least '/std:c++20'; ignored
8+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(614,32): warning C5051: attribute 'unlikely' requires at least '/std:c++20'; ignored
9+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(727,45): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
10+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(727,32): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
11+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(827,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
12+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(828,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
13+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(829,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
14+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(830,30): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
15+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(831,29): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
16+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(832,29): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
17+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(936,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
18+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(939,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
19+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(942,28): warning C4244: '+=': conversion from 'double' to 'unsigned long', possible loss of data
20+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(1185,32): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
21+
D:\Code\Astro8-Computer\Astro8-Emulator\main.cpp(2100,42): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
1722
Generating code
18-
1 of 1114 functions (<0.1%) were compiled, the rest were copied from previous compilation.
23+
1 of 1068 functions (<0.1%) were compiled, the rest were copied from previous compilation.
1924
0 functions were new in current compilation
20-
3 functions had inline decision re-evaluated but remain unchanged
25+
0 functions had inline decision re-evaluated but remain unchanged
2126
Finished generating code
2227
Astro8-Emulator.vcxproj -> D:\Code\Astro8-Computer\Astro8-Emulator\x64\Release\Astro8-Emulator.exe
-104 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)