[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Applesoft problem with reading text files
Ivan X <ivan@ivanx.com> writes:
> On Sep 26, 4:08 pm, DMn2004404 <dmn2004...@gmail.com> wrote:
>> While writing a "ProDOS Text File Displayer" in Applesoft BASIC, I've
>> encountered a nagging problem that Applesoft BASIC has with reading
>> text files. It seems to stop reading a line of text when it encounters
>> a comma, so that when it encounters a line of text that says, say,
>> "Lorem ipsum dolor sit amet, consectetuer adipiscing elit," all that
>> BASIC will read is "Lorem ipsum dolor sit amet", ignoring the rest of
>> the line.
>>
>> I probably sound stupid, but it sounds like there is a command or a
>> method that forces BASIC to read an entire line in a text file,
>> including commas. If so, what is it?
>>
>> Brandon Taylor
>
> One way to get around this is to use GET rather than INPUT. It's much
> slower, as it goes one key at a time, but it accepts any key.
>
> Also, my utility NuInput might help, as it is specifically designed to
> replace Applesoft's INPUT command. Among other benefits, it accepts
> commas and colons. You can get it at http://www.ivanx.com/appleii/ .
> Caveat emptor: I haven't ever tested it for reading text files, though
> it uses the standard key input mechanism, so it should work -- though
> perhaps only under DOS 3.3, as BASIC.SYSTEM behaves quite differently
> when it comes to how ProDOS interfaces with Applesoft.
>
> I also have a new and much better NuInput 1.1 version (better
> features, smaller footprint) which I have not yet released because I'm
> too lazy to finish the "demo app" for it -- if you'd like to try it,
> please let me know.
Another way to display text files from Applesoft might be to use the
BLOAD command with the ,TTXT parameter:
BLOAD TEXT.FILE,TTXT,A$6000
You would need to check the end-of-file, so you don't load too much if
the file is long, and so you know how much to print out
Then output the file, albeit not so fast, using:
SA = 24576
L = <length of file/length of BLOADed chunk>
FOR A = SA TO SA + L: PRINT CHR$( PEEK( A ) );: NEXT
It's at least as fast as the GET method, FWIW.
--
Jerry awanderin at yahoo dot ca