[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 Applesoft BASIC questions/1 Hyper C question



smmcafee@phy.mtu.edu (Sean M. McAfee) writes:

>Recently, I un-shrunk the first of the pieces, and found that, somehow, all
>of the carriage returns (control-M's) in the file had been turned into
>control-J's.  How to reverse the change?  Since I don't (yet) have any kind

They never were carriage returns. They have always been ^J's, because that's
what UNIX uses as a line terminator.

> 5  ONERR  GOTO 100
> 10 D$ =  CHR$ (4)
> 20  PRINT D$;"OPEN XAA"
> 30  PRINT D$;"READ XAA"
> 40  PRINT D$;"OPEN XAA2"
> 50  PRINT D$;"WRITE XAA2"
> 60  GET A$
> 70  IF A$ =  CHR$ (10) THEN  PRINT : GOTO 60
> 80  PRINT A$;
> 90  GOTO 60
> 100  PRINT D$;"CLOSE"
> 110  END 

The second open doesn't cancel the first, the the READs and WRITEs cancel
each other.

Before every GET / INPUT / whatever on the input file, issue a READ, and
before every PRINT / whatever to the output file, reissue a WRITE. So,...

20 print d$; "open xaa"
30 print d$; "open xaa2"
60 print d$; "read xaa"; get a$
70 if a$ = chr$(10) then a$= chr$(13)
80 print d$; "write xaa2"; print a$;

... and so on

Geez, it's been a while since I used applesoft. When I wrote that small
segment, the temptation to put a ; at the end of each line was huge :-)

>So then, I figured "Hey, maybe I can just load the file directly into memory
>and make the control-J replacements with PEEKs and POKEs."  But when I
>typed "BLOAD XAA,A$2000,TTXT" I got "NO BUFFERS AVAILABLE".  I even tried

Is it too big? Is you load it there, you have about $7600 bytes of
free memory or less to load it into.

-Phil