- [FIX] Al fer break on interrupt de vegades se passava de instruccions

- [NEW] el analitzador pot mostrar les instruccions repetides des de l'ultim estat
- [NEW] gestió de opcodes usats
This commit is contained in:
2024-12-12 22:44:44 +01:00
parent c70c3652bf
commit 8c197d5519
6 changed files with 136 additions and 4 deletions

32
z80.cpp
View File

@@ -193,6 +193,7 @@ namespace z80
{
WRITE_MEM_8(addr, value & 0xff);
WRITE_MEM_8(addr+1, (value>>8) & 0xff);
//if (value==0x7229) z80debug::stop();
}
void PUSH(uint16_t b)
@@ -675,6 +676,7 @@ namespace z80
if (options[Z80_OPTION_BREAK_ON_INTERRUPT]) {
printf("Break on interrupt! 0x%2x, PC: 0x%2x\n", address, rPC);
z80debug::setcursor(rPC);
z80debug::history::store();
z80debug::stop();
}
}
@@ -1081,8 +1083,10 @@ namespace z80
t = 0;
const uint8_t opcode = READ_M1();
memtag[current_opcode_address] = MEMTAG_INST;
memtouched[current_opcode_address] = MEMTAG_INST;
memtouched[current_opcode_address] = memtouched[current_opcode_address] != MEMTAG_NONE ? MEMTAG_REPEAT : MEMTAG_INST;
uint16_t tmp;
if (opcode!=0xED && opcode!=0xCB && opcode!=0xDD && opcode!=0xFD ) z80debug::useOpcode(opcode, 0);
switch (opcode)
{
@@ -1370,6 +1374,9 @@ namespace z80
void BIT_INSTRUCTIONS()
{
const uint8_t opcode = READ_M1();
z80debug::useOpcode(opcode, 2);
switch (opcode)
{
case 0x00: rB = RLC(rB); break;
@@ -1651,6 +1658,8 @@ namespace z80
const uint8_t opcode = READ_M1();
int8_t d;
if (opcode!=0xCB) z80debug::useOpcode(opcode, 3);
switch (opcode)
{
case 0x00: INVALID(opcode); break;
@@ -1872,6 +1881,9 @@ namespace z80
const int8_t d = READ_MEM_8();
const uint8_t opcode = READ_MEM_8();
t+=3;
z80debug::useOpcode(opcode, 4);
switch (opcode)
{
case 0x00: rB = WRITE_MEM_8(rIX+d, RLC(READ_MEM_8(rIX+d))); break;
@@ -2151,6 +2163,9 @@ namespace z80
void MISC_INSTRUCTIONS()
{
const uint8_t opcode = READ_M1();
z80debug::useOpcode(opcode, 1);
rR = (rR&0x80) + ((rR+1) & 0x7f);
uint16_t tmp;
@@ -2232,6 +2247,8 @@ namespace z80
const uint8_t opcode = READ_M1();
int8_t d;
if (opcode!=0xCB) z80debug::useOpcode(opcode, 5);
switch (opcode)
{
case 0x00: INVALID(opcode); break;
@@ -2453,6 +2470,9 @@ namespace z80
const int8_t d = READ_MEM_8();
const uint8_t opcode = READ_MEM_8();
t+=3;
z80debug::useOpcode(opcode, 6);
switch (opcode)
{
case 0x00: rB = WRITE_MEM_8(rIY+d, RLC(READ_MEM_8(rIY+d))); break;
@@ -2762,6 +2782,16 @@ namespace z80
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)
{
return options[option];