[comp.sys.atari.8bit] ATASCII to ASCII

rrwood@lotus.waterloo.edu (Roy Wood) (11/10/89)

I realize that this has probably been asked before, but I'm asking again.

I have a couple of text files that I would like to print from my Unix account,
but they are ATASCII files, not ASCII.  Is there a utility I can use to convert
them to ASCII without having to download them to my 130XE (which understands
ATASCII) and upload them to the Unix account (the software for the 130XE knows
how to convert ATASCII to ASCII).  Obviously I could write the software myself,
but then I'd have to actually think about it and spend time I  can't afford.

So, in the interests of my own laziness and desire to survive this academic
term, I appeal to you.



Thanks, 

Roy Wood (rrwood@lotus.waterloo.edu)

gdtltr@sun.acs.udel.edu (Gary D Duzan) (11/10/89)

In article <18039@watdragon.waterloo.edu> rrwood@lotus.waterloo.edu (Roy Wood) writes:
=>I realize that this has probably been asked before, but I'm asking again.
=>
=>I have a couple of text files that I would like to print from my Unix account,
=>but they are ATASCII files, not ASCII.  Is there a utility I can use to convert
=>them to ASCII without having to download them to my 130XE (which understands
=>ATASCII) and upload them to the Unix account (the software for the 130XE knows
=>how to convert ATASCII to ASCII).  Obviously I could write the software myself,
=>but then I'd have to actually think about it and spend time I  can't afford.
=>
=>So, in the interests of my own laziness and desire to survive this academic
=>term, I appeal to you.
=>
=>
=>
=>Thanks, 
=>
=>Roy Wood (rrwood@lotus.waterloo.edu)

   In the distribution of CC65 there is a set of utilities for converting files
between ASCII and ATASCII. I believe that the ATASCII -> ASCII program inserts
CR-LF pairs, so on the Unix machine you will have to remove the CR's. vi does
this nicely: ":%s/^V^M//g" You can get CC65 from terminator.cc.umich.edu. Look
for the conversion programs in ~ftp/atari/8bit/cc65/utils.arc .

                                        Gary Duzan
                                        Time  Lord
                                    Third Regeneration




-- 
      _o_                                                            _o_
    [|o o|]        "Two hearts are better than one." -- Yes        [|o o|]
     |_O_|      "Don't listen to me; I never do." -- Doctor Who     |_O_|

ken@hpclkms.HP.COM (Ken Sumrall) (11/12/89)

>I have a couple of text files that I would like to print from my Unix account,
>but they are ATASCII files, not ASCII.  Is there a utility I can use to convert
>them to ASCII without having to download them to...

Why not just use tr(1).  When I missed a few issues of zmag a while back,
I called a BBS, and pulled down an ARC of the missing issues.  Then the fun
began, as I had to hunt down an ARC program (I have ARC5.21 sources if
anybody wants them.  I added #ifdef's to handle HP-UX on the series
300, 500, and 800), and after I de-arc'ed them, I too had to convert them
from atascii to ascii.  I made a very simple shell script using tr(1)
to convert the file for me.  Here is is:

---------------------------------------------------------------------------
#!/bin/sh
#This reads in ATASCII files, and spits out unix text files.
#Stdin and stdout are used.

tr -d "[\001-\037][\200-\232][\234-\377]" |tr "\233" "\012"
---------------------------------------------------------------------------

Basically, what it does is remove all characters in the range 1-31, 128-154,
and 156-255.  (I wanted it to remove character 0 also, but tr(1) chokes when
you try to muck with the null character).  Then tr(1) converts character
155 (Atari EOL) to character 10 (unix EOL).  This worked fine in converting
the zmag's.

Hope this helps.

Ken Sumrall
HP California Language Labs
ken%hpda@hplabs.hp.com
...!hplabs!hpda!ken

jrd@STONY-BROOK.SCRC.SYMBOLICS.COM (John R. Dunning) (11/13/89)

    Date: 10 Nov 89 09:03:58 GMT
    From: sun.acs.udel.edu!gdtltr@vax1.acs.udel.edu  (Gary D Duzan)

       In the distribution of CC65 there is a set of utilities for converting files
    between ASCII and ATASCII. 

Right.  Part of the idea behind those frobs is that you can use them
equally well on the Atari, or anything else with a C compiler.

			       I believe that the ATASCII -> ASCII program inserts
    CR-LF pairs, so on the Unix machine you will have to remove the CR's. 

Right.  It's Atascii to *Ascii*, not Atascii to unix.  There's a
compile-time switch you can set to make it generate *nix tex, rather
than Ascii.

rbharding@orchid.waterloo.edu (Ron Harding) (11/13/89)

In article <18039@watdragon.waterloo.edu> rrwood@lotus.waterloo.edu (Roy Wood) writes:
>I realize that this has probably been asked before, but I'm asking again.
>
>I have a couple of text files that I would like to print from my Unix account,
>but they are ATASCII files, not ASCII.  Is there a utility I can use to convert
>them to ASCII without having to download them to my 130XE (which understands
>ATASCII) and upload them to the Unix account (the software for the 130XE knows
>how to convert ATASCII to ASCII).  Obviously I could write the software myself,
>but then I'd have to actually think about it and spend time I  can't afford.
>
>So, in the interests of my own laziness and desire to survive this academic
>term, I appeal to you.
>
>
>
>Thanks, 
>
>Roy Wood (rrwood@lotus.waterloo.edu)

    Just a couple days ago I had the same problem.  Since I'm not so lazy, I
whipped out a quickie fix for the problem.  The fruits of my labors appear
below, in source code form.

    Just cut the source into a file with some appropriate name like "convert.c"
and type, to the shell, "cc -o ~/bin/convert convert.c"

    You should then have an executable program, which acts like a filter, i.e.,
it reads ATASCII from standard input, and writes Unix ASCII to standard output.

    My specific use of it was "convert <kermit65.doc | lpr"

    It is, of course, rather simplistic.  It just changes $9b's to $0a's.  
Other ATASCII weirdities like inverse video aren't considered.

    Anyway, here's the source.  It's very complex, so don't try to understand
it unless you have a PhD in computer science.

--------------------------------------------------------------------------------
 "Nuke 'Em!  Get them before they get you.     | Ron Harding
  Another quality home game from Butler Bros." | rbharding@orchid.waterloo.edu
--------------------------------------------------------------------------------

================================Snip, snip======================================
#include <stdio.h>

main() {
	int c;

	while( (c=getchar()) != EOF )
		if( c == 0x9b ) putchar( 0x0a );
		else putchar( c );
}

den@hpfinote.HP.COM (Don Novy) (11/14/89)

  As far as conversion from ATASCII to ASCII for UNIX, I have done the reverse
operation. The only thing I changed was the end of line character. UNIX (at
least HP-UX) uses a carriage return while ATASCII uses octal 233. I have
converted files from HP-UX to ATASCII with the following simple command:

cat $1 | tr "\012" "\233" > $1.atr

  This simply lists the file and translates carriage returns (octal 012) to the
ATASCII end of line (octal 233). It also changes the file name by adding the
".atr" suffix.

  It would be rivial to run this conversion in the opposite direction to get
files to a UNIX system.

Don Novy
Hewlett-Packard

frw@cbnewsc.ATT.COM (frank.r.wenk) (11/14/89)

The easiest way to convert the Atari EOL character to UNIX EOL is to upload the
the ATASCII file to your UNIX account and then use the UNIX translate command:

tr "\233" "\12" < uploaded_filename > your_choice_filename

Note that the 233 is the 'OCTAL' representation for the ATARI EOL 'DECIMAL'
155 and the 12 is the 'OCTAL' representation for the ASCII 'DECIMAL' 10.

Your_choice_filename will have the UNIX (ASCII) EOL characters.

Exchange the '12' and the '233' in the above command to convert from ASCII
(UNIX) end-of-line character to the ATASCII EOL and then download to your
ATASCII machine.


                                             F. R. Wenk
                                             ihlpf!frw

rac@sherpa.uucp (Roger Cornelius) (11/15/89)

From article <19891112204048.5.JRD@MOA.SCRC.Symbolics.COM>, by jrd@STONY-BROOK.SCRC.SYMBOLICS.COM (John R. Dunning):
> 
>>    Date: 10 Nov 89 09:03:58 GMT
>>    From: sun.acs.udel.edu!gdtltr@vax1.acs.udel.edu  (Gary D Duzan)
>>
>>			       I believe that the ATASCII -> ASCII program inserts
>>    CR-LF pairs, so on the Unix machine you will have to remove the CR's. 
> 
> Right.  It's Atascii to *Ascii*, not Atascii to unix.  There's a
> compile-time switch you can set to make it generate *nix tex, rather
> than Ascii.

I believe ASCII only describes a character set, not a file format.  As
far as I know, ASCII says nothing about what character (or combination
thereof) should be used as a line terminator.

Ending a line of text with a single LF (as all UNIX systems I've used
do) is as much ASCII as ending one with a CR/LF pair (like MSDOS and CPM
do).  Both CR and LF are valid ASCII characters.  Atari's $9b line
terminator is not.

You can reword your comment to:
> Right.  It's Atascii to *MSDOS*, not Atascii to unix.  There's a
> compile-time switch you can set to make it generate *nix tex, rather
> than MSDOS text.

Roger
--
Roger A. Cornelius           rac@sherpa            uunet!sherpa!rac