FM register log

Page 1/2
| 2

By iamweasel2

Paladin (678)

iamweasel2's picture

29-11-2020, 01:08

In openMSX, we have a nice script, called PSG_LOG . It allows us to dump the contents of the register to a file. Altough the size is not optimal, this content can easily be loaded to be played inside an ASM program.

Is there something similar to FM ? Is there an script or command to dump the registers and play the data written in a file in the same way we can do with PSG_LOG ?

Login or register to post comments

By Grauw

Ascended (9683)

Grauw's picture

29-11-2020, 01:51

Use the VGM recording function.

Quote:

vgm_rec Record the music played by PSG, MSX-MUSIC, MSX-AUDIO, OPL4 and SCC into a VGM file

https://openmsx.org/manual/commands.html

By iamweasel2

Paladin (678)

iamweasel2's picture

29-11-2020, 05:52

Grauw wrote:

Use the VGM recording function.

Quote:

vgm_rec Record the music played by PSG, MSX-MUSIC, MSX-AUDIO, OPL4 and SCC into a VGM file

https://openmsx.org/manual/commands.html

This is a good solution, but unfortunately, I don't have a VGM replayer to be used in my softwares... I wanted to get the dump and use it in some demos. :(

By Manuel

Ascended (17691)

Manuel's picture

29-11-2020, 10:01

There's a generic reg_log command... It logs in ASCII format, so you probably want to post process the output.

By Grauw

Ascended (9683)

Grauw's picture

29-11-2020, 13:03

iamweasel2 wrote:

This is a good solution, but unfortunately, I don't have a VGM replayer to be used in my softwares... I wanted to get the dump and use it in some demos. Sad

The VGM format is a register dump format as well, so it is easy to convert to whatever you need.

By iamweasel2

Paladin (678)

iamweasel2's picture

29-11-2020, 13:40

Grauw wrote:
iamweasel2 wrote:

This is a good solution, but unfortunately, I don't have a VGM replayer to be used in my softwares... I wanted to get the dump and use it in some demos. Sad

The VGM format is a register dump format as well, so it is easy to convert to whatever you need.

Does it work in the same way as the .psg format ? I found the .psg format really easy to use, the demo I posted in the topic "just from fun" was done getting the output from VGMPlay using the PSG_LOG script.

In .PSG format, if you read FF, you wait for the next interrupt. Otherwise, you simply got the register to be written, and the next byte is the value, so you send them to wrtPSG Bios function. It is really easy to play it in MSX.

With FM can I work in the same way or there are other problems involved? Can FM musics be played in the same way as it is possible with PSG music?

Another thing, when you get FM musics from Master System, what kind of post processing is required in order to play them in MSX?

Ha, your VGMPlay is amazing, congratulations for this great software. Smile

By Grauw

Ascended (9683)

Grauw's picture

29-11-2020, 14:08

The VGM format is:

  1. A header with information about the chips.
  2. A series of commands.
    An AY-3-8910 write looks like A0 rr vv.
    An YM2413 write looks like 51 rr vv.
    A wait looks like 61 nn nn (in steps of 1/44100 s).
    The end of sound data is marked with command code 66.

There’s not much more to it. Well there’s a few more things to it, but for the VGM files output by openMSX the header size is always 100H bytes, and it only uses the 61H wait codes.

You should not use this format directly for your MSX replayer, but the files are very easy to process and convert in a script to something like the .PSG format you described.

By iamweasel2

Paladin (678)

iamweasel2's picture

29-11-2020, 14:02

Manuel wrote:

There's a generic reg_log command... It logs in ASCII format, so you probably want to post process the output.

This is no problem (processing the output) but I wonder, if I log the FM registers, will I be able to play the music in the same way as I do with the PSG_LOG script?

By Grauw

Ascended (9683)

Grauw's picture

29-11-2020, 14:23

The only thing you should consider is that the FM chip has minimum access time restrictions, so don’t write the register address & values too fast, respect the timings described in the application manual (p. 4). Test on a real machine with a real YM2413 chip, emulations don’t implement this properly.

By iamweasel2

Paladin (678)

iamweasel2's picture

29-11-2020, 14:45

Grauw wrote:

The only thing you should consider is that the FM chip has minimum access time restrictions, so don’t write the register address & values too fast, respect the timings described in the application manual (p. 4). Test on a real machine with a real YM2413 chip, emulations don’t implement this properly.

But the minimum access time is the same no matter what are you doing? I mean, if I wait x cycles before each write, it will work no matter what data I'm sending (without compromising the music, of course) ?

By Grauw

Ascended (9683)

Grauw's picture

29-11-2020, 15:08

Writing the address and writing the value have different wait requirements, but other than that, indeed for the YM2413 it does not matter which register you write to or what value you write.

Page 1/2
| 2