Good news, everyone! I finally got this all up and running! I pulled sickie today and instead of going to work I stayed home and worked on the code. This is the first real 6502 coding I have done and my code is very simple and primative (I am too ashamed to post it just yet) but it seems to be working. Lots of little problems along the way of course.
The circuit is simple. The 6502 controls a 6522. I use the upper four bits on one port to select which audio chip to play the sampled audio from (I have three but in theory you could do 10) and the lower four bits to preload the starting address on my binary counter hooked up to the audio ROMs. Each ROM is basically broken into 16 one second blocks and I can choose which one to start playing from. Another bit on a VIA port simultaneously loads the upper address bits on the counter and clears the lower bits. The audio board has it's own clock so a further bit on the VIA is used to AND with this clock to start it playing. I did it this way (instead of the CPU or VIA generating the clock) just so I can manually vary the clock rate for the audio and hence the playback speed. Samples can go over the one second boundaries. To know when to stop playing I have a 8 input NAND on the ROM output. I code a FF into the sample as a stop bit. The NAND generates a pulse which I feed into an interrupt pin on the VIA. That interrupts the processor and I stop the playback and reset everything. That was the hardest part. I couldn't get it to play more than once at first but that was because I wasn't disabling the VIA interrupt inside the interrupt handler and I think it was then never getting past that code as it would just keep interrupting and never reset.
All the main code does is loop around storing a value for each chip and sample to play (15 different phrases in all). After storing each one it polls a button hanging off the VIA to see if it is pressed. If so it just plays whatever sample it just stored address info for. It then ignores button presses until the sample stops playing. Since the processor is loading and reloading all the addresses so much faster than the playing of the samples it is almost random as to what sample you get when you hit the button. Random enough for me anyway.
I know there are much better ways to achieve what I have done but the point was to use a 6502 in some way and, crude as it is, this definitely works and it has been fun building it too!
When I have put together a little web page about the entire Bender and his brain I will post a link to it here.
Simon
Introduction and 1541 problem
Slightly late and not actually finished yet but I started a web page for my Bender project.
http://www.asciimation.co.nz/bender/
The page should be working in Firefox but I think IE might be broken. The 6502 specific bits are about half way down if you don't want to read all the gumf!
The 6502 'brain' is complete though and working really well. I have had the circuit sitting and running for over a week at a time (off a plug pack, not batteries of course) and it works flawlessly.
The remote control is a simple ASK transmitter with the receiver connected to the 6502 via the 6522. I just look for a simple on/off signal rather than sending any data. The whole thing is pretty crude and total overkill really but it was built for novelty rather than practical reasons
I will post more details on the site when I have them all drawn up.
Simon
http://www.asciimation.co.nz/bender/
The page should be working in Firefox but I think IE might be broken. The 6502 specific bits are about half way down if you don't want to read all the gumf!
The 6502 'brain' is complete though and working really well. I have had the circuit sitting and running for over a week at a time (off a plug pack, not batteries of course) and it works flawlessly.
The remote control is a simple ASK transmitter with the receiver connected to the 6502 via the 6522. I just look for a simple on/off signal rather than sending any data. The whole thing is pretty crude and total overkill really but it was built for novelty rather than practical reasons
Simon
I'll try to get the circuit up there soon although it may have to be hand drawn then scanned in! It's basically the 1541 drive circuit minus one of the VIAs and with a different ROM chip. The audio part is more complicated though. The code is very simple.
A friend reported the site not working in IE7 but when I tried it at work just now it was fine. It also does work on 5.5 and 6 it seems.
Simon
A friend reported the site not working in IE7 but when I tried it at work just now it was fine. It also does work on 5.5 and 6 it seems.
Simon
I finally put up part of the circuit for my Bender brain. I found some free software online to draw it all up with. So far I have done the CPU board and posted a diagram of that and the source code to here:
http://www.asciimation.co.nz/bender/page2.html
It is all a bit of a hack really but it works. I know the code can probably be a lot better too
I will try to get the audio part of the circuit up there soon.
http://www.asciimation.co.nz/bender/page2.html
It is all a bit of a hack really but it works. I know the code can probably be a lot better too
I will try to get the audio part of the circuit up there soon.