Displaying files

Mark S Baines msbaines@cix.compulink.co.uk 01862 871624

An accessory displayed on screen using the desktop 'Show'. Not much sense in that then!
 

Some files can be displayed on the screen when you double-click on them, others can't.
Why not?
Mark Baines explains.
All of you will have found that TOS allows files containing textual material to be displayed on the Desktop by double-clicking on them. No? Well, try it by double-clicking on your DESKTOP.INF or NEWDESK.INF file. An alert box is shown with the 'Show/Print/Cancel' buttons. Click on 'Show' and the text is displayed. The [Return] key normally scrolls down one line at a time, [Space] scrolls a whole screen and [Q] quits.
The trouble with this is that we can't always tell beforehand which files are readable text files. A file called READ.ME is intended to be read from the Desktop, and also most files with a *.TXT, *.ASC and sometimes *.DOC filename extenders. Occasionally though, we like to see what's contained in other files.
Non-executable files
Most of you will have tried to double-click on other non-executable files to see what happens or to try to display them to the screen. Such files are those without the *.PRG, *.TTP, *.TOS, *.APP and *.GTP filename extenders (note that not all versions of TOS and alternative desktops support the *.GTP extender). One of two things normally happen which depends on the file format. Either the file will be displayed clearly, showing text characters you can read and make sense of (as above with DESKTOP.INF) or the screen fills up with a whole mess of characters and blank spaces with occasional, tantalizing sections of sense and the computer 'pings' at you randomly. Sometimes in this situation, the screen display can become confused and the computer may even crash. Try this with an accessory file, with the *.ACC or *.ACX filename extender.
Characters are stored as bytes. Each byte consists of eight bits and there are a total of 256 different combinations of these bits, therefore a byte can have any value from 0 to 255. The characters that we normally use for text are those in the ASCII (American Standard Code for Information Interchange) character set numbered from 32 to 126 inclusive. This includes the upper and lower alphabets, numbers and punctuation characters. Only some of the first 32 characters are capable of being displayed and only under certain circumstances as not all programs allow their use. GEM programs use some of them as special symbols. Look at the figure - recognize any? Other programs treat them as control codes. Character zero is the NUL (null) character and unprintable. Character seven is the BEL (bell) character which causes the computer to 'ping' when sent to the screen. There are carriage return, tab, line feed, form feed and backspace characters and character 127 is the DEL (delete) character. All the characters from 128 to 255 contain the European accented characters, Hebrew, Greek and maths symbols that, again, only some programs can access such as word processors and editors. These characters are not part of the ASCII character set and are not standard. Only Atari TOS has the Hebrew character set instead of the IBM/ANSI standard set of lines and box drawing characters, for instance. Comms enthusiasts may be more familiar with these and most dot matrix printers can be made to use them when switched to IBM mode.
Text files
Text files come in two basic formats - pure, straight ASCII and formatted ASCII. Straight ASCII files contain nothing but text characters from the ASCII character set, generally only within the range 32 to 126 and normally contain a carriage return character at the end of each line. Word processor files that have been saved in ASCII format and those from text editors are usually pure ASCII. Some other programs store their data as pure ASCII text files, such as the DESKTOP.INF or ASSIGN.SYS files. They may have filename extenders such as *.DAT, *.INF, *.SYS, *.CNF, *.LST, *.INI and *.LOG but this doesn't mean that these types of files are always straight ASCII though. It is normally intended for the user to view these files from the Desktop or for the more advanced user to directly edit them in an editor.


The Atari character set - recognise any of the characters below number 32? Many of the others are standard on PCs especially the accented ones and those above 220.

Text files written by word processors are normally saved as formatted ASCII files. These programs insert other codes within the text to control the formatting when printed. These codes may show up as strange characters when displayed on the desktop. The text may also be stored in other ways making it unreadable. For instance, 1st Word and WordWriter do not use the normal character 32 as a space but use character 30 instead. When these documents are displayed they can either appear to have no spaces between the words or a strange squiggle (actually the bottom left quarter of the 'Atari face') instead. Such files also tend to have carriage return characters at the end of paragraphs only.
Non-text files
When a program is compiled into machine code for the computer to run, the machine code instructions are held in bytes. In a program these bytes have special meanings which are interpreted by the computer and run as the program you see. But if we try to examine these bytes by displaying them on the screen rather than executing them, TOS converts each value to its ASCII character equivalent. What we see on the screen doesn't make sense to us unless that program file also contains some normal text we can read somewhere, such as the program's title or dialog text. We also hear the computer 'ping' every time it comes across a byte with the value seven. Usually displaying executable files in this manner is pointless.
Other programs store their data in a coded or a compressed form to save space. Again, TOS interprets this as described above. DTP programs and all graphics programs are typical of this. Of course, a picture, such as a Degas or *.IMG file will not display as an image on the Desktop. Again, TOS will attempt to look at each byte in turn and show its ASCII equivalent on the screen. Not the same at all.
More about TOS
When TOS displays text on the screen like this it is using the in-built VT52 emulator to do so. This uses a standard series of codes to control the display of characters and is often used in communication terminal programs. These codes are escape code sequences similar but not related to those used by printers. For instance, Escape-p or the bytes 27 and 112 will reverse the foreground and background colours. Very useful in programs for highlighting text, but in a displayed non-text file the screen will suddenly invert. Little wonder, then, that the screen display misbehaves, TOS gets confused and your ST crashes.
So why can't TOS recognise what type of files should be displayed and which shouldn't? Well, it can recognise certain file types, for when you double-click on a *.PRG, *.TOS, *.TTP or *.APP file it doesn't display them but executes them. Part of the answer to this is contained in the DESKTOP.INF or NEWDESK.INF file.
In the DESKTOP.INF file there should be lines like this:
#F FF 04   @ *.*@
#D FF 01   @ *.*@
#G 03 FF   *.APP@ @
#G 03 FF   *.PRG@ @
#F 03 04   *.TOS@ @
#P 03 04   *.TTP@ @
The #F line determines which icon all the files will have as a default, usually icon number four, the document icon. This is then modified by the lines following it. The #D line determines which icon the folders will have (number one, a folder icon). The #G lines install the GEM applications giving them a program icon and treating all files with the filename extenders *.PRG and *.APP as GEM programs. The #F and #P lines do the same for TOS (*.TOS) and TOS Takes Parameters (*.TTP) programs. There can be additional lines in NEWDESK.INF (for TOS 2, 3 and 4) for GEM Takes Parameters (*.GTP) programs and Accessories (*.ACC). Users of MagiC and alternative desktops may find similar lines in their desktop configuration files.
So, when you double-click on a file that has one of these extenders, TOS knows how to treat that file. Any other file is, by default, treated as a document file as determined by the first #F line. When double-clicked on it is not run but shown to the screen. TOS assumes that the user knows which files should be displayed and not to click on, for instance, *.RSC files.
If you feel brave, you can edit the DESKTOP.INF file (make a backup copy first) and remove the #G lines, save it to your boot-up disk and re-boot the computer. Now attempt to double-click on a *.PRG file! Copy back the original DESKTOP.INF and re-boot to get back to normal.


Look 'n See is a very versatile file viewer and apart from the usual various text and image files, can even play sound files, show *.RSC files and even the contents of ZIP files.

Because TOS can get into a mess when displaying a non-text file and may even crash, it is always best to view such files in a program that can handle it better. This is the point of the 'Install Application...' menu item on the Desktop. You tell TOS that when you double-click on a text file with the filename extender *.TXT it should load up another program to view it better. The same goes for image files, your word processor files etc. This works very well but the desktop dialog only allows you to have one filename extender for each application. However, you can edit your DESKTOP.INF or NEWDESK.INF file to make things more flexible. For instance, if I wanted Imagecopy to display any image file I might find on my hard disk I add the following lines to my DESKTOP.INF file:
#G 03 04   C:\IMGC4.PRG@ *.IMG@
#G 03 04   C:\IMGC4.PRG@ *.TIF@
#G 03 04   C:\IMGC4.PRG@ *.GIF@
#G 03 04   C:\IMGC4.PRG@ *.JPG@
#G 03 04   C:\IMGC4.PRG@ *.PI?@
#G 03 04   C:\IMGC4.PRG@ *.PC?@
#G 03 04   C:\IMGC4.PRG@ *.NEO@
or for NEWDESK.INF:
#G 03 04 200 C:\IMGC4.PRG@ *.IMG@ @
#G 03 04 200 C:\IMGC4.PRG@ *.TIF@ @
and so on. Notice that filename wildcards can be used, so that all uncompressed Degas files (*.PI1, *.PI2, *PI3 etc) can be catered for in one line. You can extend all your applications like this and this also works for alternative desktops, such as NeoDesk and MagxDesk.
There are special file viewers obtained from PD libraries which will intercept any files that are not listed in DESKTOP.INF or NEWDESK.INF as being assigned to an application. Some of these are for displaying only text files and enabling you to have more control over moving through them than the desktop allows. Others will also display image files and play sound files. Myself - I prefer a good text editor to display my text files so that I may also edit them if I wish, something I need to do quite often.
 
 

[Home] [Info] [Back] [Next]