home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / cbm / 5327 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  4.6 KB

  1. Path: sparky!dsndata!mmedia!hybris!justin
  2. From: justin@hybris.UUCP (Justin Richards)
  3. Newsgroups: comp.sys.cbm
  4. Subject: Re:  uuencoder
  5. Distribution: world
  6. Message-ID: <justin.02r1@hybris.UUCP>
  7. References:  <1993Jan02.043134.492137@sue.cc.uregina.ca> <1i3cvnINN7lt@crcnis1.unl.edu>
  8. Date: 5 Jan 93 16:03:02 CST
  9. Organization: FEC Software Programmers, INC.
  10.  
  11. In article <1i3cvnINN7lt@crcnis1.unl.edu> Jeremy Bettis <jbettis@cse.unl.edu> writes:
  12. >YOUCKR@Meena.CC.URegina.CA (192503133) writes:
  13. >
  14. >>Can anyone tell me where I can get a UUENCODER or a UUDECODER for the c64 or
  15. >>c128?
  16. >>Perhaps on a FTP site?
  17. >>Thanks!
  18. >>BTW this is the first time I have been able to post a msg on usenet.
  19. >
  20. >Here is a uudecode program I wrote in Turbo Pascal on an IBM PC.  I think
  21. >you ought to be able to see the algorthim from it anyhopw.  It really is
  22. >quite simple to write your own decoder program.  I suppose you copuld write
  23. >in in C-64 Basic, although there is no Bit-Shift-Left/Bit-Shift_Right operations
  24. >yoiu always could use *2 /2 i suppose.
  25. >
  26. >Program UUdecode;
  27. >
  28. >Type
  29. >    String255=String[255];
  30. >
  31. >Procedure ReadIn(Var InFile : Text; Var TheLine : String255 );
  32. >       {Just readin one line of text and return it}
  33. >    Var
  34. >       Index : Integer;
  35. >       TheChar : Char;
  36. >
  37. >    Begin
  38. >       Read(InFile,TheChar);
  39. >       While TheChar In [#10,#13] Do
  40. >           Read(InFile,TheChar);
  41. >       Index := 1;
  42. >       While Not Eof(InFile) And (Index < 255) And Not (TheChar In [#10,#13])
  43. >         Do Begin
  44. >           TheLine[Index] := TheChar;
  45. >           Index := Index + 1;
  46. >           Read(InFile,TheChar);
  47. >       End;
  48. >       TheLine[0] := Chr(Index - 1) ; {Pascal strings.... sheez}
  49. >    End;
  50. >
  51. >Var
  52. >    PIndex : Word;
  53. >    InFile, OutFile : Text;
  54. >    TheLine, FileName : String255;
  55. >    Index, Len, OutIndex : Integer;
  56. >    Out : String[3];
  57. >
  58. >Begin
  59. >    FileName := '';
  60. >    Assign(OutFile,FileName);
  61. >    ReWrite(OutFIle);
  62. >    For PIndex := 1 To ParamCount Do Begin
  63. >       Assign(InFile,ParamStr(PIndex)); {Turbo Pascal Oddities}
  64. >       {$I-}
  65. >       ReSet(InFile);
  66. >       {$I+}
  67. >       If IOResult = 0 Then Begin
  68. >           While Not Eof(InFile) Do Begin
  69. >               ReadIn(InFile,TheLine);
  70. >               If Copy(TheLine,1,5) = 'begin' Then Begin
  71. >                   FileName := Copy(TheLine,11,12);
  72. >                   Close(OutFile);
  73. >                   Assign(OutFile,FileName);
  74. >                   {$I-}
  75. >                   ReWrite(OutFile);
  76. >                   {$I+}
  77. >                   If IOResult <> 0 Then Begin
  78. >                       Assign(OutFile,'');
  79. >                       ReWrite(OutFile);
  80. >                   End;
  81. >               End
  82. >               Else If Copy(TheLine,1,3) = 'end' Then Begin
  83. >                   FileName := '';
  84. >                   Close(OutFile);
  85. >                   Assign(OutFile,'');
  86. >                   ReWrite(OutFile);
  87. >               End Else Begin
  88. >                   OutIndex := Ord(TheLine[1]) AND 63 XOR 32;
  89. >                   Len := Length(TheLine);
  90. >                   If ((OutIndex + 2) Div 3)*4 = (Len - 1) Then Begin
  91. >                       Index := 2;
  92. >                       While OutIndex > 0 Do Begin
  93. >                           If OutIndex >2 Then Out[0]:=#3
  94. >                           Else Out[0]:=Chr(OutIndex);
  95. >{SHL = Shift Left}         Out[1]:=Chr((Ord(TheLine[Index]) AND 63 SHL 2
  96. >{SHR = Shift Right}         OR Ord(TheLine[Index+1]) AND 48 SHR 4) XOR 130);
  97. >{x SHL n = x * 2^n }       Out[2]:=Chr((Ord(TheLine[Index+1]) AND 15 SHL 4
  98. >{x SHR n = x / 2^n }        OR Ord(TheLine[Index+2]) AND 60 SHR 2) XOR 8);
  99. >                           Out[3]:=Chr((Ord(TheLine[Index+2]) AND 3 SHL 6
  100. >                            OR Ord(TheLine[Index+3]) AND 63) XOR 32);
  101. >                           Index := Index + 4;
  102. >                           OutIndex := OutIndex -3;
  103. >                           Write(OutFile,Out);
  104. >                       End;
  105. >                   End; {If it is of improper length, skip it}
  106. >               End;
  107. >           End;
  108. >       End;
  109. >       Close(InFile);
  110. >    End;
  111. >    Close(OutFile);
  112. >End.
  113. >--
  114. >Jeremy Bettis   -*-   Jerbo Jehoshaphat   -*-   University of Nebraska
  115. >INET:  jbettis@cse.unl.edu             "Those who stand in the middle of the
  116. >       bt757@Cleveland.Freenet.Edu      road are often hit by passing cars."
  117. > BBS:  The Dew Drop Inn (402)476-8807 3/12/24
  118.  
  119. --
  120. Jerbo Jerbo Jerbo..  I thought we worked on this before..  I have a
  121. uudecode program for the C64, I'll just have to see if I can find it
  122. under all of that dust..  (easier solution, get an Amiga  ;-)
  123.  
  124. ---
  125.  
  126.                       ---==* Justin Richards *==---
  127. Hybris.UUCP  Amiga500  9600 baud      UUCP:  ..mmedia!hybris!justin
  128. INET:  br365@Cleveland.Freenet.Edu
  129.  
  130.  
  131.  
  132.