Subject: Re: Please help with BinSCII Path: lobby!newstf02.news.aol.com!portc01.blue.aol.com!portc03.blue.aol.com!newsfeed.mathworks.com!cyclone.swbell.net!nnrp2.sbc.net.POSTED!not-for-mail Message-ID: <395A09C3.139F22AA@swbell.net> From: Rubywand Reply-To: rubywand@swbell.net X-Mailer: Mozilla 4.72 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.sys.apple2 References: <394ED778.D8A49A95@nospam.net> <395123E0.1FE2F0B2@swbell.net> <3952600d.120120187@news> <3952777C.59482A9F@nospam.net> <3952EF13.881974F0@swbell.net> <39578124.241621696@news> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 66 Date: Wed, 28 Jun 2000 09:20:51 -0500 NNTP-Posting-Host: 209.184.83.241 X-Complaints-To: abuse@swbell.net X-Trace: nnrp2.sbc.net 962205279 209.184.83.241 (Wed, 28 Jun 2000 10:14:39 CDT) NNTP-Posting-Date: Wed, 28 Jun 2000 10:14:39 CDT Organization: SBC Internet Services Jeff Blakeney writes ... > > On Fri, 23 Jun 2000 00:01:07 -0500, Rubywand > wrote: > > > The program reads through BINSCII.EXE and swaps in CR's for LF's. The > > corrected Text is saved in RAM and used to create BINSCIIX. > > EXEC BINSCIIX to get BINSCII. > > > > 100 ONERR GOTO 170 > > 110 PRINT CHR$ (4)"OPEN BINSCII.EXE" > > 120 PRINT CHR$ (4)"READ BINSCII.EXE" > > 130 GET C$ > > 140 IF ASC (C$) = 10 THEN C$ = CHR$ (13) > > 150 N = N + 1: POKE 8191 + N, ASC (C$): IF N / 100 = INT (N / 100) > > THEN Z = FRE (0): PRINT "*"; > > 160 GOTO 130 > > 170 PRINT : PRINT CHR$ (4)"CLOSE" > > 180 POKE 216,0 > > 190 PRINT CHR$ (4)"OPEN BINSCIIX" > > 200 PRINT CHR$ (4)"WRITE BINSCIIX" > > 210 FOR I = 1 TO N - 1: PRINT CHR$ (PEEK (8191 + I));: NEXT I > > 220 PRINT : PRINT CHR$ (4)"CLOSE" > > 230 END > > Well, you forgot to clean up the stack again Nope; did not forget. You need to fuss with the stack cleanup CALL when an ONERR triggers inside a subroutine. The above program uses no subroutines. > but as you seem to have > made this program overly complex, I'll post a version that will > convert either LF or CR/LF end of lines to just CR. > > 100 ONERR GOTO 210 > 110 D$ = CHR$(4) > 120 PRINT D$;"OPEN BINSCII.EXE" > 130 PRINT D$;"OPEN BINSCIIX" > 140 PRINT D$;"READ BINSCII.EXE" > 150 LC$ = C$:GET C$ > 160 IF ASC(C$) = 10 AND LC$ <> CHR$(13) THEN C$ = CHR$(13): GOTO 180 > 170 GOTO 150 > 180 PRINT D$;"WRITE BINSCIIX" > 190 PRINT C$; > 200 GOTO 140 > 210 POKE 216,0: CALL -3288 > 220 PRINT D$;"CLOSE" > 230 END > .... Trying to handle both LF and CR/LF makes a nice demo but slows down execution for the intended application-- i.e. to just change LF's to CR's. Neither the POKE 216,0 (ONERR terminate) nor the CALL -3288 stack cleanup are necessary here. The POKE 216,0 illustrates good practice; but, the CALL -3288 is excessively pedantic in a short program with no subs. Getting rid of the RAM buffer is definitely worthwhile. On the other hand, it looks like the code you use is going to produce a BINSCIIX file filled with nothing but CR's. Rubywand