beginning ppu
This commit is contained in:
21
lib/emu.c
21
lib/emu.c
@ -3,6 +3,9 @@
|
||||
#include <cart.h>
|
||||
#include <cpu.h>
|
||||
#include <ui.h>
|
||||
#include <timer.h>
|
||||
#include <dma.h>
|
||||
#include <ppu.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
@ -19,6 +22,8 @@ emu_context *emu_get_context() {
|
||||
}
|
||||
|
||||
DWORD WINAPI cpu_run(void *p) {
|
||||
ppu_init();
|
||||
timer_init();
|
||||
cpu_init();
|
||||
|
||||
ctx.running = true;
|
||||
@ -36,7 +41,6 @@ DWORD WINAPI cpu_run(void *p) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
ctx.ticks++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -80,9 +84,15 @@ int emu_run(int argc, char **argv) {
|
||||
}
|
||||
#endif
|
||||
|
||||
u32 prev_frame = 0;
|
||||
|
||||
while(!ctx.die) {
|
||||
sleep_ms(1);
|
||||
ui_handle_events();
|
||||
if (prev_frame != ppu_get_context()->current_frame) {
|
||||
ui_update();
|
||||
}
|
||||
prev_frame = ppu_get_context()->current_frame;
|
||||
}
|
||||
|
||||
|
||||
@ -90,5 +100,12 @@ int emu_run(int argc, char **argv) {
|
||||
}
|
||||
|
||||
void emu_cycles(int cpu_cycles) {
|
||||
//TODO
|
||||
for (int i = 0; i < cpu_cycles; i++){
|
||||
for(int n = 0; n < 4; n++){
|
||||
ctx.ticks++;
|
||||
timer_tick();
|
||||
ppu_tick();
|
||||
}
|
||||
dma_tick();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user