--- hatari/src/debug/68kDisass.c 2019/04/09 08:53:05 1.1.1.4 +++ hatari/src/debug/68kDisass.c 2019/04/09 08:54:22 1.1.1.5 @@ -27,7 +27,7 @@ typedef enum { doptNoBrackets = 1, // hide brackets around absolute addressing doptOpcodesSmall = 2, // opcodes are small letters doptRegisterSmall = 4, // register names are small letters - doptStackSP = 8, // stack pointer is named "SP" instead of "A7" (except for MOVEM) + doptStackSP = 8 // stack pointer is named "SP" instead of "A7" (except for MOVEM) } Diss68kOptions; static Diss68kOptions options = doptOpcodesSmall | doptRegisterSmall | doptStackSP | doptNoBrackets; @@ -88,7 +88,7 @@ typedef enum { dtASCString, // a 0-byte terminated ASCII string dtPointer, // a generic 32-bit pointer dtFunctionPointer, // a 32-bit pointer to a function - dtStringArray, // a specific number of ASCII bytes + dtStringArray // a specific number of ASCII bytes } Disass68kDataType; typedef struct { @@ -193,7 +193,7 @@ static void Disass68kLoadStructInfo(co while(*sp++) ; nextLine = sp--; - while(isspace(*--sp)) + while (isspace((unsigned char)*--sp)) *sp = 0; if(line[0] == '{') @@ -218,7 +218,7 @@ static void Disass68kLoadStructInfo(co int index = 2; if(line[1] == 'A' || line[1] == 'B') { - for(; isdigit(line[index]); ++index) + for(; isdigit((unsigned char)line[index]); ++index) { val *= 10; val += line[index] - '0'; @@ -274,7 +274,7 @@ static void Disass68kLoadSymbols(const while(*sp++) ; nextLine = sp--; - while(isspace(*--sp)) + while(isspace((unsigned char)*--sp)) *sp = 0; // ignore empty lines @@ -291,10 +291,10 @@ static void Disass68kLoadSymbols(const if(str) { char *ep = str; - while(isspace(*--ep)) + while(isspace((unsigned char)*--ep)) *ep = 0; *str++ = 0; - while(*str && isspace(*str)) + while(*str && isspace((unsigned char)*str)) ++str; parameterPtr[parameterCount++] = str; } @@ -485,10 +485,10 @@ static const char *Disass68kNumber(int v sprintf(numString, "%d", val); } else { // 4 characters/numbers or underscore (e.g. for cookies) - char c0 = (val >> 24) & 0xFF; - char c1 = (val >> 16) & 0xFF; - char c2 = (val >> 8) & 0xFF; - char c3 = (val >> 0) & 0xFF; + unsigned char c0 = (val >> 24) & 0xFF; + unsigned char c1 = (val >> 16) & 0xFF; + unsigned char c2 = (val >> 8) & 0xFF; + unsigned char c3 = (val >> 0) & 0xFF; if((isalnum(c0) || c0 == '_') && (isalnum(c1) || c1 == '_') && (isalnum(c2) || c2 == '_') && (isalnum(c3) || c3 == '_')) { sprintf(numString, "'%c%c%c%c'", c0, c1, c2, c3); @@ -588,7 +588,7 @@ static const char *Disass68kSpecialRegis char *bp; strcpy(buf, sp); for (bp = buf; *bp; ++bp) - *bp = tolower(*bp); + *bp = tolower((unsigned char)*bp); return buf; } return sp; @@ -633,8 +633,6 @@ static char *Disass68kEA(char *disassbu char regName[3]; signed long pcoffset; - val = 0; - disassbuf[0] = 0; switch(ea) { @@ -1283,7 +1281,7 @@ typedef enum { ofFPUMOVE, ofFMOVECR, ofFPU3Reg, - ofLineA, + ofLineA } Disass68kOpcodeFormat; @@ -1895,6 +1893,7 @@ more: char sizeChar = 0; char *dbuf; int ea; + unsigned int maxop; if(ots->opcodeName == NULL) break; @@ -1996,7 +1995,7 @@ more: strcpy(buf, sp); sp = buf; for (bp = buf; *bp; ++bp) - *bp = tolower(*bp); + *bp = tolower((unsigned char)*bp); } strcpy(dbuf, sp); dbuf += strlen(sp); @@ -2007,7 +2006,7 @@ more: if(c == '?') // size mask c = sizeChar; if(options & doptOpcodesSmall) - c = tolower(c); + c = tolower((unsigned char)c); *dbuf++ = c; } *dbuf = 0; @@ -2015,7 +2014,9 @@ more: // Parse the EAs for all operands ea = opcode[0] & 0x3F; dbuf = operandBuffer; - for(i=0; i<(sizeof(ots->op)/sizeof(ots->op[0])); ++i) + + maxop=(sizeof(ots->op)/sizeof(ots->op[0])); + for(i=0; i add separator - if(ots->op[i+1] != ofNone) + if ( (i+1op[i+1] != ofNone) ) *dbuf++ = ','; } return addr-baseAddr; @@ -2541,9 +2542,9 @@ Uint32 Disasm_GetNextPC(Uint32 pc) void Disasm (FILE *f, uaecptr addr, uaecptr *nextpc, int cnt) { if (ConfigureParams.Debugger.bDisasmUAE) - return m68k_disasm (f, addr, nextpc, cnt); + m68k_disasm (f, addr, nextpc, cnt); else - return Disass68k_loop (f, addr, nextpc, cnt); + Disass68k_loop (f, addr, nextpc, cnt); } static void Disasm_CheckOptionEngine(void) @@ -2666,7 +2667,7 @@ const char *Disasm_ParseOption(const cha ConfigureParams.Debugger.bDisasmUAE = false; return NULL; } - if (isdigit(*arg)) + if (isdigit((unsigned char)*arg)) { int newopt = atoi(arg); if ((newopt|optionsMask) != optionsMask)