[comp.sys.apple] Input anything

SEWALL@UCONNVM.BITNET (07/07/87)

What you need is the famous "input anything" routine.  I've seen
several flavors in computer magazines, but I've got such a large
stack, that trying to find something like that is the proverbial
needle in a haystack.  Soooo....

What follows is a short little program (a DOS 3.3 "Type" program)
that has an input anything routine built in (note: the input line
goes into A$ which MUST be the first string variable defined).

I think I corrected the lines to 80 columns without introducing any
bugs.  At least I'm 99.44% sure that the machine language input
anything part is correct.

--------------Cut Here-----------------------
0  REM  PRT -- TYPE/PRINT TEXT FILE
1 A$ = "": GOTO 200: REM  A$ MUST BE FIRST STRING IN TABLE
20  CALL 768: IF  LEN (A$) > 1 THEN  IF  ASC (A$) < 32 THEN A$ =  MID$ (A$,2)
85  PRINT CR$LF$;
90  PRINT A$;: GOTO 20
200 B$ = "":I$ =  CHR$ (9):D$ =  CHR$ (4):LF$ =  CHR$ (10):VT$ =  CHR$ (11)
202 FF$ =  CHR$ (12):CR$ =  CHR$ (13)
204  ONERR  GOTO 208
205  PRINT "
   TYPE/PRINT APPLE TEXT FILE"
206  INPUT "

PRINTER SLOT ( '0' FOR SCREEN) ? ";SL
207  IF SL > 0 AND SL < 8 THEN GOTO 209
208 SL = 0: POKE 216,0: GOTO 211
209  ONERR  GOTO 211
210  INPUT "LINE LENGTH(65,80,120 OR 132)=>";LL:LL$ = GS$: GOTO 212
211 LL = 80: POKE 216,0
212  IF LL = 65 THEN LL$ = FS$
214  IF LL = 80 THEN LL$ = GS$
216  IF LL = 120 THEN LL$ = RS$
218  IF LL = 132 THEN LL$ = US$
220  INPUT "FILE NAME=>";FI$: IF FI$ = "" THEN  GOTO 2050
230  INPUT "
HIT RETURN WHEN PAPER LOADED...";B$
250  DATA   162,0,32,117,253,160,2,138,145,105,200,169,0,145,
255  DATA   105,200,169,2,145,105,76,57,213
257  REM LINEINPUT ROUTINE->  CALL 768=LINEINPUT A$
260  FOR I = 768 TO 790: READ J: POKE I,J: NEXT I:
270  ONERR  GOTO 2000
280  PRINT D$"PR#"SL: IF SL = 0 THEN LF$ = "": GOTO 290
285  PRINT I$"K"LL$
290  PRINT D$"READ "FI$: GOTO 20
2000  PRINT CR$D$"CLOSE": PRINT D$"PR#0"
2002  IF  PEEK (222) = 5 THEN 2010
2006  PRINT " STOPPING FOR ERROR " PEEK (222)" AT LINE;
2007  PRINT " PEEK (218) +  PEEK (219) * 256
2010  POKE 768,104: POKE 769,168: POKE 770,104: POKE 771,166: POKE 772,223
2015  POKE 773,154: POKE 774,72: POKE 775,152: POKE 776,72: POKE 777,96
2020  CALL 768: CLEAR
2030  ONERR  GOTO 2050
2040  INPUT "ANOTHER FILE ? ";A$: IF  LEFT$ (A$,1) = "Y" THEN  GOTO 200
2050  PRINT "SIMPLY ENTER 'RUN' TO PRINT ANOTHER FILE"
2100  END