6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Sep 21, 2024 10:45 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Sun Feb 16, 2014 12:10 pm 
Offline

Joined: Sun Feb 16, 2014 10:39 am
Posts: 4
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.


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 16, 2014 2:32 pm 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
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.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 16, 2014 2:43 pm 
Offline

Joined: Sun Feb 16, 2014 10:39 am
Posts: 4
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.


I was under the impression that the 65c02 doesn't have a bus enable?

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.


Will that make both the address bus and the data bus high impedance? That would be perfect if that is the case.


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 16, 2014 3:18 pm 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Quote:
Will that make both the address bus and the data bus high impedance? That would be perfect if that is the case.


It will be for both busses, but I am currently unsure about wether older 65C02 will have this feature. The ones with BE will most certainly have it, but it is not documented in the data sheets. So you may have to experiment wether your 65C02 will release its busses or not (put a weak pull up or pull down on the bus and see, if the pin can be pulled low or high during reset).

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 16, 2014 4:49 pm 
Offline

Joined: Sun Feb 16, 2014 10:39 am
Posts: 4
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).


Ah that's a good idea, I will try that, thanks :)


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 16, 2014 10:41 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
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.

Considering that you want either the MPU or the Arduino to act as a bus master, I strongly recommend the use of the genuine WDC 65C02 (part number W65C02S6TPG-14, which is a DIP-40 package). The WDC part has the BE (bus enable) input, which when asserted (active low), causes the MPU to tri-state D0-D7, A0-A15 and RWB.

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!


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 17, 2014 9:10 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8510
Location: Southern California
Quote:
It seems that the BE (bus enable) pin is only present on the (65102?), which would have been ideal.

All current-production 65c02's have the BE input. See our "65xx parts sources" sticky topic for where to get them.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 19, 2014 2:16 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 588
Location: Michigan, USA
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.

If the Nano is similar to the PIC, it probably has the capability to change the clock without reprogramming. On the PIC, for example, you could use one of the PWM or Timer modules to generate the clock with a couple inputs connected to jumpers to easily select one of four different clock frequencies.


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 24, 2014 7:08 pm 
Offline
User avatar

Joined: Mon Dec 08, 2008 6:32 pm
Posts: 143
Location: Brighton, England
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.


It will be for both busses, but I am currently unsure about wether older 65C02 will have this feature. The ones with BE will most certainly have it, but it is not documented in the data sheets. So you may have to experiment wether your 65C02 will release its busses or not (put a weak pull up or pull down on the bus and see, if the pin can be pulled low or high during reset).


NMOS 6502s and CMOS 65C02s without the Bus Enable pin do NOT tri-state the address bus when the Reset pin is active. As I understand it, these devices do not have three-state drivers for the address bus and so are incapable of releasing the address bus.

_________________
Shift to the left,
Shift to the right,
Mask in, Mask Out,
BYTE! BYTE! BYTE!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: handyandy and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: