jsmolka / eggvance

A Game Boy Advance emulator.
https://smolka.dev/tags/eggvance
GNU General Public License v3.0
65 stars 1 forks source link

Export the assembly code #1

Closed Mte90 closed 4 years ago

Mte90 commented 4 years ago

After lurking a bit with the source code I saw the disassembler and that if I decomment disasm() in arm.cpp I get the assembly code on sheel so I can generate a file.

The problem is that is generating the one in that moment, I was looking to get the full code of a rom.

Do you think that is possible to add a parameter that export the code with the memory address?

jsmolka commented 4 years ago

It definitely would be possible, but I won't add it to the emulator itself.

disassemble.cpp includes like 3 different, simple headers and fmtlib. You could use it and write a small program.

Mte90 commented 4 years ago

I can try it the problem for me is the lack of documentation in the code itself, as example https://github.com/jsmolka/eggvance/blob/master/eggvance/src/arm/disassemble.cpp#L899 what are pc, lr and so on?

jsmolka commented 4 years ago

The arguments are the current instruction, the program counter, the link register and the current processor mode.

I made a small program for you, hope it works. Use: eggvance-disasm input.gba output.txt a to disassemble arm Use: eggvance-disasm input.gba output.txt t to disassemble thumb eggvance-disasm.zip

Hope it compiles on Linux, just tested it on Windows. Generates 160MB text for Pokemon Emerald in like 5 secs.

Mte90 commented 4 years ago

It is crashing with a gba rom:

Program received signal SIGSEGV, Segmentation fault.
0x000055555558559c in main ()
Mte90 commented 4 years ago

It was my fault not passing the last parameter :-)