Hello All,
I recently have had a desire to create a (very) simple 6502 computer, for fun and learning, which I am sure that many here share...
I am a decent programmer, and have a practical knowledge of electronics, so its mostly the fundamentals of a discrete computer that I will be learning in this project.
I want to keep things simple (KISS) to start with but there are a few aspects of my initial design that I need some guidance in.
For my initial design, I would ideally like to leverage only 3 chips, the R65C02, 64k SRAM, and an Arduino Nano (Microcontroller).
The SRAM will cover the entire address space of the R65C02, so I don't have to worry yet about address decoding.
The SRAM will act as both the RAM space and ROM of more conventional designs.
The Arduino Nano will be controlled via the PCs (USB) serial port, and will be used to manipulate the contents of the SRAM to load programs, and echo back the SRAM's state to verify the computers operation.
The Arduino will also provide the 1MHz clock for the processor.
This leads to my first uncertainty, as this design seems to need a shared address and data bus between the 6502 and the Arduino.
From the data sheets I understand that the 6502 cant set the address bus into a high impedance mode, which will lead to bus contention.
It seems that the BE (bus enable) pin is only present on the (65102?), which would have been ideal.
Can anyone point me in a good direction here with this problem? I would rather not increase the complexity by using extra chips (74ACT245) to interface the 6502 to the bus.
The most simple solution in my mind is to simply power down the 6502 when the Arduino wants to take control of the SRAM. Would this release the 6502's grip on the address and data lines?
May this damage the 6502 if its address/data pins are raised to 5v while its Vdd is at 0v or floating?
I have almost all the parts I should need here, so this seems to be the only hurdle that I can see.
I would very much appreciate some expert advice in this area, and please point out anything I seem to have misunderstood, or share alternative/better ideas with me.
Thanks.
Simple 6502 computer, some BUS questions?
Re: Simple 6502 computer, some BUS questions?
I don't think the Arduino Nano has enough IO pins to drive the clock, reset, bus enable of the 65c02 and the address and data busses of the RAM.
And no, you can't turn off the 65C02 while accessing the bus from another controller. You can keep it in reset state instead. A 65C02S from WDC would have the bus enable pin as another option.
And no, you can't turn off the 65C02 while accessing the bus from another controller. You can keep it in reset state instead. A 65C02S from WDC would have the bus enable pin as another option.
6502 sources on GitHub: https://github.com/Klaus2m5
Re: Simple 6502 computer, some BUS questions?
Klaus2m5 wrote:
I don't think the Arduino Nano has enough IO pins to drive the clock, reset, bus enable of the 65c02 and the address and data busses of the RAM.
You are right, and I knew I would be very tight on pins, but I haven't looked at exactly how many are needed, since I cant get my head around the bus control aspect of the design.
I will most likely have to use a shift register, which in some ways seems a clean approach to interfacing the Arduino to the ram and doesnt increase the complexity much.
That still doesn't resolve that I am unsure about how the 6502 can be decoupled from the address and data bus to allow to Arduino to access the ram.
Klaus2m5 wrote:
You can keep it in reset state instead.
Re: Simple 6502 computer, some BUS questions?
Quote:
Will that make both the address bus and the data bus high impedance? That would be perfect if that is the case.
6502 sources on GitHub: https://github.com/Klaus2m5
Re: Simple 6502 computer, some BUS questions?
Klaus2m5 wrote:
(put a weak pull up or pull down on the bus and see, if the pin can be pulled low or high during reset).
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Simple 6502 computer, some BUS questions?
Pukuhaha wrote:
I recently have had a desire to create a (very) simple 6502 computer, for fun and learning, which I am sure that many here share...as this design seems to need a shared address and data bus between the 6502 and the Arduino.
The procedure to get the 65C02 to relinquish control is to first assert RDY (low true) to halt further processing. When Ø2 goes high, the MPU will stop on the current instruction. At that time you would assert BE to "disconnect" the MPU from the buses. You would then enable the Arduino. After the Arduino has completed its work you would get it off the buses and then de-assert the MPU's BE input. Once BE has been deasserted you would de-assert RDY, causing the 65C02 to resume processing.
Timing is everything with this sort of arrangement, so carefully think it through before you start designing the actual circuit.
Also, I recommend you use a TTL can oscillator to generate your 1 MHz Ø2 clock, and clock the Arduino from it as well. This arrangement will allow you to change the Ø2 clock without having to reprogram the Arduino.
x86? We ain't got no x86. We don't NEED no stinking x86!
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Simple 6502 computer, some BUS questions?
Quote:
It seems that the BE (bus enable) pin is only present on the (65102?), which would have been ideal.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Simple 6502 computer, some BUS questions?
BigDumbDinosaur wrote:
Also, I recommend you use a TTL can oscillator to generate your 1 MHz Ø2 clock, and clock the Arduino from it as well. This arrangement will allow you to change the Ø2 clock without having to reprogram the Arduino.
Re: Simple 6502 computer, some BUS questions?
Klaus2m5 wrote:
Quote:
Will that make both the address bus and the data bus high impedance? That would be perfect if that is the case.
Shift to the left,
Shift to the right,
Mask in, Mask Out,
BYTE! BYTE! BYTE!
Shift to the right,
Mask in, Mask Out,
BYTE! BYTE! BYTE!