@@ 83,28 83,30 @@ main(int argc, char* argv[])
c = c/2;
} ARGEND;
u16int instr = 0x0000;
+ print(".ORIG\tx%x\n", origin);
for(int i = origin; i < origin + c; i++){
instr = memread(i);
+ print("\t\t");
if(instr == 0){
- print("\tNOP\n");
+ print("NOP\n");
continue;
}
u16int op = instr >> 12;
if(op == OP_JSR) {
if((instr >> 11) & 1)
- print("\tJSR\t0x%x\n", (instr & 0x7FF));
+ print("JSR\t\tx%x\n", (instr & 0x7FF));
else
- print("\tJSRR\t%s\n", regname[(instr >> 6) & 0x7]);
+ print("JSRR\t%s\n", regname[(instr >> 6) & 0x7]);
continue;
} else if(op == OP_TRAP){
- print("\t%s\n", trap[instr & 0xFF]);
+ print("%s\n", trap[instr & 0xFF]);
continue;
}
if(op >= OP_COUNT)
exits("Invalid opcode");
- print("\t%s", opcode[op]);
+ print("%s", opcode[op]);
if(printreg12(op)) {
- print("\t%s", regname[(instr >> 9) & 0x7]);
+ print("\t\t%s", regname[(instr >> 9) & 0x7]);
} else if(op == OP_BR){
u16int fl = (instr >> 9) & 0x7;
if(fl & FL_POS)
@@ 116,10 118,10 @@ main(int argc, char* argv[])
}
if(printpcof9(op)){
if(op == OP_BR)
- print("\t");
+ print("\t\t");
else
print(",");
- print("0x%x\n", (instr & 0x1FF));
+ print("x%x\n", (instr & 0x1FF));
continue;
} else if(printreg9(op)) {
print(",%s\n", regname[(instr >> 6) & 0x7]);
@@ 127,11 129,11 @@ main(int argc, char* argv[])
}
if(op == OP_ADD || op == OP_AND){
if((instr >> 5) & 1)
- print(",0x%x", instr & 0x1F);
+ print(",x%x", instr & 0x1F);
else
print(",%s", regname[instr & 0x7]);
} else if(op == OP_STR | op == OP_LDR) {
- print(",0x%x", instr & 0x3f);
+ print(",x%x", instr & 0x3f);
}
print("\n");
}