Jump to content
Sign in to follow this  
Propane13

Hardware questions from someone without a good hardware background

Recommended Posts

Hello!

 

I'm trying to learn more about hardware; in the 7800 world, I'm trying to make something that can "sniff" the address/data lines on a cartridge and store them so that I can trace a nasty bug. With that being said, I don't have a great background in electrical hardware, so I need a little help to get over the learning curve.

 

I had some questions; I figure if I ask some 2600 folks, I can try to translate that info to the 7800 world as well.

 

So, my first question is... are the cartridge signals analog or digital? Sorry if this seems like a dumb question.

If I can piece it together right, I believe that they are digital, since they typically have 2 values (ignoring noise) of 0V and +5V (Vcc).

An analog signal I think would be like from a paddle controller, where resistance makes the line vary between 0 and 5V depending on where it is set.

Is that assumption accurate?

 

My next questions come from looking at the 2600 cartridge pinouts.

Since there are 24 pinouts, I see that:

- 13 are used for address lines (2^13 = 8K addressable space)

- 8 are data lines

- 2 are Ground (GND and SGND)

- 1 is VCC (+5V)

 

So, my second question is: If there are 8K of addressable space, why are games limited to 4K before bankswitching?

Or, perhaps my math is wrong? This seems weird to me

 

My third question is: why is there no CLK line?

If I think about how this works in my mind, it's like this:

- the Atari system wants to get new information, so it changes the address lines

- the cartridge takes these lines and reads from the cartridge at that address, and sets the data lines appropriately

- I am guessing the Atari system delays for a little bit of time (milliseconds) before taking the input from the data lines.

- the dance begins again

 

So, shouldn't there be a CLK line to signal the cartridge that there is new data to be fetched?

Sometimes I would expect there to be some noise on the lines, or a delay between pins where say, A7 is set just ever so slightly behind the others.

When this happens, you'd have funky data get fetched, and then I guess instantly later get the real data.

If there was a clock line, I wonder if that would help as a signal that data was ready to be fetched from those address lines.

Maybe I'm overthinking, but I'm hoping that someone can explain why this isn't a problem.

 

Thanks!

-John

Share this post


Link to post
Share on other sites

The signals are digital, you are correct.

 

There is only 4k of addressable space because one of the address lines is used for chip enable.

 

There is no clock line because the cartridge is a simple ROM device and nothing more. You set the address lines and read from the data lines.

 

-Ian

Share this post


Link to post
Share on other sites

8 KB addressable space divides as:

- 4 KB to talk to the ROM addresses.

- 4 KB to talk to the RAM addresses. (There's only 128 bytes of RAM in this 4 KB space, though).

Share this post


Link to post
Share on other sites

So, my second question is: If there are 8K of addressable space, why are games limited to 4K before bankswitching?

As Ian Primus says, one of the address lines (A12) is used as a chip select-- it's wired so it always reads 1. That's why the cartridge address space is $1000-$1FFF. And on a 2K cartridge, A11 isn't used, giving addresses of either $1000-$17FF or $1800-$1FFF (i.e., the 2K is effectively "mirrored").

Share this post


Link to post
Share on other sites

Sometimes I would expect there to be some noise on the lines, or a delay between pins where say, A7 is set just ever so slightly behind the others.

When this happens, you'd have funky data get fetched, and then I guess instantly later get the real data.

Good intuition! This is exactly what happens, exactly because there is no clock line.

 

If you care about the exact details, the 6502 data book can tell you more about the timing. But it's just like you imagine. The 6502 changes the address lines, they wobble around for a moment until they settle down. Meanwhile, the data lines go haywire, then they settle down onto the correct data value. Only after a half clock has passed does the 6502 actually latch the data lines, then it starts again.

 

I'm trying to learn more about hardware; in the 7800 world, I'm trying to make something that can "sniff" the address/data lines on a cartridge and store them so that I can trace a nasty bug. With that being said, I don't have a great background in electrical hardware, so I need a little help to get over the learning curve.

 

You don't necessarily need to make your own. What you want is called a logic analyzer, and there are many USB Logic Analyzers that are cheap, good, and fast. They'll "trigger" on a certain pattern (such as a code fetch address that precedes the problem), then start recording everything.

 

You can go look at the recording later, and see the address lines changing, then look between each transition where the data is known to be good.

 

If you really want to build it yourself, one simple way is to just tap the clock line that is present inside the 2600. Solder a wire and you're done. If you insist on using the cartridge port alone, you can put in your own clock, say 20MHz, and sample the pins 20M times a second. This is how a logic analyzer would do it. You can even write some code to note any address line transition, then step forward to a later sample where you know both the address and data are all settled.

 

- KS

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...