Jeśli chcesz wziąć udział w dyskusjach na forum - zaloguj się. Jeżeli nie masz loginu - poproś o członkostwo.
Vanilla 1.1.4 jest produktem Lussumo. Więcej informacji: Dokumentacja, Forum.
10 DIM A$(120)
20 OPEN #3,4,0,"D:file.txt"
30 INPUT #3;A$
40 ? A$
50 CLOSE #3
10 DIM A$(1000)
20 OPEN #3,4,0,"D:file.txt"
30 TRAP 70
40 INPUT #3;A$
50 ? A$
60 GOTO 40
70 CLOSE #3
80 TRAP 32768
10 OPEN #1,4,0,"D:filename.ext"
20 TRAP#ERR:CLS
30 DO
40 GET #1,BYTE:? CHR$(27);CHR$(BYTE);
50 LOOP
60 #ERR
70 CLOSE #1
40 .... ;
10 OPEN #1,4,0,"D:filename.ext"
20 TRAP#ERR:CLS
30 DO
40 GET #1,BYTE:? CHR$(27);
45 IF BYTE=155:?" ";:ELSE:?CHR$(BYTE);:ENDIF
50 LOOP
60 #ERR
70 CLOSE #1
10 DIM A$(32767): A=ADR(A$)
20 A$=" ":A$(32767)=A$:A$(2)=A$
30 OPEN #1,4,0,"D:FILENAME.EXT"
40 TRAP #ERR
50 BGET #1,A,32767
60 #ERR : TRAP 40000
70 CLOSE #1
80 ? A$
10 DIM A$(40)
20 TRAP #END_READ
25 GR.0
30 OPEN #1,4,0,"D:MENU.TXT"
35 FOR I=0 TO 25: REM FOR ALL LETTER
40 INPUT #1,A$:? CHR$(65+I);": ";A$
45 NEXT I
50 # END_READ
99 END
10 DIM A$(40)
15 OPEN #1,8,0,"D:MENU.TXT"
20 FOR I=0 TO 25
25 ? CHR$(65+I);": ";:INPUT #16,A$
30 IF A$(="" THEN 145
35 ? #1;A$
40 NEXT I
45 CLOSE #1
30 DIM BUF$(10240)
...
170 IF B$="A" THEN FN$="D:UVOD.TXT":EXEC LOAD_FILE
10000 REM LOADING FILE (one chunk - lots of memory use!)
10005 PROC LOAD_FILE
(**)10007 BUF$(1)=CHR$(0):BUF$(10240)=CHR$(0):BUF$(2)=BUF$(1)
10010 OPEN #1,4,0,FN$
10015 TRAP #END_LOAD
10020 BGET #1,ADR(BUF$),10240
10025 # END_LOAD:CLOSE #1
10030 ENDPROC
10005 PROC LOAD_FILE
...
10030 LN=INSTR(BUF$,CHR$(0))
(*)10035 BUF$=BUF$(1,LN-1)
10040 ENDPROC
PRINT BUF$
Print BUF$(1,100) to show fragment
10 GET KEY
20 (doo something with KEY value :D)
10 GET KEY
20 IF KEY=ASC("A") OR KEY=ASC("B") THEN ... (mono solution)
30 if KEY=65 or KEY=66 THEN ...
10 DO
15 ? "Choice [ABCD]: ";:GET KEY
20 OPT=UINSTR("ABCD",CHR$(KEY))
25 IF OPT
30 ? CHR$(KEY):? "Good choice":EXIT
35 ELSE
40 ? "Wrong key, choice again"
45 ENDIF
50 LOOP
55 ON OPT EXEC OPT_A,OPT_B,OPT_C,OPT_D
OR
55 ON OPT GO# OPT_A,OPT_B...
or
55 ON OPT GOTO 1000,2000,3000.... (*)
or :)
55 ON OPT GOSUB 1000,2000,3000.... (*)
0 GR.0:EOL=13
1 DIM BUF$(10240),FN$(20)
15 FN$="D:FILENAME.TXT":EXEC LOAD_TXT
20 EXEC SHOW TXT
999 END
1000 PROC LOAD_TXT
1005 BUF$(1)=CHR$(0):BUF$(10240)=CHR$(0):BUF$(2)=BUF$(1)
1010 TRAP #END_LOAD:OPEN #1,4,0,FN$
1015 BGET #1,ADR(BUF$),10240
1020 # END_LOAD:CLOSE #1
1025 TXTLN=INSTR(BUF$,CHR$(0)):BUF$=BUF$(1,TXTLN-1)
1030 ENDPROC
1099 --
1100 PROC SHOW_TXC
1110 PTXT=1:LN=0:X=0:Y=0
1120 DO
1125 IF BUF$(PTXT,PTXT)=CHR$(EOL)
1130 X=0:Y=Y+1:LN=LN+1
1135 ELSE
1140 POS.X,Y: BUF$(PTXT,PTXT);:X=X+1:IF X>39:X=0:Y=Y+1:LN=LN+1:ENDIF
1145 ENDIF
1150 PTXT=PTXT+1:IF LN=23 OR PTXT>=TXTLN
1155 POS.0,23:? "Press any key to continue or ESC";:GET KEY:LN=0:X=0:Y=0:? CHR$(125)
1160 IF KEY=27 OR PTXT>=TXTLN THEN EXIT
1165 ENDIF
1170 LOOP
1175 ENDPROC
Od 1 do 22 z 22