- [NEW] Afegit modul debug

- [NEW] Afegit tagging de memòria
- [NEW] modul mbc_none funcional
- [NEW] Afegit modul main base del programa
- [NEW] Afegits Makefile i .gitignore
- Primera execució. No arriba a 0x0100
- [FIX] Corregida la representació del ensamblador cap enrere
This commit is contained in:
2025-01-15 15:42:14 +01:00
parent b06f26a4b7
commit ab77116dca
10 changed files with 1537 additions and 69 deletions

View File

@@ -1,7 +1,6 @@
#include "sm83.h"
#include "mem.h"
//#include "z80debug.h"
//#include "z80mem.h"
#include "debug.h"
#include <stdio.h>
namespace sm83
@@ -75,22 +74,21 @@ namespace sm83
uint8_t READ_MEM_8(const uint16_t addr, const bool code=false)
{
//if (z80debug::isbreak(addr, 2)) z80debug::stop();
if (debug::isbreak(addr, 2)) debug::stop();
t+=4;
/*
const uint8_t tag = z80mem::get()->getTag(addr);
const uint8_t tag = mem::getTag(addr);
if ( !(tag&MEMTAG_IGNORE) ) {
if (!code) {
if ( tag & MEMTAG_INST ) {
} else {
z80mem::get()->setTag(addr, tag | MEMTAG_DATA);
mem::setTag(addr, tag | MEMTAG_DATA);
}
} else {
if ( (reading_m1) && ( tag & MEMTAG_DATA ) ) {
}
}
}
*/
reading_m1 = false;
return mem::readMem(addr);
}
@@ -98,8 +96,8 @@ namespace sm83
uint8_t READ_MEM_8()
{
const uint8_t data = READ_MEM_8(rPC, true);
//const uint8_t tag = z80mem::get()->getTag(rPC);
//if ( !(tag & MEMTAG_IGNORE) ) z80mem::get()->setTag(rPC, tag | MEMTAG_CODE);
const uint8_t tag = mem::getTag(rPC);
if ( !(tag & MEMTAG_IGNORE) ) mem::setTag(rPC, tag | MEMTAG_CODE);
rPC++;
return data;
}
@@ -127,20 +125,18 @@ namespace sm83
t+=4;
mem::writeMem(addr, value);
/*
if (z80debug::isbreak(addr, 4)) z80debug::stop();
z80debug::setmemmodified(addr);
if (debug::isbreak(addr, 4)) debug::stop();
debug::setmemmodified(addr);
const uint8_t tag = z80mem::get()->getTag(addr);
const uint8_t tag = mem::getTag(addr);
if ( !(tag & MEMTAG_IGNORE) ) {
if ( tag & MEMTAG_INST ) {
//printf("WARNING! WRITING DATA OVER CODE!!! $%4X\n", addr);
//z80debug::stop();
} else {
z80mem::get()->setTag(addr, tag | MEMTAG_DATA | MEMTAG_TDATA);
mem::setTag(addr, tag | MEMTAG_DATA | MEMTAG_TDATA);
}
}
*/
return value;
}
@@ -718,10 +714,10 @@ namespace sm83
t = 0;
const uint8_t opcode = READ_M1();
/*uint8_t tag = z80mem::get()->getTag(current_opcode_address);
uint8_t tag = mem::getTag(current_opcode_address);
if ( !(tag & MEMTAG_IGNORE) )
tag = tag | MEMTAG_INST;
z80mem::get()->setTag(current_opcode_address, tag | (!(tag&MEMTAG_TOUCHED) ? MEMTAG_TREPEAT : MEMTAG_TINST) );*/
mem::setTag(current_opcode_address, tag | (!(tag&MEMTAG_TOUCHED) ? MEMTAG_TREPEAT : MEMTAG_TINST) );
uint16_t tmp;
@@ -1007,8 +1003,8 @@ namespace sm83
if (pending_ei==2) { pending_ei=0; actualEI(); }
if (pending_ei==1) pending_ei=2;
/*z80debug::setcursor(rPC);
z80debug::history::store();*/
debug::setcursor(rPC);
debug::history::store();
return t;
}
@@ -1308,32 +1304,6 @@ namespace sm83
void setPC(const uint16_t addr) { rPC = addr; }
/*
uint8_t getMemTag(const uint16_t addr) { return memtag[addr]; }
void setMemTag(const uint16_t addr, const uint8_t value) { memtag[addr] = value; }
void clearMemTag()
{
for (int i=0; i<65536; ++i) memtag[i] = MEMTAG_NONE;
}
uint8_t getMemTouched(const uint16_t addr) { return memtouched[addr]; }
void clearMemTouched()
{
for (int i=0; i<65536; ++i) memtouched[i] = MEMTAG_NONE;
}
void fixMemTouched()
{
for (int i=0; i<65536; ++i)
if ( (memtouched[i]==MEMTAG_INST) || (memtouched[i]==MEMTAG_REPEAT) )
memtouched[i] = MEMTAG_DATA;
//else if (memtouched[i]==MEMTAG_DATA)
// memtouched[i] = MEMTAG_REPEAT;
}
*/
const bool getOption(const int option)
{