Jump to content

Photo

Atari 7800XM and the Yamaha YM2151 sound chip


45 replies to this topic

#1 JonnyBritish OFFLINE  

JonnyBritish

    Moonsweeper

  • 383 posts
  • Location:Montgomery, IL

Posted Sun Feb 20, 2011 10:04 PM

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....ocuments/YM2612

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

#2 ApolloBoy OFFLINE  

ApolloBoy

    Quadrunner

  • 5,335 posts
  • Location:San Jose, CA

Posted Mon Feb 21, 2011 12:13 AM

For those who don't know, this is what the YM2151 is capable of:





#3 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 7,938 posts
  • Busy bee!
  • Location:North, England

Posted Mon Feb 21, 2011 3:50 AM

The YM2151 datasheet is here :-

http://www.ionpool.n...1_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.

#4 tep392 ONLINE  

tep392

    Stargunner

  • 1,240 posts
  • Location:Chicagoland

Posted Mon Feb 21, 2011 9:58 AM

The YM2151 datasheet is here :-

http://www.ionpool.n...1_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?

busyflag.JPG

Perry

#5 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 7,938 posts
  • Busy bee!
  • Location:North, England

Posted Mon Feb 21, 2011 10:40 AM

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.

#6 JonnyBritish OFFLINE  

JonnyBritish

    Moonsweeper

  • Topic Starter
  • 383 posts
  • Location:Montgomery, IL

Posted Mon Feb 21, 2011 11:06 AM

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?

#7 tep392 ONLINE  

tep392

    Stargunner

  • 1,240 posts
  • Location:Chicagoland

Posted Mon Feb 21, 2011 11:42 AM

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, Mon Feb 21, 2011 11:52 AM.


#8 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 7,938 posts
  • Busy bee!
  • Location:North, England

Posted Mon Feb 21, 2011 12:27 PM

Huh? Don't think I suggested that.


My mistake. I was assuming you'd be worried about the time to change all the channels simultaneously.

Is a glitch in a single frame invisible? If so, then I won't worry too much.


What do you mean by a glitch?

#9 Lynxpro OFFLINE  

Lynxpro

    Stargunner

  • 1,747 posts
  • Location:Sacramento, CA

Posted Mon Feb 21, 2011 1:17 PM

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...

#10 tep392 ONLINE  

tep392

    Stargunner

  • 1,240 posts
  • Location:Chicagoland

Posted Mon Feb 21, 2011 1:20 PM

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, Mon Feb 21, 2011 1:21 PM.


#11 Stephen OFFLINE  

Stephen

    River Patroller

  • 4,776 posts
  • A8 Gear Head
  • Location:Akron, Ohio

Posted Mon Feb 21, 2011 4:19 PM

For those who don't know, this is what the YM2151 is capable of:
http://www.youtube.com/watch?v=WbpWj6dQGAA
http://www.youtube.com/watch?v=I3KosIu3tVg
http://www.youtube.com/watch?v=yDdIecdqp1g
http://www.youtube.com/watch?v=R6gVdBD7zrQ

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

#12 gdement OFFLINE  

gdement

    Stargunner

  • 1,766 posts
  • Location:Northern CA

Posted Mon Feb 21, 2011 11:55 PM

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.

#13 andym00 OFFLINE  

andym00

    Stargunner

  • 1,036 posts
  • Location:A geordie cowfield...

Posted Tue Feb 22, 2011 6:58 AM

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..





#14 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 7,938 posts
  • Busy bee!
  • Location:North, England

Posted Tue Feb 22, 2011 7:27 AM

Would be almost worth having the XM have a small FIFO to drive the YM chip with to allow rapid stuffing of registers..


There's no space for a FIFO. It'll boil down to the developer making best use of the resources at hand (as per usual ;)) in their game.

#15 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 7,938 posts
  • Busy bee!
  • Location:North, England

Posted Tue Feb 22, 2011 7:32 AM

I forgot to add that the YM2151 user manual is on this page :-

http://www.neillcorlett.com/reference/

Its a load of *.jpg images in a zip file.

#16 nichtsnutz OFFLINE  

nichtsnutz

    Space Invader

  • 16 posts
  • Location:Germany

Posted Wed Mar 23, 2011 1:35 PM

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.n...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

#17 JonnyBritish OFFLINE  

JonnyBritish

    Moonsweeper

  • Topic Starter
  • 383 posts
  • Location:Montgomery, IL

Posted Wed Mar 23, 2011 4:29 PM

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.n...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.

#18 philipj OFFLINE  

philipj

    Moonsweeper

  • 336 posts
  • Location:Birmingham, Alabama

Posted Wed Mar 23, 2011 8:02 PM

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.

#19 nichtsnutz OFFLINE  

nichtsnutz

    Space Invader

  • 16 posts
  • Location:Germany

Posted Thu Mar 24, 2011 6:00 AM

Hello all,

@jonny:I have bought them at: http://www.littledio...onents/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.o...d/ym2151library " to access the chip,so
this maybe can also be used for experimenting.

Greetings,
Vassilis

#20 candle OFFLINE  

candle

    River Patroller

  • 2,762 posts
  • Location:Lublin, Poland

Posted Mon May 16, 2011 2:11 PM

hi

any of You happends to have any CYM files i could play on real thing?
I've got YM2151 connected to AVR up and running, but nothing that would i call worth of listening to

#21 philipj OFFLINE  

philipj

    Moonsweeper

  • 336 posts
  • Location:Birmingham, Alabama

Posted Thu May 19, 2011 3:32 PM

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, Thu May 19, 2011 3:59 PM.


#22 philipj OFFLINE  

philipj

    Moonsweeper

  • 336 posts
  • Location:Birmingham, Alabama

Posted Thu May 19, 2011 9:58 PM

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.

#23 ATARI7800fan OFFLINE  

ATARI7800fan

    Dragonstomper

  • 726 posts
  • Location:Plymouth,IN

Posted Thu May 19, 2011 10:43 PM

This is going to give the system excellent sound capabilities.

#24 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 7,938 posts
  • Busy bee!
  • Location:North, England

Posted Fri May 20, 2011 6:16 AM

This is going to give the system excellent sound capabilities.


Not until there is a 6502 playback routine. The minimum spec of the playback PC for the tracker above is pentium class so a 1.79MHz 6502 might not be able to handle the file format.

#25 philipj OFFLINE  

philipj

    Moonsweeper

  • 336 posts
  • Location:Birmingham, Alabama

Posted Fri May 20, 2011 7:41 AM

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, Fri May 20, 2011 8:05 AM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users