- Deixe el Abu Simbel ací per a anar fent proves de càrrega
- [NEW] Mòdul zx_tape, encara no carrega correctament les cintes. - [CHG] Gestió completa del só pasada a la ULA, i de la pantalla a zxscreen
This commit is contained in:
63
main.cpp
63
main.cpp
@@ -5,18 +5,11 @@
|
||||
#include "z80debug.h"
|
||||
#include "zx_ula.h"
|
||||
#include "zx_screen.h"
|
||||
#include "zx_tape.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <string.h>
|
||||
|
||||
uint8_t memory[65536];
|
||||
uint32_t t = 0;
|
||||
uint16_t ts = 0;
|
||||
uint8_t ft = 0;
|
||||
uint32_t fps=0;
|
||||
uint32_t fps_time=0;
|
||||
|
||||
|
||||
uint8_t test = 0;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -33,6 +26,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
zx_ula::sound_init();
|
||||
|
||||
zx_tape::load("abusimbel.tap");
|
||||
|
||||
bool should_exit = false;
|
||||
SDL_Event e;
|
||||
|
||||
@@ -44,27 +39,22 @@ int main(int argc, char *argv[])
|
||||
if (z80debug::debugging()) {
|
||||
if ((e.type==SDL_WINDOWEVENT) && ((e.window.event==SDL_WINDOWEVENT_SHOWN) || (e.window.event==SDL_WINDOWEVENT_EXPOSED))) {
|
||||
z80debug::refresh();
|
||||
zxscreen::refresh();
|
||||
zxscreen::refresh(0, true);
|
||||
}
|
||||
if (e.type == SDL_KEYDOWN) {
|
||||
if (e.key.keysym.scancode==SDL_SCANCODE_ESCAPE) {
|
||||
should_exit=true; break;
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F10) {
|
||||
t += z80::step();
|
||||
if (t>=69888) { t=0; z80::interrupt(); }
|
||||
const uint8_t dt = z80::step();
|
||||
z80debug::refresh();
|
||||
zxscreen::refresh();
|
||||
zxscreen::refresh(dt, true);
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F11) {
|
||||
t += z80debug::next();
|
||||
fps=0;
|
||||
fps_time = SDL_GetTicks();
|
||||
zxscreen::refresh();
|
||||
const uint8_t dt = z80debug::next();
|
||||
zxscreen::refresh(dt, true);
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F5) {
|
||||
t += z80::step();
|
||||
const uint8_t dt = z80::step();
|
||||
z80debug::cont();
|
||||
fps=0;
|
||||
fps_time = SDL_GetTicks();
|
||||
zxscreen::refresh();
|
||||
zxscreen::refresh(dt);
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_RETURN) {
|
||||
z80debug::executeConsole();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_BACKSPACE) {
|
||||
@@ -78,7 +68,10 @@ int main(int argc, char *argv[])
|
||||
if (e.type == SDL_KEYDOWN) {
|
||||
if (e.key.keysym.scancode==SDL_SCANCODE_F8) {
|
||||
z80debug::stop();
|
||||
zxscreen::refresh();
|
||||
zxscreen::refresh(0, true);
|
||||
}
|
||||
if (e.key.keysym.scancode==SDL_SCANCODE_F12) {
|
||||
zx_tape::play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,30 +79,12 @@ int main(int argc, char *argv[])
|
||||
if (!z80debug::debugging()) {
|
||||
if (z80debug::isbreak(z80::getPC(), 9)) {
|
||||
z80debug::stop();
|
||||
zxscreen::refresh();
|
||||
zxscreen::refresh(0, true);
|
||||
} else {
|
||||
uint8_t t_states = z80::step();
|
||||
t += t_states;
|
||||
ts += t_states;
|
||||
if (ts>=400) {
|
||||
ts-=400;
|
||||
zx_ula::sound_update();
|
||||
}
|
||||
if (t>=69888) {
|
||||
ft++;
|
||||
if (ft==16) { ft=0; zxscreen::flash(); }
|
||||
/*
|
||||
fps++;
|
||||
if (SDL_GetTicks() - fps_time >= 1000) {
|
||||
printf("FPS: %i\n", fps);
|
||||
fps = 0;
|
||||
fps_time = SDL_GetTicks();
|
||||
}
|
||||
*/
|
||||
t=0;
|
||||
zxscreen::refresh();
|
||||
z80::interrupt();
|
||||
}
|
||||
uint8_t dt = z80::step();
|
||||
zx_tape::update(dt);
|
||||
zx_ula::sound_update(dt);
|
||||
zxscreen::refresh(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user