- Enorme reestructuració del codi per a que el fluxe comence a ser mes racional

- [NEW] mòdul zx_system per a gestionar la vida i canvi de systemes (48K, 128K...)
This commit is contained in:
2025-07-30 13:01:01 +02:00
parent 2775da3d53
commit 1db0c52e1a
15 changed files with 257 additions and 101 deletions

View File

@@ -26,6 +26,7 @@ namespace zxscreen
uint32_t t_states_total = 69888;
uint32_t t_states_per_scanline = 224;
uint32_t vsync_lines = 16;
bool interrupt_enabled = true;
uint8_t zoom = 2;
bool fullscreen = false;
@@ -39,8 +40,6 @@ namespace zxscreen
uint8_t t_flash = 0;
bool flash = false;
int pixels_draw = 0;
uint32_t pixel_base_addr = 0x4000;
uint32_t color_base_addr = 0x5800;
@@ -235,6 +234,9 @@ namespace zxscreen
}
create_tables();
ptr_pixel = zx_pixels;
t_screen = t_flash = 0;
flash = false;
reinit();
}
@@ -247,7 +249,7 @@ namespace zxscreen
}
}
void refresh(const uint32_t dt, const bool full)
void refresh(const uint32_t dt)
{
const uint8_t* pixel_mem = mem::rawPtr(pixel_base_addr);
const uint8_t* color_mem = mem::rawPtr(color_base_addr);
@@ -272,17 +274,15 @@ namespace zxscreen
mask>>=1;
*(ptr_pixel++)=(block&mask) ? c1 : c2;
}
pixels_draw+=2;
}
t_screen++;
if (t_screen>=t_states_total) {
pixels_draw=0;
t_flash++;
if (t_flash==16) { t_flash=0; flash = !flash; }
t_screen=0;
ptr_pixel = zx_pixels;
redraw();
if (!full) z80::interrupt();
if (interrupt_enabled) z80::interrupt();
}
}
}
@@ -293,7 +293,9 @@ namespace zxscreen
t_screen = 0;
uint8_t * tmp_ptr = ptr_pixel;
ptr_pixel = zx_pixels;
refresh(t_states_total, true);
interrupt_enabled = false;
refresh(t_states_total);
interrupt_enabled = true;
ptr_pixel = tmp_ptr;
t_screen = tmp;
}