/*
- * Copyright (C) 2006 Michael Buesch <mb@bu3sch.de>
+ * Copyright (C) 2006-2010 Michael Buesch <mb@bu3sch.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
{
char *ret;
- ret = xmalloc(5);
- snprintf(ret, 5, "@%03X", operand);
+ ret = xmalloc(6);
+ snprintf(ret, 6, "@%X", operand);
return ret;
}
static const char * disasm_indirect_mem_operand(unsigned int operand)
{
char *ret;
+ unsigned int offset, reg;
+ switch (cmdargs.arch) {
+ case 5:
+ offset = (operand & 0x3F);
+ reg = ((operand >> 6) & 0x7);
+ break;
+ case 15:
+ offset = (operand & 0x7F);
+ reg = ((operand >> 7) & 0x7);
+ break;
+ default:
+ fprintf(stderr, "Internal error: disasm_indirect_mem_operand invalid arch\n");
+ exit(1);
+ }
ret = xmalloc(12);
- snprintf(ret, 12, "[0x%02X,off%u]",
- (operand & 0x3F), ((operand >> 6) & 0x7));
+ snprintf(ret, 12, "[0x%02X,off%u]", offset, reg);
return ret;
}