home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.sys.apple2      Discussion about Apple II micros      56,720 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 54,730 of 56,720   
   Brian Patrie to mmphosis   
   Re: Displaying text file from Applesoft   
   14 Apr 21 11:52:34   
   
   From: bpatrie@bellsouth.spamisicky.net   
      
   mmphosis wrote:   
    > If only you knew how many characters were in the text file beforehand.   
    > Error handling is inelegant. Gracefully handle the End Of File (EOF)   
    >   
    >    0 D$ = CHR$(4)   
    > REM 10 PRINT D$"NOMONC,I,O"   
    >   20 INPUT F$   
    >   30 PRINT D$"VERIFY"F$   
    >   40 M$ = CHR$(13)   
    >   50 PRINT D$"OPEN"F$M$D$"READ"F$   
    >   60 ONERR GOTO 100   
    >   70 GET C$   
    >   80 PRINT M$C$;   
    >   90 GOTO 70   
    > 100 POKE 216,0   
    > 120 EOF = PEEK(222) = 5   
    > 130 IF NOT EOF THEN RESUME   
    > 140 PRINT D$"CLOSE"   
    >   
    > FN is a keyword.   
    > INPUT won't handle long lines.   
    > INPUT will ignore extra characters from where a comma or   
    > a colon starts in the line.   
    > PRINT M$C$; might be a DOS 3.3 thing, I didn't test this in ProDOS.   
      
   That makes each character appear on its own line.  Also:   
      
      PRINT D$"OPEN"F$M$D$"READ"F$   
      
   doesn't work in ProDOS; each command must be a separate PRINT:   
      
      PRINT D$"OPEN"F$ : PRINT D$"READ"F$   
      
   (which, happily, isn't any bigger in memory.)   
      
   I've often wished that AppleSoft had A RESUME NEXT feature that went to   
   the instruction after the error, instead of repeating the erring   
   instruction.  This would allow effectively making the interpreter ignore   
   certain errors, letting you check for them after the relevant command   
   (in this case after the GET instruction).   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca