-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisassembler.cc
42 lines (34 loc) · 1.02 KB
/
disassembler.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "decode.h"
#include "disasm.h"
int main()
{
int xlen=32;
insn_bits_t instruction;
disassembler_t disassembler(xlen);
// disassembler_t * disassembler = new disassembler_t(xlen);
while(scanf("%lx",&instruction))
{
// switch((char)instruction)
// {
// case 'q':
// delete(disassembler);
// return 0;
// break;
// case 'h':
// fprintf(stdout, "Command Help\n\n");
// fprintf(stdout, "h\t:: Display this Command Help.\n");
// fprintf(stdout, "q\t:: Quit.\n");
// break;
// }
insn_t insn(instruction);
std::string str = disassembler.disassemble(insn);
fprintf(stdout, "%8lx :: %s\n", instruction,str.c_str()); // TODO : Formatting
// fprintf(stderr, "%lx\t:: %s\n", instruction,str.c_str());
}
// delete(disassembler);
return 0;
}