本文整理汇总了C++中CPU::cycle方法的典型用法代码示例。如果您正苦于以下问题:C++ CPU::cycle方法的具体用法?C++ CPU::cycle怎么用?C++ CPU::cycle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPU
的用法示例。
在下文中一共展示了CPU::cycle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Graphics::ratioSize = 2.0f;
//Log::typeMin = Log::ALL & (~Log::DEBUG);
Log::typeMin = Log::ALL;
Log::exitOnWarning = true;
//Log::exitOnError = false;
sf::RenderWindow window(sf::VideoMode(GRAPHIC_WIDTH*Graphics::ratioSize, GRAPHIC_WIDTH*Graphics::ratioSize), "Emul - MasterSystem");
Inputs *inputs = Inputs::instance();
Cartridge *rom = Cartridge::instance();
Memory *mem = Memory::instance();
//Graphics g(&mem, &window);
Graphics *g = Graphics::instance();
g->setWindow(&window);
//CPU cpu(&mem, &g, &rom);
CPU *cpu = CPU::instance();
//rom.readFromFile("ROMS/Sonic the Hedgehog.sms");
//rom.readFromFile("ROMS/zexall.sms");
/*for(int i = 0 ; i < 260 ; i++)
cout << hex << i << " : " << getOpcodeName(i) << endl;*/
//sf::sleep(sf::Time(20));
// Fast implementation of breakpoints
vector<int16_t> breakpoints;
bool toPause;
while (window.isOpen())
{
inputs->captureEvents(&window);
window.clear(sf::Color::Black);
toPause = false;
for(int i = 0 ; i < breakpoints.size() && !systemPaused ; i++) {
if(cpu->getProgramCounter() == breakpoints[i]) {
#if BREAKPOINT_STYLE == 0
systemPaused = true;
#elif BREAKPOINT_STYLE == 1
toPause = true;
#endif // BREAKPOINT_STYLE
breakpoints.erase(breakpoints.begin()+i);
}
}
/*if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space))
systemStepCalled = true;*/
if(!systemPaused)
cpu->cycle();
g->draw();
if(toPause)
systemPaused = true;
window.display();
}
return 0;
}