- Treballant en que funcione al temps correcte

- Treballant en el só
This commit is contained in:
2024-12-01 21:50:20 +01:00
parent 7eb5df248f
commit 7cb6ae527b
2 changed files with 51 additions and 6 deletions

View File

@@ -10,6 +10,8 @@
#include <string.h>
uint8_t memory[65536];
uint32_t time = 0;
uint32_t t_states = 0;
int main(int argc, char *argv[])
{
@@ -26,13 +28,16 @@ int main(int argc, char *argv[])
zx_ula::sound_init();
zx_tape::load("manic.tap");
zx_tape::load("abusimbel.tap");
if (argc==3) { z80debug::loadngo(argv[1], argv[2]); }
bool should_exit = false;
SDL_Event e;
time = SDL_GetTicks();
t_states = 0;
while (!should_exit)
{
while (SDL_PollEvent(&e))
@@ -83,16 +88,25 @@ int main(int argc, char *argv[])
}
}
}
if (!z80debug::debugging()) {
if (z80debug::isbreak(z80::getPC(), 9)) {
z80debug::stop();
zxscreen::redraw();
} else {
if (z80::getPC()==0x05C8) zx_tape::go_berserk();
//if (z80::getPC()==0x05C8) zx_tape::go_berserk();
uint8_t dt = z80::step();
t_states += dt;
zx_tape::update(dt);
zx_ula::sound_update(dt);
zxscreen::refresh(dt);
if (t_states>=350000)
{
while (SDL_GetTicks()<time+100) {}
t_states -= 350000;
time = SDL_GetTicks();
}
}
}
}