MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / CpuSetupBenchmark

Function CpuSetupBenchmark

source/CPU.cpp:822–854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

820//===========================================================================
821
822void CpuSetupBenchmark()
823{
824 regs.a = 0;
825 regs.x = 0;
826 regs.y = 0;
827 regs.pc = 0x300;
828 regs.sp = 0x1FF;
829
830 // CREATE CODE SEGMENTS CONSISTING OF GROUPS OF COMMONLY-USED OPCODES
831 {
832 int addr = 0x300;
833 int opcode = 0;
834 do
835 {
836 WriteByteToMemory(addr++, benchopcode[opcode]);
837 WriteByteToMemory(addr++, benchopcode[opcode]);
838
839 if (opcode >= SHORTOPCODES)
840 WriteByteToMemory(addr++, 0);
841
842 if ((++opcode >= BENCHOPCODES) || ((addr & 0x0F) >= 0x0B))
843 {
844 WriteByteToMemory(addr++, 0x4C);
845 // split into 2 lines to avoid -Wunsequenced and undefined behaviour
846 const BYTE value = (opcode >= BENCHOPCODES) ? 0x00 : ((addr >> 4)+1) << 4;
847 WriteByteToMemory(addr++, value);
848 WriteByteToMemory(addr++, 0x03);
849 while (addr & 0x0F)
850 ++addr;
851 }
852 } while (opcode < BENCHOPCODES);
853 }
854}
855
856//===========================================================================
857

Callers 2

CmdBenchmarkStartFunction · 0.85
BenchmarkMethod · 0.85

Calls 1

WriteByteToMemoryFunction · 0.85

Tested by

no test coverage detected