- [FIX] Solventats els bugs de la memòria modular amb classes
This commit is contained in:
5
z80.cpp
5
z80.cpp
@@ -1153,8 +1153,9 @@ namespace z80
|
|||||||
const uint8_t opcode = READ_M1();
|
const uint8_t opcode = READ_M1();
|
||||||
|
|
||||||
uint8_t tag = z80mem::get()->getTag(current_opcode_address);
|
uint8_t tag = z80mem::get()->getTag(current_opcode_address);
|
||||||
if ( !(tag & MEMTAG_IGNORE) ) tag = tag | MEMTAG_INST;
|
if ( !(tag & MEMTAG_IGNORE) )
|
||||||
z80mem::get()->setTag(current_opcode_address, tag | !(tag&MEMTAG_TOUCHED) ? MEMTAG_TREPEAT : MEMTAG_TINST);
|
tag = tag | MEMTAG_INST;
|
||||||
|
z80mem::get()->setTag(current_opcode_address, tag | (!(tag&MEMTAG_TOUCHED) ? MEMTAG_TREPEAT : MEMTAG_TINST) );
|
||||||
|
|
||||||
uint16_t tmp;
|
uint16_t tmp;
|
||||||
|
|
||||||
|
|||||||
@@ -1041,6 +1041,7 @@ namespace z80debug
|
|||||||
|
|
||||||
void setcursor(const uint16_t address)
|
void setcursor(const uint16_t address)
|
||||||
{
|
{
|
||||||
|
//if (!debugging()) return;
|
||||||
if ( !(z80mem::get()->getTag(address) & MEMTAG_INST) )
|
if ( !(z80mem::get()->getTag(address) & MEMTAG_INST) )
|
||||||
cursor = find_previous_opcode(address);
|
cursor = find_previous_opcode(address);
|
||||||
else
|
else
|
||||||
|
|||||||
3
z80mem.cpp
Normal file
3
z80mem.cpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#include "z80mem.h"
|
||||||
|
|
||||||
|
z80mem* z80mem::singleton= nullptr;
|
||||||
18
z80mem.h
18
z80mem.h
@@ -21,19 +21,19 @@ class z80mem
|
|||||||
public:
|
public:
|
||||||
static z80mem *get() { return singleton; };
|
static z80mem *get() { return singleton; };
|
||||||
|
|
||||||
virtual uint8_t readMem(uint16_t address);
|
virtual uint8_t readMem(uint16_t address) = 0;
|
||||||
virtual void writeMem(uint16_t address, uint8_t value);
|
virtual void writeMem(uint16_t address, uint8_t value) = 0;
|
||||||
|
|
||||||
virtual void loadMem(uint16_t address, uint16_t len, uint8_t *buffer);
|
virtual void loadMem(uint16_t address, uint16_t len, uint8_t *buffer) = 0;
|
||||||
|
|
||||||
virtual uint8_t getTag(uint16_t address);
|
virtual uint8_t getTag(uint16_t address) = 0;
|
||||||
virtual void setTag(uint16_t address, uint8_t value);
|
virtual void setTag(uint16_t address, uint8_t value) = 0;
|
||||||
virtual void reset();
|
virtual void reset() = 0;
|
||||||
|
|
||||||
virtual void saveState(FILE* f);
|
virtual void saveState(FILE* f) = 0;
|
||||||
virtual void loadState(FILE* f);
|
virtual void loadState(FILE* f) = 0;
|
||||||
|
|
||||||
virtual uint32_t getSize();
|
virtual uint32_t getSize() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class zx_48mem : public z80mem
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static uint8_t memory[65536];
|
uint8_t memory[65536];
|
||||||
static uint8_t tags[65536];
|
uint8_t tags[65536];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ namespace zxscreen
|
|||||||
uint8_t zx_pixels[352*296];
|
uint8_t zx_pixels[352*296];
|
||||||
uint8_t *ptr_pixel = zx_pixels;
|
uint8_t *ptr_pixel = zx_pixels;
|
||||||
|
|
||||||
|
#define SCREEN_SYNC 0xFFFF
|
||||||
|
#define SCREEN_BORDER 0xFFFE
|
||||||
|
|
||||||
void create_tables()
|
void create_tables()
|
||||||
{
|
{
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
@@ -46,24 +49,24 @@ namespace zxscreen
|
|||||||
uint16_t *ptr_color = color_addr;
|
uint16_t *ptr_color = color_addr;
|
||||||
|
|
||||||
// vsync
|
// 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
|
// Upper border
|
||||||
for (int i=0; i<48;++i) {
|
for (int i=0; i<48;++i) {
|
||||||
// hsync
|
// 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
|
//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
|
// scanlines
|
||||||
for (uint8_t y=0; y<192; ++y)
|
for (uint8_t y=0; y<192; ++y)
|
||||||
{
|
{
|
||||||
// hsync
|
// 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
|
// 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
|
// Actual screen
|
||||||
for (uint8_t x=0;x<32;++x)
|
for (uint8_t x=0;x<32;++x)
|
||||||
@@ -79,15 +82,15 @@ namespace zxscreen
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Right border
|
// 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
|
// Lower border
|
||||||
for (int i=0; i<56;++i) {
|
for (int i=0; i<56;++i) {
|
||||||
// hsync
|
// 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
|
//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);
|
//printf("COUNT: %i\n", count);
|
||||||
}
|
}
|
||||||
@@ -194,9 +197,9 @@ namespace zxscreen
|
|||||||
|
|
||||||
for (int i=0;i<dt;++i)
|
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;
|
||||||
*(ptr_pixel++) = border_color;
|
*(ptr_pixel++) = border_color;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user