6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 6:57 am

All times are UTC




Post new topic Reply to topic  [ 50 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: 6502 project
PostPosted: Sun Sep 08, 2013 3:37 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Hi guys

I'm planning to build my own home grown 6502 system. This is the system that I've cobbled together so far (partly my own design, partly I've pinched from others - noteably the clock circuit).

Please let me know what you think. The area I feel a little nervous about are the EEPROM and RAM chips - mostly as the orignal ones from the BBC Micro schematic that I've got don't seem to be about any longer (also who wants to use an EPROM? Not me!):

The other thing I'd like some advice about is how to communicate with it. I plan to put an IDC on the 6522 VIA A and B ports for different add on modules, but still need a way of talking to the system. Would a MAX232 or a 6402 do the trick for say the keyboard for input and may serial out for display purposes (to my windows PC - I'll write the software to read the stream for that using VB2010).

Image


[Edit] I'm aware that the reset buttons require debounce circuitry - I avoided including that for now to keep it looking clean and easy to read.


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Sun Sep 08, 2013 3:49 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
Just quickly-- I have a discussion on address decoding at http://wilsonminesco.com/6502primer/addr_decoding.html in the 6502 primer. You can get a lot more memory and I/O using only a single 14-pin quad NAND gate IC, and still run it much faster than what you have there. I would also recommend a clock oscillator can for better reliability and compactness as well as time savings in construction. I have a page on clock circuits at http://wilsonminesco.com/6502primer/ClkGen.html, and a basic whole-computer schematic at the top of the circuit potpourri page at http://wilsonminesco.com/6502primer/potpourri.html .

_________________
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  
 Post subject: Re: 6502 project
PostPosted: Sun Sep 08, 2013 8:30 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Many thanks for the information & links.
You mention using an oscillator rather than a crystal. Would this do? http://uk.farnell.com/epson-toyocom/sg- ... /1907469RL
Also, I can see a clock delay circuit for interfacing VIAs in one of the links. Unfortunately, I cannot read the component values very well. Do you have a list of components?


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Sun Sep 08, 2013 8:56 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
banedon wrote:
Many thanks for the information & links.
You mention using an oscillator rather than a crystal. Would this do? http://uk.farnell.com/epson-toyocom/sg- ... /1907469RL

It looks like you have a 1.8V one there. Is that really what you wanted? Most hobby stuff is at 5V and 3.3V. Also, did you want a surface-mount one, or thru-hole? (SMT will require a custom-made PC board, whereas thru-hole can be used with wire-wrap.) The closest I could find on that Farnell website was http://uk.farnell.com/iqd-frequency-pro ... dp/9712429 but it says it's no longer stocked. If you're in the UK, can you use Mouser? I don't remember how to get to Mouser/UK's website, but in the States, I'm looking at http://www.mouser.com/Passive-Component ... 7vZ1z0yz4q for the ones that fit in an 8-pin DIP socket, and http://www.mouser.com/Passive-Component ... 7vZ1z0yhhs for the ones that fit in a 14-pin DIP socket.

Quote:
Also, I can see a clock delay circuit for interfacing VIAs in one of the links. Unfortunately, I cannot read the component values very well. Do you have a list of components?

If it's the one I'm thinking of (http://6502.org/users/garth/projects.php?project=7), it delayed the rising edge of phase 2 to the VIA but not the falling edge, and it was to use it with the Commodore 64 which did not deliver valid and stable address and R/W\ lines before the rising edge of phase 2. If you're making your own computer, you won't have to contend with this, so don't worry about it.

_________________
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  
 Post subject: Re: 6502 project
PostPosted: Mon Sep 09, 2013 5:05 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
banedon wrote:
Hi guys

I'm planning to build my own home grown 6502 system. This is the system that I've cobbled together so far (partly my own design, partly I've pinched from others - noteably the clock circuit).

Couple of things I noted that you might wish to consider:

  • Tie the 6502's RDY input to Vcc via a 3.3K resistor. Allowing RDY to float may result in a DOA circuit because there's no telling how the MPU will react to a floating input. If the MPU thinks RDY is low, it just won't go (run, that is).

  • As Garth recommended, use a TTL can oscillator to generate the clock signal. Also, connect the 6522's PHI2 (Ø2) input to the oscillator, not PHI2 on the MPU. There's the potential for a subtle timing error with the way you now have it connected.

  • Consider using the 65C02 and 65C22 instead of NMOS parts. Along with that change, use 74HC or 74AC logic, not 74LS. 74AC is faster than 74HC and recommended for most new designs, but its use demands a tight layout to avoid ringing.

  • An easy way to debounce the reset circuit is with a Maxim DS1813.

Quote:
Please let me know what you think. The area I feel a little nervous about are the EEPROM and RAM chips - mostly as the orignal ones from the BBC Micro schematic that I've got don't seem to be about any longer (also who wants to use an EPROM? Not me!):

Nothing wrong with an EPROM—I use one in my POC unit. EPROMs are available down to 55ns, the same which can't be said about EEPROMs.

Quote:
The other thing I'd like some advice about is how to communicate with it. I plan to put an IDC on the 6522 VIA A and B ports for different add on modules, but still need a way of talking to the system. Would a MAX232 or a 6402 do the trick for say the keyboard for input and may serial out for display purposes (to my windows PC - I'll write the software to read the stream for that using VB2010).

First you need to define your communications needs. Then you can design in the hardware needed to do the job. It's not clear to me just what those needs are.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Mon Sep 09, 2013 6:52 am 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
Quote:
Would a MAX232 or a 6402 do the trick for say the keyboard for input and may serial out for display purposes

The MAX232 is a popular way (one of many ways) to do the voltage translation between TTL logic levels and the higher positive and negative RS-232 voltages.  It does not do the shifting to serialize/deserialize data and handle the start & stop bits.  For that, you need a UART or ACIA.  (I have a semi-6502-oriented article on RS-232 at http://wilsonminesco.com/RS-232/RS-232primer.html which also links to a section of the interrupts primer with 65c51 ACIA code.)  A PC keyboard's interface is similar to 5V I²C, not RS-232.  (I give a brief comparison of RS-232 and popular synchronous-serial interface types at viewtopic.php?t=1301&start=28.)  Daryl Rictor (8BIT here on the forum) has a circuit and accompanying code to handle a PC keyboard with a 6522 or '26 at http://sbc.rictor.org/pckb6522.html and with an AVR microcontroller with parallel output at http://sbc.rictor.org/pckbavr.html.  For my workbench computer, I send instructions over RS-232 from a DOS PC so I can use its full-featured programmer's text editor with high-res monitor and full keyboard and disc drives.  The workbench computer only has a 16-character LCD and 5-key keypad.

The 6502 primer has a page on displays at http://wilsonminesco.com/6502primer/displays.html that includes tiny VGA adapters.

There are a lot of general-purpose interfacing circuits and info in the circuit potpourri section of the 6502 primer, at http://wilsonminesco.com/6502primer/potpourri.html.  (I have more to post there, but I've been distracted by other things for a while.)

_________________
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  
 Post subject: Re: 6502 project
PostPosted: Mon Sep 09, 2013 6:43 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
It may also help you to take a look at my SBC website for some I/O ideas. I used an NXP 26C92 dual ACIA to drive two TIA-232 ports, one for the console and the other for exchanging data with my UNIX server. I have the schematics posted on the downloads page, along with some other resources.

A friendly word of caution: you should avoid the temptation to get too elaborate with a first-time effort like yours. Keep in mind that if it doesn't work it is you who will be trying to determine why. Although your machine is a fairly simple design, there is plenty that can go wrong. A hardware debugging session can be very instructive, but is not what I would call fun, even when you have a lot of experience with this sort of thing. If your experience and/or access to troubleshooting resources is limited you may throw in the towel instead of solving the problem.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Tue Sep 10, 2013 2:52 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Thanks again for the info/links - I'm a newbie when it comes to this and the information is proving invaluable (as is your advice!).

Here's some extra info & thoughts:

I've got a 65C02 10MHz CPU on its way through the post. I plan to run it only at 2MHz for the moment (so under-clocking it). Unfortunately, I don't seem to be able to get hold of 65C22s - I have two 6522 originals instead. From what I can tell these should interface ok with the 65C02 as I think the 65C02 is TTL compatible.

The address decoding alternative you mention looks interesting as I had a concern that with my present system I would be mapping 2 pages to I/O with one VIA which is a bit of a waste. I'll definitely consider swapping that over.

EPROM/EEPROM-wise my main issue with EPROMS is that I don't have a UV box to erase them and I genuinely thought they were old-school and obsolete. EEPROMS look far more attractive as one can easily re-write them - even from inside the 6502 system if wired that way (I don't plan to do this - over writing ones running OS ROM is a bad idea :D).

I see what you mean on the 6502 unused pins. I did plan to tie them high or low, but hadn't quite done my research on those pins so didn't know if I needed them elsewhere first. Quick (and very basic) question: I see many people tie IC pin to VCC/VDD without a 3K resistor, but others do use a resistor. Looking at the 3K/3.3K I can see it limits the current to about 1mA. Is this resistor used to protect the pin from being damaged in some way? I.e. drawing too much current?

I've adjusted by schematic to have the 6522 VIA so it's Ø goes directly to the crystal/oscillator circuit. What kind of problems does it cause to use the one outputted by the 6502? Just curious.

Would you recommend 74HCT (rather than 74HC) for added TTL support?

Communications-wise I mean for the system to do the following:
Have a means of input - either keyboard input or from a PC - both would use RS232 unless anyone has a better way. WOuld I be better attaching the RS232 via the 6522 VIA or directly on to the system (perhaps via a buffer)?
Have a means of displaying results. This would initially probably be something very basic such an 8-bit LED array or perhaps 7-segment LEDs. I'm hoping to possibly put in some HDMI at some point, but that may be beyond me.
A bit later I'm going to add my second 6522 VIA to the system and the output the A & B ports to IDC connectors so I can add I/O modules.

Thanks again for your help


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Tue Sep 10, 2013 6:00 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
banedon wrote:
I've got a 65C02 10MHz CPU on its way through the post. I plan to run it only at 2MHz for the moment (so under-clocking it). Unfortunately, I don't seem to be able to get hold of 65C22s - I have two 6522 originals instead. From what I can tell these should interface ok with the 65C02 as I think the 65C02 is TTL compatible.

Not knowing your geographical location, I can't offer any advice on a best source for the 65C22. There are some major parts vendors who carry the WDC product line. There is also a topic somewhere around here listing sources.

As for the NMOS vs. CMOS situation, the NMOS 6522 will work with the 65C02, as the latter is able to drive a 65xx bus like the NMOS 6502. Where CMOS vs. NMOS usually causes trouble is on the input side (q.v., ACT and HCT logic, which have TTL-compatible inputs but offer the CMOS advantages of speed and low power). I usually recommend to first-timers to stick with one type of logic to avoid potential incompatibilities.

Quote:
EPROM/EEPROM-wise my main issue with EPROMS is that I don't have a UV box to erase them and I genuinely thought they were old-school and obsolete. EEPROMS look far more attractive as one can easily re-write them - even from inside the 6502 system if wired that way (I don't plan to do this - over writing ones running OS ROM is a bad idea :D).

I made my EPROM eraser with a cheap under-the-cabinet kitchen fluorescent fixture I bought at the local hardware store and installed a germicidal UV lamp to do the dirty work. A wind-up timer is attached to it to turn off the lamp when erasing is done and an old cardboard carton suffices as the cover while it is in use.
Attachment:
File comment: Homemade EPROM eraser.
eprom_eraser01.jpg
eprom_eraser01.jpg [ 341.09 KiB | Viewed 2392 times ]
Attachment:
File comment: EPROM eraser timer.
eprom_eraser_timer.jpg
eprom_eraser_timer.jpg [ 681.62 KiB | Viewed 2392 times ]
My total investment in this contraption is about 70 USD, much cheaper than the commercially made units. it can erase up to 20 EPROMs at a time.

Quote:
I see what you mean on the 6502 unused pins. I did plan to tie them high or low, but hadn't quite done my research on those pins so didn't know if I needed them elsewhere first.

Inputs should always be connected to something, even if unused. This is particularly important with CMOS devices, which can misbehave if an input is allowed to float.

Quote:
I see many people tie IC pin to VCC/VDD without a 3K resistor, but others do use a resistor. Looking at the 3K/3.3K I can see it limits the current to about 1mA. Is this resistor used to protect the pin from being damaged in some way? I.e. drawing too much current?

Connecting an unused input to Vcc via a resistor makes it possible to use the input in the future without having to break the Vcc connection.

In case of WDC's 65C02 and 65C816, the RDY pin is bi-directional. When a WAI (WAIt for interrupt) instruction is executed, RDY will be pulled low by the MPU. If RDY is directly attached to Vcc and WAI gets executed (intentionally or otherwise) the MPU will be trying to sink the power supply...and probably won't succeed. :D

Quote:
I've adjusted by schematic to have the 6522 VIA so it's Ø goes directly to the crystal/oscillator circuit. What kind of problems does it cause to use the one outputted by the 6502? Just curious.

The PHI1O and PHI2O outputs were used back in the days when crystals were used to generate the clock input to the 6502. The drive available from the crystal wasn't enough to support other devices requiring a clock, e.g., 6522, 6551, etc. Such devices were driven from PHI1O and/or PHI2O, which outputs are 180 degrees out of phase with each other. Both PHI1O and PHI2O lag the input clock pulse due to internal propagation delay, a "feature" that has been known to occasionally cause timing headaches with some peripheral silicon.

WDC has this to say about PHI10 and PHI2O:

    3.8 Phase 2 In (PHI2), Phase 2 Out (PHI2O) and Phase 1 Out (PHI1O)

    Phase 2 In (PHI2) is the system clock input to the microprocessor internal clock. During the low power Standby Mode, PHI2 can be held in either high or low state to preserve the contents of internal registers since the microprocessor is a fully static design. The Phase 2 Out (PHI2O) signal is generated from PHI2. Phase 1 Out (PHI1O) is the inverted PHI2 signal. An external oscillator is recommended for driving PHI2 and used for the main system clock. All production test timing is based on PHI2. PHI2O and PHI1O were used in older systems for system timing and internal oscillators when an external crystal was used.

(Emphasis added)

Bottom line is WDC doesn't guarantee the behavior of the PHI1O and PHI2O outputs and they should not be used. Leave them as "no-connects." For clock generation, use a half-size (eight pin) can oscillator (inexpensive and reliable) and derive all clocks from that oscillator's output. The oscillator should be socketed (sockets specific to that device package are readily available) so different frequencies may be used as you experiment. If you need an inverted clock signal for something, a circuit such as the following may be employed to generate a two-phase clock:
Attachment:
File comment: Two phase clock generator.
two_phase_clock.gif
two_phase_clock.gif [ 12.48 KiB | Viewed 2392 times ]

A 74AC74 may be used in place of the 74ABT74 flip-flop. I don't recommend a 74HC74, as its output slew time slightly violates the WDC 65Cxxx specs.

Quote:
Would you recommend 74HCT (rather than 74HC) for added TTL support?

Only if you really need it. You should avoid the use of TTL (e.g., 74LS) devices. They are much slower than 74AC/74HC logic, not as immune to noise, and consume more power.

Quote:
Have a means of input - either keyboard input or from a PC - both would use RS232 unless anyone has a better way. WOuld I be better attaching the RS232 via the 6522 VIA or directly on to the system (perhaps via a buffer)?

The 65C22 is not designed to drive a TIA-232 (aka RS-232) device. For TIA-232 I/O, use a 65C51 or some other UART. I use the NXP 26C92 because it has dual channels; André Fachat (6502.org member) is partial to the 16550. The 65C22's serial I/O is a clocked 8 bit signal that doesn't generate the start and stop bits that are part of the TIA-232 bit stream. Food for future thought: you can rig up a simple "network" using the 65C22's serial shift register. Garth discusses that in some posts here and there.

The 65C22's eight bit parallel ports are useful for a variety of I/O tasks. A little adroit programming can make port-A behave like a Centronics port that can drive a standard parallel printer.

Quote:
Have a means of displaying results. This would initially probably be something very basic such an 8-bit LED array or perhaps 7-segment LEDs.

How you would drive the LED array would depend on what it expects as input. You might want to consider one of the LCD display modules that are readily available. Most can be driven via TIA-232.

An alternative for getting a working console without too much hassle is to have a TIA-232 port that you can connect to a PC's serial port. If you're on Windows you can use the HyperTerm terminal emulator (look under Accessories → Communications). It thinks that it is a VT-100 terminal, so standard ANSI/ECMA escape sequences can be used to control the display. The output when you type is ASCII.

Quote:
I'm hoping to possibly put in some HDMI at some point, but that may be beyond me.

That's a project that I would shelve for another day.

Quote:
A bit later I'm going to add my second 6522 VIA to the system and the output the A & B ports to IDC connectors so I can add I/O modules.

First get the basic machine working. You will need a more elaborate memory decoding scheme if you want to start supporting plug-in I/O cards. In any case, best to plan around CMOS, not NMOS for something like that.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Tue Sep 10, 2013 8:56 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
I see BDD posted while I was writing and got pulled away for awhile, but I'll go ahead and post this anyway as it adds a few more things.

banedon wrote:
I've got a 65C02 10MHz CPU on its way through the post. I plan to run it only at 2MHz for the moment (so under-clocking it). Unfortunately, I don't seem to be able to get hold of 65C22s - I have two 6522 originals instead. From what I can tell these should interface ok with the 65C02 as I think the 65C02 is TTL compatible.

Yes, they are compatible. We occasionally hear about how expensive it is to get these parts overseas because of shipping and insurance costs. I believe it was BitWise who recently did a bulk buy in England to amortize this cost over many ICs for those over there wanting to use them. Hopefully he will see this and speak up; otherwise you might want to contact him and see if he still has some to sell. To us in the States, the 14MHz parts (which typically top out at 25MHz with good construction and fast-enough supporting parts) are easily available and the shipping cost is minor. They are in production.

Quote:
The address decoding alternative you mention looks interesting as I had a concern that with my present system I would be mapping 2 pages to I/O with one VIA which is a bit of a waste. I'll definitely consider swapping that over.

It is a waste only if you are needing all the memory you can get in the 64K address space; but your diagram shows 32K of RAM and only 8K of ROM, leaving lots of address space open for I/O. You could double the ROM space and still use the second diagram at http://wilsonminesco.com/6502primer/addr_decoding.html .

Daryl (8BIT here on the forum) offers an address-decoding GAL (generic array logic, which is programmable logic) in a 24-pin DIP that gives you 32K of ROM, (almost) 32K of RAM, and I/O space for four I/O ICs taken out of RAM space at $200-2FF. See http://sbc.rictor.org/decoder.html .

Quote:
EPROM/EEPROM-wise my main issue with EPROMs is that I don't have a UV box to erase them and I genuinely thought they were old-school and obsolete. EEPROMs look far more attractive as one can easily re-write them - even from inside the 6502 system if wired that way (I don't plan to do this - over writing ones running OS ROM is a bad idea :D).

EPROM is kind of old-school, but is still available in higher densities than EEPROM is. EPROM is available up to 2Mx8. Flash is available in much, much greater densities, but it's usually serial, not something you can put directly on a 6502 bus. There are certain tools you need to get a system going, and an EPROM eraser at $40 is not as expensive as say the programmer, unless you make the programmer a manually operated one like I did for my first one, decades ago, when I didn't have any computer yet to connect a programmer to anyway. It was so slow and prone to human error that it was nearly useless. My $40 eraser only does 4 parts at once, unlike some of the more-expensive ones, but I cycle them through so that another one is ready every 3-4 minutes, so the delay is hardly an issue. It takes that long or more to find your bug and fix it in the source code and re-assemble and re-program anyway.

EEPROMs can be re-written in-system, but note that you cannot read the EEPROM while it's programming, so your code that keeps checking to see when it's done must be run from RAM (or at least a different EEPROM) before jumping back to any routines in the EEPROM you were programming.

Quote:
I see what you mean on the 6502 unused pins. I did plan to tie them high or low, but hadn't quite done my research on those pins so didn't know if I needed them elsewhere first. Quick (and very basic) question: I see many people tie IC pin to VCC/VDD without a 3K resistor, but others do use a resistor. Looking at the 3K/3.3K I can see it limits the current to about 1mA. Is this resistor used to protect the pin from being damaged in some way? I.e. drawing too much current?

The main one to do this on is RDY on WDC 65c02's, because it gets pulled low internally on a WAI instruction. Even if you don't plan to use WAI, a software bug could cause data to appear as a WAI instruction to execute, and the processor would stop with RDY being pulled down; so you don't want it connected directly to VDD.

Related, there's pin 1 of the 40-pin DIP which used to be a second ground pin but is a VP\ (vector-pull not, or vector-pull bar) output on WDC's 65c02. This will be high most of the time and get pulled low internally only when vectors are being pulled from the FFFA-FFFF address area. Since it is normally pulled up internally, you don't want to ground it. What some people have done when they needed to plug a WDC 65c02 into a legacy board is to just bend that pin out so it doesn't make connection in the socket.

Quote:
I've adjusted by [my?] schematic to have the 6522 VIA so it's Ø goes directly to the crystal/oscillator circuit. What kind of problems does it cause to use the one outputted by the 6502? Just curious.

I've always gone with the older method of having the processor's Φ2 output go to the system, and it always worked fine although I stopped at 7MHz due to 4MHz I/O parts and slow EPROM. WDC recently started recommending that the whole system be driven from the Φ2 input (sometimes called Φ0). When I get around to trying to push the speed limits on the processor using faster parts, I would like to use variable delay-line ICs made by Data Delay Devices to experiment to find the best timings. For now, just figure there is a slight delay between the Φ0 input and Φ2 output of the processor, and although the Φ0-Φ1-Φ2 circuit and old way of connecting things will still work, WDC no longer tests or guarantees these delays. Their timing specifications (as well as DC specifications) are quite conservative though, and in most cases there's a lot more margin than they let on. I won't go into all the implications here, but I don't think it's very significant for simple systems running at your speeds.

Quote:
Would you recommend 74HCT (rather than 74HC) for added TTL support?

It wouldn't hurt, but if the logic's inputs are all connected to processor outputs, it won't matter, since the CMOS processors can pull all the way up to 5V if the load is light. In fact, I found out by experimenting, that the WDC 65c22 outputs can pull up to 4.2V with a 19mA load, and I believe the output pin drivers on WDC's 65c02 are the same circuit. This is another place where the data sheet does not let on how much more they give you than they say they do.

Quote:
Communications-wise I mean for the system to do the following:
Have a means of input - either keyboard input or from a PC - both would use RS232 unless anyone has a better way. WOuld I be better attaching the RS232 via the 6522 VIA or directly on to the system (perhaps via a buffer)?

The 6522's shift-register port is not RS-232-compatible. There are certain jury rigs that can be done with it, like the output method mentioned in viewtopic.php?f=7&t=342 if you scroll down to "Tip of the day, #6".

You can also bit-bang, but that's kind of a pain because of RS-232's (or TIA-232's, in the newest standards, but I don't think it will make any difference to your application) stringent timing requirements.

The 6522's serial port is synchronous serial, meaning there's a separate clock line, whereas RS-232 is asynchronous serial, meaning the timing (ie, how long since the beginning of the start bit) is the only thing that tells the receiver which bit the data line is on at any given instant. The popular synchronous-serial methods of I²C, SPI, and Microwire are very easy to bit-bang (which I show on the potpourri page with links also to generic sample 6502 code), and even interrupts cutting in on the process won't cause problems, because the individual bits are coordinated by the separate clock line, not numbers of microseconds of delay.

The practical way to get RS-232 timing then is to use a UART or ACIA IC like the 65c51, 26c92, or 16550. Another possibility I might use next (which I've exercised before just to see it work, but have not put it into regular service) is the 14-pin-DIP MAX3100 UART which I interfaced to the 65c22 by SPI. The reasons for using these are:
  • as already mentioned, easily meeting the strict timing requirements of RS-232,
  • the fact that RS-232's bit order is the reverse of synchronous-serial interfaces including the 6522's serial port, and
  • adding the start and stop bits (and optional parity), and checking these for error conditions.
There might be another reason I'm forgetting at the moment.

Quote:
Have a means of displaying results. This would initially probably be something very basic such an 8-bit LED array or perhaps 7-segment LEDs.

Again the intelligent character LCDs mentioned on the displays page of the 6502 primer are an easier way to get a small display.
  • They take care of the character generation so your software doesn't have to look up dots or segments (unless you want to form custom characters),
  • they take care of the dot row & column strobing so your software doesn't have to do that either like it would with 7-segment LED displays,
  • they offer full alphanumeric (unlike 7-segment where many characters would have to be severely jury-rigged, like % $ & etc.)
  • they offer a couple of types of blinking cursors so your software doesn't have to babysit that either,
  • they can be interfaced with as few as six I/O bits (and some are serial interfaceable), and
  • they are very low-power, unlike the LEDs.
I show a circuit for interfacing one of these at http://wilsonminesco.com/6502primer/potpourri.html#LCD with a link to sample 6502 code to work it.

Quote:
A bit later I'm going to add my second 6522 VIA to the system and the output the A & B ports to IDC connectors so I can add I/O modules.

I would build the board with the second VIA socket connected right from the start, as it's harder to add this as an afterthought. I would recommend making the pin header pin-out as shown at the right end of the diagram at http://wilsonminesco.com/6502primer/pot ... ml#BAS_CPU so that if you accidentally plug the IDC on backwards, you're probably not going to hurt anything. BDD alluded to the fact that implementing plug-in boards is not trivial. I would follow up on that by recommending that you not run the processor's own buses off the main board at all. I give reasons for this, and ways to get more practical interfacing for less time and expense and penalties, at http://wilsonminesco.com/6502primer/ExpBusIntrfc.html .

BigDumbDinosaur wrote:
Food for future thought: you can rig up a simple "network" using the 65C22's serial shift register. Garth discusses that in some posts here and there.

He might be referring to SS22 which I do use on the workbench.

Quote:
The 65C22's eight bit parallel ports are useful for a variety of I/O tasks. A little adroit programming can make port-A behave like a Centronics port that can drive a standard parallel printer.

I address this a little at http://wilsonminesco.com/6502primer/potpourri.html#LPT . On my workbench computer, I do a lot of bit-sharing on especially the first 65c22 (VIA1), and the printer port shares bits with the LCD interface, keypad, and oscilloscope raster graphics. My diagram for it is at http://wilsonminesco.com/6502primer/IO_ICs.html but it's kind of hard to read. I was cleaning it up for the web page many years after I drew it but it was taking way too long to get it really readable.

_________________
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  
 Post subject: Re: 6502 project
PostPosted: Wed Sep 11, 2013 9:03 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
I've had a look at the decoding schemes available, but nothing seems to suit what I'm after.
This is the memory map I was thinking of:

0000-7FFF 32K RAM
8000-BFFF 16K RAM/ROM swapping bank - like BBC sideways RAM
C000-D7FF 6K I/O buffer/work area (RAM)
D800-DFFF 2K I/O mapping area
E000-FFFF 8K ROM

I'm not entirely sure I can achieve the above easily. Any recommendations? I can simplify the map if I have to if the above isn't achievable.


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Thu Sep 12, 2013 3:55 am 
Offline

Joined: Sun Jul 28, 2013 12:59 am
Posts: 235
I'm somewhat inexperienced with hardware design, but... It seems as though you could pick off the 32K RAM space with A15 as a chip select, the 16K RAM/ROM bank with A15 and A14 and a small amount of discrete logic (though you might want something like a 22v10 if you want to have a bankswitched ROM as well as a RAM option for that space)...

As far as the C000-DFFF range goes, the 74xx138 apparently has three chip-select inputs (two active-low, one active-high) and eight active-low outputs. An inverter on either A14 or A13 should allow the chip selects to be used to select the entire 8K range, and then you have a set of 1K ranges that you can map independently. It's too bad that the '138 doesn't have open-collector outputs, as you could then simply use a wired-OR mechanism to aggregate separate 1K ranges as needed.

Depending on what other logic you have in your design, picking out the 8K ROM range should be straightforward.

All that said, I think I'd be looking to simplify the memory map a bit or use SPLDs such as the 22v10 in the design (why am I talking about using the 22v10? It's a simple device, to the point where you could even work out by hand which fuses need to be blown, the TI parts (TIBPAL22V10 / TIBPAL22VP10) are available via the standard suppliers (at least one of digi-key, mouser, or jameco), and the programming documentation is available online from the TI site if you know where to look. And if anyone wants to discuss the pros and cons of such devices, please start a new thread in the Programmable Logic forum about it).

On the one hand, I hope this helps. On the other hand, I hope that someone with more experience weighs in so that I might learn something new.


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Thu Sep 12, 2013 3:54 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 904
You could also use my DILDAR board (http://forum.6502.org/viewtopic.php?f=10&t=2638) to provide any address decoding, implement peripherals (serial port, VGA, keyboard or anything really). It is a small FPGA with 60 IO pins, but you can even fit an entire Arlet's 6502 core running at 100MHz with peripherals. I have a few boards for sale to our community for only $20 plus shipping.

One of the uses I envisioned this board is just that - providing glue logic and peripherals. I'd be happy to help you out if you have an interest.

Edit: DILDAR can also be used as a timebase and generate just about any frequency clock you need. It also has 8K RAM or ROM that may be integrated into the system. A $50 USB programmer will let you rewrite the ROM in seconds, or change the entire system.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Sat Feb 15, 2014 7:29 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Hi guys

I've started to breadboard my project and noticed that the W65C02S has the following pins:

VPB - Vector Pull
MLB - Memory Lock
SOB - Set Overflow
BE - Bus Enable

I'm not entirely sure what to do with these pins.

Also, does PHI1O need to be tied low through a resistor or straight to ground?


Top
 Profile  
Reply with quote  
 Post subject: Re: 6502 project
PostPosted: Sat Feb 15, 2014 7:58 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
The "mystery pins" page of the 6502 primer covers those, at http://wilsonminesco.com/6502primer/MysteryPins.html

_________________
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  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 25 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: