home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / asm / MISC_ASM.ZIP / UUD17.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-11-11  |  17.3 KB  |  549 lines

  1.         name    UUD
  2.         page    55,132
  3.         title   'UUDECODE.ASM'
  4. ;
  5. ; UUDECODE.ASM -- UUDecodes a UUEncoded Binary File
  6. ;
  7. ; Copyright (C) 1988, by Theodore A. Kaldis
  8. ;
  9. ; To assemble and link this program into the executable UUDECODE.COM:
  10. ; (It will NOT run assembled as an .EXE program!)
  11.  
  12. ;        MASM UUD;
  13. ;        LINK UUD;
  14. ;        (If you just have EXE2BIN:
  15. ;          EXE2BIN UUD
  16. ;          REN UUD.BIN UUDECODE.COM (or whatever)
  17. ;        (If you have Public Domain EXE2COM or equivalent:
  18. ;          EXE2COM UUD
  19. ;          REN UUD.COM UUDECODE.COM (or whatever)
  20. ;        (Delete the .OBJ file)
  21.  
  22. ; See version 1.1 for .EXE equivalent.
  23.  
  24. ;v1.7, 9 Nov 88
  25. ; - Versions since 1.3 BROKE (a new Truncated line test).
  26. ;   Trying again.
  27. ; - Handling headers, tailers, truncated lines ok.
  28. ; - Moving some start-up data and code down into buffer space
  29. ;   just as an exercise.
  30. ; - Previously cut down input buffer size to limit buffer requirements.
  31. ;   However, since DOS needs 64Kb to load a .COM file anyway,
  32. ;   might as well use the entire 64Kb segment allocated us.
  33.  
  34. ;(notes on versions 1.4 thru 1.6 discarded.)
  35.  
  36. ;v1.3, 7 Sep 88
  37. ; - Tightened up seeking for 'begin' and 'end'.
  38. ; - Added 'start' error.
  39. ; - Tightened up line reading, uudecoding a little.
  40. ; - made console/error msgs REALLY go to standard ErrOut device (2)
  41. ; - Renamed to UUD13.ASM (differenciate from UUE, UU).
  42.  
  43. ;V1.2, 6 Sep 88
  44. ; - Changing to .COM format.
  45. ; - moved a bunch of buffers (file names, input and output buffers)
  46. ;   to be just pointers at code end (not taking up file space).
  47. ; - Reduced max file read from 0FE00H to 0F000H (to stay within 64Kb
  48. ;   for program and buffers).
  49.  
  50. ;V1.1, 6 Sep 88
  51. ; Toad Hall Tweak
  52. ; - General tightening.
  53. ; - Added comments.
  54. ;
  55. ;
  56. ; David Kirschbaum
  57. ; Toad Hall
  58. ; kirsch@braggvax.ARPA
  59. ;-------------------------------------------
  60. CR        EQU    0DH
  61. LF        EQU    0AH
  62. SPC        EQU    20H
  63. CMD_TAIL    EQU    80H        ;PSP cmd line offset
  64. ;-------------------------------------------
  65. Cseg        SEGMENT PARA PUBLIC 'CODE'
  66.         ASSUME  CS:Cseg,DS:Cseg, ES:Cseg
  67.     org    100H
  68.  
  69. ;-------------------------------------------
  70. Uudecode    PROC    near
  71.     jmp    Start        ;jump over data
  72.  
  73. ;This data will be used during the uudecode run.            v1.7
  74.  
  75. err_inp        DB      'Input file error.',CR,LF
  76. ERR_INP_LEN    EQU    $-err_inp
  77. err_out        DB      'Output file error.',CR,LF
  78. ERR_OUT_LEN    EQU    $-err_out
  79. err_begin    db    'start not found.',CR,LF
  80. ERR_START_LEN    EQU    $-err_begin
  81.  
  82. err_end        DB      'End not found.',CR,LF
  83. ERR_END_LEN    EQU    $-err_end
  84.  
  85. inp_handle    DW    0
  86. out_handle    DW    0
  87. uuptr        DW    uubuff        ;points at next byte in uuencoded
  88.                     ; input buffer uubuff
  89. uuEndptr    DW    uubuff        ;points beyond uuencoded data    v1.7
  90.                     ; (e.g., buffer end)        v1.7
  91. outptr        DW    out_buf        ;pointer to binary output buffer v1.7
  92.                     ; (where to stuff NEXT uudecoded byte)
  93. ;-------------------------------------------
  94.  
  95. Start:
  96.     call    Init            ;cmd line parsing, file opening    v1.7
  97. ;v1.7 If we make it back, all's ok.
  98. ;We should have input file opened.
  99.  
  100.     CALL    Read_File        ;do the initial read
  101.     
  102. Get_Out_Fil:
  103.     mov    di,offset out_buf    ;clear DI            v1.7
  104.     CALL    Get_Line        ;read a line of input
  105.  
  106. ;Look for uuencoded file's 'begin'
  107. ;(Don't like this very much .. could be stuck here until we've gone
  108. ;through the entire doggone file!  Oh, well ..it works anyway..
  109. ;(Also gobbles up any headers or other garbage at file start.)
  110. ;Tried a 'CMPSB'  or 'SCASB' of the input buffer against a 'begin'
  111. ;in our own code space, but it was a mess!
  112.  
  113.     lodsw                ;snarf 2 plaintext chars
  114.     cmp    ax,'eb'            ;'be'?
  115.     jne    Get_Out_Fil        ;nope, next line
  116.     lodsw                ;next 2
  117.     cmp    ax,'ig'            ;'gi'?
  118.     jne    Get_Out_Fil        ;nope, next line
  119.     lodsw                ;next 2
  120.     cmp    ax,' n'            ;'n '?
  121.     jne    Get_Out_Fil        ;nope, next line
  122.  
  123.     MOV    DI,offset out_fil    ;to output buffer        v1.7
  124.  
  125. ;AH is already a space for fast comparisons
  126. Strip_Spc:
  127. ;Gobble spaces until we hit the number after 'start'
  128.     LODSB
  129.     CMP    AL,ah            ;space?
  130.     jbe    Strip_Spc        ;gobble spaces, tabs, ctrl chars v1.7
  131. Strip_Num:
  132. ;Hit the number, now gobble until the space after number
  133.     LODSB
  134.     CMP    AL,ah            ;space?
  135.     JNE    Strip_Num        ;gobble until space
  136. ;v1.7 now gobble any spaces between number and name ... sigh ...
  137. Strip_Spc2:
  138.     lodsb
  139.     cmp    al,ah            ;space?                v1.7
  140.     jbe    Strip_Spc2        ;gobble until real char        v1.7
  141.  
  142. ;We should now be at the first char of the original target's filename.
  143. ;Move output filename from line_in buffer to our output filename buffer.
  144. ;Since line_in has been padded with spaces, a space will indicate
  145. ;name end.
  146. Get_Out:
  147.     cmp    al,ah            ;space means done        v1.7
  148.     je    Out_Fin            ;yep, name end            v1.7
  149.     STOSB                ;input byte > out_fil filename buff
  150.     lodsb                ;next filename char        v1.7
  151.     JMP    Get_Out            ;and keep going
  152. ;-------------------------------------------
  153. Out_Fin:
  154.     MOV    DX,offset out_fil    ;output filename buffer
  155.     xor    cx,cx            ;normal file attribs (R/W)
  156.     mov    [di],cl            ;AsciiZ output filename        v1.7
  157.     MOV    AH,3Ch            ;create output file
  158.     INT    21h
  159.     JNC    Out_Open        ;went ok
  160.      JMP    Out_Err            ;output file create error
  161. ;-------------------------------------------
  162. Out_Open:
  163.     MOV    out_handle,AX        ;remember output file handle
  164.     MOV    DI,offset out_buf    ;prepare to clear outptr    v1.7
  165. New_Line:
  166.     CALL    Get_Line        ;read in uuencoded line
  167.  
  168. ;First char is nr of binary bytes used to produce this line. (Asciified)
  169. ;If there's an empty last line, it'll just be a space or '`'
  170.     LODSB                ;snarf uuencoded binary byte count
  171.     or    al,al            ;empty line?            v1.7
  172.     jz    Prog_End        ;yep                v1.7
  173.  
  174.     mov    bx,2020H        ;a handy constant        v1.7
  175.     sub    al,bl    ;20H        ;Deasciify            v1.7
  176.     or    al,al            ;null?
  177.     JE    Prog_End        ;yep, must be done
  178.  
  179. ;v1.7 keeping line's binary byte count in BP
  180.     xor    ah,ah            ;clear msb            v1.7
  181.     mov    bp,ax            ;BP=binary byte count        v1.7
  182.  
  183. ;uuencoded stuff (input) is in 'quads' (4-char packets),
  184. ;binary output is in 'hunks' (3 byte packets)
  185. ;4 chars = 3 bytes
  186. NN_0:
  187.     mov    cx,0604H        ;handy constant            v1.7
  188.                     ;CL=4, CH=6            v1.7
  189.  
  190.     LODSB                ;quad[1]
  191.     MOV    AH,AL            ;AH=quad[1]
  192.     lodsb                ;AL=quad[2]
  193.     mov    dl,al            ;save quad[2]
  194.     SUB    AX,bx            ;remove standard offset
  195.  
  196.     shl    ah,1            ;quad[1] SHL 2            v1.7
  197.     shl    ah,1            ;(faster this way)        v1.7
  198.     SHR    AL,CL            ;quad[2] SHR 4
  199.     OR    AL,AH            ;shifted quad[2] OR shifted quad[1]
  200.     STOSB                ;=hunk[1], stuff in out_buf
  201.     dec    bp            ;decr binary byte ctr        v1.7
  202.     jz    New_Line        ;uuencoded line is done        v1.7
  203.  
  204.     mov    ah,dl            ;AH=unshifted quad[2]
  205.     lodsb                ;AL=quad[3]
  206.     mov    dl,al            ;save quad[3]
  207.     SUB    AX,bx            ;remove standard offset
  208.  
  209.     SHL    AH,CL            ;quad[2] SHL 4
  210.     shr    al,1            ;quad[2] SHR 2            v1.7
  211.     shr    al,1            ;(faster this way)        v1.7
  212.     OR    AL,AH            ;shifted quad[3] OR shifted quad[2]
  213.     STOSB                ;=hunk[2], stuff in out_buf
  214.     dec    bp            ;decr binary byte ctr        v1.7
  215.     jz    New_Line        ;uuencoded line is done        v1.7
  216.  
  217.     mov    ah,dl            ;AH=unshifted quad[3]
  218.     LODSB                ;AL=quad[4]
  219.     SUB    AX,bx            ;remove standard offset
  220.  
  221.     MOV    CL,CH            ;6
  222.     SHL    AH,CL            ;quad[3] SHL 6
  223.     OR    AL,AH            ;shifted quad[4] OR shifted quad[3]
  224.     STOSB                ;=hunk[3], stuff in out_buf
  225.     dec    bp            ;decr binary byte ctr        v1.7
  226.     jnz    NN_0            ;uuencoded line not done
  227.     jmp    short New_Line        ;line done, get new line
  228.  
  229. ;-------------------------------------------
  230. ;Now we look for the uuencoded file's 'end'.
  231. ;We'll write out what we've got, even if we don't find the 'end'.
  232. Prog_End:
  233.     CALL    Get_Line        ;should be file's last line
  234.     lodsw                ;load next 2 chars
  235.     cmp    ax,'ne'            ;'en'?
  236.     jne    End_Err_C        ;'No end found'
  237.      LODSB
  238.      CMP    AL,'d'
  239.      JE    File_End        ;ok, got the 'end'
  240. End_Err_C:
  241.     CALL    End_Err            ;say we had an end error
  242. File_End:
  243.     CALL    Write_File        ;do our final output write
  244. ;Seems there's no need to close files .. DOS must do it!
  245. File_End_X:
  246.     MOV    AH,4Ch            ;terminate, ERRORLEVEL ?
  247.     INT    21h
  248. Uudecode    endp
  249.  
  250. ;-------------------------------------------
  251. ;Reads in a line of uuencoded text
  252. ;Didn't like the original logic here (how it physically looks for a CR (0DH)
  253. ;as an End of Line indicator (EOL), then gobbles until a LF (0DH).
  254. ;Unix text and uuencoded files only have LFs as EOL,
  255. ;MACs only have CR EOLs (I think).
  256. ;Well, we're handling CR/LF and LF EOLs, and that'll do for now.
  257.  
  258. ;The first char of a uuencoded line is usually an 'M' (ASCII 77).  This is
  259. ;the nr of binary bytes used to create this uuencoded line (Asciified).
  260.  
  261. Get_Line    PROC    NEAR
  262.     MOV    SI,uuptr        ;current raw input buffer psn
  263.  
  264. ;This is looped to (from below) if the line was garbage (e.g., some sort
  265. ;of file header.  It refreshes the outbuf pointer to buffer start,
  266. ;and sets up the uuencoded line buffer line_in anew.
  267. Flush_Lin:
  268.     mov    outptr,di        ;save outbuf ptr in outptr    v1.7
  269.                     ;for Write_File test        v1.7
  270. ;BP holds the constant 'maximum line length'.
  271. ;I never heard of a uuencode that used lines longer than 60 bytes,
  272. ;plus length byte and CR/LF.
  273.     mov    bp,80            ;max allowable uuencoded line len v1.7
  274.  
  275. ;Prepare our uuencoded line buffer line_in for transfer of a line.
  276. ;Remember, this same sequence is used to get the uuencode protocol's
  277. ;first line ('begin 6xx filename.typ'),normal uuencoded lines,
  278. ;and the last uuencode protocol line ('end').
  279. ;We're preparing an 80-char line (maximum allowed).
  280.  
  281.     MOV    DI,offset line_in    ;uuencoded line buffer start
  282.     xor    ax,ax
  283.     stosw                ;clear first 2 bytes        v1.7
  284.     mov    cx,39            ;clear remaining 78 bytes    v1.7
  285.     mov    ax,2020H        ;fill with spaces        v1.7
  286.     REP    stosw
  287.     MOV    DI,offset line_in    ;uuencoded line buffer start
  288. Next_Chr:
  289.     cmp    si,uuEndptr        ;hit end yet?
  290.     jb    Not_Mt            ;not empty yet            v1.7
  291.      CALL    Write_File        ;write our binary output (if any)
  292.      CALL    Read_File        ;read more uuencoded input
  293. Not_Mt:
  294.     lodsb                ;snarf uuencoded line char    v1.7
  295.     CMP    AL,96            ;special '`' in place of spaces
  296.     JNE    Not_Hi            ;wasn't a space substitute
  297.      mov    al,' '            ;replace with space
  298.      jmp    short Was_Space        ;and skip the next test
  299.  
  300. ;Don't like this looking for a CR .. what about Unix systems that don't
  301. ;HAVE LF's in their text/uuencoded files?
  302. Not_Hi:    CMP    AL,CR            ;CR means line end
  303.     JE    Eol_CR            ;end of line, stop for now    v1.7
  304.     cmp    al,LF            ;How about Unix EOL?        v1.7
  305.     je    Eol_LF            ;Yep, was Unix EOL        v1.7
  306. Was_Space:
  307.     STOSB                ;stuff uuencoded line char
  308.     dec    bp            ;count down allowable length    v1.7
  309.     jnz    Next_Chr        ;Ok, not yet
  310. ;This line is longer than 80 chars, so it CAN'T be a uuencoded line.
  311. ;Continue to gobble it up, throwing it away, until EOL,
  312. ;then flush and continue.
  313. ;This only happens for headers.  We never hit trailers at all.
  314. Strip_Head:
  315.     cmp    si,uuEndptr        ;beyond uubuf data?        v1.7
  316.     jb    Strip_NoRead        ;nope                v1.7
  317.      call    Read_File        ;refill the uubuf        v1.7
  318. Strip_NoRead:
  319.     LODSB                ;look for a LF
  320.     CMP    AL,LF            ;LF yet?
  321.     JNE    Strip_Head        ;nope, keep going w/this line
  322.     mov    di,offset out_buf    ;clear DI to clear outptr    v1.7
  323.     JMP    Flush_Lin        ;EOL, keep working thru raw
  324.                     ;input buffer
  325. ;-------------------------------------------
  326. ;Hit CR, got a uuencoded line
  327. Eol_CR:
  328.     INC    SI            ;bump raw input buffer ptr
  329. Eol_LF:
  330.     MOV    uuptr,SI        ;remember current raw buff ptr
  331.     MOV    DI,outptr        ;restore binary output ptr
  332.     mov    si,offset line_in    ;ptr to inbuffer start
  333.     RET                ;done
  334. Get_Line    ENDP
  335.  
  336. ;-------------------------------------------
  337. ;Write a chunk of uudecoded data (if any) to output file.
  338. Write_File    PROC    NEAR
  339.     MOV    DX,offset out_buf    ;output binary buffer start
  340.     mov    cx,dx            ;prepare to reinit outptr    v1.7
  341.     xchg    cx,outptr        ;outptr=0,CX=outptr        v1.7
  342.     sub    cx,dx            ;-buffer start=buffer byte count v1.7
  343.  
  344. ;IF CX=0, there's no uudecoded data to write, just exit.
  345. ;If CX went below 0 (e.g., outptr pointed BELOW out_buf start),
  346. ;we have an error of some sort (my code logic?).
  347. ;Ignore that also.  It'll get cleaned up later.
  348.  
  349.     jbe    Write_Good        ;error                v1.7
  350.      MOV    BX,out_handle        ;output file handle
  351.      MOV    AH,40h            ;write to file/device
  352.      INT    21h
  353.      jb    Out_Err            ;write error
  354. Write_Good:
  355.     RET                ;write done
  356.  
  357. ;Output file write error
  358. Out_Err:
  359.     MOV    DX,OFFSET err_out    ;'Output file write error'
  360.     MOV    CX,ERR_OUT_LEN        ;msg length
  361.     jmp    short Fatal_Error    ;common code
  362.  
  363. Write_File    ENDP
  364.  
  365. ;-------------------------------------------
  366. ;Read a chunk of input (uuencoded) data into our uuencode buffer.
  367. ;I don't think we'll EVER try to read past EOF (since the 'end' line
  368. ;should've been detected and program terminated).
  369. ;Let's assume that 'read past EOF' is an error of some sort and die.
  370. ;('Coding by trial and error')
  371.  
  372. Read_File    PROC    NEAR
  373.     MOV    DX,offset uubuff    ;read into uuencode input buffer
  374.     MOV    CX,offset uu200        ;code space - 200H stack bytes    v1.7
  375.     not    cx            ;= remaining segment memory    v1.7
  376.     MOV    BX,inp_handle        ;input file handle
  377.     MOV    AH,3Fh            ;read from file/device
  378.     INT    21h
  379.     jb    Inp_Err            ;failed
  380.     or    ax,ax            ;read anything?
  381.     jz    Read_EOF        ;nope, EOF            v1.7
  382.  
  383.     MOV    SI,dx            ;point to input uubuff start    v1.7
  384.     add    ax,si            ;chars read+uubuff start    v1.7
  385.     MOV    uuEndptr,AX        ;points beyond last uubuff char    v1.7
  386.     RET                ;read done
  387.  
  388. Read_EOF:
  389. ;     CALL    End_Err            ;Unexpected end of file error
  390. ;     JMP    File_End_X        ;and terminate
  391.  
  392. ;-------------------------------------------
  393. ;Input file read error.  Error value in AL
  394. Inp_Err:
  395.     MOV    DX,OFFSET err_inp    ;'Input file error'
  396.     MOV    CX,ERR_INP_LEN        ;msg length
  397. ;Common code added here
  398. Fatal_Error:
  399.     push    ax            ;save error in AL
  400.     call    Say_Error        ;common code
  401.     POP    AX            ;restore error in AL
  402.     JMP    File_End_X        ;terminate
  403. Read_File    ENDP
  404.  
  405. ;-------------------------------------------
  406. ;Unexpected End of File.  (No 'end')
  407. End_Err        PROC    NEAR
  408.     MOV    DX,OFFSET err_end    ;'End not found'
  409.     MOV    CX,ERR_END_LEN        ;msg length
  410. Say_Error:                ;common code
  411.     MOV    BX,2            ;Std ErrOut handle
  412.     MOV    AH,40h            ;write to file/device
  413.     INT    21h
  414.     RET
  415. End_Err        ENDP
  416.  
  417.  
  418. ;using pointers beyond runtime code and/or code end for various buffers.
  419. ;This does NOT take up any space in our program.
  420.  
  421.         EVEN        ;v1.7
  422.  
  423. ;v1.7 line_in is not used until after Init,
  424. ;so it can overwrite this code and data.
  425. line_in    equ    $            ;80 bytes long            v1.7
  426.  
  427. ;Some start-up data moved down here to minimize memory requirements.    v1.7
  428. msg_v1        DB      'This Program Requires DOS Version 2.0 '
  429.         DB      'or higher.',CR,LF,'$'
  430. pr_inp        DB    CR,LF,'Input path/file:  '
  431. PR_INP_LEN    EQU    $-pr_inp
  432. no_action    db    'No action',CR,LF,'$'
  433.  
  434. ;v1.7 Some start-up code.
  435. Init    proc    near            ;                v1.7
  436.  
  437. ;First make sure we have DOS 2.0 or higher, or handles won't work.    v1.7
  438.     MOV    AH,30h            ;get DOS version
  439.     INT    21h
  440.     CMP    AL,2            ;2.0 or above?
  441.     JAE    Chk_CmdLine        ;yep, ok            v1.7
  442.      MOV    DX,OFFSET msg_v1    ;'DOS 2.0 or above'
  443. Msg_Die:
  444.      MOV    AH,9            ;display string
  445.      INT    21h
  446.      mov    ax,4C01H        ;terminate, ERRORLEVEL 1
  447.      int    21H
  448.  
  449. ;Now check cmd line for uuencoded source file.                v1.7
  450. Chk_CmdLine:
  451.     MOV    SI,CMD_TAIL        ;move cmd line parm
  452.     MOV    DI,offset inp_fil    ;to our filename buffer
  453.     CLD                ;insure fwd
  454.     LODSB                ;cmd line length byte
  455.     or    al,al            ;nothing there?
  456.     jz    Prompt_User        ;yep, nothing there        v1.7
  457.  
  458.     mov    ah,20H            ;get a handy space
  459. Strip_Ct:
  460.     LODSB                ;next cmd line char
  461.     CMP    AL,ah            ;gobble spaces,tabs, etc.
  462.     JBE    Strip_Ct
  463. Ct_Char:
  464.     CMP    AL,ah            ;ctrl char? (e.g., CR)
  465.     JBE    Prog_Go            ;yep, done            v1.7
  466.     STOSB                ;stuff filename byte
  467.     LODSB                ;snarf next cmdline char
  468.     JMP    SHORT Ct_Char        ;and loop
  469. ;-------------------------------------------
  470. ;DI points to
  471. ; (1) the filename buffer byte just beyond our file name
  472. ;     (so we can AsciiZ), or
  473. ; (2) to filename buffer start (indicating no input!).
  474.  
  475. ;-------------------------------------------
  476. Prog_Go:
  477.     cmp    di,offset inp_fil    ;did we get a cmd line filename?
  478.     ja    Open_Inp_Fil        ;yep
  479.  
  480. ;Let's be nice and prompt the user for an input filename:
  481. Prompt_User:                ;v1.7
  482.     MOV    DX,OFFSET pr_inp    ;'Input/file name:' prompt
  483.     MOV    CX,PR_INP_LEN        ;nr chars to display
  484.     MOV    BX,2            ;Std ErrOut handle (always to con)
  485.     MOV    AH,40h            ;write to file or device
  486.     INT    21h
  487.  
  488. ;Now get the user kbd input:
  489.     mov    dx,di            ;DI points to filename buff start
  490.     MOV    CX,80            ;up to 80 chars            v1.7
  491.     xor    bx,bx            ;standard input handle (always kbd)
  492.     MOV    AH,3Fh            ;read from file or device
  493.     INT    21h
  494.     add    di,AX            ;nr bytes read
  495.     dec    di            ;adjust for add and CR        v1.7
  496.     dec    di            ;                v1.7
  497.  
  498. Open_Inp_Fil:
  499.     MOV    DX,offset inp_fil    ;input file name buffer
  500.     cmp    di,dx            ;no name at all?
  501.     ja    Open1            ;ok, continue
  502.      mov    dx,offset no_action    ;'No action'
  503.      jmp    short Msg_Die        ;display, terminate
  504.  
  505. Open1:
  506.     MOV    AX,3D00h        ;open file
  507.     mov    [di],al            ;make input filename AsciiZ
  508.     INT    21h
  509.     jb    Open_Die        ;failed, terminate w/error    v1.7
  510.      MOV    inp_handle,AX        ;save input file handle        v1.7
  511.      ret                ;go uudecode            v1.7
  512.  
  513. Open_Die:
  514.      JMP    Inp_Err            ;input file open error, die
  515. Init    endp
  516.  
  517.         EVEN            ;v1.7
  518.  
  519. ;inp_file is used by Init startup, so it must sit below the code.
  520. inp_fil    equ    $            ;80 bytes long,            v1.7
  521.                     ; input filename buffer.    v1.7
  522.                     ; Overwrites out_file buffer    v1.7
  523.                     ; and uuencode buffers.        v1.7
  524.  
  525. ;out_fil, out_buf, and uubuff aren't used until AFTER Init completes.
  526. ;They can overwrite Init code, startup data, inp_file filename buffer, etc.
  527. ;However, uubuff and line_in ARE used to get the output filename out_fil),
  528. ; so uubuff and line_in can't overwrite out_fil.
  529.  
  530. ;line_in needs 80 bytes:
  531. out_fil    equ    line_in + 80        ;15 bytes long,            v1.7
  532.                     ; output filename buffer.    v1.7
  533.                     ; Sits below line_in,        v1.7
  534.                     ; overwrites Init code/data.    v1.7
  535. out_buf    equ    line_in + 80        ;80 bytes long,            v1.7
  536.                     ; uudecoded data buffer.    v1.7
  537.                     ; Sits below line_in,        v1.7
  538.                     ; overwrites out_fil filename    v1.7
  539.                     ; and Init code/data.        v1.7
  540. ;out_buf needs 80 bytes
  541. uubuff    equ    out_buf + 80        ;READSIZE bytes long,        v1.7
  542.                     ; uuencoded file read buffer.    v1.7
  543.                     ; Sits below out_buf.        v1.7
  544. uu200    equ    uubuff + 200H        ;200H bytes oughtta be enough    v1.7
  545.                     ;for the stack.            v1.7
  546.  
  547. Cseg    ENDS
  548.     END    Uudecode
  549.