Jump to content
IGNORED

Atari 7800XM and the Yamaha YM2151 sound chip


JonnyBritish

Recommended Posts

This evening went looking for information on the 2151 sound chip. I did not find anything about it apart from a yamaha doc that simply explained its characteristics.

I did find an interesting doc on the YM2612 which was used in the sega genesis and is described as being similar to the Y2151.

 

http://www.smspower.org/maxim/Documents/YM2612

 

Dont know if its useful as it relates to the YM2151 in the 7800XM but its an interesting read.

Link to comment
Share on other sites

The YM2151 datasheet is here :-

 

http://www.ionpool.net/arcade/gottlieb/technical/datasheets/YM2151_datasheet.pdf

 

If anybody finds a good tracker (like RMT on the A8s) that I can add to my list of 7800 projects then let me know.

 

 

Grooveybee,

 

 

I don't know how much you've played around with the YM2151, but maybe you can help with my question. The YM2151 user manual indicates it will take up to 68 clocks (at 3.5 mhz) for a write to the chip to be processed. This works out to be about 35 clocks of the 6502. To write a byte to the chip requires an address write and a data write. I don't know if this wait apply's to both.

 

My concern is that I will waste a lot of clock cycles waiting to write to the sound processor. For each note that I start, I need to write a note value and key on the channel. This means 4 writes (2 * address+data) for each note. In an 8 channel tune, this can add up fast. But my biggest concern is when I need to write the "instrument" data to setup a channel. Each channel has 28 bytes of parameter data to define. 28 bytes * 2 writes per byte * 35 clocks is a whopping 1960 clocks of the 6502. That's a lot of time to waste while waiting for the status bit to toggle. This could be done during game initialization, but would limit the number of instruments if they can't be changed on the fly during a tune. Maybe I'm missing something here and this isn't really an issue. I'm hoping that this 68 clocks is just a worst case number and that in use it will average out to something much lower.

 

Am I mis-interpreting this spec?

 

post-24519-129830381372_thumb.jpg

 

Perry

Link to comment
Share on other sites

I don't know the answer to your question but I suspect that changing 8 instruments, 50-60 times per second would be quite a complex music track. Anything complex is going to have CPU overhead. So, if it was me I'd probably play tracks like that on static screens like the title page or high score chart where CPU cycle time isn't such an issue.

Link to comment
Share on other sites

I don't know the answer to your question but I suspect that changing 8 instruments, 50-60 times per second would be quite a complex music track. Anything complex is going to have CPU overhead. So, if it was me I'd probably play tracks like that on static screens like the title page or high score chart where CPU cycle time isn't such an issue.

 

I assume as part of the main program you would simply play the music during VBLANK?

 

In terms of code samples, one showing how to play 8 notes would be a great start.

 

Actually playing music wuld be agreat first app for people new to 7800, no need to worry about the screen, create 6502 code to play a tune!!

 

Does the emulator for 7800 have support for this new sound chip?

Link to comment
Share on other sites

50-60 times per second would be quite a complex music track.

 

Huh? Don't think I suggested that. But if I'm running in-game music during the vertical blank and I should have more than a few instruments change at the same time, it won't be difficult to exceed the time that's available to me. It all depends on how much other game code would be running in the VBL. Is a glitch in a single frame invisible? If so, then I won't worry too much.

Edited by tep392
Link to comment
Share on other sites

Is it just me or do the audio samples not sound much better than the often maligned Yamaha sound chip found in the Atari ST? Other than Haunted Castle, the music isn't that great. I guess my flawed memory that makes me think the Atari Games titles that used the same chip sounded less "Yamaha'ie" - and more "Atari'ie" - than those examples...

Link to comment
Share on other sites

I was thinking that I would somehow interfere with the screen being redrawn. But Maria would take over and draw the screen anyway, right? And any dli's that were started would just interrupt the late running VBL code. So I suppose there would only be an issue if the DLI's were dependent on some calculations being performed during the vertical blank. Running the sound last would probably make sense. At worst a few notes might start a fraction of a second late if the code was to run into the start of the screen redraw.

Edited by tep392
Link to comment
Share on other sites

Wow - that's a MASSIVE upgrade over the TIA :) The SDI music is really nice.

Link to comment
Share on other sites

The YM2151 user manual indicates it will take up to 68 clocks (at 3.5 mhz) for a write to the chip to be processed. This works out to be about 35 clocks of the 6502. To write a byte to the chip requires an address write and a data write. I don't know if this wait apply's to both.

 

My concern is that I will waste a lot of clock cycles waiting to write to the sound processor. For each note that I start, I need to write a note value and key on the channel. This means 4 writes (2 * address+data) for each note. In an 8 channel tune, this can add up fast. But my biggest concern is when I need to write the "instrument" data to setup a channel. Each channel has 28 bytes of parameter data to define. 28 bytes * 2 writes per byte * 35 clocks is a whopping 1960 clocks of the 6502. That's a lot of time to waste while waiting for the status bit to toggle.

 

I think you'd want to interleave the YM2151 access with other operations, thus spreading out your writes instead of trying to do them all at once. Inconvenient but from what you're saying it sounds like it would waste a lot of time to wait for each write to be committed. During the display you could use DLI's for this. If you want to do your writes during VBlank, then you'd have to manually multitask it with game logic or whatever.

example:

jsr updateYM

<some physics>

jsr updateYM

<some more physics>

jsr updateYM

<etc>

 

updateYM() would read from a buffer of pending writes. You could quickly dump data into the buffer and go on to something else. Over time, the updateYM() calls would gradually send this data to the chip.

updateYM() would still need to check that the YM is ready before attempting a new write, but as long as it isn't called too quickly then busy waiting would be minimized.

Link to comment
Share on other sites

Would be almost worth having the XM have a small FIFO to drive the YM chip with to allow rapid stuffing of registers.. I looked into using the CBM Sound Expander to add support for that to something, and the only big downer was these same delays needed between writes which was massively off putting to say the least..

 

Also worth remembering that the Sharp X68000 (and some MSX carts) used the YM2151 and some of the music on that is really really really impressive :)

 

There's a whole gamut of Adlib/FM trackers out there in chip music land, and I'm sure one of them would be easily suited to supporting the YM2151, not that any of them do at the moment to my knowledge.. And even if someone decided to write one, AdlibTracker itself wouldn't be a bad starting point for what to aim for..

 

As an aside, there's many people out there looking for tools to compose for the YM2151 outside of XM land, so possibly 2 (or more) birds could be killed with one stone here..

 

 

 

 

Link to comment
Share on other sites

  • 1 month later...

Hello all,

 

although I am not a musician,I am interested in the YM2151 from a technical point of view.Many registers to experiment with.

I would like to add that the YAMAHA CX5M MSX computer had an extension with MIDI/KEYBOARD and a YM2151 stereo output.You can

find things about it here: http://www.cx5m.net/techn.htm and here: http://home.online.no/~eiriklie/CX5MFAQ.html#midiaccess

for example.The roms of the extension are also available and can be used with the bluemsx emulator (but without music!).

The SFG-05 rom has 46 Programmed Instruments.It is not difficult to find them in the rom ($3680..$3F80) but I have not

found out the format of the data except for the instrument name.Some Z80 disassembly has to be done,but it is not strait forward.

They make heavy use of IRQs in IM1 and IM2 and I think they also use dynamic jump tables.It is not easy but with the breakpoint feature

of the emulator some things can be found...

This could be some starting point to have some data to play with.The service manuals of the CX5M are also available online.

They also never poll the YM2151 directly,it is somehow in all this IRQ handling! But they also have code that writes addr and data

in the registers without waiting.Maybe this is depending on the register that is written to.I unfortunately do not own one CX5M but

bought a YM2151/YM3012 and NJM4456 to try to tinker a bit.The CX5M manuals have the circuit diagrams inside.

 

I am also interested in the implementation inside the XM:

 

- What will be the operating frequency of the YM ? (YAMAHA recommends 3,5795MHz)

- The YM has two visible register,where will they be in the address range ?

- Will the YM use IRQs ? if so will they be shared with the pokey ?

 

- Will the XM use the YM3012 (stereo) or the YM3014 (mono) D/A converter ?

- Will it have separate stereo outputs (if stereo) or will it mixed onto the audio pin of the cart ?

 

Thank you for reading and your opinion,

Vassilis

Link to comment
Share on other sites

Hello all,

 

although I am not a musician,I am interested in the YM2151 from a technical point of view.Many registers to experiment with.

I would like to add that the YAMAHA CX5M MSX computer had an extension with MIDI/KEYBOARD and a YM2151 stereo output.You can

find things about it here: http://www.cx5m.net/techn.htm and here: http://home.online.no/~eiriklie/CX5MFAQ.html#midiaccess

for example.The roms of the extension are also available and can be used with the bluemsx emulator (but without music!).

The SFG-05 rom has 46 Programmed Instruments.It is not difficult to find them in the rom ($3680..$3F80) but I have not

found out the format of the data except for the instrument name.Some Z80 disassembly has to be done,but it is not strait forward.

They make heavy use of IRQs in IM1 and IM2 and I think they also use dynamic jump tables.It is not easy but with the breakpoint feature

of the emulator some things can be found...

This could be some starting point to have some data to play with.The service manuals of the CX5M are also available online.

They also never poll the YM2151 directly,it is somehow in all this IRQ handling! But they also have code that writes addr and data

in the registers without waiting.Maybe this is depending on the register that is written to.I unfortunately do not own one CX5M but

bought a YM2151/YM3012 and NJM4456 to try to tinker a bit.The CX5M manuals have the circuit diagrams inside.

 

I am also interested in the implementation inside the XM:

 

- What will be the operating frequency of the YM ? (YAMAHA recommends 3,5795MHz)

- The YM has two visible register,where will they be in the address range ?

- Will the YM use IRQs ? if so will they be shared with the pokey ?

 

- Will the XM use the YM3012 (stereo) or the YM3014 (mono) D/A converter ?

- Will it have separate stereo outputs (if stereo) or will it mixed onto the audio pin of the cart ?

 

Thank you for reading and your opinion,

Vassilis

 

 

Where did you buy these?

 

YM2151/YM3012 and NJM4456 to try to tinker a bit.

Link to comment
Share on other sites

There are some VST out there that emulates the 2151, but I don't know if you could actually used them as legitamit files on actual 2151 hardware. I've looked at the Yamaha DX series keyboards to see if there are any sequencers or trackers out there that can run a DX keyboard because if it can run a DX, it could possibly run a 2151 based hardware like the XM. There is a way to interface a DX keyboard via "midi to USB," however I don't know the software to use that would make it work. There's also thousands of custom made sounds for the 2151 or any other yamaha DX keyboard that are out there. I don't know enough to really do anything; I've been trying to get my hands on a cheap DX keyboard, which is very hard to find even on Ebay.

Link to comment
Share on other sites

Hello all,

 

@jonny:I have bought them at: http://www.littlediode.com/components/home.php

Not very cheap but the chips are in new condition.I think they are NOS (New Old Stock).

I have not tried them out,but I have some free time until the weekend and hope to be able

to do some register access...

I had made an error in my last posting,the OPAs are the NJM4556AD and NJM4558AD.

 

@philipj:Thank you for your opinion.I have searched a bit more and also found the

FB-01 FM sound generator.The DX series keyboards are nice,but I can not play piano :-\

I will search and take a look at them,also I have to learn more about the MIDI technic and protocoll.

 

I have also found an "Arduino FM-SynthYM2151Shield" on youtube.The creator of this has also

written a library " http://www.ooishoo.org/ym2151shield/ym2151library " to access the chip,so

this maybe can also be used for experimenting.

 

Greetings,

Vassilis

Link to comment
Share on other sites

  • 1 month later...

http://www.youtube.com/watch?v=Rhn2q1bCAIg&feature=channel_video_title

 

Here's a neat little OP3 sequence... I wonder what program this guy was using?

 

 

http://www.youtube.com/watch?v=DG1_uHfa9Eo&NR=1

 

Here's a nice looking tracker I just ran into... I haven't personally tried it but it looks very promising. Give any feedback for anyone who's tried it already... Check out the link below.

 

Adlid Tracker II Homepage

 

You'll need DOSbox for this one.

Edited by philipj
Link to comment
Share on other sites

I just took a quick look-see at the Adlid Tracker 2 using "Dos-box" and found the program to be typically old-school dos. For those who still enjoy the wonders of DOS environments will find this program to be absolutely fabulous especially the Atari 8 dos tinkerers. It's all about knowing and remembering keyboard commands and I do mean memorization. There is definitely a learning curb to this program; it seems that it's going to take a little time to get to know this one. The source code is available for anyone that wants to put this program in a Windows environment to actually make a mouse useful??? There's definitely room for improvement with this one, but it looks like a goody so far despite its age.

  • Like 1
Link to comment
Share on other sites

I guess it would be balancing act getting the 6502 to run the pokey, the TIA, and the YM2151 while running graphics and logic in a video game and getting over the halt option for the 6502 to run the Maria. At least with the old atari system 1 arcade machines, they had the 68000 to do all of the game logic and what have you with the 6502 as an assistant for sound production. It would be all on the 6502 with the Atari 7800 XM to do everything.

Edited by philipj
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...