APPLICATIONSDIVERS ★ ASCII FILE COMPACTER|COMPUTING WITH THE AMSTRAD) ★

ASCII File Compacter (Computing with the Amstrad)Screen Compact
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Quarts into pint pots will go IAN SHARPE gets more out of discs by compressing text files

THIS utility is for disc drive owners who, like me, tend to fill up discs with old files that they may never need but don't want to erase. It will compress most text files to between 60% - 70% of their original size.

Type in and run Program I which loads the machine code and sets up two new commands -

|COMPACT,@f1$,@f2$

and

|EXPAND,@f1$,@f2$

With |COMPACT, f1$ is the text file to be compacted and f2$ is the name to call the compacted file. So if you want to compact a file called "bigfile" and call it "tinyfile" you would use:

f1$="bigfile"
f2$="tinyfile"
|COMPACT,@f1$,@f2$

CPC664/6128 owners have an easier life because they can use:

|COMPACT,"bigfile","tinyfile"

Expanding a file with |EXPAND is the reverse process, so f1$ would be the name of a previously compacted file and f2$ the name to give the expanded file. You may even find it convenient to use the same filename in both strings so that the old file is converted to a .bak file.

The only limitation is that your source file should not contain characters above 128 which means special control codes and the pound sign. If you have these in your file they will be made into a 'legal' character below 128 but will not be converted back when you expand the file.

In the case of the pound sign this is converted to a hash which can easily be rectified with a selective search and replace.

The compacter will accept Protext documents as input but this gives rise to a small problem. When you expand the file and reload it, you will find that it is in program mode and a space has been inserted at the start of each line.

That's fine if you only want to see the contents of the file. But if you need to make alterations or print it out the text will not format properly because all the soft carriage returns will have been replaced by the hard variety.

The difference between the two types is that hard returns force Protext to start a new line and soft returns are only temporary markers at the end of a line.

If you change the ruler width and reformat, the soft returns are moved to a suitable new end of line and allow words to be moved to suit the new format. The hard returns do not move and will always force a new line at that point.

Help is at hand with Program II. Make sure the memory is clear, then load your text and put Protext in document mode with the DOC command.

Now type in the short Basic listing exactly as you see it here, with no extra spaces, and replace the 9500 in line 10 with the size of the document. This is displayed on the reverse video bar between the editing and command windows.

Run the program and the hard carriage returns will be replaced with soft ones. Now re-enter Protext and type:

FORMAT

Multiple hard returns are ignored, so if there are places where you want hard returns such as at the end of a paragraph, insert an extra line by pressing Return/Enter at the appropriate point.

10 FOR a%-&1CE TO &1CE+9500:IF PEEK( a%)=10 AND PEEK(a%-2)<>10 AND PEEK(a%+2)<>10 THEN POKE aX,138
20 NEXT


Program II

Each character in a text file is represented as a number known as an Ascii code. Ordinary characters range from 32 to 127.

The compacter works by replacing common two letter combinations with a single character between 128 and 255. For instance, the characters "a ", that is space+a, crop up over and over again so these are replaced by one character thus saving one byte for every occurrence.

CWTA

★ PUBLISHER: Computing with the Amstrad
★ YEAR: 1987
★ CONFIG: ???
★ LANGAGE: ???
★ LICENCE: LISTING
★ AUTHOR: Ian C. Sharpe

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» Text  File  Compacter    (Computing  with  the  Amstrad)    LISTINGDATE: 2013-05-05
DL: 108 fois
TYPE: text
SIZE: 3Ko

Je participe au site:
» Newfile(s) upload/Envoye de fichier(s)
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Edito Save Load Run And Co 31 - Exploitation des Fichiers Ascii
» Applications » Ascii - Binaire Conversion (CPC Revue)
» Applications » Ascii - Read
» Applications » Ascii File Protector (Amstrad Action)
» Applications » ASCII File Compacter (Computing with the Amstrad)
» Applications » Transformateur fichier source DAMS en fichier ASCII

QUE DIT LA LOI FRANÇAISE:

L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 179 millisecondes et consultée 721 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.