- [NEW] While debugging you can go back/forward in time
- [NEW] Step by step execution with F6 - [NEW] Memory is tagged as code or data while executing, so later it can be properly disassembled - [NEW] "reg X value" to set the value of X register - [FIX] IX opcode table had errors - [FIX] opcodes with two parameters where printed incorrectly on the disassembler - [FIX] opcodes can't be lager than 4 bytes - [CHG] Berserk mode and fernando martin TAP by default, to help with debugging
This commit is contained in:
15
z80.cpp
15
z80.cpp
@@ -6,6 +6,7 @@
|
||||
namespace z80
|
||||
{
|
||||
static uint8_t *memory = nullptr;
|
||||
static uint8_t memtag[65536];
|
||||
static uint32_t t = 0;
|
||||
static uint16_t current_opcode_address = 0;
|
||||
|
||||
@@ -145,12 +146,15 @@ namespace z80
|
||||
{
|
||||
if (z80debug::isbreak(addr, 2)) z80debug::stop();
|
||||
t+=3;
|
||||
memtag[addr] = MEMTAG_DATA;
|
||||
return memory[addr];
|
||||
}
|
||||
|
||||
uint8_t READ_MEM_8()
|
||||
{
|
||||
return READ_MEM_8(rPC++);
|
||||
uint8_t data = READ_MEM_8(rPC);
|
||||
memtag[rPC++] = MEMTAG_CODE;
|
||||
return data;
|
||||
}
|
||||
|
||||
uint8_t READ_M1()
|
||||
@@ -178,6 +182,8 @@ namespace z80
|
||||
if (z80debug::isbreak(addr, 4)) z80debug::stop();
|
||||
//if (z80debug::debugging())
|
||||
z80debug::setmemmodified(addr);
|
||||
memtag[addr] = MEMTAG_DATA;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -1033,6 +1039,7 @@ namespace z80
|
||||
void reset(uint8_t* mem)
|
||||
{
|
||||
memory = mem;
|
||||
for (int i=0; i<65536; ++i) memtag[i] = MEMTAG_NONE;
|
||||
rPC = iff1 = iff2 = im = 0;
|
||||
rAF = rAF2 = rBC = rBC2 = rDE = rDE2 = rHL = rHL2 = rIX = rIY = rSP = 0xffff;
|
||||
t = 0;
|
||||
@@ -1061,6 +1068,7 @@ namespace z80
|
||||
current_opcode_address = rPC;
|
||||
t = 0;
|
||||
const uint8_t opcode = READ_M1();
|
||||
memtag[current_opcode_address] = MEMTAG_INST;
|
||||
uint16_t tmp;
|
||||
|
||||
switch (opcode)
|
||||
@@ -1340,6 +1348,8 @@ namespace z80
|
||||
|
||||
if (pending_ei==2) { pending_ei=0; actualEI(); }
|
||||
if (pending_ei==1) pending_ei=2;
|
||||
|
||||
z80debug::history::store();
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -2720,4 +2730,7 @@ namespace z80
|
||||
uint16_t getPC() { return rPC; }
|
||||
|
||||
void setPC(const uint16_t addr) { rPC = addr; }
|
||||
|
||||
uint8_t getMemTag(const uint16_t addr) { return memtag[addr]; };
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user