253 |
|
return; |
254 |
|
|
255 |
|
while (adr <= end_adr && !mon_aborted()) { |
256 |
< |
fprintf(monout, "%08x:", mon_use_real_mem ? adr : adr % mon_mem_size); |
256 |
> |
fprintf(monout, "%0*lx:", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
257 |
|
for (int i=0; i<ASCIIDUMP_BPL; i++, adr++) |
258 |
|
str[i] = char2print(mon_read_byte(adr)); |
259 |
|
fprintf(monout, " '%s'\n", str); |
279 |
|
return; |
280 |
|
|
281 |
|
while (adr <= end_adr && !mon_aborted()) { |
282 |
< |
fprintf(monout, "%08x:", mon_use_real_mem ? adr : adr % mon_mem_size); |
282 |
> |
fprintf(monout, "%0*lx:", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
283 |
|
uint8 b = mon_read_byte(adr); |
284 |
|
for (int m=0x80, i=0; i<8; m>>=1, i++) |
285 |
|
str[i] = (b & m) ? '*' : '.'; |
307 |
|
CPU_680x0, |
308 |
|
CPU_Z80, |
309 |
|
CPU_80x86_32, |
310 |
< |
CPU_80x86_16 |
310 |
> |
CPU_80x86_16, |
311 |
> |
CPU_x86_64 |
312 |
|
}; |
313 |
|
|
314 |
|
static void disassemble(CPUType type) |
322 |
|
case CPU_PPC: |
323 |
|
while (adr <= end_adr && !mon_aborted()) { |
324 |
|
uint32 w = mon_read_word(adr); |
325 |
< |
fprintf(monout, "%08x: %08x\t", mon_use_real_mem ? adr : adr % mon_mem_size, w); |
325 |
> |
fprintf(monout, "%0*lx: %08x\t", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size, w); |
326 |
|
disass_ppc(monout, mon_use_real_mem ? adr : adr % mon_mem_size, w); |
327 |
|
adr += 4; |
328 |
|
} |
333 |
|
uint8 op = mon_read_byte(adr); |
334 |
|
uint8 lo = mon_read_byte(adr + 1); |
335 |
|
uint8 hi = mon_read_byte(adr + 2); |
336 |
< |
fprintf(monout, "%08x: ", mon_use_real_mem ? adr : adr % mon_mem_size); |
336 |
> |
fprintf(monout, "%0*lx: ", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
337 |
|
adr += disass_6502(monout, mon_use_real_mem ? adr : adr % mon_mem_size, op, lo, hi); |
338 |
|
} |
339 |
|
break; |
340 |
|
|
341 |
|
case CPU_680x0: |
342 |
|
while (adr <= end_adr && !mon_aborted()) { |
343 |
< |
fprintf(monout, "%08x: ", mon_use_real_mem ? adr : adr % mon_mem_size); |
343 |
> |
fprintf(monout, "%0*lx: ", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
344 |
|
adr += disass_68k(monout, mon_use_real_mem ? adr : adr % mon_mem_size); |
345 |
|
} |
346 |
|
break; |
347 |
|
|
348 |
|
case CPU_Z80: |
349 |
|
while (adr <= end_adr && !mon_aborted()) { |
350 |
< |
fprintf(monout, "%08x: ", mon_use_real_mem ? adr : adr % mon_mem_size); |
350 |
> |
fprintf(monout, "%0*lx: ", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
351 |
|
adr += disass_z80(monout, mon_use_real_mem ? adr : adr % mon_mem_size); |
352 |
|
} |
353 |
|
break; |
354 |
|
|
355 |
+ |
case CPU_x86_64: |
356 |
+ |
while (adr <= end_adr && !mon_aborted()) { |
357 |
+ |
fprintf(monout, "%0*lx: ", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
358 |
+ |
adr += disass_x86(monout, mon_use_real_mem ? adr : adr % mon_mem_size, 64); |
359 |
+ |
} |
360 |
+ |
break; |
361 |
+ |
|
362 |
|
case CPU_80x86_32: |
363 |
|
while (adr <= end_adr && !mon_aborted()) { |
364 |
< |
fprintf(monout, "%08x: ", mon_use_real_mem ? adr : adr % mon_mem_size); |
365 |
< |
adr += disass_x86(monout, mon_use_real_mem ? adr : adr % mon_mem_size, false); |
364 |
> |
fprintf(monout, "%0*lx: ", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
365 |
> |
adr += disass_x86(monout, mon_use_real_mem ? adr : adr % mon_mem_size, 32); |
366 |
|
} |
367 |
|
break; |
368 |
|
|
369 |
|
case CPU_80x86_16: |
370 |
|
while (adr <= end_adr && !mon_aborted()) { |
371 |
< |
fprintf(monout, "%08x: ", mon_use_real_mem ? adr : adr % mon_mem_size); |
372 |
< |
adr += disass_x86(monout, mon_use_real_mem ? adr : adr % mon_mem_size, true); |
371 |
> |
fprintf(monout, "%0*lx: ", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
372 |
> |
adr += disass_x86(monout, mon_use_real_mem ? adr : adr % mon_mem_size, 16); |
373 |
|
} |
366 |
– |
break; |
374 |
|
} |
375 |
|
|
376 |
|
mon_dot_address = adr; |
406 |
|
disassemble(CPU_80x86_16); |
407 |
|
} |
408 |
|
|
409 |
+ |
void disassemble_x86_64(void) |
410 |
+ |
{ |
411 |
+ |
disassemble(CPU_x86_64); |
412 |
+ |
} |
413 |
+ |
|
414 |
|
|
415 |
|
/* |
416 |
|
* Modify memory |
513 |
|
|
514 |
|
while (adr <= end_adr && !mon_aborted()) { |
515 |
|
if (mon_read_byte(adr) != mon_read_byte(dest)) { |
516 |
< |
fprintf(monout, "%08x ", mon_use_real_mem ? adr : adr % mon_mem_size); |
516 |
> |
fprintf(monout, "%0*lx ", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
517 |
|
num++; |
518 |
|
if (!(num & 7)) |
519 |
|
fputc('\n', monout); |
553 |
|
break; |
554 |
|
|
555 |
|
if (i == len) { |
556 |
< |
fprintf(monout, "%08x ", mon_use_real_mem ? adr : adr % mon_mem_size); |
556 |
> |
fprintf(monout, "%0*lx ", 2 * sizeof(adr), mon_use_real_mem ? adr : adr % mon_mem_size); |
557 |
|
num++; |
558 |
|
if (num == 1) |
559 |
|
mon_dot_address = adr; |
605 |
|
mon_write_byte(adr++, fc); |
606 |
|
fclose(file); |
607 |
|
|
608 |
< |
fprintf(monerr, "%08x bytes read from %08x to %08x\n", adr - start_adr, mon_use_real_mem ? start_adr : start_adr % mon_mem_size, mon_use_real_mem ? adr-1 : (adr-1) % mon_mem_size); |
608 |
> |
fprintf(monerr, "%08x bytes read from %0*lx to %0*lx\n", adr - start_adr, 2 * sizeof(adr), mon_use_real_mem ? start_adr : start_adr % mon_mem_size, 2 * sizeof(adr), mon_use_real_mem ? adr-1 : (adr-1) % mon_mem_size); |
609 |
|
mon_dot_address = adr; |
610 |
|
} |
611 |
|
} |
648 |
|
fputc(mon_read_byte(adr++), file); |
649 |
|
fclose(file); |
650 |
|
|
651 |
< |
fprintf(monerr, "%08x bytes written from %08x to %08x\n", size, mon_use_real_mem ? start_adr : start_adr % mon_mem_size, mon_use_real_mem ? end_adr : end_adr % mon_mem_size); |
651 |
> |
fprintf(monerr, "%08x bytes written from %0*lx to %0*lx\n", size, 2 * sizeof(adr), mon_use_real_mem ? start_adr : start_adr % mon_mem_size, mon_use_real_mem ? end_adr : end_adr % mon_mem_size); |
652 |
|
} |
653 |
|
} |