Introduction and 1541 problem

For discussing the 65xx hardware itself or electronics projects.
Simon
Posts: 155
Joined: 16 Apr 2007
Location: Auckland, New Zealand
Contact:

Post by Simon »

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
Simon
Posts: 155
Joined: 16 Apr 2007
Location: Auckland, New Zealand
Contact:

Post by Simon »

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
User avatar
HansO
Posts: 206
Joined: 31 Oct 2003

Post by HansO »

Simon,

The web site shows fine (IE6). Good story, great result!

Seeing the details of the 6502 system would be nice!

Hans
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

You put way more detail into that project than I ever expected. :) Awesome! I forwarded the URL to a beer-fanatic friend of mine who also is a Futurama fanatic too. :)
Simon
Posts: 155
Joined: 16 Apr 2007
Location: Auckland, New Zealand
Contact:

Post by 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
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

Just one more reason to stay as far away from IE 7 as possible -- it's even less standards compliant than any of its predecessors.

I stick with Firefox and Opera personally, and your site is perfectly fine to me.
Simon
Posts: 155
Joined: 16 Apr 2007
Location: Auckland, New Zealand
Contact:

Post by Simon »

I generally get things working in Firefox first. Then spend a little time (not too much though) getting it to work on IE. If anyone complains I tell them to use FF!

Will try to draw up the circuit diagrams today and post them soon.
Simon
Posts: 155
Joined: 16 Apr 2007
Location: Auckland, New Zealand
Contact:

Post by 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.
VBR
Posts: 25
Joined: 29 May 2007

Post by VBR »

Bravo. Well done.

Do you know what other famous robot has the same 'brain'?

I'll be back later to check your answer.
Simon
Posts: 155
Joined: 16 Apr 2007
Location: Auckland, New Zealand
Contact:

Post by Simon »

VBR wrote:
Bravo. Well done.

Do you know what other famous robot has the same 'brain'?

I'll be back later to check your answer.
No idea? And if I try Googling for it I just get back to my own site!
VBR
Posts: 25
Joined: 29 May 2007

Post by VBR »

Simon wrote:
VBR wrote:
Do you know what other famous robot has the same 'brain'?

I'll be back later to check your answer.
No idea? And if I try Googling for it I just get back to my own site!
The Terminator (1984 model)
Simon
Posts: 155
Joined: 16 Apr 2007
Location: Auckland, New Zealand
Contact:

Post by Simon »

Oh yeah, I remember that now! You see the assembly language when getting a Terminators eye view :)
Post Reply