Z80: Ignore machine state in disasseble command

Change-Id: I28b67a53ec8936bb9172aa10ca6548fe0d9e6460
This commit is contained in:
David Banks 2021-07-04 19:31:13 +01:00
parent 0d837de8a6
commit 78423708c5
6 changed files with 18 additions and 10 deletions

View File

@ -922,7 +922,7 @@ void writeIOByteInc() {
addr_t disMem(addr_t addr) { addr_t disMem(addr_t addr) {
loadAddr(addr); loadAddr(addr);
return disassemble(addr); return disassemble(addr, MODE_NORMAL);
} }
void genericDump(char *params, data_t (*readFunc)()) { void genericDump(char *params, data_t (*readFunc)()) {
@ -1526,7 +1526,7 @@ void doCmdDis(char *params) {
memAddr = startAddr; memAddr = startAddr;
loadAddr(memAddr); loadAddr(memAddr);
do { do {
memAddr = disassemble(memAddr); memAddr = disassemble(memAddr, MODE_DIS_CMD);
i++; i++;
} while ((!endAddr && i < 10) || (endAddr && memAddr > startAddr && memAddr <= endAddr)); } while ((!endAddr && i < 10) || (endAddr && memAddr > startAddr && memAddr <= endAddr));
} }

View File

@ -6,6 +6,10 @@
#define PDC_DDR DDRA #define PDC_DDR DDRA
#define PDC_DIN PINA #define PDC_DIN PINA
addr_t disassemble(addr_t addr); #define MODE_NORMAL 0
#define MODE_DIS_CMD 1
addr_t disassemble(addr_t addr, uint8_t m);
#endif #endif

View File

@ -167,7 +167,7 @@ static const unsigned char dopaddr[256] PROGMEM =
/*F0*/ BRA, INDY, IMP, IMP, ZP, ZPX, ZPX, IMP, IMP, ABSY, IMP, IMP, ABS, ABSX, ABSX, IMP /*F0*/ BRA, INDY, IMP, IMP, ZP, ZPX, ZPX, IMP, IMP, ABSY, IMP, IMP, ABS, ABSX, ABSX, IMP
}; };
addr_t disassemble(addr_t addr) addr_t disassemble(addr_t addr, uint8_t m)
{ {
char buffer[40]; char buffer[40];

View File

@ -187,7 +187,7 @@ static const unsigned char dopaddr[256] PROGMEM =
/*F0*/ BRA, INDY, IND, IMP, ZP, ZPX, ZPX, IMP, IMP, ABSY, IMP, IMP, ABS, ABSX, ABSX, IMP /*F0*/ BRA, INDY, IND, IMP, ZP, ZPX, ZPX, IMP, IMP, ABSY, IMP, IMP, ABS, ABSX, ABSX, IMP
}; };
addr_t disassemble(addr_t addr) addr_t disassemble(addr_t addr, uint8_t m)
{ {
char buffer[40]; char buffer[40];

View File

@ -647,7 +647,7 @@ static char *strcc(char *ptr, uint8_t val) {
/* disassemble one instruction at address addr and return the address of the next instruction */ /* disassemble one instruction at address addr and return the address of the next instruction */
addr_t disassemble(addr_t addr) { addr_t disassemble(addr_t addr, uint8_t m) {
uint8_t d = get_memb(addr); uint8_t d = get_memb(addr);
uint8_t s; uint8_t s;
int8_t i; int8_t i;

View File

@ -887,12 +887,15 @@ char * disassem (char *ptr, unsigned int *ip) {
return ptr; return ptr;
} }
addr_t disassemble(addr_t addr) { addr_t disassemble(addr_t addr, uint8_t m) {
static char buffer[64]; static char buffer[64];
char *ptr; char *ptr;
addr_t addr2 = addr; addr_t addr2 = addr;
// Ignore the current CPU state in the disassemble connamd
uint8_t pdc = (m == MODE_DIS_CMD) ? 0 : PDC_DIN;
// 0123456789012345678901234567890123456789 // 0123456789012345678901234567890123456789
// AAAA : HH HH HH HH : LD RR,($XXXX) // AAAA : HH HH HH HH : LD RR,($XXXX)
@ -905,11 +908,12 @@ addr_t disassemble(addr_t addr) {
// Opcode // Opcode
ptr = buffer + 21; ptr = buffer + 21;
if (PDC_DIN & 0x80) {
if (pdc & 0x80) {
strcpy_P(ptr, msg_HALT); strcpy_P(ptr, msg_HALT);
} else if (PDC_DIN & 0x40) { } else if (pdc & 0x40) {
strcpy(ptr, msg_NMI); strcpy(ptr, msg_NMI);
} else if (PDC_DIN & 0x20) { } else if (pdc & 0x20) {
strcpy(ptr, msg_INT); strcpy(ptr, msg_INT);
} else { } else {
ptr = disassem(ptr, &addr2); ptr = disassem(ptr, &addr2);