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

View File

@ -6,6 +6,10 @@
#define PDC_DDR DDRA
#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

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
};
addr_t disassemble(addr_t addr)
addr_t disassemble(addr_t addr, uint8_t m)
{
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
};
addr_t disassemble(addr_t addr)
addr_t disassemble(addr_t addr, uint8_t m)
{
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 */
addr_t disassemble(addr_t addr) {
addr_t disassemble(addr_t addr, uint8_t m) {
uint8_t d = get_memb(addr);
uint8_t s;
int8_t i;

View File

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