Add files via upload
This commit is contained in:
parent
64c6352265
commit
35131ba393
90 changed files with 1738 additions and 0 deletions
7
Examples/Core/DataTypes/boolean.bas
Normal file
7
Examples/Core/DataTypes/boolean.bas
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM X AS BOOLEAN
|
||||||
|
X=FALSE
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
X=TRUE
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
END SUB
|
7
Examples/Core/DataTypes/byte.bas
Normal file
7
Examples/Core/DataTypes/byte.bas
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM X AS BYTE
|
||||||
|
X=BYTE(0x80)
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
X=BYTE(127)
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
END SUB
|
5
Examples/Core/DataTypes/complex.bas
Normal file
5
Examples/Core/DataTypes/complex.bas
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM C AS COMPLEX
|
||||||
|
C = COMPLEX(2.2, 1.1)
|
||||||
|
PRINT C + C
|
||||||
|
END SUB
|
12
Examples/Core/DataTypes/double.bas
Normal file
12
Examples/Core/DataTypes/double.bas
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM X AS DOUBLE
|
||||||
|
X=1.234E+2
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
X=-1234.56E-2
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
X=321.1234567890123
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
X=PI
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
END SUB
|
||||||
|
|
9
Examples/Core/DataTypes/float.bas
Normal file
9
Examples/Core/DataTypes/float.bas
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM X AS FLOAT
|
||||||
|
X=321.1234f // Note the trailing f
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
X=1.234E+2f
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
X=-1234.56E-2f
|
||||||
|
PRINT "X=" + STRING(X)
|
||||||
|
END SUB
|
9
Examples/Core/DataTypes/integer.bas
Normal file
9
Examples/Core/DataTypes/integer.bas
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM X AS INTEGER
|
||||||
|
X=1234
|
||||||
|
PRINT X
|
||||||
|
X=0x80000000
|
||||||
|
PRINT X
|
||||||
|
X=0x7fffffff
|
||||||
|
PRINT X
|
||||||
|
END SUB
|
9
Examples/Core/DataTypes/long.bas
Normal file
9
Examples/Core/DataTypes/long.bas
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM X AS LONG
|
||||||
|
X=123L // Note the trailing L
|
||||||
|
PRINT X
|
||||||
|
X=0x8000000000000000L
|
||||||
|
PRINT X
|
||||||
|
X=0x7fffffffffffffffL
|
||||||
|
PRINT X
|
||||||
|
END SUB
|
9
Examples/Core/DataTypes/short.bas
Normal file
9
Examples/Core/DataTypes/short.bas
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM X AS SHORT
|
||||||
|
X=SHORT(123)
|
||||||
|
PRINT X
|
||||||
|
X=SHORT(0x8000)
|
||||||
|
PRINT X
|
||||||
|
X=SHORT(0x7fff)
|
||||||
|
PRINT X
|
||||||
|
END SUB
|
11
Examples/Core/DataTypes/string.bas
Normal file
11
Examples/Core/DataTypes/string.bas
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM X AS STRING
|
||||||
|
X="Backslash character=\\"
|
||||||
|
PRINT "X: " + X
|
||||||
|
X="Quote Character=\""
|
||||||
|
PRINT "X: " + X
|
||||||
|
X="First line\nSecond line"
|
||||||
|
PRINT "X: " + X
|
||||||
|
X=STRING(123)
|
||||||
|
PRINT "X=" + X
|
||||||
|
END SUB
|
15
Examples/Core/DataTypes/variant.bas
Normal file
15
Examples/Core/DataTypes/variant.bas
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
FUNCTION DBL(X AS VARIANT) AS VARIANT
|
||||||
|
DBL = X + X
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
DIM V AS VARIANT
|
||||||
|
V=VARIANT(5)
|
||||||
|
PRINT DBL(V)
|
||||||
|
V=VARIANT(5.5)
|
||||||
|
PRINT DBL(V)
|
||||||
|
V=VARIANT(COMPLEX(2.2,1.1))
|
||||||
|
PRINT DBL(V)
|
||||||
|
V=VARIANT("Test")
|
||||||
|
PRINT DBL(V)
|
||||||
|
END SUB
|
13
Examples/Core/Operators/arithmetic.bas
Normal file
13
Examples/Core/Operators/arithmetic.bas
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "14 + 2 = " + STRING(14 + 2)
|
||||||
|
PRINT "14 - 2 = " + STRING(14 - 2)
|
||||||
|
PRINT "14 * 2 = " + STRING(14 * 2)
|
||||||
|
PRINT "14 / 2 = " + STRING(14 / 2)
|
||||||
|
PRINT "157 % 100 = " + STRING(157 % 100)
|
||||||
|
PRINT "10.0 ** 2.0 = " + STRING(10.0 ** 2.0)
|
||||||
|
PRINT "5 * -3 = " + STRING(5 * -3)
|
||||||
|
|
||||||
|
PRINT "3 * 4 + 2 = " + STRING(3*4+2)
|
||||||
|
PRINT "(3 * 4) + 2 = " + STRING((3*4)+2)
|
||||||
|
PRINT "3 * (4 + 2) = " + STRING(3*(4+2))
|
||||||
|
END SUB
|
24
Examples/Core/Operators/bitshift.bas
Normal file
24
Examples/Core/Operators/bitshift.bas
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
FUNCTION toHexString(N AS INTEGER) AS STRING
|
||||||
|
DIM S AS STRING
|
||||||
|
DIM I, J AS INTEGER
|
||||||
|
|
||||||
|
S = ""
|
||||||
|
|
||||||
|
FOR I=1 TO 8
|
||||||
|
J = N & 0x0000000f
|
||||||
|
IF (J < 10) THEN
|
||||||
|
S = CHR$(ASC("0") + J) + S
|
||||||
|
ELSE
|
||||||
|
S = CHR$(ASC("A") + (J-10)) + S
|
||||||
|
END IF
|
||||||
|
N = N >> 4
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
toHexString = "0x" + S
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "0x000000f0 << 4 = " + toHexString(0x000000f0 << 4)
|
||||||
|
PRINT "0xf0000000 >> 4 = " + toHexString(0xf0000000 >> 4)
|
||||||
|
PRINT "0xf0000000 >>> 4 = " + toHexString(0xf0000000 >>> 4)
|
||||||
|
END SUB
|
9
Examples/Core/Operators/bitwise.bas
Normal file
9
Examples/Core/Operators/bitwise.bas
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "0x0ffff & 0x00ff = " + STRING(0x0ffff & 0x00ff)
|
||||||
|
PRINT "0xff00 | 0x00ff = " + STRING(0xff00 | 0x00ff)
|
||||||
|
PRINT "0xff00 ^ 0x00ff = " + STRING(0xff00 ^ 0x00ff)
|
||||||
|
PRINT "~0xffffffff = " + STRING(~0xffffffff)
|
||||||
|
PRINT "~0xfffffffe = " + STRING(~0xfffffffe)
|
||||||
|
PRINT "~0xffffffffffffffffL = " + STRING(~0xffffffffffffffffL)
|
||||||
|
PRINT "~0xfffffffffffffffeL = " + STRING(~0xfffffffffffffffeL)
|
||||||
|
END SUB
|
26
Examples/Core/Operators/logical.bas
Normal file
26
Examples/Core/Operators/logical.bas
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I, J AS INTEGER
|
||||||
|
|
||||||
|
PRINT "NOT false = " + STRING(NOT false)
|
||||||
|
PRINT "NOT true = " + STRING(NOT true)
|
||||||
|
|
||||||
|
PRINT "false AND false = " + STRING(false AND false)
|
||||||
|
PRINT "false AND true = " + STRING(false AND true)
|
||||||
|
PRINT "true AND false = " + STRING(true AND false)
|
||||||
|
PRINT "true AND true = " + STRING(true AND true)
|
||||||
|
|
||||||
|
PRINT "false OR false = " + STRING(false OR false)
|
||||||
|
PRINT "false OR true = " + STRING(false OR true)
|
||||||
|
PRINT "true OR false = " + STRING(true OR false)
|
||||||
|
PRINT "true OR true = " + STRING(true OR true)
|
||||||
|
|
||||||
|
FOR I=1 TO 10
|
||||||
|
FOR J=1 TO 10
|
||||||
|
IF (I=5 AND J=5) THEN
|
||||||
|
PRINT "I AND J ARE BOTH 5, I=" + STRING(I) + ", J=" + STRING(J)
|
||||||
|
ELSEIF (I=5 OR J=5) THEN
|
||||||
|
PRINT "EITHER I OR J IS 5, I=" + STRING(I) + ", J=" + STRING(J)
|
||||||
|
END IF
|
||||||
|
END FOR
|
||||||
|
END FOR
|
||||||
|
END SUB
|
8
Examples/Core/Operators/relational.bas
Normal file
8
Examples/Core/Operators/relational.bas
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "(10 = 12) = " + STRING(10 = 12)
|
||||||
|
PRINT "(10 <> 12) = " + STRING(10 <> 12)
|
||||||
|
PRINT "(10 < 12) = " + STRING(10 < 12)
|
||||||
|
PRINT "(10 <= 12) = " + STRING(10 <= 12)
|
||||||
|
PRINT "(10 > 12) = " + STRING(10 > 12)
|
||||||
|
PRINT "(10 >= 12) = " + STRING(10 >= 12)
|
||||||
|
END SUB
|
31
Examples/Core/array.bas
Normal file
31
Examples/Core/array.bas
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
SUB PASS_ARRAY_1D(ARRAY(3) AS INTEGER)
|
||||||
|
DIM I AS INTEGER
|
||||||
|
FOR I=1 TO 3
|
||||||
|
PRINT "PASS_ARRAY_1D> ARRAY(" + STRING(I) + ")=" + STRING(ARRAY(I))
|
||||||
|
END FOR
|
||||||
|
END SUB
|
||||||
|
|
||||||
|
SUB PASS_ARRAY_2D(ARRAY(3,3) AS INTEGER)
|
||||||
|
DIM I,J AS INTEGER
|
||||||
|
FOR I=1 TO 3
|
||||||
|
FOR J=1 TO 3
|
||||||
|
PRINT "PASS_ARRAY_2D> ARRAY(" + STRING(I) + "," + STRING(J) + ")=" + STRING(ARRAY(I,J))
|
||||||
|
END FOR
|
||||||
|
END FOR
|
||||||
|
END SUB
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
DIM ARRAY1(3) AS INTEGER
|
||||||
|
DIM ARRAY2(3,3) AS INTEGER
|
||||||
|
DIM I,J AS INTEGER
|
||||||
|
|
||||||
|
FOR I=1 TO 3
|
||||||
|
ARRAY1(I) = I
|
||||||
|
FOR J=1 TO 3
|
||||||
|
ARRAY2(I,J) = (I-1) * 3 + J
|
||||||
|
END FOR
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
CALL PASS_ARRAY_1D(ARRAY1)
|
||||||
|
CALL PASS_ARRAY_2D(ARRAY2)
|
||||||
|
END SUB
|
56
Examples/Core/data.bas
Normal file
56
Examples/Core/data.bas
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM S AS STRING
|
||||||
|
DIM X AS DOUBLE
|
||||||
|
DIM I, N AS INTEGER
|
||||||
|
|
||||||
|
PRINT "Starting"
|
||||||
|
|
||||||
|
RESTORE dataList1
|
||||||
|
READ S
|
||||||
|
PRINT S
|
||||||
|
READ N
|
||||||
|
FOR I=1 TO N
|
||||||
|
READ X
|
||||||
|
PRINT X
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
RESTORE dataList2
|
||||||
|
READ S
|
||||||
|
PRINT S
|
||||||
|
READ N
|
||||||
|
FOR I=1 TO N
|
||||||
|
READ S
|
||||||
|
PRINT S
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
RESTORE dataList3
|
||||||
|
READ S
|
||||||
|
PRINT S
|
||||||
|
READ N
|
||||||
|
FOR I=1 TO N
|
||||||
|
READ S
|
||||||
|
PRINT S
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
PRINT "Finished"
|
||||||
|
|
||||||
|
datalist1:
|
||||||
|
DATA Data List 1
|
||||||
|
DATA 9
|
||||||
|
DATA 1,2,3
|
||||||
|
DATA 4,5,6
|
||||||
|
DATA 7,8,9
|
||||||
|
|
||||||
|
dataList2:
|
||||||
|
DATA Data List 2
|
||||||
|
DATA 3
|
||||||
|
DATA ABC,DEF,GHI
|
||||||
|
|
||||||
|
dataList3:
|
||||||
|
DATA Data List 3
|
||||||
|
DATA 5
|
||||||
|
DATA "Hello World","Hello, World!"
|
||||||
|
DATA Hello\ World,Hello\\World
|
||||||
|
DATA \"Hello World\"
|
||||||
|
|
||||||
|
END SUB
|
21
Examples/Core/dim.bas
Normal file
21
Examples/Core/dim.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM MONTH_ARRAY(12) AS STRING
|
||||||
|
DIM I AS INTEGER
|
||||||
|
|
||||||
|
MONTH_ARRAY(1)="January"
|
||||||
|
MONTH_ARRAY(2)="February"
|
||||||
|
MONTH_ARRAY(3)="March"
|
||||||
|
MONTH_ARRAY(4)="April"
|
||||||
|
MONTH_ARRAY(5)="May"
|
||||||
|
MONTH_ARRAY(6)="June"
|
||||||
|
MONTH_ARRAY(7)="July"
|
||||||
|
MONTH_ARRAY(8)="August"
|
||||||
|
MONTH_ARRAY(9)="September"
|
||||||
|
MONTH_ARRAY(10)="October"
|
||||||
|
MONTH_ARRAY(11)="November"
|
||||||
|
MONTH_ARRAY(12)="December"
|
||||||
|
|
||||||
|
FOR I=1 TO 12
|
||||||
|
PRINT "Month " + STRING(I) + " = " + MONTH_ARRAY(I)
|
||||||
|
END FOR
|
||||||
|
END SUB
|
25
Examples/Core/for.bas
Normal file
25
Examples/Core/for.bas
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I, J AS INTEGER
|
||||||
|
|
||||||
|
PRINT "FOR Loop counting from 1 up to 10"
|
||||||
|
FOR I=1 TO 10
|
||||||
|
PRINT "I=" + STRING(I)
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
PRINT "FOR Loop counting from 1 to 50 in steps of 10"
|
||||||
|
FOR I=1 TO 50 STEP 10
|
||||||
|
PRINT "I=" + STRING(I)
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
PRINT "FOR Loop counting from 99 down to 11 in steps of -11"
|
||||||
|
FOR I=99 TO 11 STEP -11
|
||||||
|
PRINT "I=" + STRING(I)
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
PRINT "Nested FOR Loops, Both Loops are counting from 0 TO 9"
|
||||||
|
FOR I=0 TO 9
|
||||||
|
FOR J=0 TO 9
|
||||||
|
PRINT "I=" + STRING(I) + ", J=" + STRING(J)
|
||||||
|
END FOR
|
||||||
|
END FOR
|
||||||
|
END SUB
|
7
Examples/Core/function.bas
Normal file
7
Examples/Core/function.bas
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
FUNCTION SUM(X AS INTEGER, Y AS INTEGER) AS INTEGER
|
||||||
|
SUM = X + Y
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
PRINT SUM(5, 7)
|
||||||
|
END SUB
|
26
Examples/Core/if.bas
Normal file
26
Examples/Core/if.bas
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
FOR I=1 TO 10
|
||||||
|
IF (I = 1) THEN
|
||||||
|
PRINT "ONE"
|
||||||
|
ELSEIF (I = 2) THEN
|
||||||
|
PRINT "TWO"
|
||||||
|
ELSEIF (I = 3) THEN
|
||||||
|
PRINT "THREE"
|
||||||
|
ELSEIF (I = 4) THEN
|
||||||
|
PRINT "FOUR"
|
||||||
|
ELSEIF (I = 5) THEN
|
||||||
|
PRINT "FIVE"
|
||||||
|
ELSEIF (I = 6) THEN
|
||||||
|
PRINT "SIX"
|
||||||
|
ELSEIF (I = 7) THEN
|
||||||
|
PRINT "SEVEN"
|
||||||
|
ELSEIF (I = 8) THEN
|
||||||
|
PRINT "EIGHT"
|
||||||
|
ELSEIF (I = 9) THEN
|
||||||
|
PRINT "NINE"
|
||||||
|
ELSE
|
||||||
|
PRINT "TEN"
|
||||||
|
END IF
|
||||||
|
END FOR
|
||||||
|
END SUB
|
5
Examples/Core/input.bas
Normal file
5
Examples/Core/input.bas
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM S AS STRING
|
||||||
|
INPUT "What is your name?",S
|
||||||
|
PRINT "Hello " + S
|
||||||
|
END SUB
|
9
Examples/Core/repeat.bas
Normal file
9
Examples/Core/repeat.bas
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
I=1
|
||||||
|
REPEAT
|
||||||
|
PRINT I
|
||||||
|
I=I+1
|
||||||
|
UNTIL I=10
|
||||||
|
PRINT "Finished"
|
||||||
|
END SUB
|
8
Examples/Core/sleep.bas
Normal file
8
Examples/Core/sleep.bas
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
FOR I=1 TO 10
|
||||||
|
PRINT I
|
||||||
|
SLEEP 1000
|
||||||
|
END FOR
|
||||||
|
PRINT "Finished"
|
||||||
|
END SUB
|
26
Examples/Core/throw.bas
Normal file
26
Examples/Core/throw.bas
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
DIM ERR AS STRING
|
||||||
|
|
||||||
|
TRY
|
||||||
|
FOR I=1 TO 10
|
||||||
|
PRINT I
|
||||||
|
IF (I=5) THEN
|
||||||
|
THROW "I=5"
|
||||||
|
END IF
|
||||||
|
END FOR
|
||||||
|
CATCH ERR
|
||||||
|
PRINT "ERROR> " + ERR
|
||||||
|
|
||||||
|
/*
|
||||||
|
* THROW A Second Error from within the Error Handler
|
||||||
|
* This time there isn't a current error handler so it
|
||||||
|
* will cause the program to abort - you will notice
|
||||||
|
* that the program doesn't print "Program Finished".
|
||||||
|
*/
|
||||||
|
|
||||||
|
THROW ERR + " THROWN by ERROR1"
|
||||||
|
END TRY
|
||||||
|
|
||||||
|
PRINT "Program Finished"
|
||||||
|
END SUB
|
23
Examples/Core/try.bas
Normal file
23
Examples/Core/try.bas
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
DIM ERR1 AS STRING
|
||||||
|
DIM ERR2 AS STRING
|
||||||
|
|
||||||
|
TRY
|
||||||
|
TRY
|
||||||
|
FOR I=1 TO 10
|
||||||
|
PRINT I
|
||||||
|
IF (I=5) THEN
|
||||||
|
THROW "I=5"
|
||||||
|
END IF
|
||||||
|
END FOR
|
||||||
|
CATCH ERR1
|
||||||
|
PRINT "ERROR1> " + ERR1
|
||||||
|
THROW ERR1 + " THROWN by ERROR1"
|
||||||
|
ENDTRY
|
||||||
|
CATCH ERR2
|
||||||
|
PRINT "ERROR2> " + ERR2
|
||||||
|
END TRY
|
||||||
|
|
||||||
|
PRINT "Program Finished"
|
||||||
|
END SUB
|
9
Examples/Core/while.bas
Normal file
9
Examples/Core/while.bas
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
I=1
|
||||||
|
WHILE I<10
|
||||||
|
PRINT I
|
||||||
|
I=I+1
|
||||||
|
END WHILE
|
||||||
|
PRINT "Finished"
|
||||||
|
END SUB
|
12
Examples/Dialogues/alert.bas
Normal file
12
Examples/Dialogues/alert.bas
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM R AS INTEGER
|
||||||
|
R = ALERT("OK Dialog", "OK Dialog Message which cannot be cancelled", "OK", "", "", FALSE)
|
||||||
|
PRINT R
|
||||||
|
R = ALERT("OK Dialog", "OK Dialog Message which can be cancelled", "OK", "", "", TRUE)
|
||||||
|
PRINT R
|
||||||
|
R = ALERT("Yes/No Dialog", "Yes/No Dialog Message", "Yes", "", "No", FALSE)
|
||||||
|
PRINT R
|
||||||
|
R = ALERT("Yes/Maybe/No Dialog", "Yes/Maybe/No Dialog Message", "Yes", "Maybe", "No", FALSE)
|
||||||
|
PRINT R
|
||||||
|
PRINT "*** Finished ***"
|
||||||
|
END SUB
|
14
Examples/Dialogues/select.bas
Normal file
14
Examples/Dialogues/select.bas
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM ITEM(5) AS STRING
|
||||||
|
DIM R AS INTEGER
|
||||||
|
ITEM(1)="A"
|
||||||
|
ITEM(2)="B"
|
||||||
|
ITEM(3)="C"
|
||||||
|
ITEM(4)="D"
|
||||||
|
ITEM(5)="E"
|
||||||
|
R = SELECT("Select One - Not Cancellable", ITEM, FALSE)
|
||||||
|
PRINT R
|
||||||
|
R = SELECT("Select One - Cancellable", ITEM, TRUE)
|
||||||
|
PRINT R
|
||||||
|
PRINT "*** Finished ***"
|
||||||
|
END SUB
|
37
Examples/Dialogues/selectmulti.bas
Normal file
37
Examples/Dialogues/selectmulti.bas
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM ITEM(5) AS STRING
|
||||||
|
DIM FLAG(5) AS BOOLEAN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
ITEM(1)="A"
|
||||||
|
ITEM(2)="B"
|
||||||
|
ITEM(3)="C"
|
||||||
|
ITEM(4)="D"
|
||||||
|
ITEM(5)="E"
|
||||||
|
FLAG(1)=FALSE
|
||||||
|
FLAG(2)=FALSE
|
||||||
|
FLAG(3)=FALSE
|
||||||
|
FLAG(4)=FALSE
|
||||||
|
FLAG(5)=FALSE
|
||||||
|
DIM R AS INTEGER
|
||||||
|
R = SELECTMULTI("OK Dialog", ITEM, FLAG, "OK", "", "", FALSE)
|
||||||
|
PRINT "R=" + STR$(R)
|
||||||
|
FOR I=1 TO 5
|
||||||
|
PRINT FLAG(I)
|
||||||
|
END FOR
|
||||||
|
R = SELECTMULTI("OK Dialog", ITEM, FLAG, "OK", "", "", TRUE)
|
||||||
|
PRINT "R=" + STR$(R)
|
||||||
|
FOR I=1 TO 5
|
||||||
|
PRINT FLAG(I)
|
||||||
|
END FOR
|
||||||
|
R = SELECTMULTI("Yes/No Dialog", ITEM, FLAG, "Yes", "", "No", FALSE)
|
||||||
|
PRINT "R=" + STR$(R)
|
||||||
|
FOR I=1 TO 5
|
||||||
|
PRINT FLAG(I)
|
||||||
|
END FOR
|
||||||
|
R = SELECTMULTI("Yes/Maybe/No Dialog", ITEM, FLAG, "Yes", "Maybe", "No", FALSE)
|
||||||
|
PRINT "R=" + STR$(R)
|
||||||
|
FOR I=1 TO 5
|
||||||
|
PRINT FLAG(I)
|
||||||
|
END FOR
|
||||||
|
PRINT "*** Finished ***"
|
||||||
|
END SUB
|
24
Examples/Dialogues/selectone.bas
Normal file
24
Examples/Dialogues/selectone.bas
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM ITEM(5) AS STRING
|
||||||
|
DIM SELECTED AS INTEGER
|
||||||
|
DIM R AS INTEGER
|
||||||
|
ITEM(1)="A"
|
||||||
|
ITEM(2)="B"
|
||||||
|
ITEM(3)="C"
|
||||||
|
ITEM(4)="D"
|
||||||
|
ITEM(5)="E"
|
||||||
|
SELECTED=-1
|
||||||
|
R = SELECTONE("OK Dialog", ITEM, SELECTED, "OK", "", "", FALSE)
|
||||||
|
PRINT R
|
||||||
|
PRINT SELECTED
|
||||||
|
R = SELECTONE("OK Dialog", ITEM, SELECTED, "OK", "", "", TRUE)
|
||||||
|
PRINT R
|
||||||
|
PRINT SELECTED
|
||||||
|
R = SELECTONE("Yes/No Dialog", ITEM, SELECTED, "Yes", "", "No", FALSE)
|
||||||
|
PRINT R
|
||||||
|
PRINT SELECTED
|
||||||
|
R = SELECTONE("Yes/Maybe/No Dialog", ITEM, SELECTED, "Yes", "Maybe", "No", FALSE)
|
||||||
|
PRINT R
|
||||||
|
PRINT SELECTED
|
||||||
|
PRINT "*** Finished ***"
|
||||||
|
END SUB
|
BIN
Examples/FileIO/appendfile.dat
Normal file
BIN
Examples/FileIO/appendfile.dat
Normal file
Binary file not shown.
41
Examples/FileIO/fileio.bas
Normal file
41
Examples/FileIO/fileio.bas
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM bool AS BOOLEAN
|
||||||
|
DIM b AS BYTE
|
||||||
|
DIM w AS SHORT
|
||||||
|
DIM i AS INTEGER
|
||||||
|
DIM l AS LONG
|
||||||
|
DIM f AS FLOAT
|
||||||
|
DIM d AS DOUBLE
|
||||||
|
DIM s AS STRING
|
||||||
|
DIM c AS COMPLEX
|
||||||
|
|
||||||
|
PRINT "Writing file"
|
||||||
|
OPEN #1,"fileio.dat","w"
|
||||||
|
PUT #1,true
|
||||||
|
PUT #1,BYTE(45)
|
||||||
|
PUT #1,SHORT(768)
|
||||||
|
PUT #1,123
|
||||||
|
CLOSE #1
|
||||||
|
|
||||||
|
PRINT "Appending to file"
|
||||||
|
OPEN #1,"fileio.dat","a"
|
||||||
|
PUT #1,9876l
|
||||||
|
PUT #1,"hello"
|
||||||
|
PUT #1,COMPLEX(3.1,-2.5)
|
||||||
|
PUT #1,3.1f
|
||||||
|
PUT #1,pi
|
||||||
|
CLOSE #1
|
||||||
|
|
||||||
|
PRINT "Reading file"
|
||||||
|
OPEN #1,"fileio.dat","r"
|
||||||
|
GET #1,bool,b,w,i,l
|
||||||
|
GET #1,s
|
||||||
|
GET #1,c,f,d
|
||||||
|
CLOSE #1
|
||||||
|
|
||||||
|
PRINT bool
|
||||||
|
PRINT b,w,i,l
|
||||||
|
PRINT s
|
||||||
|
PRINT c
|
||||||
|
PRINT f,d
|
||||||
|
END SUB
|
BIN
Examples/FileIO/fileio.dat
Normal file
BIN
Examples/FileIO/fileio.dat
Normal file
Binary file not shown.
51
Examples/FileIO/run_logger.bas
Normal file
51
Examples/FileIO/run_logger.bas
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
SUB MAIN()
|
||||||
|
DIM TM AS DOUBLE
|
||||||
|
DIM DD,MM,CCYY AS INTEGER
|
||||||
|
DIM HRS,MINS,SECS,MILLI AS INTEGER
|
||||||
|
DIM S AS STRING
|
||||||
|
|
||||||
|
DIM DATAFILE AS STRING
|
||||||
|
|
||||||
|
DATAFILE = "appendfile.dat"
|
||||||
|
|
||||||
|
TM=NOW()
|
||||||
|
DD=DAY(TM)
|
||||||
|
MM=MONTH(TM)
|
||||||
|
CCYY=YEAR(TM)
|
||||||
|
HRS=HOUR(TM)
|
||||||
|
MINS=MINUTE(TM)
|
||||||
|
SECS=SECOND(TM)
|
||||||
|
MILLI=MILLISECOND(TM)
|
||||||
|
S=STR$(DD) + "/" + STR$(MM) + "/" + STR$(CCYY) + " " + STR$(HRS) + ":" + STR$(MINS) + ":" + STR$(SECS) + "." + STR$(MILLI)
|
||||||
|
|
||||||
|
REM
|
||||||
|
REM ================================
|
||||||
|
REM Append Current Time to data file
|
||||||
|
REM ================================
|
||||||
|
REM
|
||||||
|
|
||||||
|
PRINT "Appending: " + S
|
||||||
|
OPEN #1,DATAFILE,"a"
|
||||||
|
PUT #1,S
|
||||||
|
CLOSE #1
|
||||||
|
|
||||||
|
REM
|
||||||
|
REM =================================================
|
||||||
|
REM Read back and display all times in appendfile.dat
|
||||||
|
REM =================================================
|
||||||
|
REM
|
||||||
|
|
||||||
|
PRINT "List of times in " + CHR$(0x22) + "appendfile.dat" + CHR$(0x22)
|
||||||
|
|
||||||
|
OPEN #1,DATAFILE,"r"
|
||||||
|
TRY
|
||||||
|
WHILE (TRUE)
|
||||||
|
GET #1,S
|
||||||
|
PRINT S
|
||||||
|
END WHILE
|
||||||
|
CATCH S
|
||||||
|
PRINT "End of File"
|
||||||
|
END TRY
|
||||||
|
CLOSE #1
|
||||||
|
END SUB
|
||||||
|
|
23
Examples/Graphics/alpha.bas
Normal file
23
Examples/Graphics/alpha.bas
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,0,0
|
||||||
|
FILLRECT X,Y,RW,RH
|
||||||
|
SETCOLOR 0,255,0,128
|
||||||
|
FILLRECT X*2,Y*2,RW,RH
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
87
Examples/Graphics/crossplot.bas
Normal file
87
Examples/Graphics/crossplot.bas
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
SUB CROSSPLOT(NP AS INTEGER, XARRAY(1) AS DOUBLE, YARRAY(1) AS DOUBLE)
|
||||||
|
DIM LEFT, RIGHT, TOP, BOTTOM AS INTEGER
|
||||||
|
DIM NX, NY AS INTEGER
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM XDELTA, YDELTA AS DOUBLE
|
||||||
|
DIM XPOS, YPOS AS DOUBLE
|
||||||
|
DIM I AS INTEGER
|
||||||
|
DIM S AS STRING
|
||||||
|
|
||||||
|
DIM BORDER AS INTEGER
|
||||||
|
|
||||||
|
BORDER = 40
|
||||||
|
|
||||||
|
TOP = BORDER
|
||||||
|
BOTTOM = SCREENHEIGHT() - BORDER * 2
|
||||||
|
LEFT = BORDER
|
||||||
|
RIGHT = SCREENWIDTH() - BORDER * 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
|
||||||
|
SETCOLOR 255,255,0
|
||||||
|
NX = 10
|
||||||
|
NY = 10
|
||||||
|
|
||||||
|
XDELTA = DOUBLE(RIGHT - LEFT) / DOUBLE(NX)
|
||||||
|
YDElTA = DOUBLE(BOTTOM - TOP) / DOUBLE(NY)
|
||||||
|
|
||||||
|
FOR I=0 TO NX
|
||||||
|
XPOS = DOUBLE(LEFT) + DOUBLE(I) * XDELTA
|
||||||
|
DRAWLINE XPOS, TOP, XPOS, BOTTOM
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
FOR I=0 TO NY
|
||||||
|
YPOS = DOUBLE(TOP) + DOUBLE(I) * YDELTA
|
||||||
|
DRAWLINE LEFT, YPOS, RIGHT, YPOS
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
S = "0.0"
|
||||||
|
W = STRINGWIDTH(S)+1
|
||||||
|
H = STRINGHEIGHT(S)+1
|
||||||
|
DRAWSTRING S,LEFT-W,BOTTOM
|
||||||
|
DRAWSTRING S,LEFT,BOTTOM+H
|
||||||
|
|
||||||
|
S = "1.0"
|
||||||
|
W = STRINGWIDTH(S)+1
|
||||||
|
H = STRINGHEIGHT(S)+1
|
||||||
|
DRAWSTRING S,LEFT-W,TOP+H
|
||||||
|
DRAWSTRING S,RIGHT-W,BOTTOM+H
|
||||||
|
|
||||||
|
S = "Y-Axis"
|
||||||
|
W = STRINGWIDTH(S)+1
|
||||||
|
H = STRINGHEIGHT(S)+1
|
||||||
|
DRAWSTRING S,LEFT-W,TOP+(BOTTOM-TOP-H)/2
|
||||||
|
|
||||||
|
S = "X-Axis"
|
||||||
|
W = STRINGWIDTH(S)+1
|
||||||
|
H = STRINGHEIGHT(S)+1
|
||||||
|
DRAWSTRING S,LEFT+(RIGHT-LEFT-W)/2,BOTTOM+H
|
||||||
|
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
|
||||||
|
FOR I=1 TO NP
|
||||||
|
XPOS = DOUBLE(LEFT) + XARRAY(I) * DOUBLE(RIGHT - LEFT)
|
||||||
|
YPOS = DOUBLE(TOP) + YARRAY(I) * DOUBLE(BOTTOM - TOP)
|
||||||
|
PLOT XPOS, YPOS
|
||||||
|
END FOR
|
||||||
|
END SUB
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
DIM XARRAY(500), YARRAY(500) AS DOUBLE
|
||||||
|
DIM NP AS INTEGER
|
||||||
|
DIM I AS INTEGER
|
||||||
|
|
||||||
|
NP = 500
|
||||||
|
|
||||||
|
FOR I=1 TO NP
|
||||||
|
XARRAY(I) = RND(0.0)
|
||||||
|
YARRAY(I) = RND(0.0)
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
CALL CROSSPLOT(NP, XARRAY, YARRAY)
|
||||||
|
REPAINT
|
||||||
|
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
25
Examples/Graphics/drawarc.bas
Normal file
25
Examples/Graphics/drawarc.bas
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWRECT X,Y,RW,RH
|
||||||
|
SETCOLOR 255,0,0
|
||||||
|
DRAWARC X,Y,RW,RH,5,90
|
||||||
|
SETCOLOR 0,255,0
|
||||||
|
DRAWARC X,Y,RW,RH,-5,-90
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
21
Examples/Graphics/drawcircle.bas
Normal file
21
Examples/Graphics/drawcircle.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM CX, CY, R AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
CY=SCREENHEIGHT()/2
|
||||||
|
CX=SCREENWIDTH()/2
|
||||||
|
|
||||||
|
IF (CX < CY) THEN
|
||||||
|
R=CX/2
|
||||||
|
ELSE
|
||||||
|
R=CY/2
|
||||||
|
END IF
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWCIRCLE CX,CY,R
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
32
Examples/Graphics/drawline.bas
Normal file
32
Examples/Graphics/drawline.bas
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM HEIGHT, WIDTH AS INTEGER
|
||||||
|
DIM I AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
HEIGHT=SCREENHEIGHT()
|
||||||
|
WIDTH=SCREENWIDTH()
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0 // BLACK
|
||||||
|
CLS
|
||||||
|
|
||||||
|
SETCOLOR 255,255,0 // YELLOW
|
||||||
|
FOR I=0 to WIDTH STEP 5
|
||||||
|
PRINT "I=" + STR$(I)
|
||||||
|
DRAWLINE 0,0,I,HEIGHT
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
SETCOLOR 0,255,255 // CYAN
|
||||||
|
FOR I=0 TO WIDTH STEP 5
|
||||||
|
DRAWLINE WIDTH,0,I,HEIGHT
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
REPAINT
|
||||||
|
|
||||||
|
FOR I=1 TO 10
|
||||||
|
SLEEP 1000
|
||||||
|
TEXT
|
||||||
|
SLEEP 1000
|
||||||
|
GRAPHICS
|
||||||
|
END FOR
|
||||||
|
END SUB
|
21
Examples/Graphics/drawoval.bas
Normal file
21
Examples/Graphics/drawoval.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWOVAL X,Y,RW,RH
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
25
Examples/Graphics/drawpie.bas
Normal file
25
Examples/Graphics/drawpie.bas
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWRECT X,Y,RW,RH
|
||||||
|
SETCOLOR 255,0,0
|
||||||
|
DRAWPIE X,Y,RW,RH,5,90
|
||||||
|
SETCOLOR 0,255,0
|
||||||
|
DRAWPIE X,Y,RW,RH,-5,-90
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
21
Examples/Graphics/drawrect.bas
Normal file
21
Examples/Graphics/drawrect.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWRECT X,Y,RW,RH
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
21
Examples/Graphics/drawroundrect.bas
Normal file
21
Examples/Graphics/drawroundrect.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWROUNDRECT X,Y,RW,RH,50,50
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
11
Examples/Graphics/drawstring.bas
Normal file
11
Examples/Graphics/drawstring.bas
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SUB MAIN
|
||||||
|
GRAPHICS
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,0,0
|
||||||
|
DRAWSTRING "HELLO",0,SCREENHEIGHT()/4
|
||||||
|
SETCOLOR 255,255,0
|
||||||
|
DRAWSTRING "WORLD",0,SCREENHEIGHT()/2
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
25
Examples/Graphics/fillarc.bas
Normal file
25
Examples/Graphics/fillarc.bas
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWRECT X,Y,RW,RH
|
||||||
|
SETCOLOR 255,0,0
|
||||||
|
FILLARC X,Y,RW,RH,5,90
|
||||||
|
SETCOLOR 0,255,0
|
||||||
|
FILLARC X,Y,RW,RH,-5,-90
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
21
Examples/Graphics/fillcircle.bas
Normal file
21
Examples/Graphics/fillcircle.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM CX, CY, R AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
CY=SCREENHEIGHT()/2
|
||||||
|
CX=SCREENWIDTH()/2
|
||||||
|
|
||||||
|
IF (CX < CY) THEN
|
||||||
|
R=CX/2
|
||||||
|
ELSE
|
||||||
|
R=CY/2
|
||||||
|
END IF
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
FILLCIRCLE CX,CY,R
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
21
Examples/Graphics/filloval.bas
Normal file
21
Examples/Graphics/filloval.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
FILLOVAL X,Y,RW,RH
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
25
Examples/Graphics/fillpie.bas
Normal file
25
Examples/Graphics/fillpie.bas
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWRECT X,Y,RW,RH
|
||||||
|
SETCOLOR 255,0,0
|
||||||
|
FILLPIE X,Y,RW,RH,5,90
|
||||||
|
SETCOLOR 0,255,0
|
||||||
|
FILLPIE X,Y,RW,RH,-5,-90
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
21
Examples/Graphics/fillrect.bas
Normal file
21
Examples/Graphics/fillrect.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
FILLRECT X,Y,RW,RH
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
21
Examples/Graphics/fillroundrect.bas
Normal file
21
Examples/Graphics/fillroundrect.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM RW, RH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
RW = W / 2
|
||||||
|
RH = H / 2
|
||||||
|
X = RW / 2
|
||||||
|
Y = RH / 2
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
FILLROUNDRECT X,Y,RW,RH,50,50
|
||||||
|
REPAINT
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
16
Examples/Graphics/plot.bas
Normal file
16
Examples/Graphics/plot.bas
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM WIDTH, HEIGHT AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
WIDTH=SCREENWIDTH()
|
||||||
|
HEIGHT=SCREENHEIGHT()
|
||||||
|
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
|
||||||
|
WHILE true
|
||||||
|
SETCOLOR RND(256),RND(256),RND(256)
|
||||||
|
PLOT RND(WIDTH),RND(HEIGHT)
|
||||||
|
REPAINT
|
||||||
|
END WHILE
|
||||||
|
END SUB
|
10
Examples/Graphics/repaint.bas
Normal file
10
Examples/Graphics/repaint.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
GRAPHICS
|
||||||
|
FOR I=1 TO 20
|
||||||
|
SETCOLOR RND(256),RND(256),RND(256)
|
||||||
|
CLS
|
||||||
|
REPAINT
|
||||||
|
SLEEP 500
|
||||||
|
END FOR
|
||||||
|
END SUB
|
32
Examples/Graphics/rotated_text.bas
Normal file
32
Examples/Graphics/rotated_text.bas
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
SUB MAIN
|
||||||
|
GRAPHICS
|
||||||
|
SETCOLOR 0,0,0 // BLACK
|
||||||
|
|
||||||
|
GSAVE
|
||||||
|
TRANSLATE 100,100
|
||||||
|
SETCOLOR 255,0,0
|
||||||
|
CALL ROTATEDTEXT
|
||||||
|
GRESTORE
|
||||||
|
|
||||||
|
GSAVE
|
||||||
|
TRANSLATE 300,200
|
||||||
|
SETCOLOR 0,255,0
|
||||||
|
CALL ROTATEDTEXT
|
||||||
|
GRESTORE
|
||||||
|
|
||||||
|
REPAINT
|
||||||
|
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
||||||
|
|
||||||
|
SUB ROTATEDTEXT
|
||||||
|
DIM I AS INTEGER
|
||||||
|
DRAWLINE -10,0,10,0
|
||||||
|
DRAWLINE 0,-10,0,10
|
||||||
|
FOR I=0 TO 359 STEP 30
|
||||||
|
GSAVE
|
||||||
|
ROTATE I
|
||||||
|
DRAWSTRING "Angle=" + STR$(I), 40, 0
|
||||||
|
GRESTORE
|
||||||
|
END FOR
|
||||||
|
END SUB
|
45
Examples/Graphics/setfont.bas
Normal file
45
Examples/Graphics/setfont.bas
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM ALPHABET AS STRING
|
||||||
|
DIM XPOS, YPOS AS INTEGER
|
||||||
|
|
||||||
|
ALPHABET="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
XPOS=0
|
||||||
|
YPOS=40
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
SETCOLOR 0,0,0 // BLACK
|
||||||
|
CLS
|
||||||
|
|
||||||
|
SETCOLOR 255,255,255 // WHITE
|
||||||
|
SETFONT "MONOSPACE", 20
|
||||||
|
YPOS=YPOS+STRINGHEIGHT(ALPHABET)
|
||||||
|
DRAWSTRING ALPHABET,XPOS,YPOS
|
||||||
|
|
||||||
|
SETFONT "SANS_SERIF", 20
|
||||||
|
YPOS=YPOS+STRINGHEIGHT(ALPHABET)
|
||||||
|
DRAWSTRING ALPHABET,XPOS,YPOS
|
||||||
|
|
||||||
|
SETFONT "SERIF", 20
|
||||||
|
YPOS=YPOS+STRINGHEIGHT(ALPHABET)
|
||||||
|
DRAWSTRING ALPHABET,XPOS,YPOS
|
||||||
|
|
||||||
|
SETCOLOR 255,0,0 // RED
|
||||||
|
SETFONT "MONOSPACE", 25
|
||||||
|
YPOS=YPOS+STRINGHEIGHT(ALPHABET)
|
||||||
|
DRAWSTRING ALPHABET,XPOS,YPOS
|
||||||
|
|
||||||
|
SETCOLOR 0,255,0 // GREEN
|
||||||
|
SETFONT "SANS_SERIF", 30
|
||||||
|
YPOS=YPOS+STRINGHEIGHT(ALPHABET)
|
||||||
|
DRAWSTRING ALPHABET,XPOS,YPOS
|
||||||
|
|
||||||
|
ROTATE 10
|
||||||
|
SETCOLOR 0,0,255 // BLUE
|
||||||
|
SETFONT "SERIF", 35
|
||||||
|
YPOS=YPOS+STRINGHEIGHT(ALPHABET)
|
||||||
|
DRAWSTRING ALPHABET,XPOS,YPOS
|
||||||
|
|
||||||
|
REPAINT
|
||||||
|
|
||||||
|
SLEEP 5000
|
||||||
|
END SUB
|
3
Examples/Include/library.bas
Normal file
3
Examples/Include/library.bas
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
FUNCTION ADD(A AS DOUBLE, B AS DOUBLE) AS DOUBLE
|
||||||
|
ADD = A + B
|
||||||
|
END FUNCTION
|
6
Examples/Include/main.bas
Normal file
6
Examples/Include/main.bas
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include "library.bas"
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
PRINT ADD(5.0, 7.0)
|
||||||
|
PRINT ADD(3.0, -5.0)
|
||||||
|
END SUB
|
13
Examples/Include_Files/Convert.bas
Normal file
13
Examples/Include_Files/Convert.bas
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
REM
|
||||||
|
REM ==================================================
|
||||||
|
REM Please make sure the Include Files Enabled setting
|
||||||
|
REM has been enabled before trying to run this program
|
||||||
|
REM ==================================================
|
||||||
|
REM
|
||||||
|
|
||||||
|
#include "Library.bas"
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "100 degC = " + STR$(DegF(100.0)) + " degF"
|
||||||
|
PRINT "212 degF = " + STR$(DegC(212.0)) + " degC"
|
||||||
|
END SUB
|
7
Examples/Include_Files/Library.bas
Normal file
7
Examples/Include_Files/Library.bas
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
FUNCTION DegF(DegC AS DOUBLE) AS DOUBLE
|
||||||
|
DegF = DegC * 9.0 / 5.0 + 32.0
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
FUNCTION DegC(DegF AS DOUBLE) AS DOUBLE
|
||||||
|
DegC = (DegF - 32.0) * 5.0 / 9.0
|
||||||
|
END FUNCTION
|
10
Examples/Location/location.bas
Normal file
10
Examples/Location/location.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsLocationAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT GETALTITUDE(),GETLATITUDE(),GETLONGITUDE()
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Location is not available"
|
||||||
|
END IF
|
||||||
|
END SUB
|
23
Examples/Maths/atan2.bas
Normal file
23
Examples/Maths/atan2.bas
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "---- ATAN2D (Degrees) ----"
|
||||||
|
|
||||||
|
PRINT "ATAN2D(0.0, 0.0)=" + STR$(ATAN2D(0.0, 0.0))
|
||||||
|
PRINT "ATAN2D(10.0, 10.0)=" + STR$(ATAN2D(10.0, 10.0))
|
||||||
|
PRINT "ATAN2D(10.0, 0.0)=" + STR$(ATAN2D(10.0, 0.0))
|
||||||
|
PRINT "ATAN2D(10.0, -10.0)=" + STR$(ATAN2D(10.0, -10.0))
|
||||||
|
PRINT "ATAN2D(0.0, -10.0)=" + STR$(ATAN2D(0.0, -10.0))
|
||||||
|
PRINT "ATAN2D(-10.0, -10.0)=" + STR$(ATAN2D(-10.0, -10.0))
|
||||||
|
PRINT "ATAN2D(-10.0, 0.0)=" + STR$(ATAN2D(-10.0, 0.0))
|
||||||
|
PRINT "ATAN2D(-10.0, 10.0)=" + STR$(ATAN2D(-10.0, 10.0))
|
||||||
|
|
||||||
|
PRINT "\n---- ATAN2 (Radians) ----"
|
||||||
|
|
||||||
|
PRINT "ATAN2(0.0, 0.0)=" + STR$(ATAN2(0.0, 0.0))
|
||||||
|
PRINT "ATAN2(10.0, 10.0)=" + STR$(ATAN2(10.0, 10.0))
|
||||||
|
PRINT "ATAN2(10.0, 0.0)=" + STR$(ATAN2(10.0, 0.0))
|
||||||
|
PRINT "ATAN2(10.0, -10.0)=" + STR$(ATAN2(10.0, -10.0))
|
||||||
|
PRINT "ATAN2(0.0, -10.0)=" + STR$(ATAN2(0.0, -10.0))
|
||||||
|
PRINT "ATAN2(-10.0, -10.0)=" + STR$(ATAN2(-10.0, -10.0))
|
||||||
|
PRINT "ATAN2(-10.0, 0.0)=" + STR$(ATAN2(-10.0, 0.0))
|
||||||
|
PRINT "ATAN2(-10.0, 10.0)=" + STR$(ATAN2(-10.0, 10.0))
|
||||||
|
END SUB
|
21
Examples/Maths/hyperbolic.bas
Normal file
21
Examples/Maths/hyperbolic.bas
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "---- SINE, COSINE, TANGENTS (HYPERBOLIC) ----"
|
||||||
|
|
||||||
|
PRINT "COSH(1) = " + STRING(COSH(1))
|
||||||
|
PRINT "SINH(1) = " + STRING(SINH(1))
|
||||||
|
PRINT "TANH(1) = " + STRING(TANH(1))
|
||||||
|
|
||||||
|
PRINT "ACOSH(1.543) = " + STRING(ACOSH(1.543))
|
||||||
|
PRINT "ASINH(1.175) = " + STRING(ASINH(1.175))
|
||||||
|
PRINT "ATANH(0.762) = " + STRING(ATANH(0.762))
|
||||||
|
|
||||||
|
PRINT "\n---- SECANT, COSECANT, COTANGENT (HYPERBOLIC) ----"
|
||||||
|
|
||||||
|
PRINT "SECH(1) = " + STRING(SECH(1))
|
||||||
|
PRINT "CSCH(1) = " + STRING(CSCH(1))
|
||||||
|
PRINT "COTH(1) = " + STRING(COTH(1))
|
||||||
|
|
||||||
|
PRINT "ASECH(0.648) = " + STRING(ASECH(0.648))
|
||||||
|
PRINT "ACSCH(0.851) = " + STRING(ACSCH(0.851))
|
||||||
|
PRINT "ACOTH(1.313) = " + STRING(ACOTH(1.313))
|
||||||
|
END SUB
|
24
Examples/Maths/maths.bas
Normal file
24
Examples/Maths/maths.bas
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM I AS INTEGER
|
||||||
|
|
||||||
|
PRINT "---- Logarithm and Power Functions ----"
|
||||||
|
|
||||||
|
PRINT "SQRT(81.0) = " + STRING(SQRT(81.0))
|
||||||
|
PRINT "LOG(2.718) = " + STRING(LOG(2.718))
|
||||||
|
PRINT "EXP(1.0) = " + STRING(EXP(1.0))
|
||||||
|
PRINT "LOG10(100.0) = " + STRING(LOG10(100.0))
|
||||||
|
PRINT "EXP10(2) = " + STRING(EXP10(2.0))
|
||||||
|
PRINT "POW(5.0, 3.0) = " + STRING(POW(5.0, 3.0))
|
||||||
|
|
||||||
|
PRINT "---- Miscellaneous Functions ----"
|
||||||
|
|
||||||
|
PRINT "ABS(-3.142) = " + STRING(ABS(-3.142))
|
||||||
|
PRINT "ABS(3.142) = " + STRING(ABS(3.142))
|
||||||
|
PRINT "ABS(-321L) = " + STRING(ABS(-321L))
|
||||||
|
PRINT "ABS(321L) = " + STRING(ABS(321L))
|
||||||
|
PRINT "ROUND(" + STRING(PI) + ",3) = " + STRING(ROUND(PI,3))
|
||||||
|
|
||||||
|
FOR I=1 TO 5
|
||||||
|
PRINT "I=" + STRING(I) + ", RND(10) = " + STRING(RND(10))
|
||||||
|
END FOR
|
||||||
|
END SUB
|
41
Examples/Maths/trig.bas
Normal file
41
Examples/Maths/trig.bas
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "---- SINE, COSINE, TANGENTS (DEGREES) ----"
|
||||||
|
|
||||||
|
PRINT "COSD(45)=" + STR$(COSD(45))
|
||||||
|
PRINT "SIND(45)=" + STR$(SIND(45))
|
||||||
|
PRINT "TAND(45)=" + STR$(TAND(45))
|
||||||
|
|
||||||
|
PRINT "ACOSD(0.707)=" + STR$(ACOSD(0.707))
|
||||||
|
PRINT "ASIND(0.707)=" + STR$(ASIND(0.707))
|
||||||
|
PRINT "ATAND(1)=" + STR$(ATAND(1))
|
||||||
|
|
||||||
|
PRINT "\n---- SINE, COSINE, TANGENTS (RADIANS) ----"
|
||||||
|
|
||||||
|
PRINT "COS(0.785)=" + STR$(COS(0.785))
|
||||||
|
PRINT "SIN(0.785)=" + STR$(SIN(0.785))
|
||||||
|
PRINT "TAN(0.785)=" + STR$(TAN(0.785))
|
||||||
|
|
||||||
|
PRINT "ACOS(0.707)=" + STR$(ACOS(0.707))
|
||||||
|
PRINT "ASIN(0.707)=" + STR$(ASIN(0.707))
|
||||||
|
PRINT "ATAN(1)=" + STR$(ATAN(1))
|
||||||
|
|
||||||
|
PRINT "\n---- SECANT, COSECANT, COTANGENT (DEGREES) ----"
|
||||||
|
|
||||||
|
PRINT "SECD(45)=" + STR$(SECD(45))
|
||||||
|
PRINT "CSCD(45)=" + STR$(CSCD(45))
|
||||||
|
PRINT "COTD(45)=" + STR$(COTD(45))
|
||||||
|
|
||||||
|
PRINT "ASECD(1.414)=" + STR$(ASECD(1.414))
|
||||||
|
PRINT "ACSCD(1.414)=" + STR$(ACSCD(1.414))
|
||||||
|
PRINT "ACOTD(1)=" + STR$(ACOTD(1))
|
||||||
|
|
||||||
|
PRINT "\n---- SECANT, COSECANT, COTANGENT (RADIANS) ----"
|
||||||
|
|
||||||
|
PRINT "SEC(0.785)=" + STR$(SEC(0.785))
|
||||||
|
PRINT "CSC(0.785)=" + STR$(CSC(0.785))
|
||||||
|
PRINT "COT(0.785)=" + STR$(COT(0.785))
|
||||||
|
|
||||||
|
PRINT "ASEC(1.414)=" + STR$(ASEC(1.414))
|
||||||
|
PRINT "ACSC(1.414)=" + STR$(ACSC(1.414))
|
||||||
|
PRINT "ACOT(1)=" + STR$(ACOT(1))
|
||||||
|
END SUB
|
9
Examples/NetworkIO/network.bas
Normal file
9
Examples/NetworkIO/network.bas
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM S AS STRING
|
||||||
|
PRINT "Reading from Google"
|
||||||
|
OPEN #1,"http://www.google.com/","r"
|
||||||
|
READLINE #1,S
|
||||||
|
CLOSE #1
|
||||||
|
|
||||||
|
PRINT s
|
||||||
|
END SUB
|
11
Examples/Sensors/accelerometer.bas
Normal file
11
Examples/Sensors/accelerometer.bas
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsAccelerometerAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT "--"
|
||||||
|
PRINT "X=" + STRING(getAccelerometerX()) + ", Y=" + STRING(getAccelerometerY()) + ", Z=" + STRING(getAccelerometerZ())
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Accelerometer Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/ambienttemperature.bas
Normal file
10
Examples/Sensors/ambienttemperature.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsAmbientTemperatureAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT getAmbientTemperature()
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Ambient Temperature Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/gravity.bas
Normal file
10
Examples/Sensors/gravity.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsGravityAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT "X=" + STRING(getGravityX()) + ", Y=" + STRING(getGravityY()) + ", Z=" + STRING(getGravityZ())
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Gravity Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/gyroscope.bas
Normal file
10
Examples/Sensors/gyroscope.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsGyroscopeAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT "X=" + STRING(getGyroscopeX()) + ", Y=" + STRING(getGyroscopeY()) + ", Z=" + STRING(getGyroscopeZ())
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Gyroscope Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/light.bas
Normal file
10
Examples/Sensors/light.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsLightAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT getLight()
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Light Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/linearacceleration.bas
Normal file
10
Examples/Sensors/linearacceleration.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsLinearAccelerationAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT "X=" + STRING(getLinearAccelerationX()) + ", Y=" + STRING(getLinearAccelerationY()) + ", Z=" + STRING(getLinearAccelerationZ())
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Linear Acceleration Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/magneticfield.bas
Normal file
10
Examples/Sensors/magneticfield.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsMagneticFieldAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT "X=" + STRING(getMagneticFieldX()) + ", Y=" + STRING(getMagneticFieldY()) + ", Z=" + STRING(getMagneticFieldZ())
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Magnetic Field Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/pressure.bas
Normal file
10
Examples/Sensors/pressure.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsPressureAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT getPressure()
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Pressure Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/proximity.bas
Normal file
10
Examples/Sensors/proximity.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsProximityAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT getProximity()
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Proximity Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/relativehumidity.bas
Normal file
10
Examples/Sensors/relativehumidity.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsRelativeHumidityAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT getRelativeHumidity()
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Relative Humidity Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/rotationvector.bas
Normal file
10
Examples/Sensors/rotationvector.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsRotationVectorAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT "X=" + STRING(getRotationVectorX()) + ", Y=" + STRING(getRotationVectorY()) + ", Z=" + STRING(getRotationVectorZ())
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Rotation Vector Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
10
Examples/Sensors/temperature.bas
Normal file
10
Examples/Sensors/temperature.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
SUB MAIN
|
||||||
|
IF (IsTemperatureAvailable()) THEN
|
||||||
|
WHILE (TRUE)
|
||||||
|
PRINT getTemperature()
|
||||||
|
SLEEP 1000
|
||||||
|
END WHILE
|
||||||
|
ELSE
|
||||||
|
PRINT "Temperature Sensor is not available on this device"
|
||||||
|
END IF
|
||||||
|
END SUB
|
11
Examples/Speech/Hello.bas
Normal file
11
Examples/Speech/Hello.bas
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SUB MAIN
|
||||||
|
PRINT "HELLO"
|
||||||
|
SPEAK "HELLO"
|
||||||
|
|
||||||
|
WHILE (IsSpeaking())
|
||||||
|
SLEEP 100
|
||||||
|
END WHILE
|
||||||
|
|
||||||
|
PRINT "GOODBYE"
|
||||||
|
SPEAK "GOODBYE"
|
||||||
|
END SUB
|
18
Examples/String/strings.bas
Normal file
18
Examples/String/strings.bas
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM STR AS STRING
|
||||||
|
DIM X AS DOUBLE
|
||||||
|
|
||||||
|
STR="Hello World"
|
||||||
|
PRINT "LEN(\"" + STR + "\")=" + STR$(LEN(STR))
|
||||||
|
PRINT "LEFT$(\"" + STR + "\",3) = \"" + LEFT$(STR,3) + "\""
|
||||||
|
PRINT "RIGHT$(\"" + STR + "\",3) = \"" + RIGHT$(STR,3) + "\""
|
||||||
|
PRINT "MID$(\"" + STR + "\",5,3) = \"" + MID$(STR,5,3) + "\""
|
||||||
|
PRINT "ASC(\"A\")=" + STR$(ASC("A"))
|
||||||
|
PRINT "CHR$(65)=" + CHR$(65)
|
||||||
|
PRINT "STR$(1.234) = \"" + STR$(1.234) + "\""
|
||||||
|
PRINT "LOWER$(\"" + STR + "\") = \"" + LOWER$(STR) + "\""
|
||||||
|
PRINT "UPPER$(\"" + STR + "\") = \"" + UPPER$(STR) + "\""
|
||||||
|
STR = "1.234"
|
||||||
|
X = VAL(STR)
|
||||||
|
PRINT "VAL(\"" + STR + "\") = " + STR$(X)
|
||||||
|
END SUB
|
15
Examples/Time/time.bas
Normal file
15
Examples/Time/time.bas
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM TM AS DOUBLE
|
||||||
|
DIM DD,MM,CCYY AS INTEGER
|
||||||
|
DIM HRS,MINS,SECS,MILLI AS INTEGER
|
||||||
|
TM=NOW()
|
||||||
|
DD=DAY(TM)
|
||||||
|
MM=MONTH(TM)
|
||||||
|
CCYY=YEAR(TM)
|
||||||
|
HRS=HOUR(TM)
|
||||||
|
MINS=MINUTE(TM)
|
||||||
|
SECS=SECOND(TM)
|
||||||
|
MILLI=MILLISECOND(TM)
|
||||||
|
PRINT "Todays Date (DD/MM/CCYY) = " + STRING(DD) + "/" + STRING(MM) + "/" + STRING(CCYY)
|
||||||
|
PRINT "Current Time = " + STRING(HRS) + ":" + STRING(MINS) + ":" + STRING(SECS) + "." + STRING(MILLI)
|
||||||
|
END SUB
|
31
Examples/TouchScreen/touchdown.bas
Normal file
31
Examples/TouchScreen/touchdown.bas
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM XY, XPOS, YPOS AS INTEGER
|
||||||
|
DIM LASTX, LASTY AS INTEGER
|
||||||
|
DIM MSG AS STRING
|
||||||
|
|
||||||
|
LASTX = 0
|
||||||
|
LASTY = 0
|
||||||
|
MSG = "Touch the Screen (Down)"
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWSTRING MSG,(SCREENWIDTH()-STRINGWIDTH(MSG))/2, SCREENHEIGHT()/2
|
||||||
|
REPAINT
|
||||||
|
|
||||||
|
WHILE TRUE
|
||||||
|
XY = TOUCHDOWN()
|
||||||
|
IF (XY <> -1) THEN
|
||||||
|
XPOS = (XY / 65536) & 0x0000ffff
|
||||||
|
YPOS = XY & 0x0000ffff
|
||||||
|
SETCOLOR RND(256),RND(256),RND(256)
|
||||||
|
DRAWLINE LASTX,LASTY,XPOS,YPOS
|
||||||
|
LASTX = XPOS
|
||||||
|
LASTY = YPOS
|
||||||
|
REPAINT
|
||||||
|
ELSE
|
||||||
|
SLEEP 10
|
||||||
|
END IF
|
||||||
|
END WHILE
|
||||||
|
END SUB
|
39
Examples/TouchScreen/touchmove.bas
Normal file
39
Examples/TouchScreen/touchmove.bas
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM XY, XPOS, YPOS AS INTEGER
|
||||||
|
DIM LASTX, LASTY AS INTEGER
|
||||||
|
DIM FLAG AS BOOLEAN
|
||||||
|
DIM MSG AS STRING
|
||||||
|
|
||||||
|
LASTX = -1
|
||||||
|
LASTY = -1
|
||||||
|
MSG = "Touch the Screen (Move)"
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWSTRING MSG,(SCREENWIDTH()-STRINGWIDTH(MSG))/2, SCREENHEIGHT()/2
|
||||||
|
REPAINT
|
||||||
|
|
||||||
|
SETCOLOR 255,255,0
|
||||||
|
|
||||||
|
WHILE TRUE
|
||||||
|
XY = TOUCHDOWN()
|
||||||
|
IF (XY <> -1) THEN
|
||||||
|
LASTX = (XY / 65536) & 0x0000ffff
|
||||||
|
LASTY = XY & 0x0000ffff
|
||||||
|
ELSE
|
||||||
|
XY = TOUCHMOVE()
|
||||||
|
IF (XY <> -1) THEN
|
||||||
|
XPOS = (XY / 65536) & 0x0000ffff
|
||||||
|
YPOS = XY & 0x0000ffff
|
||||||
|
DRAWLINE LASTX, LASTY, XPOS, YPOS
|
||||||
|
REPAINT
|
||||||
|
LASTX = XPOS
|
||||||
|
LASTY = YPOS
|
||||||
|
ELSE
|
||||||
|
SLEEP 10
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
END WHILE
|
||||||
|
END SUB
|
31
Examples/TouchScreen/touchup.bas
Normal file
31
Examples/TouchScreen/touchup.bas
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
SUB MAIN
|
||||||
|
DIM XY, XPOS, YPOS AS INTEGER
|
||||||
|
DIM LASTX, LASTY AS INTEGER
|
||||||
|
DIM MSG AS STRING
|
||||||
|
|
||||||
|
LASTX = 0
|
||||||
|
LASTY = 0
|
||||||
|
MSG = "Touch the Screen (Up)"
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
SETCOLOR 0,0,0
|
||||||
|
CLS
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWSTRING MSG,(SCREENWIDTH()-STRINGWIDTH(MSG))/2, SCREENHEIGHT()/2
|
||||||
|
REPAINT
|
||||||
|
|
||||||
|
WHILE TRUE
|
||||||
|
XY = TOUCHUP()
|
||||||
|
IF (XY <> -1) THEN
|
||||||
|
XPOS = (XY / 65536) & 0x0000ffff
|
||||||
|
YPOS = XY & 0x0000ffff
|
||||||
|
SETCOLOR RND(256),RND(256),RND(256)
|
||||||
|
DRAWLINE LASTX,LASTY,XPOS,YPOS
|
||||||
|
LASTX = XPOS
|
||||||
|
LASTY = YPOS
|
||||||
|
REPAINT
|
||||||
|
ELSE
|
||||||
|
SLEEP 10
|
||||||
|
END IF
|
||||||
|
END WHILE
|
||||||
|
END SUB
|
26
math/example.bas
Normal file
26
math/example.bas
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include "maplib.bas"
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
|
||||||
|
DIM C AS BOOLEAN
|
||||||
|
DIM D AS DOUBLE
|
||||||
|
DIM I AS INTEGER
|
||||||
|
|
||||||
|
REM IF YOU WANT TO TRY FUNCTION
|
||||||
|
REM CONSTRAINT(),
|
||||||
|
REM ENABLE THIS OPTION
|
||||||
|
C = FALSE
|
||||||
|
|
||||||
|
D = MAPINT(249,0,360,0,100,C)
|
||||||
|
I = MAPINT(249,0,360,0,100,C)
|
||||||
|
|
||||||
|
PRINT "WITHOUT ANY DECLARING: " + STR$(MAPINT(249, 0,360, 0,100, FALSE))
|
||||||
|
PRINT ""
|
||||||
|
|
||||||
|
PRINT "DECLARED AS DOUBLE: " + STR$(D)
|
||||||
|
PRINT ""
|
||||||
|
|
||||||
|
PRINT "DECLARED AS INTEGER: " + STR$(I)
|
||||||
|
PRINT ""
|
||||||
|
|
||||||
|
END SUB
|
25
math/maplib.bas
Normal file
25
math/maplib.bas
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
FUNCTION CONSTRAINT(N AS DOUBLE, MINVAL AS DOUBLE, MAXVAL AS DOUBLE) AS DOUBLE
|
||||||
|
IF N < MINVAL THEN
|
||||||
|
CONSTRAINT=MINVAL
|
||||||
|
ELSEIF N > MAXVAL THEN
|
||||||
|
CONSTRAINT=MAXVAL
|
||||||
|
ELSE
|
||||||
|
CONSTRAINT=N
|
||||||
|
END IF
|
||||||
|
END FUNCTION
|
||||||
|
FUNCTION CONSTRAINTINT(N AS INTEGER, MINVAL AS INTEGER, MAXVAL AS INTEGER) AS VARIANT
|
||||||
|
CONSTRAINTINT=CONSTRAINT(DOUBLE(N),DOUBLE(MINVAL),DOUBLE(MAXVAL))
|
||||||
|
END FUNCTION
|
||||||
|
FUNCTION MAP(N AS DOUBLE, MINVALIN AS DOUBLE, MAXVALIN AS DOUBLE, MINVALOUT AS DOUBLE, MAXVALOUT AS DOUBLE, CONSTR AS BOOLEAN) AS DOUBLE
|
||||||
|
DIM CONV AS DOUBLE
|
||||||
|
REM CONV=N/(MAXVALIN/MAXVALOUT)
|
||||||
|
CONV=(N-MINVALIN)*(MAXVALOUT-MINVALOUT)/(MAXVALIN-MINVALIN)+MINVALOUT
|
||||||
|
IF CONSTR THEN
|
||||||
|
MAP=CONSTRAINT(CONV,MINVALOUT,MAXVALOUT)
|
||||||
|
ELSE
|
||||||
|
MAP=CONV
|
||||||
|
END IF
|
||||||
|
END FUNCTION
|
||||||
|
FUNCTION MAPINT(N AS INTEGER, MINVALIN AS INTEGER, MAXVALIN AS INTEGER, MINVALOUT AS INTEGER, MAXVALOUT AS INTEGER, CONSTR AS BOOLEAN) AS VARIANT
|
||||||
|
MAPINT=MAP(DOUBLE(N),DOUBLE(MINVALIN),DOUBLE(MAXVALIN),DOUBLE(MINVALOUT),DOUBLE(MAXVALOUT),CONSTR)
|
||||||
|
END FUNCTION
|
8
netjson/example.bas
Normal file
8
netjson/example.bas
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include "json.bas"
|
||||||
|
|
||||||
|
SUB MAIN
|
||||||
|
DIM IP AS STRING
|
||||||
|
IP = REQUEST("http://ifconfig.me/ip")
|
||||||
|
PRINT IP
|
||||||
|
PRINT REQUEST("http://ipwhois.app/json/" + IP)
|
||||||
|
END SUB
|
10
netjson/json.bas
Normal file
10
netjson/json.bas
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
REM RECEIVE DATA FROM
|
||||||
|
REM REMOTE SERVER USING
|
||||||
|
REM GET REQUEST
|
||||||
|
FUNCTION REQUEST(ADDRESS AS STRING) AS STRING
|
||||||
|
DIM RESPONSE AS STRING
|
||||||
|
OPEN #1,ADDRESS,"r"
|
||||||
|
READLINE #1,RESPONSE
|
||||||
|
CLOSE #1
|
||||||
|
REQUEST = RESPONSE
|
||||||
|
END FUNCTION
|
45
test/accel.bas
Normal file
45
test/accel.bas
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
SUB MAIN
|
||||||
|
|
||||||
|
DIM ACCX, ACCY, ACCZ AS INTEGER
|
||||||
|
DIM RACC AS INTEGER
|
||||||
|
DIM W, H, X, Y AS INTEGER
|
||||||
|
DIM SIZE AS INTEGER
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
SIZE = 150
|
||||||
|
Y = H/2-SIZE/2
|
||||||
|
|
||||||
|
IF ISACCELEROMETERAVAILABLE() THEN
|
||||||
|
|
||||||
|
WHILE TRUE
|
||||||
|
|
||||||
|
ACCX = GETACCELEROMETERX()
|
||||||
|
ACCY = GETACCELEROMETERY()
|
||||||
|
ACCZ = GETACCELEROMETERZ()
|
||||||
|
|
||||||
|
RACC = INTEGER(ACCY*100)
|
||||||
|
|
||||||
|
IF X < W THEN
|
||||||
|
X=5
|
||||||
|
END IF
|
||||||
|
IF X > W THEN
|
||||||
|
X=W-SIZE-5
|
||||||
|
END IF
|
||||||
|
|
||||||
|
SETCOLOR 70,70,70
|
||||||
|
CLS
|
||||||
|
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
FILLRECT X, Y, SIZE, SIZE
|
||||||
|
|
||||||
|
REPAINT
|
||||||
|
SLEEP 35
|
||||||
|
|
||||||
|
END WHILE
|
||||||
|
|
||||||
|
END IF
|
||||||
|
|
||||||
|
END SUB
|
65
test/loading.bas
Normal file
65
test/loading.bas
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
SUB MAIN
|
||||||
|
|
||||||
|
DIM W, H AS INTEGER
|
||||||
|
DIM SIZE AS INTEGER
|
||||||
|
DIM ANGL AS INTEGER
|
||||||
|
DIM PCTS AS STRING
|
||||||
|
DIM BTNW AS INTEGER
|
||||||
|
DIM BTNH AS INTEGER
|
||||||
|
DIM X, Y AS INTEGER
|
||||||
|
DIM TXY, TX, TY AS INTEGER
|
||||||
|
DIM WAIT AS BOOLEAN
|
||||||
|
|
||||||
|
GRAPHICS
|
||||||
|
|
||||||
|
WAIT = TRUE
|
||||||
|
W = SCREENWIDTH()
|
||||||
|
H = SCREENHEIGHT()
|
||||||
|
SIZE = 300
|
||||||
|
|
||||||
|
FOR ANGL=0 TO 360
|
||||||
|
|
||||||
|
SETCOLOR 40,41,70
|
||||||
|
CLS
|
||||||
|
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
DRAWARC W/2-SIZE/2, H/2-SIZE/2, SIZE, SIZE, -90, ANGL
|
||||||
|
|
||||||
|
PCTS = STR$(INTEGER(DOUBLE(ANGL)/3.6))+"%"
|
||||||
|
|
||||||
|
SETFONT "MONOSPACE", 35
|
||||||
|
DRAWSTRING PCTS, W/2-STRINGWIDTH(PCTS)/2, H/2-STRINGHEIGHT(PCTS)/2
|
||||||
|
|
||||||
|
REPAINT
|
||||||
|
SLEEP 33
|
||||||
|
|
||||||
|
END FOR
|
||||||
|
|
||||||
|
BTNW = 100
|
||||||
|
BTNH = 50
|
||||||
|
X = W/2-BTNW/2
|
||||||
|
Y = H/2+SIZE/2+50
|
||||||
|
|
||||||
|
SETCOLOR 255,255,255
|
||||||
|
FILLROUNDRECT X, Y, BTNW, BTNH, 5, 5
|
||||||
|
|
||||||
|
SETCOLOR 40, 41, 70
|
||||||
|
SETFONT "SANS-SERIF", 30
|
||||||
|
|
||||||
|
DRAWSTRING "OK", X+BTNW/2-20, Y+BTNH/2+10
|
||||||
|
|
||||||
|
REPAINT
|
||||||
|
|
||||||
|
WHILE WAIT
|
||||||
|
|
||||||
|
TXY = TOUCHDOWN()
|
||||||
|
TX = (TXY / 65536) & 0x0000ffff
|
||||||
|
TY = TXY & 0x0000ffff
|
||||||
|
|
||||||
|
IF TX > X AND TX < (X+BTNW) AND TY > Y AND TY < (Y+BTNH) THEN
|
||||||
|
WAIT = FALSE
|
||||||
|
END IF
|
||||||
|
|
||||||
|
END WHILE
|
||||||
|
|
||||||
|
END SUB
|
14
test/variant.bas
Normal file
14
test/variant.bas
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
SUB MAIN
|
||||||
|
|
||||||
|
DIM A, B, C AS VARIANT
|
||||||
|
DIM I AS INTEGER
|
||||||
|
|
||||||
|
A=2.3
|
||||||
|
B=4
|
||||||
|
C=1
|
||||||
|
I=8
|
||||||
|
|
||||||
|
I=A+B-C
|
||||||
|
PRINT I
|
||||||
|
|
||||||
|
END SUB
|
Loading…
Add table
Add a link
Reference in a new issue