First steps with MSX-Music

Page 1/2
| 2

By Metalion

Paragon (1179)

Metalion's picture

09-08-2020, 18:48

OK, I'd like to make a sort of "Hello world" with MSX-Music, but without using MSX-Music BASIC. So I can switch to assembler when I understood how it works. I opened in the emulator an MSX2 and inserted a FM-PAC cartridge.

I made this small program :

10 CALL MUSIC (0,0,1,1,1,1,1,1,1,1,1)
20 AD=&h7FF4:DAT=&h7FF5
30 POKEAD,&h30:POKEDAT,&h2F:' Instrument 2, volume 15
40 POKEAD,&h10:POKEDAT,216:' F-number LSB = 216
50 POKEAD,&h20:POKEDAT,&b00001000:' Octave = 4, F-number MSB = 0
60 POKEAD,&h20:POKEDAT,&b00011000:' +Key on

This produces no sound at all ...
I've tried before that using the I/O ports &h7C/&h7D but the result was the same.
I thought that either I/O or POKE would work, since the FM-PAC is inserted ...

What am I missing ?

Thanks.

Login or register to post comments

By Metalion

Paragon (1179)

Metalion's picture

09-08-2020, 23:15

No one ?

I just need a snippet of code showing me how to make a simple music note with MSX-Music. I know about the detection procedure, but I'm more interested about what happens after.

By Grauw

Ascended (9282)

Grauw's picture

10-08-2020, 00:21

The volume and level values on Yamaha FM chips are actually attenuation amounts. Where 15 means max attenuation (almost silent) while 0 means no attenuation (max volume).

p.s. There is no need to set key-on separately from f-num/block .

By Parn

Hero (603)

Parn's picture

10-08-2020, 03:25

I'd suggest using _AUDREG instead of poking &H7FF4 and &H7FF5. Don't these mean that these addresses must be visible on the FM-PAC slot? It would be impossible to use them from BASIC. You could use OUT instead, but _AUDREG is cleaner.

By Metalion

Paragon (1179)

Metalion's picture

10-08-2020, 10:28

Thanks to both your comments, this program did the job :

10 _MUSIC (0,0,1,1,1,1,1,1,1,1,1)
20 _AUDREG (16,216)
30 _AUDREG (48,&h20)
40 _AUDREG (32,&b00011000)

And it worked also using I/O ports.

Thanks !

By Grauw

Ascended (9282)

Grauw's picture

10-08-2020, 11:05

p.s. The memory-mapped I/O at 7FF4H and 7FF5H is only available on the original FM-PAC, the MSX-MUSIC standard and FM-PAC clone cartridges do not support it (a little unfortunately).

By DarkSchneider

Paladin (938)

DarkSchneider's picture

10-08-2020, 11:09

When moving to ASM, remember that there is not only detection but initialization requirements.

By Metalion

Paragon (1179)

Metalion's picture

10-08-2020, 18:32

DarkSchneider wrote:

When moving to ASM, remember that there is not only detection but initialization requirements.

What do you mean specifically?

By Grauw

Ascended (9282)

Grauw's picture

10-08-2020, 20:17

If you detect an FM-PAC, you need to set bit 0 of address #7FF6 to enable the I/O ports (disabled by default to allow multiple FM-PACs). Further explanation here here. Example code including detection following the MSX Datapack advice here.

By Briqunullus

Master (147)

Briqunullus's picture

11-08-2020, 09:28

Funny. I had always assumed FM-PAC cartridges would be I/O only, just like the Philips Music Module. However, that memory mapped I/O on the original FM-PAC is very clever indeed.

Just wondering. Because of that detection routine, even clones wouldn't work in an I/O only slot, would they?

By Grauw

Ascended (9282)

Grauw's picture

11-08-2020, 09:56

That’s correct.

Page 1/2
| 2