Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Working on a project making sound in arcade games and Sega games

Reply to topic
Author Message
  • Joined: 06 Mar 2018
  • Posts: 1
Reply with quote
Working on a project making sound in arcade games and Sega games
Post Posted: Tue Mar 06, 2018 6:33 am
I'm working on a project which uses the Texas Instruments SN76489 ()integrated circuit, which was used to make sound in arcade games and Sega games from the 80's and 90's, I believe. I made a similar project with the Yamaha YM2612m which is the main sound chip from the Sega Genesis, and I have that project fully up and running and can play through vintage Sega sounds on a midi keyboard, up to 6 notes at a time. Probably not a huge deal to you guys but its the biggest project I have done so far.

So I am now working with the SN76489 and am having some issues. The way it works is that it has 8 internal 8-bit registers, and these are controlled via an 8-bit bus of data pins on the IC. In order to write data to these registers, the data is written to the pins of the IC (d0 to d7) and a separate write enable pin which is active low (/wr) gets flashed from a logic high to a logic low, and this latches the data from the data bus into the chip. Just going over things for the record.

So here is the issue I am having: I cannot seem to reliably load data into the chip on purpose. To test it out, I wrote a program which writes random values to the data pins, and then flashes that /WR pin low in order to write the data to the chip. It does this about 10 times per second, with the expected result being that the chip would generate random tones and noise sounds. And this part works absolutely as expected, so I know that my write function works, at least in this application.

However say, for example, I want to turn off channel 0. This is done by sending the byte 0b10011111) which sends the value "1111" to the attenuation register of channel 0. If I execute code which does this, and then execute the write command, it will not do what I expect it to do. 80% of the time it doens't do anything, and maybe the other 20% of the time it changes something unexpected like the frequency (pitch) of one of the other channels. I was able to get these commands working correctly briefly, but in order to do this, I had to loop that write command algorithm about 20 times in order to get it to work every time. Does anyone know why this might be?

I am very confused about several parts of this project because it seems like it should be quite simple so maybe I am quite an idiot lol. I am using a clock signal of 500 kHz (measured at 488 kHz) because I am using the SN76489N as opposed to the SN76489AN. I looked at my clock signal and it is very clean looking, and I feel that my error is somewhere in the execution of my code since it seems to work on the hardware level.

One last thing I am confused about is the READY pin (pin 5.) This pin is supposed to go high when the chip is ready to receive its next command (meaning, it has finished executing its last instruction.) However this never seems to be the case, as I put an LED on this pin and it seems to stay low the entire time, unless the current from this pin is not enough to power an LED. I should look at this under the scope. For now I have a 1.5 kΩ resistor pulling the pin down to ground, and I saw somebody explain on a forum somewhere (maybe this one actually) that this is an open-collector pin which is internally connected a 2.2kΩ resistance. I just know that the write commands will work 0% of the time if this pin is not pulled down with the resistor, but I have no idea why. I apologize if I seem very incapable to you guys, I know there are some very smart engineers on this forum.

So anybody who has worked with this chip or similar ones, I would very much appreciate some guidance from you although I do enjoy these projects and the inevitable banging my head on the desk until I can't feel my face anymore. This is the joy of engineering.


Thank you!
  View user's profile Send private message
  • Joined: 14 Apr 2013
  • Posts: 624
Reply with quote
Post Posted: Tue Mar 06, 2018 7:47 am
Have you already seen this post?:
http://www.smspower.org/forums/16698-HelpWithSn76489Chip#98499

It looks very similar to yours and it seems like he got it working in the end.
  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2013
  • Posts: 384
  • Location: Osaka
Reply with quote
Post Posted: Tue Mar 06, 2018 11:07 pm
texas instruments often uses a convention where D0 = most significant, D7= least significant. Check if you connected the data lines correctly (or flip the bytes before writing)
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!