--- uae/src/debug.c 2018/04/24 16:38:39 1.1.1.1 +++ uae/src/debug.c 2018/04/24 16:39:01 1.1.1.2 @@ -17,6 +17,7 @@ #include "options.h" #include "memory.h" #include "custom.h" +#include "readcpu.h" #include "newcpu.h" #include "debug.h" #include "cia.h" @@ -99,6 +100,44 @@ static void dumpmem(CPTR addr, CPTR *nxm *nxmem = addr; } +static void modulesearch(void) +{ + ULONG ptr; + + for(ptr=0x438;ptrlength) + length=j; + + length = (length+1)*1024+0x43c; + + /* Add sample lengths */ + ptr2 = &chipmemory[ptr-0x438+0x2a]; + for(i=0;i<31;i++,ptr2+=30) + length += 2*((ptr2[0]<<8)+ptr2[1]); + + printf("Name \"%s\", Length %ld (0x%lx) bytes.\n", name, length, length); + } + } +} + void debug(void) { char input[80],c; @@ -130,13 +169,16 @@ void debug(void) char cmd,*inptr; printf(">"); - fgets(input, 80, stdin); + fflush (stdout); + if (fgets(input, 80, stdin) == 0) + return; inptr = input; cmd = next_char(&inptr); switch(cmd){ case 'q': quit_program = 1; debugging = 0; regs.spcflags |= SPCFLAG_BRK; return; case 'c': dumpcia(); dumpcustom(); break; case 'r': m68k_dumpstate(&nextpc); break; + case 'M': modulesearch(); break; case 'd': { ULONG daddr; @@ -228,9 +270,9 @@ void debug(void) printf (" HELP for UAE Debugger\n"); printf (" -----------------------\n\n"); printf (" g:
"); - printf("Start execution at the current address or
.\n"); + printf("Start execution at the current address or
\n"); printf (" c: "); - printf("Dump state of the CIA and custom chips.\n"); + printf("Dump state of the CIA and custom chips\n"); printf (" r: "); printf("Dump state of the CPU\n"); printf (" m
: "); @@ -244,7 +286,9 @@ void debug(void) printf (" f
: "); printf ("Step forward until PC ==
\n"); printf (" H : "); - printf ("Show PC history instructions.\n"); + printf ("Show PC history instructions\n"); + printf (" M: "); + printf ("Search for *Tracker sound modules\n"); printf (" h,?: "); printf ("Show this help page\n"); printf (" q: ");