Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Turbo Tape, how does it work?
2008-12-06 10:31
johncl

Registered: Aug 2007
Posts: 37
Turbo Tape, how does it work?

I have always been curious about how turbo tape really worked. I know that the tape drive originally could only read 50 bytes per second which would take a whopping 21 minutes to fill up the whole memory. I was always under the impression that games used compression to speed up tape loading (Just did a test with Giana Sisters which took 4 minutes to load).

Did Turbo Tape fiddle with the speed that data was written and read to the tape? I didnt think that was possible (only thought that was how they sped up disk reading/writing). If anyone got a good resource at how e.g. the well known Turbo Tape works, please post a linky here.
2008-12-06 11:18
ice00

Registered: Apr 2002
Posts: 54
C64 format:
2 copies of program are stored in sequence
20 bits are used for one byte of data to store
~ 1000 microsecond for a bit

Turbo format:
1 copy of program stored
8 or 9 bit for one byte of data to store
~ 550 microsecond for a bit

2008-12-06 11:44
Krill

Registered: Apr 2002
Posts: 2980
Generally, apart from storing only 1 copy, the lengths of short and long pulses for either bit are shorter, and some loaders also introduce a middle pulse, so two lengths would be ones and zeros, and the third would swap the meaning of the other two so the total length is minimized.
2008-12-07 06:35
Martin Piper

Registered: Nov 2007
Posts: 722
A good explanation of how a turbo works is here in "rant 8": http://codebase64.org/doku.php?id=base:irq-tape_loader

Then to get your turbo loader to autoboot: http://codebase64.org/doku.php?id=base:autoboot_tape_turbo_load..

The autoboot sources also include an improvement from the method used in "rant 8" to use a CIA timer while saving instead of having to carefully count cycles in the save code.
2008-12-07 11:44
enthusi

Registered: May 2004
Posts: 677
check http://enthusi.de
:)

edit:
also what other mentioned.
Main speedup: data not written twice.
CBM load uses 3 pulse-lengths (1 "pulse" = 2 signals, one "positive", one "negative" - the c64 detects downflanks).
CBM load uses 2 pulses for one bit!

TT uses 1 pulse = 1 bit.
Pulselengths are much shorter for TurboTape.
I illustrated some details in the link above some time ago.

TT is kind of the limit. Closer pulselength would get unreliable on different datasettes. Their speed varies slightly. Also the signal gets less clean when the head gets slightly twisted in respect to the tape itself...
I tried that alot :) cant really improve speed further without making it a lottery for the user.

CBM load aligns itself to tapespeed though! very efficient actually. TurboTape simply fails on significantly faster/slower datasettes.
2008-12-07 14:02
doynax
Account closed

Registered: Oct 2004
Posts: 212
Interesting. I never did have a datassette to play with and only vaguely remember a friend and I clocking a load at 15+ minutes for one of his C64 games. Still, if the speeds discussed here are accurate then you could squeeze an astonishing two megabytes onto a 90 minute tape.

Anyone care to explain how the physical encoding works and what the low-level limitations are, as opposed to, say, the magnetic coding on a floppy drive?
I mean why is a pulse scheme with flexible lengths preferred/required as opposed to something like GCR or MFM coding? And if differing tape speeds is the main obstacle then why isn't it possible to dynamically calibrate the loader?
2008-12-07 14:21
Mace

Registered: May 2002
Posts: 1799
To add to Doynax's questions: what's the differences between those proprietary loaders like Cyberload?
2008-12-07 14:36
tlr

Registered: Sep 2003
Posts: 1790
Quote: Interesting. I never did have a datassette to play with and only vaguely remember a friend and I clocking a load at 15+ minutes for one of his C64 games. Still, if the speeds discussed here are accurate then you could squeeze an astonishing two megabytes onto a 90 minute tape.

Anyone care to explain how the physical encoding works and what the low-level limitations are, as opposed to, say, the magnetic coding on a floppy drive?
I mean why is a pulse scheme with flexible lengths preferred/required as opposed to something like GCR or MFM coding? And if differing tape speeds is the main obstacle then why isn't it possible to dynamically calibrate the loader?


I guess pulse widths are prefered because every bit is a transition then, i.e safer/simpler.

Calibration should be possible, enthusi mentions it is done by the kernal cbm loader.
Also using GCR should be possible. That could be used to make a byte the length of 10 '0'-bits.
I'm not sure how safe it would be. Depends on how much/fast the tape speed varies _during_ loading.
Perhaps calibration could be made on the fly?
2008-12-07 15:13
doynax
Account closed

Registered: Oct 2004
Posts: 212
Come to think of it, if the cycle counts for a turbo-tape one-bit is half again as long as a zero then a GCR (5-to-4 bits) wouldn't really win anything unless you had more than fifty percent ones (which you shouldn't, since you can always invert all the data to get less than 50%.)
You'd be better off interleaving a Huffman-coder weighted towards zeroes with the loader instead.
2008-12-07 15:42
tlr

Registered: Sep 2003
Posts: 1790
In my GCR suggestion I assumed '0' was the shorter bit. For GCR only short bits are required.
In GCR a missing bit means 0, and a bit (=transition) means '1'.
2008-12-07 15:50
doynax
Account closed

Registered: Oct 2004
Posts: 212
Quote: In my GCR suggestion I assumed '0' was the shorter bit. For GCR only short bits are required.
In GCR a missing bit means 0, and a bit (=transition) means '1'.


As did I. It's just that a GCR encoded byte needs two extra bits, so a worst-case turbo-tape with 50% ones should just about break even with it.
At least, I think that's how it works out..
2008-12-07 16:38
tlr

Registered: Sep 2003
Posts: 1790
Quote: As did I. It's just that a GCR encoded byte needs two extra bits, so a worst-case turbo-tape with 50% ones should just about break even with it.
At least, I think that's how it works out..


Hmm, yes you are right.
I assumed a '1'-bit was twice as long as a '0'-bit, but now I realize the difference is much less.
2008-12-07 16:56
enthusi

Registered: May 2004
Posts: 677
check neoload for a error-correction loader.
The most complex there is so far.
Neoload
2008-12-07 17:51
tlr

Registered: Sep 2003
Posts: 1790
Yes, noted that before. Very cool!
The discussion about GCR was an attempt to propose a faster loader than turbo tape though.
Perhaps it is already close to max? Very cool in that case as it is from 1983. :)
2008-12-08 00:48
Frantic

Registered: Mar 2003
Posts: 1648
The loader in Deep Throat by Durex uses four pulse lenghts corresponding to 00, 01, 10, and 11. This minimizes the constant minimal length you always need to have in a pulse. I think there was also a fifth pulse length, signalling "syncrhonization point", since you can ffwd and rewind the tape while the demo is playing, but still resync at regular intervalls...

Greetings too Krill! (...and greetings to everyone from the Polish/German border..;)
2008-12-08 06:19
johncl

Registered: Aug 2007
Posts: 37
Ahh, thanks for clearing that out. I didnt know you had such a low level access to the tape read/write mechanisms that enables you to actually time pulses.

So to further discuss this, what did most commercial games use? For example Novaload which I know a number of distributors used. I guess they couldnt squeeze it as low as Turbo Tape as that would probably have ended up with the game not working on some tape drives (and couldnt handle any kind of error).

You see, I am quite surprised at the fact that close to 100% of the old tapes I have tried still load perfectly after 20-25 years of storage (and I mean all sorts of storage since these are bought from around the world). In fact, only one tape has bugged out on me in which the tape drive was not even able pull the tape after 3 count ticks into the tape start. :)
2008-12-08 07:24
Martin Piper

Registered: Nov 2007
Posts: 722
Cyberload/Novaload etc don't handle the potential for the really slow or fast tape drive wobblyness so I suppose it was never much of an issue. Basically, don't bother writing code to calibrate the timings because they're not that much of an issue compared to the cycle timing wobbles you can get when displaying a picture during loading.

Unless you have the screen turned off and want to make a really fast loader. But in my experience the time differences you can get on a real C2N during loading change due to the amount of tape on each spool. Or if the pet dog walks past the C2N. :)
2008-12-08 10:51
Graham
Account closed

Registered: Dec 2002
Posts: 990
I believe that much faster turbo tape formats are possible. The main problem with the existing fast tape stuff is, that those routines always use hardcoded thresholds for 0 and 1. This causes problems if you move from one tape drive to the next so the threshold has to be chosen in such a way that the 0 and 1 ranges are quite big. If you manage to measure the tape drive speed first, you might be able to use much smaller pulse lengths -> faster loading + more data on a tape.
2008-12-08 11:08
algorithm

Registered: May 2002
Posts: 705
There was the SuperTurbo format which was used in the Action Replay Cartridge which i believe was nearly twice as fast as Turbotape. I dont think there was any other loader which would load data this fast commercially but that is understandable as it could have caused more possibility of error
2008-12-08 11:32
Martin Piper

Registered: Nov 2007
Posts: 722
Re: Action Replay super turbo. If the assumption is made that the C2N doing the saving is going to be the C2N that will be doing the loading then it's possible to make the bit rate quicker without any fancy timing calibration. :)
2008-12-08 11:33
johncl

Registered: Aug 2007
Posts: 37
Hm, did any of these fast loaders/savers do real time compression/decompression of data? E.g. RLE compression?
2008-12-08 11:37
enthusi

Registered: May 2004
Posts: 677
There is also supertape format.
3600 baud used in Input64 tape-mag.
It has the option to save/load in high speed mode as well.
7200 baud. Would make it hellish fast too but too unreliable to be called a proper load/save I"d say.
Same goes for that AR-Superturbo. Even the manual says: dont use it when you need your data.
About graham: yeah, the ROM-load sets the thresholds according to sync-signal. TurboTapes SHOULD/could really do that too.

Maybe you dont have to wait all too long to see it done :)
2008-12-08 11:40
johncl

Registered: Aug 2007
Posts: 37
Hehe at 7200 baud you could do a tape movie playback that updated a 7x7 charset image at 2 frames per second! Imagine the quality video you could have (and a few errors here and there wouldnt be too annoying).
2008-12-08 11:42
algorithm

Registered: May 2002
Posts: 705
Quote: Re: Action Replay super turbo. If the assumption is made that the C2N doing the saving is going to be the C2N that will be doing the loading then it's possible to make the bit rate quicker without any fancy timing calibration. :)

Yes certainly. Infact the data could be saved with more density. Superturbo was just below 1k a second if i remember rightly.
2008-12-08 12:03
enthusi

Registered: May 2004
Posts: 677
@johncl the problem with tape loaders is not flipped bits.
That wouldnt hurt and would be rather simple to correct, but MISSING bits. (or extra bits)
Those are pure evil hell to deal with...
2008-12-08 12:10
algorithm

Registered: May 2002
Posts: 705
For fast loading speed, simply pack the data as efficiently as possible before saving. I remember most of the games available in the stone ages (ie vendetta) that would load nearly the full 60k of data or so when the load time could have easily halved if the data was packed beforehand
2008-12-08 12:38
iAN CooG

Registered: May 2002
Posts: 3197
Quote: For fast loading speed, simply pack the data as efficiently as possible before saving. I remember most of the games available in the stone ages (ie vendetta) that would load nearly the full 60k of data or so when the load time could have easily halved if the data was packed beforehand

mainly because there were nearly no packers at that time, at least before 1985 =)
2008-12-08 14:33
Mace

Registered: May 2002
Posts: 1799
Vendetta (c) 1990
2008-12-08 15:10
algorithm

Registered: May 2002
Posts: 705
Quote: Vendetta (c) 1990

And a tonne more of others. If data took long to load, would have also been a good idea to play music, show a picture while next part was loading or even let the user interact in some way (eg subgame - shinobi) etc. Would not make a difference in the complexity of tape mastering as the tape loading would be under priority with everything else running in the background.



2008-12-08 18:59
johncl

Registered: Aug 2007
Posts: 37
Well, there are some Mastertronic tape titles that does have a minigame in front of it. Invade-A-Load was one of them and I remember its on the Rogue game at least. What I find interesting is that many games had fullscreen bitmap pictures that you could see while it was drawing on the screen, basically adding another 20-30 second to the loading time. :)

Of course it was cool back then as you got tired of staring at a blank screen. When loaders came with Galway music pumping out the mono speakers we never wanted to go back. :)
2008-12-08 20:39
algorithm

Registered: May 2002
Posts: 705
Ahh yes, the memories of the rambo music with the picture appearing gradually as the tape was loading the data.. ahhhh
2008-12-08 20:41
algorithm

Registered: May 2002
Posts: 705
Quote: Well, there are some Mastertronic tape titles that does have a minigame in front of it. Invade-A-Load was one of them and I remember its on the Rogue game at least. What I find interesting is that many games had fullscreen bitmap pictures that you could see while it was drawing on the screen, basically adding another 20-30 second to the loading time. :)

Of course it was cool back then as you got tired of staring at a blank screen. When loaders came with Galway music pumping out the mono speakers we never wanted to go back. :)


Just surprising that more was not done with it. After all. the IRQ is responsible for the loading and outside of this, it would have been possible for anything to run without distracting the loading at all unless you wanted solid rasters which would mean more complex tape mastering
2008-12-08 23:24
AlexC

Registered: Jan 2008
Posts: 299
Quote: Just surprising that more was not done with it. After all. the IRQ is responsible for the loading and outside of this, it would have been possible for anything to run without distracting the loading at all unless you wanted solid rasters which would mean more complex tape mastering

The reason is simple - 1541 came ;) But actually Datassette is one of interesting devices because it's capabilities to store huge amount of data (comparing to 1541) and technical details has been almost forgotten even if it looks simple. There are very few technical documents regarding this device unfortunately. I've learned a lot about it studying Cyberload.
2008-12-08 23:40
algorithm

Registered: May 2002
Posts: 705
Tape mastering (eg saving/loading) is very simple. just precise timing and writing values to a location at precise intervals ( i think its memory location 01?) then the loader can be interrupt driven (provided it runs at full priority) to pick up the bits of data saved to tape. The secret is how to place the 0's and 1's. as well as delay timing. As long as the interrupt routine reads all the data, then exits (to allow main loop to execute whatever) and gets back to the interrupt before the next bit appears on tape etc. Anything can occur in the main loop

Although sprites and the screen on can cause problems if the data is more densely packed
2008-12-09 06:48
Martin Piper

Registered: Nov 2007
Posts: 722
Multiplexor while tape loading... Hmm...
2008-12-09 06:52
enthusi

Registered: May 2004
Posts: 677
check this for precise timing on IRQ tape load :)
A Load of TAP

...what a nice thread... :)
2008-12-09 07:24
johncl

Registered: Aug 2007
Posts: 37
Yeah, thats a pretty nice demo showing tape-streaming. I am quite sure there are lots of cool things one could do with it. Still, a scroller is pretty cpu consuming so obviously perfect timing is necessary to be able to use this for example a game or something. Although I guess one would be bored at rewinding the tape for every time one wanted to play again. :)
2008-12-09 07:31
Mace

Registered: May 2002
Posts: 1799
Quote:
Although I guess one would be bored at rewinding the tape for every time one wanted to play again. :)
That is easily fixed by putting the demo on both sides of the tape ;)
2008-12-09 09:00
algorithm

Registered: May 2002
Posts: 705
Quote: Quote:
Although I guess one would be bored at rewinding the tape for every time one wanted to play again. :)
That is easily fixed by putting the demo on both sides of the tape ;)


Or make the demo two sided :-}
2008-12-09 09:34
johncl

Registered: Aug 2007
Posts: 37
What I find strange is that they didnt see the potential of the tape drive better. For example, from what I have understood, these tape drives only recorded one track, while most heads actually supported stereo tracks. Why didnt they record on both tracks which could bring the saving/loading down to half. And while they were at it they could have recorded both "sides" at the same time which would make it 4 times faster. Although that would require the user to always put the tape on the correct side since they would still use the standard tape drive.

I guess it was because they could reuse existing hardware to make it as cheap as possible and once it was established there was no way they could change it. Sad really, imagine tape games loading 4 times faster.
2008-12-09 09:42
algorithm

Registered: May 2002
Posts: 705
Quote: What I find strange is that they didnt see the potential of the tape drive better. For example, from what I have understood, these tape drives only recorded one track, while most heads actually supported stereo tracks. Why didnt they record on both tracks which could bring the saving/loading down to half. And while they were at it they could have recorded both "sides" at the same time which would make it 4 times faster. Although that would require the user to always put the tape on the correct side since they would still use the standard tape drive.

I guess it was because they could reuse existing hardware to make it as cheap as possible and once it was established there was no way they could change it. Sad really, imagine tape games loading 4 times faster.


Thats almost the same question as asking why VIC II did not have 16 sprites rather than 8. I suppose a mono signal is more reliable and 'lasts' longer. Besides if the tape drive had the facility along with the rest of the circuitry for the C64 to be able to read two signals, not many people would have purchased the 1541 (Although Random Access is always great)

The only advantage in the tape drive was its storage capacity in comparison to the disk as well as the cheap price.
2008-12-09 09:48
johncl

Registered: Aug 2007
Posts: 37
Well, I wouldnt say thats a fair comparison. The VIC chip took quite a bit of research and work to be created. Stereo tape drives had been around for a long time, even 8 tracks had been around so the technology for storing data on the whole tape was already there. And the C64 was only recording pulses, not an accurate analogue stream. Its really a technology that was under-estimated or dumbed down for other reasons.

But your marketing point holds valid, the faster the tape drive, the less motivation to buy the 1541. :)
2008-12-09 10:03
algorithm

Registered: May 2002
Posts: 705
I dont think any tape device connected to a computer at that time would be able to save/load two channel streams at once. The signal would have been less reliable without a doubt in comparison to the mono signal.

The Kernal should have had a fastload/save facility. Saving full memory contents in less than 5 minutes and loading would have still been very reliable rather than the ridiculous twice saving of data.

It was too late at the time I suppose. The Kernal was already created just the same as the C2N was created and the tape connector did not have the facility to receive/transmit two signals hence would have to have been userport/cartridge based (perhaps also joyport?)

If you remember later on in the years there was a Rainbow Arts CD with special interface which would load data at a decent speed

Regarding the speed in comparison to 1541 The Turbotape (Particularly Superturbo) was actually faster than 1541 (Without a disk fastload obviously)
2008-12-09 10:12
algorithm

Registered: May 2002
Posts: 705
Unfinished Demo 1

The above is a c64 demo created around 14 years ago or so by me. (Please excuse the lame coding and scrolltext) Had no motivation to finish it at the time (What do you expect when coding the entire thing using AR monitor and Tape!)

It was originally part of a multitape demo which contains an IRQ loader. Press space after the demo which starts off the tape loader. Scrolltext, Fading logos and music, although has potential of full demo parts running while data is being pulled off from tape at around the same speed as turbotape. Although solid rasters are not possible using this method
2008-12-09 17:50
Zer0-X
Account closed

Registered: Aug 2008
Posts: 78
En example for a bedtime read:

http://oms.wmhost.com/TAP/loaders/SLC_Flimbo's_Quest.txt
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Peacemaker/CENSOR/Hi..
rexbeng
marley
Krill/Plush
REBEL 1/HF
Guests online: 121
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.113 sec.