Page 1 of 1

Using the /TIME line for more than bank switching?

Posted: Wed Feb 02, 2011 11:34 pm
by Alan
Hi all,

Probably a simple question. How are you guys making cartridges that take advantage of SD cards, USB ports, etc?

Is it just the /TIME line or are other lines required too?

I assume you are doing something along the lines of seeing what address is on the bus when the /TIME line is toggled then each address acts as a sort of register. For example, $A13000 could relate to something to do with SPI for an SD card.

I am probably overlooking something very simple, I just cant seem to fix the pieces together in my mind.

Regards.

Posted: Thu Feb 03, 2011 12:21 am
by Chilly Willy
This topic should help explain some things.

viewtopic.php?p=11589

Re: Using the /TIME line for more than bank switching?

Posted: Thu Feb 03, 2011 3:23 am
by Charles MacDonald
Alan wrote:Is it just the /TIME line or are other lines required too?
It depends on what kind of hardware you are mapping to A10300-A130FF, but generally it can be as simple as just using /TIME for a 'strobe' that does something when you write or read from that range.

For finer control you would check the address bus and /LWR, /UWR (if using D15-D8 as well) and /CAS0.
I assume you are doing something along the lines of seeing what address is on the bus when the /TIME line is toggled then each address acts as a sort of register. For example, $A13000 could relate to something to do with SPI for an SD card.
Exactly. So when /TIME goes low, I check the other address bits to enable or disable different peripherals within that range, and then also use /LWR and /CAS0 to control those that can be read or written or both. For example the input port is enabled when reading from one address range, the output port is enabled when writing to another range, and the USB chip for reads OR writes in a third range. I can tell which range I'm in by observing the higher address bits like A7 and A6, etc.
I am probably overlooking something very simple, I just cant seem to fix the pieces together in my mind.
I think you've got it right; when /TIME goes low you know there's a valid address on the bus within the A13000-A130FF range. If you need to resolve a finer range of addresses you could check the lower address bits (A7-A1), and if you need to check specifically for reading or writing you'd also check /LWR,/UWR and /CAS0.

The simplest example would be having a 8-bit latch connected to D0-D7 that is clocked every time /TIME goes low. Maybe to flash some LEDs. This way you could just write anywhere within $A130xx to load it (at odd addresses) and you wouldn't have to use any other signals.

One gotcha would be that reading would also load the latch with garbage data (as you are just going by /TIME, not by /LWR as well) so you'd want to avoid trying to read it. But as you are in control of the software it's never a problem.

Posted: Thu Feb 03, 2011 4:10 pm
by TmEE co.(TM)
I use !TIME to control all on-cart stuff, such as EEPROM handling and banking mechanisms.

For ultra fast shift left by 8 bits have a register mapped to higher byte, but do a write on lower byte. 68K has both upper and lower byte with same value on writes so the register will get the byte, and when you read it back you get the value, but with a shift :)

Posted: Thu Feb 03, 2011 11:14 pm
by Alan
Thanks for your replies guys, much better understanding now.

What about when I need to read from my 'device' I must need to somehow put that data onto the data lines. What considerations should I take? Maybe the megadrive or my game ROM is already asserting the data lines. Is there a valid sequence or timing I should follow?

Regards.

Posted: Fri Feb 04, 2011 7:37 am
by TmEE co.(TM)
ROM only puts out data when you access 000000-3FFFFF area. For reads strobing you use the !OE / !CAS0 / B16 signal, for writes strobing you use !UWR and !LWR signals (B28, B29).
Very easy and effective.

Posted: Sat Feb 05, 2011 2:18 am
by Alan
Hi, please could you take a few minutes to look over the small schematic I made.

The top shows a 8bit latch attached to D0..7, and by checking !LWR and !TIME via a NOR gate will latch the data bus on writes to $A130xx. Results then displayed on LEDs.

The bottom shows 8 lines that are controlled via the DIP switch to be high or low. This is then fed into a 8bit buffer/line driver. !CAS0 and !TIME via a OR gate controls the output enable on the buffer on reads from $A130xx, allowing the data onto the bus.

Have I missed anything? Once again thanks.
Regards.

Image

Posted: Sun Feb 06, 2011 9:21 am
by HardWareMan
All correct.

Posted: Mon Feb 07, 2011 10:19 pm
by Alan
Thanks again to all that helped.
Regards.

Posted: Thu Mar 19, 2015 5:41 pm
by bastien
Hi,
Sorry for bumping this thread but i have a question regarding /TIME.
I work on a Multigame cartridge project and i want to use /TIME as an input for a PIC.
The PIC will drive upper memory adress for bankswicth game.
/TIME will be use as a clock counter.

For the first test i just solder a Led in the /TIME pin ( with a 150 ohm Resistor) , the Led always enabled even if i write into the $A13000-$A130FF range...
Can you tell me what's i'm doing wrong ?

Here is my test code :

Code: Select all

    while (1)
    {
		VDP_waitVSync();    
               {
				vu8 *pb;
				u16 i;
                pb = (vu8 *) 0xA13000;
                i =255 ;
                while(i--) *pb++ = 0;
               }

	}
Thanks in advance

Posted: Fri Mar 20, 2015 4:58 am
by Jorge Nuno
well, /Time only goes low for the access, around 300ns-ish. During the rest of the time it's high. To use to toggle a led you'll need a T-flipflop or a counter

Posted: Fri Mar 20, 2015 10:14 am
by bastien
Thanks for your reply.
I will test that :)

Posted: Mon Mar 23, 2015 9:01 pm
by db-electronics
The only way you can get the PIC microcontroller to respond to the #TIME signal would be to trigger a negative edge interrupt (or input capture perhaps, depending on which PIC you are using) - #TIME is not low long enough for any sort of software polling to detect it.

Posted: Tue Mar 24, 2015 7:09 am
by bastien
Thanks for that info , i have looked the 12F629 datasheet an it have an interrupt on pin function.
I will try with that.