Using the /TIME line for more than bank switching?

For hardware talk only (please avoid ROM dumper stuff)
Post Reply
Alan
Interested
Posts: 10
Joined: Sun Oct 31, 2010 10:41 pm

Using the /TIME line for more than bank switching?

Post by Alan » Wed Feb 02, 2011 11:34 pm

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.

Chilly Willy
Very interested
Posts: 2608
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu Feb 03, 2011 12:21 am

This topic should help explain some things.

viewtopic.php?p=11589

Charles MacDonald
Very interested
Posts: 283
Joined: Sat Apr 21, 2007 1:14 am

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

Post by Charles MacDonald » Thu Feb 03, 2011 3:23 am

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.

User avatar
TmEE co.(TM)
Very interested
Posts: 2320
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Thu Feb 03, 2011 4:10 pm

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 :)
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Alan
Interested
Posts: 10
Joined: Sun Oct 31, 2010 10:41 pm

Post by Alan » Thu Feb 03, 2011 11:14 pm

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.

User avatar
TmEE co.(TM)
Very interested
Posts: 2320
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Feb 04, 2011 7:37 am

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.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Alan
Interested
Posts: 10
Joined: Sun Oct 31, 2010 10:41 pm

Post by Alan » Sat Feb 05, 2011 2:18 am

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

User avatar
HardWareMan
Very interested
Posts: 715
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Sun Feb 06, 2011 9:21 am

All correct.

Alan
Interested
Posts: 10
Joined: Sun Oct 31, 2010 10:41 pm

Post by Alan » Mon Feb 07, 2011 10:19 pm

Thanks again to all that helped.
Regards.

bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien » Thu Mar 19, 2015 5:41 pm

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

User avatar
Jorge Nuno
Very interested
Posts: 374
Joined: Mon Jun 11, 2007 3:09 am
Location: Azeitão, PT

Post by Jorge Nuno » Fri Mar 20, 2015 4:58 am

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

bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien » Fri Mar 20, 2015 10:14 am

Thanks for your reply.
I will test that :)

User avatar
db-electronics
Very interested
Posts: 89
Joined: Mon Feb 24, 2014 6:04 pm
Location: Kapuskasing, Ontario, Canada
Contact:

Post by db-electronics » Mon Mar 23, 2015 9:01 pm

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.
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca

bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien » Tue Mar 24, 2015 7:09 am

Thanks for that info , i have looked the 12F629 datasheet an it have an interrupt on pin function.
I will try with that.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest