From: justin@hybris.UUCP (Justin Richards)
Newsgroups: comp.sys.cbm
Subject: Re:  uuencoder
Distribution: world
Date: 5 Jan 93 16:03:02 CST
Organization: FEC Software Programmers, INC.

In article <1i3cvnINN7lt@crcnis1.unl.edu> Jeremy Bettis <jbettis@cse.unl.edu> writes:
>YOUCKR@Meena.CC.URegina.CA (192503133) writes:
>
>>Can anyone tell me where I can get a UUENCODER or a UUDECODER for the c64 or
>>c128?
>>Perhaps on a FTP site?
>>Thanks!
>>BTW this is the first time I have been able to post a msg on usenet.
>
>Here is a uudecode program I wrote in Turbo Pascal on an IBM PC.  I think
>you ought to be able to see the algorthim from it anyhopw.  It really is
>quite simple to write your own decoder program.  I suppose you copuld write
>in in C-64 Basic, although there is no Bit-Shift-Left/Bit-Shift_Right operations
>yoiu always could use *2 /2 i suppose.
>
>Program UUdecode;
>
>Type
>    String255=String[255];
>
>Procedure ReadIn(Var InFile : Text; Var TheLine : String255 );
>       {Just readin one line of text and return it}
>    Var
>       Index : Integer;
>       TheChar : Char;
>
>    Begin
>       Read(InFile,TheChar);
>       While TheChar In [#10,#13] Do
>           Read(InFile,TheChar);
>       Index := 1;
>       While Not Eof(InFile) And (Index < 255) And Not (TheChar In [#10,#13])
>         Do Begin
>           TheLine[Index] := TheChar;
>           Index := Index + 1;
>           Read(InFile,TheChar);
>       End;
>       TheLine[0] := Chr(Index - 1) ; {Pascal strings.... sheez}
>    End;
>
>Var
>    PIndex : Word;
>    InFile, OutFile : Text;
>    TheLine, FileName : String255;
>    Index, Len, OutIndex : Integer;
>    Out : String[3];
>
>Begin
>    FileName := '';
>    Assign(OutFile,FileName);
>    ReWrite(OutFIle);
>    For PIndex := 1 To ParamCount Do Begin
>       Assign(InFile,ParamStr(PIndex)); {Turbo Pascal Oddities}
>       {$I-}
>       ReSet(InFile);
>       {$I+}
>       If IOResult = 0 Then Begin
>           While Not Eof(InFile) Do Begin
>               ReadIn(InFile,TheLine);
>               If Copy(TheLine,1,5) = 'begin' Then Begin
>                   FileName := Copy(TheLine,11,12);
>                   Close(OutFile);
>                   Assign(OutFile,FileName);
>                   {$I-}
>                   ReWrite(OutFile);
>                   {$I+}
>                   If IOResult <> 0 Then Begin
>                       Assign(OutFile,'');
>                       ReWrite(OutFile);
>                   End;
>               End
>               Else If Copy(TheLine,1,3) = 'end' Then Begin
>                   FileName := '';
>                   Close(OutFile);
>                   Assign(OutFile,'');
>                   ReWrite(OutFile);
>               End Else Begin
>                   OutIndex := Ord(TheLine[1]) AND 63 XOR 32;
>                   Len := Length(TheLine);
>                   If ((OutIndex + 2) Div 3)*4 = (Len - 1) Then Begin
>                       Index := 2;
>                       While OutIndex > 0 Do Begin
>                           If OutIndex >2 Then Out[0]:=#3
>                           Else Out[0]:=Chr(OutIndex);
>{SHL = Shift Left}         Out[1]:=Chr((Ord(TheLine[Index]) AND 63 SHL 2
>{SHR = Shift Right}         OR Ord(TheLine[Index+1]) AND 48 SHR 4) XOR 130);
>{x SHL n = x * 2^n }       Out[2]:=Chr((Ord(TheLine[Index+1]) AND 15 SHL 4
>{x SHR n = x / 2^n }        OR Ord(TheLine[Index+2]) AND 60 SHR 2) XOR 8);
>                           Out[3]:=Chr((Ord(TheLine[Index+2]) AND 3 SHL 6
>                            OR Ord(TheLine[Index+3]) AND 63) XOR 32);
>                           Index := Index + 4;
>                           OutIndex := OutIndex -3;
>                           Write(OutFile,Out);
>                       End;
>                   End; {If it is of improper length, skip it}
>               End;
>           End;
>       End;
>       Close(InFile);
>    End;
>    Close(OutFile);
>End.
>--
>Jeremy Bettis   -*-   Jerbo Jehoshaphat   -*-   University of Nebraska
>INET:  jbettis@cse.unl.edu             "Those who stand in the middle of the
>       bt757@Cleveland.Freenet.Edu      road are often hit by passing cars."
> BBS:  The Dew Drop Inn (402)476-8807 3/12/24

--
Jerbo Jerbo Jerbo..  I thought we worked on this before..  I have a
uudecode program for the C64, I'll just have to see if I can find it
under all of that dust..  (easier solution, get an Amiga  ;-)

---

                      ---==* Justin Richards *==---
Hybris.UUCP  Amiga500  9600 baud      UUCP:  ..mmedia!hybris!justin
INET:  br365@Cleveland.Freenet.Edu