X=ABS(-5)
Y=ABS(5.1)
PRINT X
PRINT Y
5
5.1
GFILL 0,0,150,100,5
PRINT "HELLO, GOODBYE"
WAIT 60
ACLS
OUTPUT:10011000
10010001
--------
10010000
PRINT 152 AND 145
144
LOAD "PACMAN"
APPEND "TETRIS"
PRINT ASC("*"),ASC("Q")
42 81
PRINT ATAN(1)
0.785
BEEP 69,0,127,64
ACLS:CLEAR
BGFILL 0,0,0,12,6,33,9,0,0
BGOFS 0,-100,-100,3*60
@LOOP
LOCATE 16,10
PRINT BGCHK(0)
GOTO @LOOP
BGFILL 0,0,0,31,23,33,9,0,0
WAIT 60
BGCLIP 0,0,12,12
BGFILL 0,0,0,31,23,33,9,0,0
WAIT 60
BGCLR 0
BGFILL 0,0,0,12,12,33,9,0,0
WAIT 60
BGCOPY 0,0,0,6,6,14,14
BGFILL 0,0,0,12,12,33,0,0,0
PRINT "PLAYING? ";BGMCHK(0)
WAIT 60
BGMPLAY 3
PRINT "PLAYING? ";BGMCHK(0)
WAIT 180
BGMSTOP
PLAYING? 0
PLAYING? 1
C$=":0@6T122O2"
M$="C2E2F2A2A4C4D4F4"
BGMSET 128,C$,M$
BGMPLAY 128
WAIT 120
BGMCLEAR 128
BGMPLAY 128
@SONG
DATA ":0@7T160O2$0=4"
DATA "[AEAG]$0"
DATA 0
BGMSETD 128,@SONG
BGMPLAY 128
@LOOP
VSYNC 1:CLS
PRINT "LOOP ";BGMGETV(0,0);" TIMES"
GOTO @LOOP
BGMPLAY 3
@LOOP
IF BUTTON() THEN BGMSTOP:END
VSYNC 1
GOTO @LOOP
W1$="DA236456FF45A45EFF45A45EFF45A45E"
WAVE$=W1$+W1$+W1$+W1$
'WAVE$=WAVE$+WAVE$
'uncomment the above line for 128 byte sample
BGMPRG 224,127,127,127,64,WAVE$
BGMPLAY ":0@224T120O1","CAGECAGE"
melody is played.
SETUP$=":0@42T240O2"
MELODY$="CAFEFACE"
BGMSET 128,SETUP$,MELODY$
BGMPLAY 128
@SONG
DATA ":0@42T240O2"
DATA "CAFEFACE"
DATA 0
BGMSETD 128,@SONG
BGMPLAY 128
@SONG
DATA ":0@7T160O2"
DATA "[AEAG]$0"
DATA 0
BGMSETD 128,@SONG
BGMPLAY 128
BGMSETV 0,0,4
BGMPLAY 3
WAIT 60
BGMSTOP 0,5
.
BGMPLAY 3
WAIT 120
? "SHHH!!"
BGMVOL 0,32
ACLS:CLEAR
BGFILL 0,0,0,12,6,33,9,0,0
BGOFS 0,-100,-100,3*60
@LOOP
LOCATE 16,10
PRINT BGCHK(0)
GOTO @LOOP
.
BGPAGE 1
BGPUT 0,16,12,32,0,0,0
@LOOP
PNLTYPE "OFF"
VSYNC 1
GOTO @LOOP
BGPUT 0,16,12,32,0,0,0
.
BGPUT 0,16,12,33,2,0,1
BGREAD(0,16,12),ID,PAL,RH,RV
PRINT ID,PAL,RH,RV
33 2 0 1
BREPEAT 4,25,15
@LOOP
PRINT "HOLD A PLEASE"
IF BUTTON(1)==16 THEN PRINT "A IS PULSING"
VSYNC 1
CLS
GOTO @LOOP
PLEASE HOLD A
A IS PULSING
'2ND LINE FLASHES AS KEY AUTO-REPEATS
@LOOP
PRINT BTRIG()
CLS
GOTO @LOOP
@LOOP
IF (BUTTON() AND 16) THEN PRINT "A PRESSED"
'note: use the (button() and X) format above to allow multiple buttons
'to be read at the same time
VSYNC 1
CLS
GOTO @LOOP
A PRESSED
SELECTION = -1
IF SELECTION == CANCEL THEN PRINT "CANCELED"
CANCELED
LOCATE 20,15
PRINT "!"
PRINT "CHAR VALUE IS ";CHKCHR(20,15)
CHAR VALUE IS 33
PRINT CHR$(76);
CHR$(79);
CHR$(76);
LOL
CHRINIT "BGU0"
and a drawing function to be useful.
CHRREAD("BGU0",42),TILE$
PRINT TILE$
BGPUT 0,15,15,42,0,0,0
.
CHRINIT "BGU0"
TILE$="AA33DD22"*8
CHRSET "BGU0",42 ,TILE$
BGPUT 0,15,15,42,0,0,0
X=5:Y=25
CLEAR
PRINT X,Y
0 0
PRINT "YOU DON'T WANT TO SEE THIS"
WAIT 60:CLS
COLSET "GRP",1,"FF00FF"
COLINIT "GRP",1
COLREAD("GRP",1),R,G,B
PRINT R,G,B
58 57 58
COLOR 13,10
PRINT "COLORS ARE NICE"
COLREAD("GRP",1),R,G,B
PRINT R,G,B
58 57 58
COLSET "GRP",1,"FF00FF"
GFILL 0,0,50,50,1
. Also will not work if program has ended
CONT
PRINT COS( PI() / 3 )
0.5
LOCATE 5,10
PRINT CSRX
5
LOCATE 5,10
PRINT CSRY
10
DIM ARRAY(10)
DATA 9,0,0,0,1
DATA 3,7,37,8,42
FOR I=0 TO 9
READ ARRAY(I)
NEXT I
FOR I=0 TO 9
PRINT ARRAY(I);" ";
NEXT I
9 0 0 0 1 3 7 37 8 42
PRINT DATE$
2012/08/09
PRINT DEG( PI()/2 )
89.986
DELETE "EXAMPLE"
DIM ARRAY(2,2)
DATA 3,4,2,5
READ ARRAY(0,0) ,
ARRAY(0,1) ,
ARRAY(1,0) ,
ARRAY(1,1)
PRINT
ARRAY(0,0) ,
ARRAY(0,1) ,
ARRAY(1,0) ,
ARRAY(1,1)
3 4 2 5
DTREAD(DATE$),Y,M,D
PRINT Y,M,D
2012 8 9
ANSWER=42
PRINT "42? THE ANSWER?"
IF ANSWER != 42 THEN PRINT "NO? HEARESAY!" ELSE PRINT "OF COURSE IT IS
:)"
42? THE ANSWER?
OF COURSE IT IS :)
PRINT "PRESS A TO END"
@LOOP
IF BUTTON()==16 THEN END
VSYNC 1
GOTO @LOOP
PRESS A TO END
OK
PRINT ERL
4
PRINT ERR
1
EXEC "POKEMON"
PRINT EXP(2)
7.389
PRINT TRUE,!TRUE,FALSE,!FALSE
1 0 0 1
FILES
PRINT FLOOR(3.999)
3
FOR I=0 TO 10
PRINT I;
NEXT I
012345678910
PRINT FREEMEM
1023
PRINT FREEVAR
2047
PRINT "PRESS 1 OF THE FIVE TABS AT TOP OF TOUCH PANEL"
@LOOP
IF FUNCNO > 0 THEN PRINT FUNCNO
VSYNC 1
GOTO @LOOP
PRESS 1 OF THE FIVE TABS AT TOP
OF TOUCH PANEL
3
2
GBOX 20,20,70,70,12
.
GCIRCLE 128,96,95,6,0,360
GLINE 10,10,150,150,13
WAIT 60
GCLS 4
.
GCOLOR 4
GFILL 10,10,150,150
A blue box.
ACLS
GFILL 20,20,70,70,12
WAIT 30
GCOPY 0,20,20,70,70,100,0,TRUE
ACLS
GDRAWMD TRUE
GFILL 20,20,70,70,12
WAIT 30
GFILL 20,20,70,70,12
.
GFILL 20,20,70,70,12
.
GLINE 20,20,150,150,12
GOSUB @HERE
PRINT "WORLD"
END
@HERE
PRINT "HELLO"
RETURN
HELLO
WORLD
@HERE
PRINT RND(42)
GOTO @HERE
. (Press Select to
abort)
'draw to gpage
FOR I=0 TO 3
GPAGE 0,I,I
GFILL I*10,I*10,100,100,I+5
NEXT I
'view pages
FOR I=0 TO 3
GPAGE 0,I,I
WAIT 30
NEXT I
.
GCIRCLE 128,96,75,13,0,360
WAIT 30
GPAINT 128,96,13
GPSET 100,100,12
ACLS
GFILL 0,0,100,100,5
BGFILL 0,0,0,20,20,56,0,0,0
LOCATE 0,23:PRINT "Graphics behind BG"
WAIT 120:ACLS
GPRIO 0
GFILL 0,0,100,100,5
BGFILL 0,0,0,20,20,56,0,0,0
LOCATE 0,23:PRINT "Graphics in front of BG"
graphics, then the
graphics (solid square) gets drawn in front
GPUTCHR 100,100,"BGU0",1,5,1
GPSET 32,32,34
PRINT GSPOIT(32,32)
34
PRINT HEX$(255)
FF
PRINT "PLEASE, JUST TAP AN ICON ON THE BOTTOM RIGHT CORNER."
FOR X=0 TO 3
ICONSET X,X
NEXT X
@LOOP
IF ICONCHK() > -1 THEN PRINT ICONCHK()
VSYNC 1
GOTO @LOOP
l be displayed every time an
icon is touched.
PRINT "LOOK AT BOTTOM RIGHT CORNER OF TOUCH PANEL."
FOR X=0 TO 3
ICONSET X,X
NEXT X
FOR X=0 TO 3
WAIT 60
ICONCLR X
NEXT X
ICONPUSE=TRUE
ICONPMAX=15
ICONPAGE=0
@LOOP
FOR I=0 TO 3
P=ICONPAGE
ICONSET I,P*4+I
NEXT
VSYNC 1
GOTO @LOOP
PRINT "PLEASE, JUST TAP AN ICON ON THE BOTTOM RIGHT CORNER."
FOR X=0 TO 3
ICONSET X,X
NEXT X
@LOOP
IF ICONCHK() > -1 THEN PRINT ICONCHK()
VSYNC 1
GOTO @LOOP
Shows icon ID 0-3 when tapped.
ANSWER=9000
PRINT "42? THE ANSWER?"
IF ANSWER != 42 THEN PRINT "NO? HEARESAY!"
42? THE ANSWER?
NO? HEARESAY!
@LOOP
IF TCHTIME==1 THEN PRINT INKEY$()
VSYNC 1
GOTO @LOOP
INPUT "ENTER A NUMBER";G
PRINT "YOU ENTERED",G
INPUT "ENTER SOME TEXT";S$
PRINT "YOU ENTERED",S$
ENTER A NUMBER?
67
YOU ENTERED 67
ENTER SOME TEXT?
COME AGAIN?
YOU ENTERED COME AGAIN?
P=INSTR("YOU CANT FIND ME","FIND")
PRINT P
9
KEY 1,"ACLS:CLEAR:BGMSTOP"
ACLS:CLEAR:BGMSTOP
when pressed.
@LOOP
IF KEYBOARD THEN PRINT KEYBOARD
VSYNC 1
GOTO @LOOP
S$=LEFT$("PWNIFICATION",3)
PRINT S$
PWN
PRINT LEN("THIS IS A CLOWN FUNCTION BRO")
28
LINPUT "ENTER SOME TEXT";S$
PRINT "YOU ENTERED",S$
ENTER SOME TEXT
LOL
YOU ENTERED LOL
LIST 45
LOAD "MEM:MYSAVE",FALSE
LOAD "MYGAME",FALSE
LOCATE 12,12
PRINT "THE CENTER"
THE CENTER
PRINT LOG(100)
4.605
@LOOP
PRINT MAINCNTL
VSYNC 1:CLS
GOTO @LOOP
@LOOP
PRINT MAINCNTH
VSYNC 1:CLS
GOTO @LOOP
PRINT "RUN THIS PROGRAM TWICE FOR MEM$ SAVE DEMO"
SYSBEEP=0
LOAD "MEM:SAVE1",0
PRINT MEM$
MEM$="THIS IS YOUR SAVED TEXT. PLEASE, JUST RELAX AND ENJOY IT."
SAVE "MEM:SAVE1"
RUN THIS PROGRAM TWICE FOR MEM$ SAVE DEMO
RUN THIS PROGRAM TWICE FOR MEM$ SAVE DEMO
THIS IS YOUR SAVED TEXT. PLEASE, JUST RELAX AND ENJOY IT.
S$="IN THE MIDDLE OF THE ACTION"
PRINT MID$(S$,7,6)
MIDDLE
NEW
FOR I=0 TO 10
PRINT I;
NEXT I
012345678910
00101010 becomes
11010101
As you can see, all of the bits become the opposite in the 2nd
line.
PRINT NOT 42
-43
BRANCH=RND(4)
ON BRANCH GOSUB @FIRST,@SECOND,@THIRD,@FOURTH
END
@FIRST
PRINT "1ST FUNCTION"
RETURN
@SECOND
PRINT "2ND FUNCTION"
RETURN
@THIRD
PRINT "3RD FUNCTION"
RETURN
@FOURTH
PRINT "4TH FUNCTION"
RETURN
2ND FUNCTION
01100100
01000111
--------
01100111
PRINT 100 OR 71
103
PRINT PACKAGE$
E342A
PRINT 2*PI()
6.283
PNLSTR 5,10,"A LITTLE STRING",3
@LOOP
PNLTYPE "OFF"
VSYNC 1
GOTO @LOOP
A LITTLE STRING
@LOOP
PNLTYPE "PNL"
VSYNC 1
GOTO @LOOP
PRINT POW(2,8)
256
PRINT PRGNAME$
TETRIS
PRINT "HELLO WORLD",PI()
PRINT "HELLO WORLD";PI()
PRINT STR$( PI() ) * 2
? "HELLO WORLD"
HELLO WORLD 3.141
HELLO WORLD3.141
3.1413.141
HELLO WORLD
PRINT RAD(180)
3.141
DATA 42,34,77,11,89
READ A,B,C,D,E
PRINT A,B,C,D,E
42 34 77 11 89
REBOOT
RECVFILE "PACMAN"
REM THIS IS A COMMENT
'THIS IS THE EASIER WAY TO COMMENT
RENAME "BUBSY3D","MARIO64"
@RE
DATA 3,4,5,6,7,8
READ A,B,C
RESTORE @RE
READ D,E,F
PRINT A,B,C,D,E,F
3 4 5 3 4 5
LOAD "EXAMPLE"
PRINT RESULT
LOAD "FAILED"
PRINT RESULT
1
0
@LOOP
GOSUB @TI
GOTO @LOOP
@TI
PRINT TIME$
VSYNC 1:CLS
RETURN
S$=RIGHT$("THE FAR SIDE",4)
PRINT S$
SIDE
@LOOP
PRINT RND(10),
WAIT 30
GOTO @LOOP
3 0 2 6 3 5 6 9 ...
ACLS:CLEAR:DIM AR(10)
FOR X=0 TO 9
AR(X)=RND(10)
PRINT AR(X);
NEXT
LOCATE 0,2
RSORT 0,10,AR
FOR X=0 TO 9
PRINT AR(X);
NEXT
5802083009
9885320000
RUN
SAVE "AGAME"
SENDFILE "PACMAN"
PRINT SGN(-25)
-1
PRINT SIN( PI()/6 )
0.5
ACLS:CLEAR:DIM AR(10)
FOR X=0 TO 9
AR(X)=RND(10)
PRINT AR(X);
NEXT
LOCATE 0,2
SORT 0,10,AR
FOR X=0 TO 9
PRINT AR(X);
NEXT
5802083009
0000235889
QR
SPSET 0,96,0,0,0,0
SPHOME 0,8,8
SPOFS 0,100,100
SPANGLE 0,359,120,1
ACLS
SPSET 0,96,0,0,0,0
SPANIM 0,4,15,0
1001
ACLS
SPSET 0,96,0,0,0,0
SPOFS 0,100,100,120
SPANIM 0,4,15,0
@LOOP
LOCATE 0,3
PRINT SPCHK(0):?
IF SPCHK(0) AND 8 THEN ? "ANIMATING"
IF SPCHK(0) AND 4 THEN ? "SCALING"
IF SPCHK(0) AND 2 THEN ? "ROTATING"
IF SPCHK(0) AND 1 THEN ? "MOVING"
VSYNC 1:CLS
GOTO @LOOP
text.
ACLS
SPSET 0,96,0,0,0,0
WAIT 60
SPCHR 0,64
WAIT 120
ACLS
SPSET 0,96,0,0,0,0
WAIT 60
SPCLR 0
WAIT 60
ACLS
SPSET 0,96,0,0,0,0
SPCOL 0,0,0,32,16,TRUE
SPSET 1,64,0,0,0,0
@LOOP
X=X-1
IF X<-16 THEN X=50
SPOFS 1,X,0
LOCATE 0,3:PRINT SPHIT(0)
VSYNC 2
GOTO @LOOP
ACLS:CLEAR:Y=50
SPSET 0,96,0,0,0,0
SPOFS 0,10,10
SPSET 1,64,0,0,0,0
SPCOLVEC 0,16,16
@LOOP
Y=Y-1
IF Y<-16 THEN Y=50
SPOFS 1,Y,Y
LOCATE 0,6
?"SPHIT(0) "SPHIT(0):?
?"SPHITNO "SPHITNO
?"SPHITX "SPHITX
?"SPHITY "SPHITY
?"SPHITT "SPHITT
VSYNC 4:CLS
GOTO @LOOP
SPSET 0,64,0,1,1,0
SPSETV 0,0,34
PRINT SPGETV(0,0)
34
QR
Back to Table of Contents
X=100
SPSET 0,64,0,0,0,0
SPSET 1,96,0,0,0,0
@LOOP
X=X-1
IF X==-16 THEN X=50
SPOFS 1,X,0
LOCATE 0,3:PRINT SPHIT(0)
VSYNC 1:CLS
GOTO @LOOP
CLEAR:X=100
SPSET 0,64,0,0,0,0
SPSET 1,96,0,0,0,0
@LOOP
X=X-1
IF X==-16 THEN X=50
SPOFS 1,X,0
C=SPHIT(0)
LOCATE 0,3:PRINT SPHITNO
VSYNC 1:CLS
GOTO @LOOP
-1
After collision:1
SPSET 0,64,0,0,0,0
SPOFS 0,150,150,120
@LOOP
PRINT SPHITRC(0,150,150,10,10)
VSYNC 1:CLS
GOTO @LOOP
X=100
SPSET 0,64,0,0,0,0
SPSET 1,96,0,0,0,0
@LOOP
X=X-1
IF X==-16 THEN X=50
SPOFS 1,X,0
LOCATE 0,3:PRINT SPHITSP(0,1)
VSYNC 1:CLS
GOTO @LOOP
See SPCOLVEC
See SPCOLVEC
See SPCOLVEC
SPSET 0,64,0,0,0,0
SPHOME 0,128,-96
SPSET 0,64,0,0,0,0
SPOFS 0,128,96,120
SPPAGE 1
SPSET 0,0,0,0,0,0
@LOOP
PNLTYPE "OFF"
GOTO @LOOP
is displayed on the bottom screen.
SPSET 0,64,0,0,1,0
SPOFS 0,240,170,120
@LOOP
SPREAD(0),X,Y,ANGLE,SCALE,IMAGENUM
PRINT X,Y,ANGLE,SCALE,IMAGENUM
VSYNC 1:CLS
GOTO @LOOP
.
SPSET 0,64,0,0,0,0
SPSCALE 0,200,120
SPSET 0,64,2,1,1,0
shown on the upper left of the top screen.
SPSET 0,64,0,1,1,0
SPSETV 0,0,34
PRINT SPGETV(0,0)
34
PRINT SQR(4.5)
2.121
FOR I=0 TO 10 STEP 2
PRINT I,
NEXT I
0 2 4 6 8 10
STOP
BREAK in 1
S=1234
S$=STR$(S)
PRINT S+S,S$+S$
2468 12341234
S$="I LOVE YOU"
SC$=SUBST$(S$,2,0,"DON'T ")
PRINT SC$
I DON'T LOVE YOU
A=1:B=100
SWAP A,B
PRINT A,B
100 1
SYSBEEP=0
.
TABSTEP=16
PRINT "TAB","STEP"
TAB
STEP
PRINT TAN( PI()/2 )
0.999
@LOOP
PRINT "TCHST ";TCHST
PRINT "TCHTIME ";TCHTIME
PRINT "TCHX ";TCHX
PRINT "TCHY ";TCHY
PNLTYPE"OFF"
VSYNC 1:CLS
GOTO @LOOP
shown
to the right.
ANSWER=9000
PRINT "42? THE ANSWER?"
IF ANSWER != 42 THEN PRINT "NO? HEARESAY!"
42? THE ANSWER?
NO? HEARESAY!
@LOOP
PRINT TIME$
VSYNC 1:CLS
GOTO @LOOP
08:23:34
TMREAD(TIME$),H,M,S
PRINT H,M,S
8 23 34
FOR I=0 TO 10
PRINT I;
NEXT I
012345678910
PRINT TRUE,!TRUE,FALSE,!FALSE
1 0 0 1
PRINT "ENTER A NUMBER"
LINPUT S$
PRINT VAL(S$)*2
ENTER A NUMBER
4200
(enter)8400
PRINT VERSION
8224
ACLS:CLEAR
VISIBLE 0,0,0,0,0,0
PRINT" SOMETEXT"
BGFILL 0,3,3,11,11,57,0,0,0
BGFILL 1,7,7,15,15,58,0,0,0
SPSET 0,64,0,0,0,0
GCIRCLE 200,96,30,5
WAIT 60
VISIBLE 1,0,0,0,0,0:WAIT 60
VISIBLE 1,1,0,0,0,0:WAIT 60
VISIBLE 1,1,1,0,0,0:WAIT 60
VISIBLE 1,1,1,1,0,0:WAIT 60
VISIBLE 1,1,1,1,1,0:WAIT 60
VISIBLE 1,1,1,1,1,1
@LOOP
PRINT "PRESS ANY BUTTON TO ENGAGE VSYNC"
IF BUTTON() THEN VSYNC 1
CLS
GOTO @LOOP
?"HELLO":WAIT 60:?" WORLD"
HELLO WORLD
10011010
10010001
--------
00001011
PRINT 154 XOR 154
PRINT 154 XOR 145
PRINT 11 XOR 145
0
11
154