2010-12-28 06:03:02 +00:00
|
|
|
//4194304hz (4 * 1024 * 1024)
|
|
|
|
//70224 clocks/frame
|
|
|
|
// 456 clocks/scanline
|
|
|
|
// 154 scanlines/frame
|
|
|
|
|
|
|
|
#ifdef CPU_CPP
|
|
|
|
|
|
|
|
#include "opcode.cpp"
|
|
|
|
|
|
|
|
void CPU::add_clocks(unsigned clocks) {
|
|
|
|
clock += clocks;
|
|
|
|
|
|
|
|
if(clock >= 456) scanline();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CPU::scanline() {
|
|
|
|
clock -= 456;
|
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
lcd.status.ly++;
|
|
|
|
if(lcd.status.ly >= 154) frame();
|
2010-12-28 06:03:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CPU::frame() {
|
2010-12-29 11:03:42 +00:00
|
|
|
lcd.status.ly -= 154;
|
2010-12-28 06:03:02 +00:00
|
|
|
scheduler.exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|