6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 5:26 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sat Jan 14, 2023 4:05 pm 
Offline

Joined: Mon Jan 09, 2023 9:33 pm
Posts: 29
Could this be used to select a $8000 to $8FFF (4k) for devices as CIAs, VIAs, etc ?
Thanks for advices


Attachments:
6502.extras.png
6502.extras.png [ 128.38 KiB | Viewed 686 times ]
Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 14, 2023 4:52 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 491
That does decode $8 into a low pulse for CS\. However, CIAs and VIAs etc. have their own Ø2 inputs so you don't normally need to include the clock in your address decoding for them.[1]

Here are some articles you might find useful:

http://wilsonminesco.com/6502primer/addr_decoding.html <- Garth's famous primer
https://www.atarimagazines.com/computeii/issue3/page15.php <- an old but still good article

Note that, in Garth's circuit (about halfway down the page), the chip select for RAM and ROM is qualified by Ø2 but *not* the chip select for the interface adapters. Also note that Garth's circuit has simplicity as a design goal, and is intended for use in systems of this type:

Garth wrote:
If your first aim is for a couple of MHz or less, particularly with slowish parts like a 2MHz processor and 74HC logic, your chances of initial success will be excellent.


If you're trying to eke every last ounce of speed out of your 6502, you might need a slightly different circuit.

[1] Edit to add in this pertinent quote from the Primer:

Quote:
The VIAs and ACIAs have their own Φ2 input, and the address decoding must provide the appropriate valid chip-select before the Φ2 rising edge. I know from experience that the VIA will not work if the CS waits for the Φ2 rising edge. (I found out in about 1986, then years later had to use the trick shown near the bottom of this page when I used a pair of 6522's in a Commodore 64 I/O expansion board, the C64 not giving an early select signal.) Do not bring Φ2 into these ICs' CS logic like the circuit above does for RAM.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 15, 2023 6:40 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
agsb wrote:
Could this be used to select a $8000 to $8FFF (4k) for devices as CIAs, VIAs, etc ?
Thanks for advices

It’s best to not include Ø2 in any address decoding, whether using 65xx peripherals or something else, e.g., an Intel-compatible device. As Paganini noted, you cannot gate any 65xx silicon with Ø2. 65xx devices are clocked by the same source as the microprocessor, which means their control inputs and chips selects must be stable before the rise of Ø2.

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


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 21, 2023 2:59 pm 
Offline

Joined: Mon Jan 09, 2023 9:33 pm
Posts: 29
Thanks for answers, phi2 out of grid and direct to 6522s and 6551s

Easy now:

/RAM_CS with (A15)
/ROM_CS with (NOT A15)
/DEV_CS with ((NOT A15) OR A14 OR A13 OR A12)


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 21, 2023 6:16 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 491
Hi agsb,

It *is* easy (or it can be!) :)

Just be sure that ROM_CS\ and DEV_CS\ can't both be low at the same time.

One other thing you might want to think about is that 6522s and 6551s have two chip-select lines each, an active high one and an active low one. Depending on the complexity of your system, you might not need to decode them much at all. You could, e.g., connect A4 and A5 to CS1 and CS2\ of your VIA, and then connect them the other way round to CS0 and CS1\ of your ACIA.

Code:
xxxx xxxx xx01 0000 <- VIA addresses
              . . .
xxxx xxxx xx01 1111



xxxx xxxx xx10 0000 <- ACIA addresses
              . . .
xxxx xxxx xx10 1111


This works kind of like XOR: your IO devices will activate on A4/A5 = 10 and 01, so you still have A4/A5 = 00 and 11 for RAM and ROM addresses. This kind of decoding will mirror your IO devices throughout your entire address space (all those 'don't care' x's), but depending on what you're building that might be OK! There are some areas of the address space you probably don't want to mirror your IO in, though. How would your address space look if you used A5 and A6 or some other pair of address lines instead of A4 and A5?

Another way is to use your DEV_CS\ signal to drive both the VIA/ACIA active low selects (CS2\ for the VIA and CS1\ for the ACIA), and then use A4 and (NOT A4) to select between them. Depending on how you generate your DEV_CS\ signal, this can give you a more fully decoded address space. (You could use a 74x138 to generate your DEV_CS\ and park your IO at $8000 like you mentioned in your first post.)

Some useful logic chips often used for address decoding are:

74x30 8 input NAND gate, 74x688 8 bit magnitude comparator, 74x139 2 to 4 line decoder / demux, 74x138 3 to 8 line decoder / demux.

The traditional way of fully decoding an address space was to use cascading 74x138s. This will still work fine if you're building a slow system, but propagation delay will add up quickly!

One last thought: to me, setting aside 8k for IO is wasteful. That's room for *hundreds* of VIAs and ACIAs! Depending on your project, there might be tradeoffs that make that waste acceptable. However, if you're building a kind of "standard" system with a 32k SRAM and 32k EEPROM, your address space is already totally full of RAM and ROM. It's not like in the old days where your system might come from the store with 4k or even 2k of RAM. In this scenario decoding IO is a problem of *stealing bytes* from the RAM or (in your case) the ROM area of your address space. If you haven't already, I'd again suggest reading the two articles I linked in my previous post. Garth's page has a good discussion of why you might or might not care about mirroring your IO, and the COMPUTE II article talks about IO decoding as byte stealing.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 21, 2023 6:58 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
> wasteful

Just to note, this is often a mistaken way to think, in my opinion. Whatever it is, it may be inefficient in some resources, but it might be the right tradeoff for the project.

An example might be using just 32k of a 128k RAM chip, or using anything less than the whole capacity of a RAM or a ROM. Yes, you have unused RAM, in a sense, but maybe that's the chip you have, and maybe that's the memory map that makes sense for your project.

In many cases, the glue logic will offer more space for I/O than is strictly needed. That's not too important, so long as there's enough RAM and ROM to do what the project wants to do.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 21, 2023 8:46 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 491
As I said:

Paganini wrote:
Depending on your project, there might be tradeoffs that make that waste acceptable.


:P

However, if you're already using a 2-chip solution then since there are fast 2-chip solutions that let you plant a small IO window anywhere in the address space, it seems to me that you can often have your cake and eat it too.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 21, 2023 10:00 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Ah, yes, so you did!


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

All times are UTC


Who is online

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