?? dasmtest.cpp
字號(hào):
/**************************************************************************
* DSemu - The Next Generation *
* Portable ARM cores: Disassembly tester [dasmtest.cpp] *
* Copyright Imran Nazar, 2005; released under the BSD public licence. *
**************************************************************************/
#include <fstream>
#include "armdasm.h"
#include "datadefs.h"
#include "byteswap.h"
#include "sysdep.h"
u8 *buf; u32 *bufw;
// Function the disasm will use to read the ROM buffer
u32 rdW(u32 addr) { return bufw[addr>>2]; }
// Input: A binary file on the command line
// Output: A disassembly, starting at R15=0, to stdout
int main(int argc, char *argv[])
{
if(argc != 2)
{
printf("Usage: dasmtest <ROM to disasm>\n");
return 0;
}
std::ifstream input(argv[1], std::ios::binary);
if(!input.is_open())
{
printf("Failed opening %s.\n", argv[1]);
return 1;
}
int size;
ARMDasm dasm(rdW);
input.seekg(0, std::ios::end);
size = input.tellg();
input.seekg(0, std::ios::beg);
buf = new u8[size];
bufw = (u32*)buf;
input.read((char*)buf, size);
input.close();
for(int i=0; i<(size>>2); i++)
{
printf("%08X | %08X | ", i*4, bufw[i], mtohl(bufw[i]));
printf("%s\n",dasm.disasm(mtohl(bufw[i]),i*4).c_str());
}
delete buf; buf=NULL;
return 0;
}
/*** EOF: dasmtest.cpp ***************************************************/
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -