Sound chip, video circuitry, and more address decoding: 6502 computer part 2
I had a theoretically working computer by the end of the last entry. It could input and output binary data to and from RAM, ROM, a 65C22, and some LEDs. I was heavily considering a form of video output and keyboard input, and settled on using the Motorola MC6847 for the former, and was undecided about the latter. I decided to think of a list of things I wanted to add onto the computer (from most to least important), and here it is:
PS/2 Keyboard
Another 65C22
Some sort of sound chip
Dedicated Video RAM
RS232 serial I/O capability
Assembly language and BASIC programming
External Character ROM
I set out to achieve these goals and so far completed three of them.
For the sound chip I decided on the Yamaha YM3812. It's kind of out of place on a computer so crude, but it's cheap and easy to find. I originally wanted to connect everything (data and control bits) to the 65C22, but decided against it. I need it for more important things. Now it is independent and has its own separate address space just above the second 65C22. IRQ pin is connected to IRQ on the 65C02, The Write pin to the RW pin on the 65C02, and Read pin to the RW pin on the 65C02 through and inverter. Clock is shared with the video circuitry since both need a 3.58MHz clock. It takes up a whopping one bit of address space, and since it shares the 4 most significant bits with the 65C22s, address decoding is piggybacked on top of the 65C22s'.
Speaking of which, I added second one just above the first one. Each use a nybble of address space.
I sacrificed two expansion slots to add 8k of dedicated video RAM. I needed the 65C02 to only write to it when the MC6847 wants it to. I used an 8 bit D flip-flop with the Clock pin connected to the R/W pin on the 65C02 through an inverter and the Output Enable (active low) pin connected to the Horizontal Sync and Field Sync (both are active low) through an AND gate. The data inputs are connected to the data bus, and the outputs are connected to the 6264. I'll use two more 8 bit D flip-flops for the address pins. I also tied Write Enable (active low) high through a pullup resistor, and Read Enable (active low) to ground through a pulldown resistor. Write Enable is also connected to HS and FS of the MC6847 through an AND gate, and Read Enable receives the same signal except through an inverter. I also connected the MS pin (not sure what the MS stands for) on the MC6847 to HS and FS through an AND gate and an inverter. This pin, when low, sets the address pins on the MC6847 into high impedance state, so the video RAM can be controlled by the 65C02. So yeah, this is pretty complicated, but it's the best I could come up with. Let me know if there's a better way to do things.
All the 8 control bits on the MC6847 is connected to one of the 65C22s. Now graphics capability is already better than on a CoCo.
I should note that a lot of the audio circuitry is copied off the Commodore SFX Sound Expander and a minimal amount of the video circuitry is stolen from a TRS-80 CoCo. Mostly the amplification circuitry as I have no clue how those work.
This is the current schematics of the computer. It's been erased and redrawn in a lot of places and it's very messy. I plan on re-doing everything on a computer in the future. However, unless I'm mistaken, this combined with some code should mean a fully working computer. If it doesn't, it shouldn't be terribly complicated to figure something out. I would be the most suspicious of the D flip-flops between the processor and video RAM, since it's the most complex bit of circuitry on the computer and I came up with it.
This is the current memory map and address decode logic for each of the ICs. I tried to make everything as simple as possible, although perhaps the I/O portion might need some more work. I do plan on adding a parallel to UART IC (and of course a MAX232 on top of it) into the I/O portion, so we'll see how that goes.
Tomorrow, I will add a DB9 joystick port and that RS232 interface. The UART used in the RS232 interface may also be used for input and output to cassette. If I have time afterwards I'll begin programming the BIOS and a simple test program. A bit depressing that I won't be able to test and use this computer until much later... I want to log onto BBS with it, and program some games for it too!
Update: I scanned through the CoCo schematics and it seems that it uses a similar system. However, I use a 74LS374 since I need it to handle all the decoding, and the CoCo uses a 74LS273 (almost the same as the 74LS374 except it has a Clear pin instead of an Output Enable pin) and relies on the MC6883 multiplexer in many ways. I want to use one of those in my computer someday, but they seem really expensive these days. At least this means that my idea of using a D flip-flop for buffering data input to video RAM has been done before.
Update #2: Okay, I found someone who figured out how to interface IDE devices with an 8 bit computer using a latch and a multiplexer; now that I know it's possible I have to implement it. I'll probably use the lone expansion slot for this. I'll make an interface for a 40 pin HDD and 34 pin floppy drive. I don't know how IDE devices work yet, but I'll figure it out.
2 Comments
Recommended Comments