print code openmsx-debugger

By jepmsx

Expert (89)

jepmsx's picture

25-10-2021, 23:06

Hi!

Is there a way to print the code in the Code view section of the openmsx-debugger to a txt file?

I'm disassembling a binary file and I would like to write comments on different lines

Login or register to post comments

By geijoenr

Champion (276)

geijoenr's picture

26-10-2021, 00:01

why don't you just use a disasembler? It will do exactly that, turn the binary into a text file you can edit.

By jepmsx

Expert (89)

jepmsx's picture

26-10-2021, 10:42

Thanks geijoenr for your answer.

You are right. I was expecting that openmsx-debugger could do it to avoid to learn a new tool (I'm a lazy boy).

Do you have any suggestion for a disassembler?

By MsxKun

Paragon (1038)

MsxKun's picture

26-10-2021, 16:11

I used z80dasm on linux and I was happy with the result.

By thegeps

Paladin (896)

thegeps's picture

26-10-2021, 16:23

I've recently used disark and I was fine too

By wouter_

Champion (469)

wouter_'s picture

26-10-2021, 21:11

I sometimes use this command in the openMSX console (so openMSX itself, not the openMSX-debugger):
disasm <address> <numer-of-lines>
Possibly combined with the command:
save_to_file <filename> <string>
For example:
save_to_file output.txt [disasm 0x4000 500]
It's a bit primitive, but it works.

By jepmsx

Expert (89)

jepmsx's picture

27-10-2021, 06:21

Thanks guys for your answers.

First I will try wouter_'s option because it's an environment that I already used.

Thanks again for your help.

By pgimeno

Champion (302)

pgimeno's picture

28-10-2021, 02:40

In Linux, the package d52 contains three disassemblers; one of them is for Z80, called dz80. They allow you to write "control files". These are files where you specify the locations of comments etc. and it will generate a disassembly with the comments in it. Basically like IDA but with a text file instead of an UI. SkoolKit is similar and outputs HTML among other things, but for text files, dz80 is more powerful. As you disassemble, if you find out that you made a mistake (e.g. a label name), it's easier to correct it in the control file than all appearances in the whole listing, as there's usually just one place to change. Another advantage is that you don't have to break any copyrights if you distribute just the control file and let people with the ROMs do their own disassembly.

Here's an example control file to disassemble a bootleg version of PacMan: https://notabug.org/pgimeno/pacmanbl-dis - the project is paused because I have a more important one in my hands right now, but it will give you an idea of what a control file looks like. There's a legend at the bottom of the file.

It's been for years my tool of choice for every disassembly project that goes beyond simple inspection with the debugger. I used it with Thrust II to write the Thrust II Reloaded remake; also with Elite to make a Goat Soup generator, with Mazogs to understand the maze generator, with the Capitán Trueno loader to fix it for certain MSX models, and also with Wriggler, Android Two, Labirint, and now PacMan Bootleg, each for its own reasons.

By jepmsx

Expert (89)

jepmsx's picture

28-10-2021, 08:16

Thanks pgimeno for the good explanation of dz80, to learn how you use it it's been very helpful