Note: This is not validated by Hawwash Soft. Use at your own risk!
Author name: Arthur Morris
Description: "C64 BASIC V2 CONCISE LIST of COMMANDS"
Author name: Arthur Morris
Description: "C64 BASIC V2 CONCISE LIST of COMMANDS"
63998 END
63999 REM "cmds.txt" Concise BASIC Commands File
^^^^^^^^^^^^^^SAFETY WALL^^^^^^^^^^^^^^^^^^^^^^^
In Editor write Program above WALL, SAVEing temporary back-ups as required.
To test: firstly COPY the Program from Editor, then while still in Editor delete all above L.63998 and tap Save Button to preserve this File
Go to C64 BASIC and PASTE.
NB. RETURN all Lines before RUN. When testing is OK, SAVE as a FILE "name.bas".
================================================
CONCISE HAND-BASIC COMMANDS [File "cmds.txt"]
I N D E X
[1] VARIABLES [6] DIRECT
[2] STRINGS [7] MATHS FUNCTIONS
[3] ARRAYS [8] LOGIC FUNCTIONS
[4] PROGRAM FLOW [9] GRAPHICS
[5] IN/OUTPUT etc. [10] MEMORY ACCESS
================================================
[1]***VARIABLES***
NUMBERS (2.93873588E-39 TO 1.70141183E38)
SIMPLE eg. A; B;TYPE;X all number variables
Most frequently used type.
All computations are float precision
without the '%' identifier (below)
NAMES cannot be Direct Commands
only first two chars. are ever used
CO=COUNT;CONCISE;COLOUR BUT NOT 'C'.
CO, CO%, CO$ are different names.
PRECISION eg. AB%;X%;TYPE% 32 bit mantissa
(apprx.9.6 decimal digits)+8bit exp.
INTEGER AB% +/- 32767 Integer (16 Bit)
INT Truncate number to Integer: rounded down
INT(0)=0 INT(5)=5 INT(-5)=-5
INT(6.25)=6 INT(-6.25)=-7
================================================
[2]***STRING$*** (0-255 CHARS.)
NAMES MN--$:M=letter(A-Z);N=letter (or no.0-9)
ASC(A$)or("A--Z")=the first ASCII Char. only
ASC("P")=80 ASC("Power")=80
CHR$(X) ASCII character of (X) CHR$(80)="P"
STR$(X) Numeric value of X as a string
STR$(6.25)=" 6.25" STR$(-6.25)="-6.25"
VAL(X$) value to first non-numeric character
VAL("6.25x")=6.25 VAL("6xx25")=6
VAL("x6x25")=0
CONCATENATE STRING$(+/-) "Pow"+"er64"="Power64"
ALGEBRAIC OPERATORS < <= = <> >= >-
"C64"<"Power64"=-1(true)
"Alpha">"Omega"=0 (false)
LEN(A$) Number of characters in String
LEFT$(A$,X) Chars. First to X
MID$(A$,X,Y) Chars. X to Y [X=1,Y=1 ok in IF-NEXT loop]
RIGHT$(A$,X) Chars. X to last
10 FOR CODE=49 TO 81
15 TEMP$=CHR$(CO): CODE$=CO$+TE$: NEXT
20 TE$="...."
25 PRINT CO$:
30 PRINT LEFT$(CO$,4);"-!-";TAB(4);
35 PRINT MID$(CO$,9,12)"-!-"
40 PRINT TE$; RIGHT$(CO$,9): END
run: (Variables- CODE,TEMP$,CODE$)
(25) "123456789:;<=>?@ABCDEFGHIJKLMNOPQ"
(30/5) "1234-!- 9:;<=>?@ABCD-!-"
(40) "....IJKLMNOPQ"
================================================
[3]***ARRAYS***
DIM Over eleven elements, (=subscripts 0-10+)
requires program space reserved first.
DIM NAME(x(,y,z), DIM NAME$(x,(y,z)
DIM A(11)=12 elements (0..11)
DIM B$(40,5,6)=1200(40x5x6) total elements
entries: A(3)=17 B$(0,2,3)="String"
================================================
[4]***PROGRAM FLOW***
GOTO X: program moves to Line X
GOSUB XY: to Subroutine at XY
100 PRINT"Main Program": GOSUB 900
110 PRINT"Back to Main": GOSUB 900
120 PRINT"Back again to Main": END
900 PRINT"At the Subroutine":RETURN
ON...GOTO Multiway branch
ON...GOSUB " "
100 ON X GOTO 100, 200, 300
(X=1:GOTO100, 2:GOTO200, 3:GOTO300)
IF..THEN.. Conditional branch
100 IF A < B THEN MN = A: GOTO xxx
105 REM if true goto Line xxx
110 MN=B: REM if false
120 ....
FOR..TO..(STEP..):NEXT (default:Step=1)
FOR I=1 TO 3:PRINT I;:NEXT 1 2 3
FOR I=1 TO 3 STEP 2:PRINT I;:NEXT 1 3
FOR I=3 TO 1 STEP-2:PRINT I;:NEXT 3 1
FOR I=3 TO 1:PRINT I;:NEXT 3
================================================
[5]***INPUT/OUTPUT/PRINT/READ***
CHR$(X) ASCII character (X=code) CHR$(80)="P"
ASC ASCII CODE (first char. in string ONLY)
ASC("A")=65 ASC("A STRING ")=65
GET(X) byte from data
(no "?" or wait, eg. to read storage)
GET(A$) string from data (ditto)
xxx GET K$:IF K$="": GOTO xxx
xxy GOSUB zzzy
xxz REM any[key] -goto subroutine
zzzy FOR N=1TO6^9:NEXT:RETURN
zzzz REM?1min.pause}
INPUT "Enter Number";A
prints "data"; "?", waits for [key]entry
INPUT A "Enter X,Y,C,"; A,B,C +[Ret]
puts values X,Y,Z into A,B,C
INPUT A$: enters string A$ (or value as string)
INPUT "Enter data+[Ret]";A$; (PRINT A$)
waits as above: (prints A$)
SPC(X) print SPC(X) = X spaces to next PRINT
100 FORT=0TO2: PRINT "|";SPC(T);
110 FOR I =1TO2: PRINT "*";SPC(T):NEXT
120 PRINT"| ";:NEXT
run "|**| | * * | | * * | "
CHR$(9)=8-column move TAB
10 PRINT "A";CHR$(9);"B";CHR$(9);"C";CHR$(9);"D"
20 PRINT "A";CHR$(9);"B2";CHR$(9);"C234567";
CHR$(9);"D"
30 PRINT "A";CHR$(9);"B 5";CHR$(9);
"C 7";CHR$(9);"D"
run A B C D
A B2 C234567 D
A B 5 C 7 D
PRINT "a.."; Semi-colon= no gap
PRINT "a..", Comma= 10 spaces
PRINT "a.." =Next line
10 PRINT "; =no space" ; "THUS"
20 PRINT ", =10 spaces" , "THUS"
30 PRINT "if no punctuation mark"
40 PRINT "=HERE!"
run (10) "; =no spaceTHUS"
(20) ", =10 spaces THUS"
(30) "if no punctuation mark"
"=HERE!"
10 FOR NUM=7 TO 13:PRINT NU;";";:NEXT: PRINT
20 FOR N=7 TO 13:NUM$=NU$+CHR$(48+N):NEXT
25 PRINT " ";NU$
run (10) " 7 ; 8 ; 9 ; 10 ; 11 ; 12 ; 13 ;"
(25) " 789:;<="
DATA stores data,data, , , (items)
RESTORE resets DATA pointer to
the FIRST item again for next READ
READ "data" : items from DATA in order
100 RESTORE:READ D$:PRINT D$;
110 FOR I=1 TO 3:READ D:N=N+D:PRINT N;:NEXT I
120 DATA "Power",12,34,18
run (110) Power 12 46 64
100 RESTORE
200 FOR I=1TO4:READ D$:PRINT D$;:NEXT
210 FOR I=1TO3:READ N$:PRINTN$;:NEXT
230 FOR I=1TO3:READ N:PRINTN;:NEXT
300 DATA "Tes ",TST,CHR$(64)@,
310 DATA 3,111,5, 2,6,90,100,
run (110) "Tes TSTCHR$(64)@31115 2 6 90 "
OPEN creates a file (for data)
10 OPEN 1,0,1,"TEST.DAT"
15 REM " 1," open a file to store data
20 PRINT#1, 1234: PRINT#1, "Hello":REM -data
30 CLOSE 1
50 OPEN 1,0,0,"TEST.DAT"
55 REM " 0," open file to retrieve data
60 INPUT#1, A: INPUT#1, I$: CLOSE 1
90 PRINT I$: PRINT A
run "Hello 1234"
CLOSE file
Store/load user files using OPEN/CLOSE, PRINT#/INPUT#
ASCII OFF: LOAD/SAVE "-.BAS" files
ASCII ON (=default): LOAD/SAVE "-.TXT" files
LOADing auto-detects format(Text/Encoded).
ASCII flag still used to specify SAVE format.
OPEN ASCII BASIC Files with”.TXT” extension,
<other apps.
================================================
[6]***DIRECT COMMANDS***~
NEW deletes all code & variables
CLR clears all variables
CLS clears screen {="PRINT CHR$(147)"}
REM comments -ignored by program run.
LIST (all) -X(start to X) X-Y X (X to end)
RUN (1-end) RUN X (X to end)
STOP stops program: prints "BREAK IN L.xxx"
CONT continues program after a STOP
END program completion
FILES ("filter" option) list files
LOAD "filename" to Screen 0 (then LIST & ENTER)
SAVE "filename" stores the program in a file
EDIT "FileName" loads file to Editor
COPY "FILE1"TO"FILE2" 1 is copied to 2
MERGE "FILE1"AND"FILE2"INTO"FILE3"
repeated lines overwritten by F.2 lines
RENUM "FILE1"[TO "FILE2" option] FROM N STEP M
RENUM "QUIZ.BAS" TO "QUIZ"
RENUM "QUIZ"
RENUM "QUIZ" TO "Q" FROM 1000
RENUM "QUIZ" TO "Q" FROM 1000 STEP 5
RENUM "Q" FROM 5 STEP 5
FONTS ("filter" option) lists all fonts
SET FONT "fontname",size (recommended 16-24 pt.)
SET FCLR R,G,B text col. Red,Green,Blue(0-255}
SET BCLR R,G,B background col,
SET STORE save settings
SET RESTORE restore original col. settings
PRINT FRE(0)=-26625 (Power-on)
= 38911 (65536-26625)
================================================
[7]***MATH FUNCTIONS***
ARITHMETIC calculating done from L.to R.
[1] contents of brackets: innermost-->outwards
[2] powers & roots [3] *,/ [4] +,-
? 2+256/2^2-2+3*2+1 71
? 2+{(256/(2^2)}-2+(3*2)+1 71
? (2+256)/((2^2-2+2)*(2+1)) 21.5
258 /( 4 * 3 )
? (2+256)/((2^2-2+3)*2)+1 26.8
258 / 10 +1
? 2+(256/((2^2-2)+2*(2+1))) 34
2+(256/ (2 + 6)
= Equal <> Unequal
> Greater than >= Greater than or equal
< Less than <= Less than or equal
ABS Absolute Value
ABS: (-6.25)=6.25 ABS: (0)=0 ABS: (6.25)=6.25
SGN: (-6.25)=-1 SGN: (0)=0 SGN: (6.25)=1
INT Truncate to Integer (rounded down)
INT: (0)=0 INT: (50)=50 INT: (-56)=-56
INT: (6.99.)=6 INT: (6.25)=6 INT: (-6.25)=-7
SQR: Square Root SQR: (6.25)=2.5
SIN: (?/3)=0.866025404 radians (?=3.14159..)
COS: (?/3)=0.5
TAN: (?/3)=1.73205081
ATN Arc Tan
ATN: (1)=0.785398163=?/4
(Deg=R*360/? & R=Deg*?/360)
EXP Exponent
EXP (6.25)=518.012825 (e = 2.71828183...)
LOG (6.25)=1.83258146
RND Seed<ABS: (0) = RND generator ON
RND(-625)=3.85114436E-06
N=INT(RND(1)*(Y+1-X)+X):(random nos. X to Y)
DEF FN= Define a BASIC Function or Subroutine
DEF FN=SI(A)=SIN(X)/Y DEF FN =SI(?/3)=0.81699
================================================
[8]***LOGIC OPERATORS***
Boolean results use Integers.
TRUE -1 (3<>6)
FALSE 0 (33<4)
AND IF A>B AND C<=D GOTO xxx -done if both true
12 AND 10 = 8(1100AND1010=1000)
OR IF A>B OR C<=D GOTO xxx done if either true
12 OR 10 = 14(1100OR1010=1110)
NOT NOT 2 = -3(NOT 0002 = FFFD)
================================================
================================================
[9]***GRAPHICS COMMANDS***
SCREEN 1 - Portrait or Landscape -but not both.
Portrait - X=0-767 Y=0-1023(Title Bar hides 0-63)
Landscape- Y=0-767 X=0-1023(Title Bar hides 0-63)
X Axis: L.to R. Y Axis: Top to Bottom
Standard Variables used below
C=colour F=flag(0{def.}/1=filled) Rad=radius
L=left R=right U=up D=down
UL=up&L UR=up&R DL=down&L DR=down&R
CSET I,R,G,B,A I>15 (if used in Draw Commands)
Red,Green,Blue,A-transparency (all 0-255)
10 SCREEN 1 : CLS: CSET 100,255,0,0,12
30 CIRCLE 160,200,100,1,100
40 GOTO 40
SLEEP T -waits T*0.001secs -CPU in sleep mode
TITLE "My Title!": Graphics Title Bar.
Hide/show bar: 2-finger touch
ANTIALIAS(X) Smooths lines/curves
0=disable 1=enable(default)
COMMODORE COLOURS(C=0-15)
0 WHITE 4 BLACK 8 ORANGE 12 GREY
1 RED 5 PURPLE 9 BROWN 13 Lt.GREEN
2 GREEN 6 YELLOW 10 Lt.RED 14 Lt.BLUE
3 BLUE 7 CYAN 11 Dk.GREY 15 Lt.GREY
MOVET X,Y 200,400:Move current point to
X, Y (without drawing)
PSET X,Y,C 160,200,1 -pixel position,col.
LSET A,B 4,1 -pixel width,end shape
0=Square [default]
1=Rounded (X.......Y)
2=Squared [X.......Y]
LINE XS ,YS ,XE ,YE , C S=start E=end
160,200,260,300, 2
LINETO X,Y,C from current point to X,Y
ARC 160,200,100,0,45,1,1
X,Y,Rad,start/end angle(deg),C,F
CIRCLE 160,200,100,1,1
centre X,Y,Rad,C,F{1=filled}
RECT 160,200,260,300,2,1 coloured rectangle
XUL,YUL,XDR,YDR,C,F L.Top,R.Bott. corners
ELLIPSE 160,200,300,300,3,1
XUL,YUL,XDR,YDR,C,F
rectangle limits L.Top,R.Bott. corners
FRAME 160,200,260,300,1,0 outlined rectangle
XUL,YUL,XDR,YDR,C,F L.Top,R.Bott.
TRIANGLE 160,200,260,300,360,200,1,1
red filled triangle
XDL,YDL,XU,YU,XDR,YDR,C,F
<- 3 corners ->
POLYGON 160,230,100,5,0,1,0
red frame,5 sides.
X,Y-centre,Rad,Sides(3-20)
rotation{0-360deg:0=nil}, C, F
STAR 160,230,120,40,5,0,6,0
yellow frame,5 vertexes -centre X,Y,
Rad outer,>Rad inner,vertexes(3-20),
rotation(0-360),C,F
FSET "Courier",16
"font name", size (recommended 16-24 pt.)
to list FONTS (Direct Cmd see above)
GPRINT "Hello World!", 160, 200, 2
string,X,Y(lower left position),C
DRAW "BM 100,100 C1 R2 0U 20 L20 D20"
String of Parameters
BM X,Y C RP UP LP DP
B move, does not draw
affects next command only
M move to X,Y{+/- X/Y
relative to last point}
N draw & return to start X,Y
from current point(last reached)
P(Integer) no.of pixels to draw
RP:pixels right, EP:pixels up&right,
LP: " left, FP: " down&right,
UP: " up, GP: " down&left,
DP: " down, HP: " up&left,
BEGINFRAME: Begin Drawing into frame
all draws are buffered, until-
ENDFRAME: End Drawing into frame
all buffered draws are screened
================================================
================================================
[10]***MEMORY ACCESS*** (not available on iPad!)
PEEK: PEEK(53280)=Current Frame ?
POKE: POKE 53280, 7 (Yellow Frame);POKE S+20,X
================================================
63999 REM "cmds.txt" Concise BASIC Commands File
^^^^^^^^^^^^^^SAFETY WALL^^^^^^^^^^^^^^^^^^^^^^^
In Editor write Program above WALL, SAVEing temporary back-ups as required.
To test: firstly COPY the Program from Editor, then while still in Editor delete all above L.63998 and tap Save Button to preserve this File
Go to C64 BASIC and PASTE.
NB. RETURN all Lines before RUN. When testing is OK, SAVE as a FILE "name.bas".
================================================
CONCISE HAND-BASIC COMMANDS [File "cmds.txt"]
I N D E X
[1] VARIABLES [6] DIRECT
[2] STRINGS [7] MATHS FUNCTIONS
[3] ARRAYS [8] LOGIC FUNCTIONS
[4] PROGRAM FLOW [9] GRAPHICS
[5] IN/OUTPUT etc. [10] MEMORY ACCESS
================================================
[1]***VARIABLES***
NUMBERS (2.93873588E-39 TO 1.70141183E38)
SIMPLE eg. A; B;TYPE;X all number variables
Most frequently used type.
All computations are float precision
without the '%' identifier (below)
NAMES cannot be Direct Commands
only first two chars. are ever used
CO=COUNT;CONCISE;COLOUR BUT NOT 'C'.
CO, CO%, CO$ are different names.
PRECISION eg. AB%;X%;TYPE% 32 bit mantissa
(apprx.9.6 decimal digits)+8bit exp.
INTEGER AB% +/- 32767 Integer (16 Bit)
INT Truncate number to Integer: rounded down
INT(0)=0 INT(5)=5 INT(-5)=-5
INT(6.25)=6 INT(-6.25)=-7
================================================
[2]***STRING$*** (0-255 CHARS.)
NAMES MN--$:M=letter(A-Z);N=letter (or no.0-9)
ASC(A$)or("A--Z")=the first ASCII Char. only
ASC("P")=80 ASC("Power")=80
CHR$(X) ASCII character of (X) CHR$(80)="P"
STR$(X) Numeric value of X as a string
STR$(6.25)=" 6.25" STR$(-6.25)="-6.25"
VAL(X$) value to first non-numeric character
VAL("6.25x")=6.25 VAL("6xx25")=6
VAL("x6x25")=0
CONCATENATE STRING$(+/-) "Pow"+"er64"="Power64"
ALGEBRAIC OPERATORS < <= = <> >= >-
"C64"<"Power64"=-1(true)
"Alpha">"Omega"=0 (false)
LEN(A$) Number of characters in String
LEFT$(A$,X) Chars. First to X
MID$(A$,X,Y) Chars. X to Y [X=1,Y=1 ok in IF-NEXT loop]
RIGHT$(A$,X) Chars. X to last
10 FOR CODE=49 TO 81
15 TEMP$=CHR$(CO): CODE$=CO$+TE$: NEXT
20 TE$="...."
25 PRINT CO$:
30 PRINT LEFT$(CO$,4);"-!-";TAB(4);
35 PRINT MID$(CO$,9,12)"-!-"
40 PRINT TE$; RIGHT$(CO$,9): END
run: (Variables- CODE,TEMP$,CODE$)
(25) "123456789:;<=>?@ABCDEFGHIJKLMNOPQ"
(30/5) "1234-!- 9:;<=>?@ABCD-!-"
(40) "....IJKLMNOPQ"
================================================
[3]***ARRAYS***
DIM Over eleven elements, (=subscripts 0-10+)
requires program space reserved first.
DIM NAME(x(,y,z), DIM NAME$(x,(y,z)
DIM A(11)=12 elements (0..11)
DIM B$(40,5,6)=1200(40x5x6) total elements
entries: A(3)=17 B$(0,2,3)="String"
================================================
[4]***PROGRAM FLOW***
GOTO X: program moves to Line X
GOSUB XY: to Subroutine at XY
100 PRINT"Main Program": GOSUB 900
110 PRINT"Back to Main": GOSUB 900
120 PRINT"Back again to Main": END
900 PRINT"At the Subroutine":RETURN
ON...GOTO Multiway branch
ON...GOSUB " "
100 ON X GOTO 100, 200, 300
(X=1:GOTO100, 2:GOTO200, 3:GOTO300)
IF..THEN.. Conditional branch
100 IF A < B THEN MN = A: GOTO xxx
105 REM if true goto Line xxx
110 MN=B: REM if false
120 ....
FOR..TO..(STEP..):NEXT (default:Step=1)
FOR I=1 TO 3:PRINT I;:NEXT 1 2 3
FOR I=1 TO 3 STEP 2:PRINT I;:NEXT 1 3
FOR I=3 TO 1 STEP-2:PRINT I;:NEXT 3 1
FOR I=3 TO 1:PRINT I;:NEXT 3
================================================
[5]***INPUT/OUTPUT/PRINT/READ***
CHR$(X) ASCII character (X=code) CHR$(80)="P"
ASC ASCII CODE (first char. in string ONLY)
ASC("A")=65 ASC("A STRING ")=65
GET(X) byte from data
(no "?" or wait, eg. to read storage)
GET(A$) string from data (ditto)
xxx GET K$:IF K$="": GOTO xxx
xxy GOSUB zzzy
xxz REM any[key] -goto subroutine
zzzy FOR N=1TO6^9:NEXT:RETURN
zzzz REM?1min.pause}
INPUT "Enter Number";A
prints "data"; "?", waits for [key]entry
INPUT A "Enter X,Y,C,"; A,B,C +[Ret]
puts values X,Y,Z into A,B,C
INPUT A$: enters string A$ (or value as string)
INPUT "Enter data+[Ret]";A$; (PRINT A$)
waits as above: (prints A$)
SPC(X) print SPC(X) = X spaces to next PRINT
100 FORT=0TO2: PRINT "|";SPC(T);
110 FOR I =1TO2: PRINT "*";SPC(T):NEXT
120 PRINT"| ";:NEXT
run "|**| | * * | | * * | "
CHR$(9)=8-column move TAB
10 PRINT "A";CHR$(9);"B";CHR$(9);"C";CHR$(9);"D"
20 PRINT "A";CHR$(9);"B2";CHR$(9);"C234567";
CHR$(9);"D"
30 PRINT "A";CHR$(9);"B 5";CHR$(9);
"C 7";CHR$(9);"D"
run A B C D
A B2 C234567 D
A B 5 C 7 D
PRINT "a.."; Semi-colon= no gap
PRINT "a..", Comma= 10 spaces
PRINT "a.." =Next line
10 PRINT "; =no space" ; "THUS"
20 PRINT ", =10 spaces" , "THUS"
30 PRINT "if no punctuation mark"
40 PRINT "=HERE!"
run (10) "; =no spaceTHUS"
(20) ", =10 spaces THUS"
(30) "if no punctuation mark"
"=HERE!"
10 FOR NUM=7 TO 13:PRINT NU;";";:NEXT: PRINT
20 FOR N=7 TO 13:NUM$=NU$+CHR$(48+N):NEXT
25 PRINT " ";NU$
run (10) " 7 ; 8 ; 9 ; 10 ; 11 ; 12 ; 13 ;"
(25) " 789:;<="
DATA stores data,data, , , (items)
RESTORE resets DATA pointer to
the FIRST item again for next READ
READ "data" : items from DATA in order
100 RESTORE:READ D$:PRINT D$;
110 FOR I=1 TO 3:READ D:N=N+D:PRINT N;:NEXT I
120 DATA "Power",12,34,18
run (110) Power 12 46 64
100 RESTORE
200 FOR I=1TO4:READ D$:PRINT D$;:NEXT
210 FOR I=1TO3:READ N$:PRINTN$;:NEXT
230 FOR I=1TO3:READ N:PRINTN;:NEXT
300 DATA "Tes ",TST,CHR$(64)@,
310 DATA 3,111,5, 2,6,90,100,
run (110) "Tes TSTCHR$(64)@31115 2 6 90 "
OPEN creates a file (for data)
10 OPEN 1,0,1,"TEST.DAT"
15 REM " 1," open a file to store data
20 PRINT#1, 1234: PRINT#1, "Hello":REM -data
30 CLOSE 1
50 OPEN 1,0,0,"TEST.DAT"
55 REM " 0," open file to retrieve data
60 INPUT#1, A: INPUT#1, I$: CLOSE 1
90 PRINT I$: PRINT A
run "Hello 1234"
CLOSE file
Store/load user files using OPEN/CLOSE, PRINT#/INPUT#
ASCII OFF: LOAD/SAVE "-.BAS" files
ASCII ON (=default): LOAD/SAVE "-.TXT" files
LOADing auto-detects format(Text/Encoded).
ASCII flag still used to specify SAVE format.
OPEN ASCII BASIC Files with”.TXT” extension,
<other apps.
================================================
[6]***DIRECT COMMANDS***~
NEW deletes all code & variables
CLR clears all variables
CLS clears screen {="PRINT CHR$(147)"}
REM comments -ignored by program run.
LIST (all) -X(start to X) X-Y X (X to end)
RUN (1-end) RUN X (X to end)
STOP stops program: prints "BREAK IN L.xxx"
CONT continues program after a STOP
END program completion
FILES ("filter" option) list files
LOAD "filename" to Screen 0 (then LIST & ENTER)
SAVE "filename" stores the program in a file
EDIT "FileName" loads file to Editor
COPY "FILE1"TO"FILE2" 1 is copied to 2
MERGE "FILE1"AND"FILE2"INTO"FILE3"
repeated lines overwritten by F.2 lines
RENUM "FILE1"[TO "FILE2" option] FROM N STEP M
RENUM "QUIZ.BAS" TO "QUIZ"
RENUM "QUIZ"
RENUM "QUIZ" TO "Q" FROM 1000
RENUM "QUIZ" TO "Q" FROM 1000 STEP 5
RENUM "Q" FROM 5 STEP 5
FONTS ("filter" option) lists all fonts
SET FONT "fontname",size (recommended 16-24 pt.)
SET FCLR R,G,B text col. Red,Green,Blue(0-255}
SET BCLR R,G,B background col,
SET STORE save settings
SET RESTORE restore original col. settings
PRINT FRE(0)=-26625 (Power-on)
= 38911 (65536-26625)
================================================
[7]***MATH FUNCTIONS***
ARITHMETIC calculating done from L.to R.
[1] contents of brackets: innermost-->outwards
[2] powers & roots [3] *,/ [4] +,-
? 2+256/2^2-2+3*2+1 71
? 2+{(256/(2^2)}-2+(3*2)+1 71
? (2+256)/((2^2-2+2)*(2+1)) 21.5
258 /( 4 * 3 )
? (2+256)/((2^2-2+3)*2)+1 26.8
258 / 10 +1
? 2+(256/((2^2-2)+2*(2+1))) 34
2+(256/ (2 + 6)
= Equal <> Unequal
> Greater than >= Greater than or equal
< Less than <= Less than or equal
ABS Absolute Value
ABS: (-6.25)=6.25 ABS: (0)=0 ABS: (6.25)=6.25
SGN: (-6.25)=-1 SGN: (0)=0 SGN: (6.25)=1
INT Truncate to Integer (rounded down)
INT: (0)=0 INT: (50)=50 INT: (-56)=-56
INT: (6.99.)=6 INT: (6.25)=6 INT: (-6.25)=-7
SQR: Square Root SQR: (6.25)=2.5
SIN: (?/3)=0.866025404 radians (?=3.14159..)
COS: (?/3)=0.5
TAN: (?/3)=1.73205081
ATN Arc Tan
ATN: (1)=0.785398163=?/4
(Deg=R*360/? & R=Deg*?/360)
EXP Exponent
EXP (6.25)=518.012825 (e = 2.71828183...)
LOG (6.25)=1.83258146
RND Seed<ABS: (0) = RND generator ON
RND(-625)=3.85114436E-06
N=INT(RND(1)*(Y+1-X)+X):(random nos. X to Y)
DEF FN= Define a BASIC Function or Subroutine
DEF FN=SI(A)=SIN(X)/Y DEF FN =SI(?/3)=0.81699
================================================
[8]***LOGIC OPERATORS***
Boolean results use Integers.
TRUE -1 (3<>6)
FALSE 0 (33<4)
AND IF A>B AND C<=D GOTO xxx -done if both true
12 AND 10 = 8(1100AND1010=1000)
OR IF A>B OR C<=D GOTO xxx done if either true
12 OR 10 = 14(1100OR1010=1110)
NOT NOT 2 = -3(NOT 0002 = FFFD)
================================================
================================================
[9]***GRAPHICS COMMANDS***
SCREEN 1 - Portrait or Landscape -but not both.
Portrait - X=0-767 Y=0-1023(Title Bar hides 0-63)
Landscape- Y=0-767 X=0-1023(Title Bar hides 0-63)
X Axis: L.to R. Y Axis: Top to Bottom
Standard Variables used below
C=colour F=flag(0{def.}/1=filled) Rad=radius
L=left R=right U=up D=down
UL=up&L UR=up&R DL=down&L DR=down&R
CSET I,R,G,B,A I>15 (if used in Draw Commands)
Red,Green,Blue,A-transparency (all 0-255)
10 SCREEN 1 : CLS: CSET 100,255,0,0,12
30 CIRCLE 160,200,100,1,100
40 GOTO 40
SLEEP T -waits T*0.001secs -CPU in sleep mode
TITLE "My Title!": Graphics Title Bar.
Hide/show bar: 2-finger touch
ANTIALIAS(X) Smooths lines/curves
0=disable 1=enable(default)
COMMODORE COLOURS(C=0-15)
0 WHITE 4 BLACK 8 ORANGE 12 GREY
1 RED 5 PURPLE 9 BROWN 13 Lt.GREEN
2 GREEN 6 YELLOW 10 Lt.RED 14 Lt.BLUE
3 BLUE 7 CYAN 11 Dk.GREY 15 Lt.GREY
MOVET X,Y 200,400:Move current point to
X, Y (without drawing)
PSET X,Y,C 160,200,1 -pixel position,col.
LSET A,B 4,1 -pixel width,end shape
0=Square [default]
1=Rounded (X.......Y)
2=Squared [X.......Y]
LINE XS ,YS ,XE ,YE , C S=start E=end
160,200,260,300, 2
LINETO X,Y,C from current point to X,Y
ARC 160,200,100,0,45,1,1
X,Y,Rad,start/end angle(deg),C,F
CIRCLE 160,200,100,1,1
centre X,Y,Rad,C,F{1=filled}
RECT 160,200,260,300,2,1 coloured rectangle
XUL,YUL,XDR,YDR,C,F L.Top,R.Bott. corners
ELLIPSE 160,200,300,300,3,1
XUL,YUL,XDR,YDR,C,F
rectangle limits L.Top,R.Bott. corners
FRAME 160,200,260,300,1,0 outlined rectangle
XUL,YUL,XDR,YDR,C,F L.Top,R.Bott.
TRIANGLE 160,200,260,300,360,200,1,1
red filled triangle
XDL,YDL,XU,YU,XDR,YDR,C,F
<- 3 corners ->
POLYGON 160,230,100,5,0,1,0
red frame,5 sides.
X,Y-centre,Rad,Sides(3-20)
rotation{0-360deg:0=nil}, C, F
STAR 160,230,120,40,5,0,6,0
yellow frame,5 vertexes -centre X,Y,
Rad outer,>Rad inner,vertexes(3-20),
rotation(0-360),C,F
FSET "Courier",16
"font name", size (recommended 16-24 pt.)
to list FONTS (Direct Cmd see above)
GPRINT "Hello World!", 160, 200, 2
string,X,Y(lower left position),C
DRAW "BM 100,100 C1 R2 0U 20 L20 D20"
String of Parameters
BM X,Y C RP UP LP DP
B move, does not draw
affects next command only
M move to X,Y{+/- X/Y
relative to last point}
N draw & return to start X,Y
from current point(last reached)
P(Integer) no.of pixels to draw
RP:pixels right, EP:pixels up&right,
LP: " left, FP: " down&right,
UP: " up, GP: " down&left,
DP: " down, HP: " up&left,
BEGINFRAME: Begin Drawing into frame
all draws are buffered, until-
ENDFRAME: End Drawing into frame
all buffered draws are screened
================================================
================================================
[10]***MEMORY ACCESS*** (not available on iPad!)
PEEK: PEEK(53280)=Current Frame ?
POKE: POKE 53280, 7 (Yellow Frame);POKE S+20,X
================================================