6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun May 19, 2024 6:21 pm

All times are UTC




Post new topic Reply to topic  [ 86 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Sun Oct 03, 2010 8:38 am 
Offline

Joined: Sun Oct 03, 2010 7:45 am
Posts: 43
Been Enjoying the list now for a few months and have always wanted to basically roll my own ever since I seen PE come out with the ELF project of yesteryear. So I have been looking at schematics and decided I might toy with the idea of making my own C64 ish flavor of computer.
Okay so before you laugh, Its really an attempt to understand basic computer arch as well as machine code which would come next.
Now I know the original used a Programmable logic array (U8), but I want to try to keep away from that for the time being. So may I present to you something that I threw together tonight in an attempt to come to grips with how to pull a CE line from the address bus, now Im sure there is other chips I could have selected and wired them up differently and all comments are welcome. Is this on the right track? or is this not how it would be done with discrete devices?


Simple Schematic


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 03, 2010 11:11 am 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
digidice wrote:
or is this not how it would be done with discrete devices?
I wonder why you aren't using the 74138 and/or 74139 for creating the various signals, like the C64 does? Less parts needed IMHO.

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Oct 03, 2010 3:19 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
I can only take a minute now, but I will add a couple of quick comments. 4000-series logic is extreeeeeeemely slow. The 4068 could take as much as 300ns to propagate a signal through at 5V. Also keep in mind that if you are only using bank 0 with an '816 (ie, no addresses above $FFFF), you can totally ignore the bank byte, and not latch, decode, or use it at all. Gotta run.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 03, 2010 3:59 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Ruud wrote:
I wonder why you aren't using the 74138 and/or 74139 for creating the various signals, like the C64 does? Less parts needed IMHO.


Actually, the PET and VIC-20 use these. The C64 and C128 both depend on PALs (the C64 uses the 82S100, IIRC; not sure what the C128 uses).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Oct 03, 2010 7:43 pm 
Offline

Joined: Sun Oct 03, 2010 7:45 am
Posts: 43
GARTHWILSON wrote:
I can only take a minute now, but I will add a couple of quick comments. 4000-series logic is extreeeeeeemely slow. The 4068 could take as much as 300ns to propagate a signal through at 5V. Also keep in mind that if you are only using bank 0 with an '816 (ie, no addresses above $FFFF), you can totally ignore the bank byte, and not latch, decode, or use it at all. Gotta run.


This is a really rough diagram. My like of thought was to have all the system and IO in everything below 65535 and put static ram in everything above there to the 16Meg max on the 816 hence the 74LS(HC)573 the 4068 just seemed handy to provide a high logic pin to the NAND gates. In retrospect the 300ns is too long because I really want to run this thing at close the 14Mhz, IE some 20ns good up to 50Mhz. which is also the reason I dont want to use an eprom or the PAL that came with the C-64, Yet I would like to keep it somewhat compatible with the old 64. Im still undecided if I want to use the VIC II IC or The Yamaha v9938 IC, maybe both. I have toyed with the idea of making the whole cpu board on a ISA board and then be able to swap in some old PC hardware. I know this has been talked about before and done by some but I am not sure how to do that yet as I have not got a full grasp on how IRQ's work yet. Like I say, I am quite new to computer design.
Learn as I go.

I thought about some 74ls138's I will have to look at the VIC 20 diagram and see what they did in that, I suppose I could use a bunch of 74 series NAND/AND gates to accomplish the same thing as the 4068 too..


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 03, 2010 8:29 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
digidice wrote:
Been Enjoying the list now for a few months and have always wanted to basically roll my own ever since I seen PE come out with the ELF project of yesteryear. So I have been looking at schematics and decided I might toy with the idea of making my own C64 ish flavor of computer.
Okay so before you laugh, Its really an attempt to understand basic computer arch as well as machine code which would come next.
Now I know the original used a Programmable logic array (U8), but I want to try to keep away from that for the time being. So may I present to you something that I threw together tonight in an attempt to come to grips with how to pull a CE line from the address bus, now Im sure there is other chips I could have selected and wired them up differently and all comments are welcome. Is this on the right track? or is this not how it would be done with discrete devices?


Simple Schematic

A couple of thoughts:

1) As suggested by Ruud, decoding with a 74*138 would make for a lower parts count and a less difficult to debug design. Your address decoding is going to suffer significant prop delays with all those gates. Be that as it may, I'm sure it'll run at least as fast as the real C-64. :)

2) Your design doesn't account for the VDA and VPA signals emitted by the W65C816S. The '816 generates spurious bus accesses during the intermediate stages of executing some instructions. VDA and VPA have been provided to identify and avoid such conditions. Failing to account for those two signals may lead to obdurate bus issues.

3) The '816 is a CMOS device and should used with CMOS glue logic where possible. With the exception of the 4000 series logic (which, as Garth noted, is dog-slow and should not be used), everything can be implemented in 74ABT or 74AC logic, which are substantially faster than 74LS logic.

Quote:
In retrospect the 300ns is too long because I really want to run this thing at close the 14Mhz, IE some 20ns good up to 50Mhz. which is also the reason I dont want to use an eprom or the PAL that came with the C-64...

4) You'll be struggling to get up to 14 MHz with this setup. I see 8 MHz as a stretch, given the circuit you have right now. At 14 MHz, machine cycle time is 70ns. Address setup has to be completed by the rise of Ø2, which means you'd only have about 25ns max for address setup. My opinion is it isn't going to happen with all that discrete logic. Also, you may be faced with wait-stating I/O accesses, depending on what you use for I/O hardware.

kc5tja wrote:
The C64 and C128 both depend on PALs (the C64 uses the 82S100, IIRC; not sure what the C128 uses).

The C-128 used both an MMU and PAL, the former being the device that worked out the mix of RAM, ROM and I/O. The details are no longer in my head, unfortunately (ain't aging a bitch?).

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Oct 03, 2010 8:44 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
4000-series is fine for interfacing to higher-voltage circuits where speed is no issue, like using the 4066, 4051, 4052, and 4053 analog switches for switing audio in 12V circuits, something I have done a lot in our products.  In fact, those are probably the most popular 4000-series devices today, while the others' popularity has dropped off because they are too slow for use in computers.  For CMOS logic, 74HC is kind of the entry point now, waaaaay faster than 4000, and in most (but not all) cases, slightly faster than 74LS.  The next faster popular CMOS family is 74AC or ACT, then there's 74ABT which is several times as fast as 74LS.

Quote:
IE some 20ns good up to 50Mhz.

Not at all.  50MHz has a cycle time of 20ns, but the '816 basically works on half-cycles which would be 10ns (if it could run at 50MHz), and then some of that time is taken by set-up and hold times.  If you could get all your logic down in the area of a couple of ns max total, that would leave you a few ns for memory access times-- difficult on the memory and totally unrealistic for the logic, especially if you're going to have several levels to propagate through.  Board layout becomes very critical too, having to be well behaved out to about a GHz.  Go for 74AC or 74ACT or 74ABT logic (74LS will be too slow), and simplify it to where no logic path is more than a couple of gates deep if possible.  It will probably mean giving wider slots in the memory map to each VIA for example, maybe 256 bytes or more instead of 16.  I'm hoping to get around 20MHz that way on my next one.  VIAs have two select inputs, which facilitates the address decoding.

Beginners tend to get the address decoding much, much more complex than it needs to be, with slow designs.  For an almost extreme example of address-decoding simplicity, see what I'm using on my workbench computer, which has 32KB ROM, 16KB RAM, 3 6522 VIAs and 3 6551 ACIAs, and can do the whole job with a single 74xx00.  In my next one, I tentatively plan to do the whole thing, a 4Mx8 SRAM module [Edit: now available, and data sheet is here] and 7 I/O ICs, with only an 11-input AND gate.

Quote:
I have not got a full grasp on how IRQ's work yet.

It looks like you're talking about the PC's interrupts; but in case you mean the 6502/816's interrupts, there's a primer on them here.

http://WilsonMinesCo.com/

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


Last edited by GARTHWILSON on Fri Mar 02, 2012 5:45 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Oct 03, 2010 10:38 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
...Then there is the issue of your bootup ROM. What are your thoughts on how to boot up your system (i.e. program your EEPROM)?

If this is your first project, I would highly recommmend you start out at very low speeds.

Some things you need to consider:

1) Loose the old school CMOS. As other have said, the ABT/ACT TTL families are THE best/fastest to design with when using discrete components. If you start out with fast decoding logic, you can then push your CPU speeds up to the limiting factor, usually the EEPROM? in a basic system.

2) EEPROM programmer/size of EEPROM. The size will determine your address decoding scheme.

3) Bypass capacitor's/noise levels. This is perhaps THE single most important wall that beginners overlook. I did and I wasted a year chasing a ghost. Finally though persistence paid off, and I wish to pass on my experience.

4) How will you wire it up? Solder? Custom boards? Wirewrap?

There's much more I could ramble on about, but I'll cut it short here. Good luck!

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 03, 2010 10:40 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
BigDumbDinosaur wrote:
kc5tja wrote:
The C64 and C128 both depend on PALs (the C64 uses the 82S100, IIRC; not sure what the C128 uses).

The C-128 used both an MMU and PAL, the former being the device that worked out the mix of RAM, ROM and I/O. The details are no longer in my head, unfortunately (ain't aging a bitch?).


Thankfully, you have young'uns like me to remind you. ;) Since this is marginally on-topic, I'll continue the posting, but I'll refrain from furthering the digression afterwards.

If I'm understanding the schematics rightly, the MMU chip focuses mostly on Z80A interfacing to the 65xx bus and some DRAM timing (the rest is handled by the VIC-IIe). The "memory management" aspect of the chip appear limited to storing configuration bits set by the CPU, decoding accesses to $FF00-$FF04 (8502 address space; I think this would appear at $3F0x in the Z80A space), and responding to some of memory-map-affecting the cartridge pins. The PLA (model 8721; HUGE compared to the C64's 82S100 by the looks of it) appears to implement the actual combinatorial decode logic. Yes, folks, this means that the Commodore 128 dedicates the majority of 96 pins of IC interfaces to its address decoding. Enjoy!

Cripes this is complicated. If you ever want to see a schematic diagram that is about as dense to read as you've ever seen, turn to page 740 in the Commodore 128 Programmer's Reference Guide. Yikes! Dave Haynie is a better man than I am for having to analyze that kind of circuitry!


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 03, 2010 11:58 pm 
Offline

Joined: Sun Oct 03, 2010 7:45 am
Posts: 43
BigDumbDinosaur wrote:
A couple of thoughts:

1) As suggested by Ruud, decoding with a 74*138 would make for a lower parts count and a less difficult to debug design. Your address decoding is going to suffer significant prop delays with all those gates. Be that as it may, I'm sure it'll run at least as fast as the real C-64. :)

2) Your design doesn't account for the VDA and VPA signals emitted by the W65C816S. The '816 generates spurious bus accesses during the intermediate stages of executing some instructions. VDA and VPA have been provided to identify and avoid such conditions. Failing to account for those two signals may lead to obdurate bus issues.

3) The '816 is a CMOS device and should used with CMOS glue logic where possible. With the exception of the 4000 series logic (which, as Garth noted, is dog-slow and should not be used), everything can be implemented in 74ABT or 74AC logic, which are substantially faster than 74LS logic.

Quote:
In retrospect the 300ns is too long because I really want to run this thing at close the 14Mhz, IE some 20ns good up to 50Mhz. which is also the reason I dont want to use an eprom or the PAL that came with the C-64...

4) You'll be struggling to get up to 14 MHz with this setup. I see 8 MHz as a stretch, given the circuit you have right now. At 14 MHz, machine cycle time is 70ns. Address setup has to be completed by the rise of Ø2, which means you'd only have about 25ns max for address setup. My opinion is it isn't going to happen with all that discrete logic. Also, you may be faced with wait-stating I/O accesses, depending on what you use for I/O hardware.



Thanks for the safety tip on the TTL guys, I realize that there are inherent problems with speed latency and gremlins in my scratches of a diagram. All good info. I still dont exactly know what the VDA or VPA pins do. the manual says

The Valid Data Address and Valid Program Address output signals indicate valid memory addresses when high and are used for memory or I/O address qualification.
VDA VPA
0 0 Internal Operation Address and Data Bus available. The Address Bus may be invalid.
0 1 Valid program address-may be used for program cache control.
1 0 Valid data address-may be used for data cache control.
1 1 Opcode fetch-may be used for program cache control and single step control.

Anyone care to elucidate how you put these to good use?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 04, 2010 12:05 am 
Offline

Joined: Sun Oct 03, 2010 7:45 am
Posts: 43
ElEctric_EyE wrote:
...Then there is the issue of your bootup ROM. What are your thoughts on how to boot up your system (i.e. program your EEPROM)?

If this is your first project, I would highly recommmend you start out at very low speeds.

Some things you need to consider:

1) Loose the old school CMOS. As other have said, the ABT/ACT TTL families are THE best/fastest to design with when using discrete components. If you start out with fast decoding logic, you can then push your CPU speeds up to the limiting factor, usually the EEPROM? in a basic system.

2) EEPROM programmer/size of EEPROM. The size will determine your address decoding scheme.

3) Bypass capacitor's/noise levels. This is perhaps THE single most important wall that beginners overlook. I did and I wasted a year chasing a ghost. Finally though persistence paid off, and I wish to pass on my experience.

4) How will you wire it up? Solder? Custom boards? Wirewrap?

There's much more I could ramble on about, but I'll cut it short here. Good luck!


I was thinking of using a AT29C512 which I would program from my PC and test in the proto computer. Lots of Bypass caps at least on every IC and of course when I actually get to plugging circuits into a bread board to test I would run it at low speed 1/4Mhz. once I make it work then I can crank up the speed. Put in on some vector board and then maybe get some circuit boards made up....


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 04, 2010 2:20 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
kc5tja wrote:
BigDumbDinosaur wrote:
kc5tja wrote:
The C64 and C128 both depend on PALs (the C64 uses the 82S100, IIRC; not sure what the C128 uses).

The C-128 used both an MMU and PAL, the former being the device that worked out the mix of RAM, ROM and I/O. The details are no longer in my head, unfortunately (ain't aging a bitch?).


Thankfully, you have young'uns like me to remind you. ;) Since this is marginally on-topic, I'll continue the posting, but I'll refrain from furthering the digression afterwards.

If I'm understanding the schematics rightly, the MMU chip focuses mostly on Z80A interfacing to the 65xx bus and some DRAM timing (the rest is handled by the VIC-IIe). The "memory management" aspect of the chip appear limited to storing configuration bits set by the CPU, decoding accesses to $FF00-$FF04 (8502 address space; I think this would appear at $3F0x in the Z80A space), and responding to some of memory-map-affecting the cartridge pins. The PLA (model 8721; HUGE compared to the C64's 82S100 by the looks of it) appears to implement the actual combinatorial decode logic. Yes, folks, this means that the Commodore 128 dedicates the majority of 96 pins of IC interfaces to its address decoding. Enjoy!

Cripes this is complicated. If you ever want to see a schematic diagram that is about as dense to read as you've ever seen, turn to page 740 in the Commodore 128 Programmer's Reference Guide. Yikes! Dave Haynie is a better man than I am for having to analyze that kind of circuitry!

Again, working from fading memory (which is covered up by "fading" hair), the MMU, among other things, generated the "translated address bus," which encompassed the A8-A15 address lines. The PLA,as you say, took care of the combinational logic in response inputs from the MMU and VIC-II. I'm still amazed that it actually worked.

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 04, 2010 2:54 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
Quote:
2) Your design doesn't account for the VDA and VPA signals emitted by the W65C816S.  The '816 generates spurious bus accesses during the intermediate stages of executing some instructions.

It will never, ever write to a spurious address though, and it won't even read wrong addresses like the NMOS 6502 did on a few instructions during the phase-2-high time of dead bus cycles which caused problems with clearing the status or receive buffers on I/O ICs in unusual memory-map arrangements.  The cycle-by-cycle information in the data sheet accounts for every single cycle of every instruction, and none of the reads or writes are random.  Also, none of the instructions you're likely to use to read an I/O IC's status or input buffer registers will read them twice and present a risk of overrun or clearing an interrupt before it got noticed.

It is true that it takes some amount of time for the address bus to change between cycles, but that's one reason why there's phase 2 to coördinate transactions.  Even the VDA and VPA lines will be in transition at that time, so they won't be valid either; so you go by phase 2, which will be low at that time letting everything know not to take anything seriously yet.  The '573 latch for the high address byte is transparent when phase 2 is low, so all 24 bits of the address will be available near the end of the phase-2-low time before phase 2 rises and latches the high byte.

In your situation, if you're not cacheing or doing single-stepping or wait states, I would just ignore the VPA and VDA signals.


Quote:
Lots of Bypass caps at least on every IC and of course when I actually get to plugging circuits into a bread board to test I would run it at low speed 1/4Mhz.

If your timing requirements are met, then the real problem-causer left is fast edge rates, which you'll get from fast parts even if your clock speed is low.  The edge on a digital signal line will be followed by ringing severe enough to change states again and fool circuits if your construction is not up to snuff.  A ground plane may not be absolutely necessary (depending on the size of the board), but strongly recommended nevertheless, and you can get perfboard for a wire-wrap project with planes on one or both sides.  I would also recommend chip capacitors for your bypassing, because the leads and anything related presents inductance, and I've seen leaded ceramic-disc .1µF capacitors turn inductive as low at 10 or 15MHz.  Use .01µF too, which will bump the resonant frequency up by a factor of about 3.  Solder one side of the chip capacitor directly to the Vdd lead of the IC (and its pad on the board), and the other end of the capacitor to the ground plane, with no leads.  My post at viewtopic.php?p=945#945 has a lot of links to ap notes on this subject.

_________________
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: Mon Oct 04, 2010 3:59 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
digidice wrote:
I still dont exactly know what the VDA or VPA pins do. the manual says

The Valid Data Address and Valid Program Address output signals indicate valid memory addresses when high and are used for memory or I/O address qualification.
VDA VPA
0 0 Internal Operation Address and Data Bus available. The Address Bus may be invalid.
0 1 Valid program address-may be used for program cache control.
1 0 Valid data address-may be used for data cache control.
1 1 Opcode fetch-may be used for program cache control and single step control.

Anyone care to elucidate how you put these to good use?

Unfortunately, WDC's documentation doesn't really clarify the use of these signals. When I built my POC unit, I had a strange problem involving one piece of I/O hardware, which was solved by correct implementation of VDA and VPA.

It has often been said one picture is worth at least 1K in words, so start by locking at the I/O decoding logic in this schematic.

Any instruction that involves some sort of memory access is subject to one or more intermediate cycles, during which the MPU has to compute the effective address. During that time, the address bus may undergo transitions that result in invalid addresses being presented.

As noted in the data sheet, any time both VDA and VPA are low the address bus should be considered invalid. While this usually is not an issue with RAM and ROM, it could be a problem with I/O hardware. The concern is that invalid bus cycles can result in false read operations that may inadvertently touch hardware registers when they should not be accessed. Hence the use of VDA and VPA in the above referenced schematic.

The logic equation looks something like this:
Code:
I/O SELECT = A12 & A14 & A15 & VDA & !A13 & !VPA

I/O is selected when the address is in the range $D000-$DFFF, VDA is high and VPA is low. If the VDA/VPA combination is anything other than high/low, the I/O decoder (74AC138) is not selected and thus no I/O hardware reacts in any way to address bus activity.

While on the subject of qualifying I/O accesses with VDA and VPA, also take a look at read/write qualification in that same schematic. The logic prevents a /WD (write data) from being applied to any read/write device (RAM or I/O) unless Ø2 is high. D0-D7 are not valid unless Ø2 is high, which is why it is essential to not allow a write operation to occur when Ø2 is low. This logic, combined with the VDA/VPA logic, will assure that all chips behave correctly during periods of invalid bus activity.

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 04, 2010 4:07 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8440
Location: Southern California
Quote:
The concern is that invalid bus cycles can result in false read operations that may inadvertently touch hardware registers when they should not be accessed.

BDD, the reading of invalid addresses was fixed long ago on all CMOS 65-family processors.  Only the NMOS ones have that problem!

_________________
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  [ 86 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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: