home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_27_1988_Transactor_Publishing.d64
/
read
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
886b
|
33 lines
100 rem parse the input buffer for a file
110 rem name following run:
120 rem by noel nyman
130 :
140 x=512 : rem start of input buffer
150 xx=592: rem change to 673 for c128
160 : if peek(x)<138 and peek(x)>0 then x=x+1: goto 160: rem 138=run token
170 : if peek(x)=0 goto 250: rem end of line in buffer
180 : if peek(x)=58 then x=x+1: goto 210: rem found a colon
190 : x=x+1: if x>xx goto 250: rem xx points to end of input buffer
200 : goto 180
210 : if peek(x)=32 and bf$="" then x=x+1: goto 210: rem skip leading spaces
220 : if peek(x)=34 then x=x+1: goto 220: rem skip quotes
230 : if peek(x)<>0 then bf$=bf$+chr$(peek(x)): x=x+1: goto 220
240 :
250 if bf$="" then input "enter file name: ";bf$: rem no arguments
260 :
270 open 15,8,15
280 open 2,8,2,"0:"+bf$+",s,r"
290 input#15,x,x$
300 if x>19 then print "file name = "bf$: print "disk error"x,x$: goto 390
310 :
320 get#2,x$
330 print x$;
340 :
350 wait 653,1,255: rem shift key pauses, shift/lock holds
360 :
370 if st=0 goto 320
380 :
390 close 2: close 15
400 :
410 end