- [FIX] Solventats els bugs de la memòria modular amb classes

This commit is contained in:
2024-12-19 20:57:28 +01:00
parent dbd80694aa
commit 68843ab6b3
6 changed files with 31 additions and 23 deletions

View File

@@ -38,6 +38,9 @@ namespace zxscreen
uint8_t zx_pixels[352*296];
uint8_t *ptr_pixel = zx_pixels;
#define SCREEN_SYNC 0xFFFF
#define SCREEN_BORDER 0xFFFE
void create_tables()
{
uint32_t count = 0;
@@ -46,24 +49,24 @@ namespace zxscreen
uint16_t *ptr_color = color_addr;
// vsync
for (int i=0; i<224*16;++i) { *(ptr_pixel++) = 0; *(ptr_color++) = 0; }
for (int i=0; i<224*16;++i) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_SYNC; }
// Upper border
for (int i=0; i<48;++i) {
// hsync
for (int j=0;j<48;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = 0; }
for (int j=0;j<48;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_SYNC; }
//border
for (int j=0;j<176;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = 1; count+=2; }
for (int j=0;j<176;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_BORDER; count+=2; }
}
// scanlines
for (uint8_t y=0; y<192; ++y)
{
// hsync
for (int j=0;j<48;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = 0; }
for (int j=0;j<48;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_SYNC; }
// Left border
for (int j=0;j<24;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = 1; count+=2; }
for (int j=0;j<24;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_BORDER; count+=2; }
// Actual screen
for (uint8_t x=0;x<32;++x)
@@ -79,15 +82,15 @@ namespace zxscreen
}
// Right border
for (int j=0;j<24;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = 1; count+=2; }
for (int j=0;j<24;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_BORDER; count+=2; }
}
// Lower border
for (int i=0; i<56;++i) {
// hsync
for (int j=0;j<48;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = 0; }
for (int j=0;j<48;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_SYNC; }
//border
for (int j=0;j<176;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = 1; count+=2; }
for (int j=0;j<176;++j) { *(ptr_pixel++) = 0; *(ptr_color++) = SCREEN_BORDER; count+=2; }
}
//printf("COUNT: %i\n", count);
}
@@ -194,9 +197,9 @@ namespace zxscreen
for (int i=0;i<dt;++i)
{
if (color_addr[t_screen] != 0)
if (color_addr[t_screen] != SCREEN_SYNC)
{
if (color_addr[t_screen] == 1) {
if (color_addr[t_screen] == SCREEN_BORDER) {
*(ptr_pixel++) = border_color;
*(ptr_pixel++) = border_color;
} else {