comparison zdis.c @ 258:852b8765bba6

Fix infinite loop in Z80 disassembler
author Mike Pavone <pavone@retrodev.com>
date Tue, 30 Apr 2013 00:37:30 -0700
parents 69585e7d474f
children a13329645ea3
comparison
equal deleted inserted replaced
257:4c7933444df4 258:852b8765bba6
123 } while(def && encoded == NULL); 123 } while(def && encoded == NULL);
124 if (!encoded) { 124 if (!encoded) {
125 break; 125 break;
126 } 126 }
127 for(;;) { 127 for(;;) {
128 if (address > filesize) { 128 if (address > filesize || is_visited(address)) {
129 break; 129 break;
130 } 130 }
131 visit(address); 131 visit(address);
132 next = z80_decode(encoded, &instbuf); 132 next = z80_decode(encoded, &instbuf);
133 address += (next-encoded); 133 address += (next-encoded);
134 encoded = next; 134 encoded = next;
135 135
136 //m68k_disasm(&instbuf, disbuf); 136 //z80_disasm(&instbuf, disbuf);
137 //printf("%X: %s\n", instbuf.address, disbuf); 137 //printf("%X: %s\n", address, disbuf);
138 if (instbuf.op == Z80_HALT || instbuf.op == Z80_RET || instbuf.op == Z80_RETI || instbuf.op == Z80_RETN || instbuf.op == Z80_RST) { 138 if (instbuf.op == Z80_HALT || instbuf.op == Z80_RET || instbuf.op == Z80_RETI || instbuf.op == Z80_RETN || instbuf.op == Z80_RST) {
139 break; 139 break;
140 } 140 }
141 switch (instbuf.op) 141 switch (instbuf.op)
142 { 142 {