[comp.sys.apple] Sneaky LF -> CR

kodali@portia.Stanford.EDU (VAS KODALI) (08/03/89)

Well, I ran into this nasty problem, of trying to convert LF to CR.

After writing a quick & dirty BASIC program to convert, and watching it
take over 20 minutes to run, I decided to get nasty.

It's a real simple matter to write a quick assembly (gasp!) program
that will search a range from, say, $1000 to $8000, and replace every
occurance of LF to CR (I don't have the hex values in front of me..)
This routine runs instantaneously, cause it's so simple.

Just load your text file into memory like such:

]bload filename,a$1000,ttxt  (if it's a text file, which it should be)

and then execute the assembly program, and save the file out. If you
save it under a different name, you will have to CREATE a file first,
like so:

CREATE FILENAME.CONV,TTXT

and then bsave it:

bsave filename,a$1000,ttxt,l$xxxx

The length is found from either the catalog entry or immediately after
you bload the file, do a BEDB (or BED7, I'm not exactly sure- one is 
length, one is location)

If the file is bigger than $7000, you will have to split it up and
convert it that way.  I've never done it, because I don't know exactly
how to use the B parameter...as in BLOAD FILENAME,A$1000,L$7000,B$????


--Chan Wilson

'noshin' right along....

krb20699@uxa.cso.uiuc.edu (08/04/89)

     Could you post an example assembly program?  I've written the BASIC
program to do this, and I just use Beagle Compiler on it.  Compiled, on a
GS, it's pretty fast, but I'd prefer the assembly.
     I've been writing in Pascalese so long I can't remember a word of 
6502 assembly.  Not to mention my lack of 65816 skill...{=


InterNet:        krb20699@uxa.cso.uiuc.edu        |    Ken Brownfield
PLATO:           ken brownfield/unialum/cerl      |    RR#4 Box 152
NovaNET, CERL:   brownfield/dialup                |    Champaign, IL, 61820.
AppleLinkPE:     ASA(I-can-afford-it)             |    1-217-643-7504
-------------------------------------------------------------------------------
I'm 16 years old, a Sophomore Computer Engineer at the University of Illinois,
  and proud of it.  "The company I work for didn't give me this signon, so
everything I say above is legal, if not correct, right, authorized, or poetic."