jhs@MITRE-BEDFORD.ARPA.UUCP (01/28/87)
I have made a change in the BASIC uudecode machine language program which I hope will make it work correctly on both the 800 and the 800XL, including OMNIVIEW-equipped 800XLs. (Fingers crossed...) The revised program is attached. I would appreciate confirmation from those who have had trouble running uudecode on their 800s, that this version DOES work. (If it does.) Note that the attached file has normal ASCII line feeds (or whatever) instead of ATASCII EOL characters. This means that it prints normally on non-Atari systems and can be transmitted in 7-bit ASCII mode. BE SURE when you download it to use a mode which translates it back into ATASCII so you will get ATASCII End Of Line (EOL) characters back. Good luck. Let me know if it now decodes Turrible BASIC correctly. I will re-post Turrible BASIC in uuencoded form so you will be able to test it. -John Sangster jhs@mitre-bedford.arpa --------------------c-u-t---h-e-r-e---f-o-r---UUDECODE.LST-------------------- 1 GOTO 100:REM jump around critical stuff to start up program. 2 M=USR(UUDADR) 10 IF M=0 THEN 2090 20 IF M>OBUFDIM THEN ? "Dimension error at line 20":GOTO 3000 30 PRINT #2;OBUF$;:BYTES=BYTES+M 40 INPUT #1,IBUF$:GOTO 2 100 ? "Uucode Ver. 0.6":? "Report errors to":? "J. Sangster at (617) 235-8753" 101 ? "or jhs@mitre-bedford.arpa":REM Modified to count bytes 1/14/86 - JHS 102 POKE 6,1:REM Dumb fix for OMNIVIEW256 problem or whatever. 105 DIM OBUF$(80),IBUF$(80),OFILE$(16),IFILE$(16),A$(1) 110 DIM UUDECODE$(400),UUENCODE$(400) 120 UUDADR=ADR(UUDECODE$):UUEADR=ADR(UUENCODE$):IBUF=ADR(IBUF$):OBUF=ADR(OBUF$) 130 OBUFDIM=80:UUDDIM=400 500 REM COMMAND DISPATCHER 520 ? "Encode (E) or Decode (D)";:INPUT A$ 530 ? "INPUT FILE";:INPUT IFILE$:? "OUTPUT FILE";:INPUT OFILE$ 540 IF LEN(IFILE$)=0 OR LEN(OFILE$)=0 THEN 530:REM FOR NOW 550 IF A$="E" THEN 1000 560 IF A$="D" THEN 2000 570 SOUND 1,85,12,15:FOR I=1 TO 60:NEXT I:SOUND 1,0,0,0:GOTO 520 1000 GOTO 1100:REM E not done yet 1010 CLOSE #1:OPEN #1,4,0,IFILE$ 1020 CLOSE #2:OPEN #2,8,0,OFILE$ 1030 L=45:TRAP 1100 1100 ? "UUENCODE NOT IMPLEMENTED YET":END 2000 ? "LOADING UUDECODE SUBROUTINE..." 2001 RESTORE 4000:POKADR=UUDADR:MAXADR=POKADR+UUDDIM-1:PRGTOP=UUDADR-1 2002 READ X:IF X=255 THEN READ X:IF X=255 THEN 2004 2003 ? "BAD LOAD FILE FOR UUD":END 2004 READ LO1,HI1,LO2,HI2:BYTES=HI2*256+LO2-(HI1*256+LO1)+1:PRGTOP=PRGTOP+BYTES 2005 IF BYTES<0 OR BYTES>UUDDIM THEN ? "BYTE COUNT ERROR FOR UUD":END 2006 FOR I=1 TO BYTES:READ X:POKE POKADR,X:POKADR=POKADR+1:IF POKADR>MAXADR THEN ? "UUD STRG OVFLOW!":END 2007 NEXT I 2008 TRAP 2009:READ LO1,HI1,LO2,HI2:BYTES=256*HI2+LO2-(256*HI1+LO1)+1 2009 PRGTOP=PRGTOP+BYTES:IF LO1<>224 OR HI1<>2 THEN 2006 2010 ? "Beginning uudecode loop..." 2011 IBUF$(1,1)=" ":M=USR(UUDADR,IBUF,OBUF):IF M<>0 THEN ? "Error in initializing UUDECODE! M=";M:? 2019 CLOSE #1:OPEN #1,4,0,IFILE$ 2020 CLOSE #2:OPEN #2,8,0,OFILE$ 2030 INPUT #1,IBUF$:BYTES=0 2040 TRAP 2095:IF IBUF$(1,5)<>"begin" THEN ? "No begin line!":GOTO 2 2045 ? IBUF$:GOTO 40:REM Print begin line for documentation, normally. 2090 INPUT #1,IBUF$:IF IBUF$(1,3)="end" THEN PRINT IBUF$:GOTO 3000 2095 NERR=PEEK(195):IF NERR=136 THEN PRINT "Missing 'end' line!":GOTO 3000 2097 ? "Error Code=";NERR 3000 ? "Done!":CLOSE #1:CLOSE #2:? "Output byte count = ";BYTES:END 4000 DATA 255,255,8,6,3,7 4010 DATA 104,240,67,170,56,233 4020 DATA 2,240,14,104,104,202 4030 DATA 208,251,169,254,133,212 4040 DATA 169,255,133,213,96,104 4050 DATA 141,1,6,104,141,0 4060 DATA 6,104,141,3,6,104 4070 DATA 141,2,6,165,6,240 4080 DATA 100,165,134,133,203,165 4090 DATA 135,133,204,173,2,6 4100 DATA 56,229,140,133,208,173 4110 DATA 3,6,229,141,133,209 4120 DATA 162,128,208,2,240,72 4130 DATA 160,0,177,203,201,129 4140 DATA 208,42,160,2,177,203 4150 DATA 56,229,208,208,33,200 4160 DATA 177,203,229,209,208,26 4170 DATA 165,203,141,6,6,165 4180 DATA 204,141,7,6,160,6 4190 DATA 177,203,141,4,6,200 4200 DATA 177,203,141,5,6,24 4210 DATA 144,22,24,165,203,105 4220 DATA 8,133,203,144,2,230 4230 DATA 204,202,208,192,169,255 4240 DATA 133,212,133,213,96,234 4250 DATA 173,0,6,133,204,173 4260 DATA 1,6,133,205,160,0 4270 DATA 132,213,177,204,56,233 4280 DATA 32,133,212,208,24,165 4290 DATA 6,240,19,173,6,6 4300 DATA 133,208,173,7,6,133 4310 DATA 209,160,4,169,0,145 4320 DATA 208,200,145,208,96,165 4330 DATA 6,240,43,173,4,6 4340 DATA 56,229,212,173,5,6 4350 DATA 229,213,16,9,169,255 4360 DATA 133,212,133,213,32,54 4370 DATA 185,173,6,6,133,208 4380 DATA 173,7,6,133,209,169 4390 DATA 0,160,5,145,208,136 4400 DATA 165,212,145,208,230,204 4410 DATA 208,2,230,205,173,2 4420 DATA 6,133,206,173,3,6 4430 DATA 4,7,102,7,133,207 4440 DATA 166,212,160,1,177,204 4450 DATA 56,233,32,133,203,6 4460 DATA 203,6,203,136,177,204 4470 DATA 56,233,32,6,203,42 4480 DATA 6,203,42,145,206,202 4490 DATA 240,64,169,0,133,208 4500 DATA 160,2,177,204,56,233 4510 DATA 32,74,102,208,74,102 4520 DATA 208,5,203,136,145,206 4530 DATA 202,240,39,160,3,177 4540 DATA 204,56,233,32,5,208 4550 DATA 136,145,206,202,240,24 4560 DATA 24,165,204,105,4,133 4570 DATA 204,144,2,230,205,24 4580 DATA 165,206,105,3,133,206 4590 DATA 144,166,230,207,176,162 4600 DATA 96,224,2,225,2,0
Fleysher.wbst@XEROX.COM.UUCP (01/28/87)
Thanks for the explanation of how UUDECODE works. I'll give the new version you distributed a try as soon as I can. I think you should ALWAYS assume you have to update the length parameter of OBUF$ - i.e., the ML DATA statements in you BASIC program aren't being executed unless the user is really in BASIC. Different versions of your routine for non-basic users is an option. However I also think it's a mistake to be depending upon BASIC's data structures at all. The ML in your DATA statements would be more bullet proof if you allowed BASIC to set the length of OBUF$ based upon the return value M from the ML routine. re: the line feed problem: When uploading to your UNIX environment you must specify straight ATASCII to make sure no translation occurs to screw up the (binary) data. Also note that the line feeds do not look like line feeds in their UUENCODED state, so selection of ATASCII vs. ASCII on download from UNIX to the recipient's Atari should not make any difference in the UUENCODED data - only the terminator character at the end of each line of 60 bytes. Is your ML routine sensitive to this terminator character? Dan -----------------------------------
jhs@MITRE-BEDFORD.ARPA.UUCP (01/28/87)
The ML routine pays no attention to the terminator character, but the BASIC calling program is supposed to read lines and pass them to the ML routine. If the terminator character is wrong, BASIC will never see an EOL so will think the whole file is one long line. As for the calling program setting the buffer length, the user is free to use M as he/she sees fit, but I was trying to minimize the non-ML overhead in the calling program. I **HOPE** your concerns are unfounded, now that I have gotten the logic of detecting BASIC present working right. The variable locations I used are well documented and should be fairly (!) standard in all software that attempts to be compatible with Atari BASIC. If you replace the POKE 6,1 in line 102 with POKE 1,0, that should convince the subroutine that BASIC is not enabled, so it won't meddle with the length parameter. You might also try just removing this line, as it should not be necessary. It appears to be needed when running OMNIVIEW and switching BASIC ina and out with a program I got from COMPUTE! awhile ago, but it probably is not needed by most users. -John S.