home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_27_1988_Transactor_Publishing.d64 / read (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  886b  |  33 lines

  1. 100 rem parse the input buffer for a file
  2. 110 rem name following run:
  3. 120 rem by noel nyman
  4. 130 :
  5. 140 x=512 : rem start of input buffer
  6. 150 xx=592: rem change to 673 for c128
  7. 160 :  if peek(x)<138 and peek(x)>0 then x=x+1: goto 160: rem 138=run token
  8. 170 :  if peek(x)=0 goto 250: rem end of line in buffer
  9. 180 :  if peek(x)=58 then x=x+1: goto 210: rem found a colon
  10. 190 :  x=x+1: if x>xx goto 250: rem xx points to end of input buffer
  11. 200 :  goto 180
  12. 210 :  if peek(x)=32 and bf$="" then x=x+1: goto 210: rem skip leading spaces
  13. 220 :  if peek(x)=34 then x=x+1: goto 220: rem skip quotes
  14. 230 :  if peek(x)<>0 then bf$=bf$+chr$(peek(x)): x=x+1: goto 220
  15. 240 :
  16. 250 if bf$="" then input "enter file name: ";bf$: rem no arguments
  17. 260 :
  18. 270 open 15,8,15
  19. 280 open 2,8,2,"0:"+bf$+",s,r"
  20. 290 input#15,x,x$
  21. 300 if x>19 then print "file name = "bf$: print "disk error"x,x$: goto 390
  22. 310 :
  23. 320 get#2,x$
  24. 330 print x$;
  25. 340 :
  26. 350 wait 653,1,255: rem shift key pauses, shift/lock holds
  27. 360 :
  28. 370 if st=0 goto 320
  29. 380 :
  30. 390 close 2: close 15
  31. 400 :
  32. 410 end
  33.