Petit Computer Function Guide
Written by Snailface
Please share, edit, and improve this free document and source codes to your hearts content.
Just please give credit, and remember that you agree to assume all risks associated with its use.

A B C D E F G H I K L M N O P R S T V W X

A
ABS
ACLS
AND
APPEND
ASC
ATAN
B
BEEP
BGCHK
BGCLIP
BGCLR
BGCOPY
BGFILL
BGMCHK
BGMCLEAR
BGMGETV
BGMPLAY
BGMPRG
BGMSET
BGMSETD
BGMSETV
BGMSTOP
BGMVOL
BGOFS
BGPAGE
BGPUT
BGREAD
BREPEAT
BTRIG
BUTTON
C
CANCEL
CHKCHR
CHR$
CHRINIT
CHRREAD
CHRSET
CLEAR
CLS
COLINIT
COLOR
COLREAD
COLSET
CONT
COS
CSRX
CSRY
D
DATA
DATE$
DEG
DELETE
DIM
DTREAD
E
ELSE
END
ERL
ERR
EXEC
EXP
F
FALSE
FILES
FLOOR
FOR
FREEMEM
FREEVAR
FUNCNO
G
GBOX
GCIRCLE
GCLS
GCOLOR
GCOPY
GDRAWMD
GFILL
GLINE
GOSUB
GOTO
GPAGE
GPAINT
GPSET
GPRIO
GPUTCHR
GSPOIT
H
HEX$
I
ICONCHK
ICONCLR
ICONPAGE
ICONPMAX
ICONPUSE
ICONSET
IF
INKEY$
INPUT
INSTR
J
K
KEY
KEYBOARD
L
LEFT$
LEN
LINPUT
LIST
LOAD
LOCATE
LOG
M
MAINCNTL
MAINCNTH
MEM$
MID$
N
NEW
NEXT
NOT
O
ON
OR
P
PACKAGE$
PI
PNLSTR
PNLTYPE
POW
PRGNAME$
PRINT
Q
R
RAD
READ
REBOOT
RECVFILE
REM
RENAME
RESTORE
RESULT
RETURN
RIGHT$
RND
RSORT
RUN
S
SAVE
SENDFILE
SGN
SIN
SORT
SPANGLE
SPANIM
SPCHK
SPCHR
SPCLR
SPCOL
SPCOLVEC
SPGETV
SPHIT
SPHITNO
SPHITRC
SPHITSP
SPHITT
SPHITX
SPHITY
SPHOME
SPOFS
SPPAGE
SPREAD
SPSCALE
SPSET
SPSETV
SQR
STEP
STOP
STR$
SUBST$
SWAP
SYSBEEP
T
TABSTEP
TAN
TCHST
TCHTIME
TCHX
TCHY
THEN
TIME$
TMREAD
TO
TRUE
U
V
VAL
VERSION
VISIBLE
VSYNC
W
WAIT
X
XOR
Y
Z


ABS(number)
This function accepts a number and returns the distance from zero.

EXAMPLE:
X=ABS(-5)
Y=ABS(5.1)
PRINT X
PRINT Y


OUTPUT:
5
5.1


QR

Back to Table of Contents


ACLS
Clears the screen of all visual data. Like CLS and GCLS combined.

EXAMPLE:
GFILL 0,0,150,100,5
PRINT "HELLO, GOODBYE"
WAIT 60
ACLS

OUTPUT:
A blue box, some words... then nothing.

QR

Back to Table of Contents



number AND number
Bitwise operator that compares two numbers and produces the "and" value. It's
easier to understand visually:

10011000
10010001
--------
10010000


The digits that are both 1 result in a 1 digit. 0&0 or 0&1 both translate to 0.

EXAMPLE:
PRINT 152 AND 145

OUTPUT:
144

Back to Table of Contents


APPEND "filename"
While in Run mode (not Edit mode), you can add another program's source code to the
end of the program you are currently working on. They are fused together as one program.
This is not permanent until you save the file.

EXAMPLE:
LOAD "PACMAN"
APPEND "TETRIS"

OUTPUT:
Two game source codes back to back (Pac-tris?).

Back to Table of Contents


ASC("character")
Takes a single character and returns its corresponding ascii value.

EXAMPLE:
PRINT ASC("*"),ASC("Q")

 
OUTPUT:
42 81

Back to Table of Contents


ATAN(number)
Takes the tan value and returns its angle in radians. The inverse of TAN(number).

EXAMPLE:
PRINT ATAN(1)


OUTPUT:
0.785

Back to Table of Contents


BEEP soundID 0-69 , pitch -8192->8192 , volume 0-127 , pan 0-127
Plays a sound effect. If params left empty, it plays sound effect 0 -- a beep. Pitch is -2 to 2 octaves
(0.25 to 4 times original pitch). Pan is centered at 64, left at 0, right at 127.

EXAMPLE:
BEEP 69,0,127,64

OUTPUT:
Sound of a cat's meow.

Back to Table of Contents


BGCHK layer 0-1
While function BGOFS is moving a background layer, this function will return 1, otherwise it will report 0.

EXAMPLE:
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


OUTPUT:
Background image moves while 1 is displayed. It shows 0 when the background stops moving.

QR

Back to Table of Contents


BGCLIP  0-31, 0-23, 0-31, 0-23
Think of this as a background 'cropper'. The first 2 parameters are the upper left corner (in 8x8 pixel tiles),
the second 2 are the bottom left corner of the crop box. What extends past the box is cropped off

EXAMPLE:
BGFILL 0,0,0,31,23,33,9,0,0
WAIT 60
BGCLIP 0,0,12,12


OUTPUT:
A 32x24 tile background is drawn. One second later, it is cropped to 12x12 tiles.

QR

Back to Table of Contents


BGCLR layer0-1
Simply erases the background layer only. You can specify the layer or leave it blank (defaults to layer 0).

EXAMPLE:
BGFILL 0,0,0,31,23,33,9,0,0
WAIT 60
BGCLR 0


OUTPUT:
A 32x24 tile background is drawn then erased.

QR

Back to Table of Contents


BGCOPY layer0-1, x 0-31 , y 0-23 , x 0-31 , y 0-23 , x 0-31 , y 0-23
A background copy/paste function. The 2nd-5th parameters are the upper left and bottom right tile coordinates that
bound the section to be copied. The 6th and 7th parameters are the destination (all coordinates are 8x8 tiles not pixels)

EXAMPLE:
BGFILL 0,0,0,12,12,33,9,0,0
WAIT 60
BGCOPY 0,0,0,6,6,14,14


OUTPUT:
A 12x12 tile background is drawn. Then, a 6x6 tile portion of it is copied to another part of the screen.

QR

Back to Table of Contents


BGFILL layer0-1, xTile0-63, yTile0-63 , xTile0-63, yTile0-63 , bgTileId0-1023, palette0-16, rotate horizontal 0-1, rotate vertical 0-1
Draws a tiled background. You specify the upper left and bottom right tile coordinates in parameters 2-5. The 6th param is the specific image.
Palette is 16 sets of sixteen colors each (just choose 0 for now). Rotate horizontal flips the tiles about the y-axis. Rotate left flips around the x-axis -- 0 is off, 1 is on
(for rotation).

EXAMPLE:
BGFILL 0,0,0,12,12,33,0,0,0

OUTPUT:
A 12x12 tile background is drawn. It looks like grass.

Back to Table of Contents


BGMCHK(track 0-7)
Checks to see whether a song is playing on a given track. Returns 0 is FALSE, 1 is TRUE.
 If parameter left empty it defaults to track 0.

EXAMPLE:
PRINT "PLAYING? ";BGMCHK(0)
WAIT 60
BGMPLAY 3
PRINT "PLAYING? ";BGMCHK(0)
WAIT 180
BGMSTOP


OUTPUT:
PLAYING? 0
PLAYING? 1


QR

Back to Table of Contents


BGMCLEAR songID128-255
Clears the mml song data from a user made song. Song #128-255 can be specified or left blank
for all songs.

EXAMPLE:
C$=":0@6T122O2"
M$="C2E2F2A2A4C4D4F4"

BGMSET 128,C$,M$
BGMPLAY 128

WAIT 120

BGMCLEAR 128
BGMPLAY 128


OUTPUT
The user song #128 plays for a couple of seconds then is silenced when its data is cleared by BGMCLEAR.
It cannot be restarted because its data is cleared.

QR

Back to Table of Contents


BGMGETV(track0-7 , mml variableID 0-7)
This function returns the value of the mml variable designated by the 2nd parmeter. In the below example, $0
(the mml variable) is used to repeat a music loop ([AEAG]) 4 times.When the track containing the mml variable
stops playing, BGMGETV returns -1. See BGMSETV for further information.

EXAMPLE:
@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


OUTPUT:
Loops the notes AEAG 4 times. BGMGETV shows the mml variable value 4 while the sound is looping.
It then shows -1 when the loops complete.

QR

Back to Table of Contents


BGMPLAY track0-7 , songID 0-29 or 128-255 , volume0-127
Plays built-in song (0-29) or user-made song (128-255) if one parameter entered. You can also specify the track number and volume as shown
above. If in Write Program mode, you will need to execute BGMSTOP to quit song or it will keep playing after the program ends or is
interrupted by button Select.

EXAMPLE:
BGMPLAY 3

@LOOP
IF BUTTON() THEN BGMSTOP:END
VSYNC 1
GOTO @LOOP


OUTPUT:
Song plays until you press a button.

QR

Back to Table of Contents


BGMPRG soundID224-255 , attack0-127 , delay0-127, sustain0-127 , release0-127 , "string128or256characters"
This expert-level function allows you to create a unique instrument sound via directly manipulatiting the bytes within a
sound effect sample. The data that makes up the waveform of the sound effect is 64 or 128 bytes long (two hex
characters each per byte, hence the 128 or 256 character parameter string). NOTE: Avoid using 0 for the release parameter
as the sound tends to sustain indefinitily even when returning to the Petit Computer home screen.

EXAMPLE:
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"


OUTPUT:
A rather dissonant melody is played.

QR

Back to Table of Contents


BGMSET song128-255 , "song setup string" , "musical notes"
Allows the user to create custom melodies by putting strings of musical notes together. 8 tracks of music can
be played simultaneously for fairly complex musical arrangements.

The "song setup string" format:
: 0-7 (track)
@ 0-255 (instrument)
T 1-512 (tempo)
O 0-8 (octave)

These need to be placed back-to back with no spaces (see example).

EXAMPLE:
SETUP$=":0@42T240O2"
MELODY$="CAFEFACE"

BGMSET 128,SETUP$,MELODY$
BGMPLAY 128


OUTPUT:
A short song is played.

QR

Back to Table of Contents


BGMSETD song 128-255, @label
Very similar to BGMSET directly above (read it first), but the data is entered differently. Song data string and
melody string are grouped into a @label then fed into the function. Observe the example below to see how it is done.

EXAMPLE:
@SONG
DATA ":0@42T240O2"
DATA "CAFEFACE"
DATA 0

BGMSETD 128,@SONG
BGMPLAY 128


OUTPUT:
A brief melody is played.

QR

Back to Table of Contents


BGMSETV track0-7 , mmlVariableID0-7, mmlVariableValue0-255
Normally, is impossible to insert numeric variables into character strings. But there is one exception in SmileBasic --
the mml variable. You can insert this variable into an mml (Music Macro Language) string by using the $ symbol followed
bey a numberID 0-7. You can then assign it a value of 0-255. One way of doing this is to use the BGMSETV function. You designate the
track it appears in, the number ID 0-7 (no $ used here),  and then finally assign its value 0-255.

EXAMPLE:
@SONG
DATA ":0@7T160O2"
DATA "[AEAG]$0"
DATA 0

BGMSETD 128,@SONG
BGMPLAY 128

BGMSETV 0,0,4


OUTPUT:
A melody loops 4 times as designated by the $0 variable whos value was assigned by BGMSETV

QR

Back to Table of Contents


BGMSTOP track0-7 , fadeOutSeconds
If left blank BGMSTOP will simply silence any playing music. You can, however, specify the track
number and add the number of seconds to fade to silence for added polish.

EXAMPLE:
BGMPLAY 3
WAIT 60
BGMSTOP 0,5


OUTPUT:
Song plays for a second then gradually goes silent within 5 seconds.

QR

Back to Table of Contents


BGMVOL track0-7 , volume0-127
Chooses the track number and then adjusts the volume -- 0 being mute, 127 being max.

EXAMPLE:
BGMPLAY 3
WAIT 120
? "SHHH!!"
BGMVOL 0,32


OUTPUT:
Song plays at full volume for a couple of seconds then quiets down.

QR

Back to Table of Contents


BGOFS layer0-1, xCoordinate , yCoordinate , movementTime(1/60th secs)
Moves background tiles from their current position to the x,y coordinates you set. Note that these have to
be the opposite +/- sign than what you'd normally expect. For instance, -50,0 moves the image right. The movementTime
is the amount of time the image takes to make the move. Expect a large move distance and short time to create fast bg movement
and vice-versa.

EXAMPLE:
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


OUTPUT:
Background moves down and to the right.

QR

Back to Table of Contents


BGPAGE screen0-1
Can be used to specify which screen background tiles will to drawn to. 0 is top screen, 1 is bottom screen.
Use PNLTYPE "OFF" every frame to clear the bottom screen for drawing.

EXAMPLE:
BGPAGE 1
BGPUT 0,16,12,32,0,0,0

@LOOP
PNLTYPE "OFF"
VSYNC 1
GOTO @LOOP


OUTPUT:
Bottom screen is blacked out and a 8x8 tile is drawn on it.

QR

Back to Table of Contents


BGPUT layer0-1 , xTile0-63 , yTile0-63 , bgTileId0-1023 , palette0-15 ,verticleRotation0-1 , horizontalRotation0-1
Places a background tile at the x,y coordinate (tile coordinates, not pixel!) specified in parameters 2 and 3. Rotation params 6 and 7 flip the tile around the y and y axis
respectively. 0 is rotation off, 1 is rotation on.

EXAMPLE:
BGPUT 0,16,12,32,0,0,0

OUTPUT:
Places a background tile at the middle of the top screen.

Back to Table of Contents


BGREAD(layer0-1, xTile0-63 ,yTile0-63), userVariable , userVariable , userVariable , userVariable
Simple:
Gets info from a tile and puts the data into 4 variables.
Detailed:
Give this function the layer and x,y tile coordinates of a bg tile in the parenthesis and it will write the bgID, palette number, and horizonal
and vertical rotation to 4 variables you choose after the parenthesis.

EXAMPLE:
BGPUT 0,16,12,33,2,0,1

BGREAD(0,16,12),ID,PAL,RH,RV

PRINT ID,PAL,RH,RV


OUTPUT:
33 2 0 1

QR

Back to Table of Contents


BREPEAT buttonID , initialTime , repeatIntervalTime
Allows a held button to repeat in a timed manner. 2nd parameter is the 1/60th second ticks before the repeating starts.
3rd parameter is the time in between repeats. Button ID codes are different values than the BUTTON() function:
0=up, 1=down, 2=left, 3=right, 4=A, 5=B, 6=X, 7=Y, 8=L, 9=R, 10=Start

EXAMPLE:
BREPEAT 4,25,15

@LOOP
PRINT "HOLD A PLEASE"
IF BUTTON(1)==16 THEN PRINT "A IS PULSING"
VSYNC 1
CLS

GOTO @LOOP

OUTPUT:
PLEASE HOLD A
A IS PULSING
'2ND LINE FLASHES AS KEY AUTO-REPEATS

QR

Back to Table of Contents


BTRIG()
No parameters for this function. It simply returns the button code* the moment it is pressed.
Use VSYNC 1 to register the value with the CPU.
*Check the below function, BUTTON(), for button codes.

EXAMPLE:
@LOOP
PRINT BTRIG()
CLS
GOTO @LOOP


OUTPUT:
Prints the button code values instantly as they are pressed.

QR

Back to Table of Contents


BUTTON(mode0-3)
Returns the button code value in different ways depending on the mode:

mode 0 or empty ( ) is Held (returns button code every frame)
mode 1 is Repeat Mode (see BREPEAT)
mode 2 is Instant Press (returns button code for 1 frame)
mode 3 is Instant Release (returns button code for 1 frame)

Button codes:
1=up, 2=down, 4=left, 8=right, 16=A, 32=B, 64=X, 128=Y, 256=L, 512=R, 1024=Start

EXAMPLE:
@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


OUTPUT:
A PRESSED

QR

Back to Table of Contents


CANCEL
A numeric constant that is always valued at -1.

EXAMPLE:
SELECTION = -1
IF SELECTION == CANCEL THEN PRINT "CANCELED"


OUTPUT:
CANCELED

Back to Table of Contents


CHKCHR(x0-32 , y0-23)
When given the x,y text coordinate, the function will return the character code of the character located there.

EXAMPLE:
LOCATE 20,15
PRINT "!"

PRINT "CHAR VALUE IS ";CHKCHR(20,15)

OUTPUT:
CHAR VALUE IS 33

QR

Back to Table of Contents


CHR$(0-255)
Returns the character that belongs to a given character code (0-255).

EXAMPLE:
PRINT CHR$(76);CHR$(79);CHR$(76);

OUTPUT:
LOL

Back to Table of Contents


CHRINIT  "BGU0-3 or SPU0-7"
Initializes the background tile memory banks or sprite memory banks for user customization.
 See CHRSET for further instructions.

EXAMPLE:
CHRINIT "BGU0"


OUTPUT:
Nothing. Needs CHRSET and a drawing function to be useful.

Back to Table of Contents


CHRREAD("BGU0-3 or SPU0-7" , tileOrSpriteNumber), userString$
Reads a user (or default) sprite/bg tile and writes the pixel data  (8x8 or 64 total characters) to a string. Each character in the string represents
a pixel's color that ranges from 0-16 (specifically represented by 0-F hexadecimal). Look at the example for an idea on how it works.

EXAMPLE:
CHRREAD("BGU0",42),TILE$

PRINT TILE$

BGPUT 0,15,15,42,0,0,0


OUTPUT:
A long number string that takes up two rows (64 characters).
The tile the data represents is also displayed in the middle of the screen.

QR

Back to Table of Contents


CHRSET "BGU0-3 or SPU0-7" , tileOrSpriteNumber , "exactly64characters0-F"
After using the CHRINIT function, you can viually customize a background/sprite tile. Pick a BGU or SPU memory bank, assign a tile/sprite number,
and finally create a 64 character long string that stores the tile's pixel colors. Each character represents the 0-F hexadecimal (0-16 value) color of the
pixel. Although the tiles are shown on the screen as 8x8, the pixels are arranged 1x64 in the string. (The example shown, TILE$, appears to only use an 8 character string,
but it is repeated 8 times by multiplication.)

EXAMPLE:
CHRINIT "BGU0"

TILE$="AA33DD22"*8

CHRSET "BGU0",42 ,TILE$

BGPUT 0,15,15,42,0,0,0


OUTPUT:
A striped, 4 color custom tile in the middle of the top screen.

QR

Back to Table of Contents


CLEAR
Clears out variable and system memory. Good idea to use this at the beginning of a program.

EXAMPLE:
X=5:Y=25
CLEAR
PRINT X,Y

OUTPUT:
0  0

QR

Back to Table of Contents


CLS
Clears outs any text on the screen.

EXAMPLE:
PRINT "YOU DON'T WANT TO SEE THIS"
WAIT 60:CLS

OUTPUT:
After one second, text disappears.

QR

Back to Table of Contents


COLINIT "BGorSPorGRP", colorNumber0-255
Restores a color's RGB values to default values. This function does not need to be called to use COLSET.
BG=background SP=sprite GRP=graphics

The example shows the sample color being changed to FF,00,FF (255,0,255) and changed back to default by
COLINIT.

EXAMPLE:
COLSET "GRP",1,"FF00FF"
COLINIT "GRP",1
COLREAD("GRP",1),R,G,B

PRINT R,G,B


OUTPUT:
58 57 58

QR

Back to Table of Contents


COLOR textColor0-16 , bgColor0-16
Changes the text and background (not the whole screen) color. You can skip the background color and it will default to
transparent value 0.

EXAMPLE:
COLOR 13,10
PRINT "COLORS ARE NICE"


OUTPUT:
Red text with blue background.

QR

Back to Table of Contents


COLREAD ("BGorSPorGRP", colorNumber0-255), userVariable, userVariable, userVariable
Reads the color data from the color bank (BG,SP or GRP) and colorNumber specified and writes the Red, Green, and Blue value to
the 3 userVariables respectively.

EXAMPLE:
COLREAD("GRP",1),R,G,B
PRINT R,G,B

OUTPUT:
58 57 58

QR

Back to Table of Contents


COLSET "BGorSPorGRP", colorNumber0-255 , "RRGGBB"
Choose a  color bank (BG,SP or GRP) and colorNumber, then define its color in the format "RRGGBB". These are hexadecimal
values, so each color (in order: red, green, blue) is 00-FF (translation: 0-255).
Color Banks: BG=background SP=sprite GRP=graphics

EXAMPLE:
COLSET "GRP",1,"FF00FF"
GFILL 0,0,50,50,1


OUTPUT:
A magenta box in the upper-left corner of the top screen.

QR

Back to Table of Contents


CONT
A Run-Mode only command that resumes a program after an interruption (such as pressing the Select button).
Does not work in Gallery mode or Edit mode (will error if you place it within a program). Also will not work if program has ended
even if in Run-Mode.

EXAMPLE:
CONT

OUTPUT:
Program resumes.

Back to Table of Contents


COS(radians)
Takes degrees in radians and returns the result.

EXAMPLE:
PRINT COS( PI() / 3 )

OUTPUT:
0.5

Back to Table of Contents


CSRX
System variable that returns the x position of the text cursor (in tile coordinates).

EXAMPLE:
LOCATE 5,10
PRINT CSRX

OUTPUT:
5

QR

Back to Table of Contents


CSRY

System variable that returns the y position of the text cursor (in tile coordinates).

EXAMPLE:
LOCATE 5,10
PRINT CSRY

OUTPUT:
10

QR

Back to Table of Contents


DATA numberOrString ,numberOrString ,numberOrString , . . .
Stores number or string data  to be assigned to variables by the READ command.

EXAMPLE:
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

OUTPUT:
9 0 0 0 1 3 7 37 8 42

QR

Back to Table of Contents


DATE$
A system variable (of string type) that shows the current date in the format yyyy/mm/dd.

EXAMPLE:
PRINT DATE$

OUTPUT:
2012/08/09

Back to Table of Contents


DEG(radians)
Takes the degrees in radians and converts it into conventional degrees (0-359). You can choose a radian
larger than 2π, however, and it will return an angle larger than 360.

EXAMPLE:
PRINT DEG( PI()/2 )

OUTPUT:
89.986

Back to Table of Contents


DELETE "filename"
Deletes the file specifed in the parameter. You cannot delete the sample files included with Petit Computer.
Can be used in Edit Mode or Run Mode.

EXAMPLE:
DELETE "EXAMPLE"

OUTPUT:
A confirmation screen asking if you wish to delete the file.

Back to Table of Contents


DIM arrayName(maxElements , maxElements)
Declares an array (a group of data with a common name). Arrays in SmileBasic can be one or two dimensions
and can be strings or numbers but not mixed. The parameters of the array are the max number of elements but
you cannot use the max number. For example, in DIM array(10) you cannot assign array(10)=42. It can only be array(0-9).

In short:
array(0)=42   /good
array(9)=42   /good
array(10)=42  /bad!

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)

OUTPUT:
3  4  2  5

QR

Back to Table of Contents


DTREAD(DATE$), userVariable, userVariable, userVariable
Reads the DATE$ string and writes the year, month, and day to three variables of your choosing.

EXAMPLE:
DTREAD(DATE$),Y,M,D
PRINT Y,M,D

OUTPUT:
2012  8  9

QR

Back to Table of Contents


ELSE
Part of the IF THEN ELSE branch statement of SmileBasic. What comes after ELSE occurs if the IF condition is FALSE (or 0).
Must be on the same line as IF and THEN.

EXAMPLE:
ANSWER=42
PRINT "42? THE ANSWER?"
IF ANSWER != 42 THEN PRINT "NO? HEARESAY!" ELSE PRINT "OF COURSE IT IS :)"

OUTPUT:
42? THE ANSWER?
OF COURSE IT IS :)

QR

Back to Table of Contents


END
Ends the program if called.

EXAMPLE:
PRINT "PRESS A TO END"
@LOOP
IF BUTTON()==16 THEN END
VSYNC 1
GOTO @LOOP

OUTPUT:
PRESS A TO END
OK

QR

Back to Table of Contents


ERL
System variable that holds the line number where the last known error occured.
Will be 0 if no error record.

EXAMPLE:
PRINT ERL

OUTPUT:
4

Back to Table of Contents


ERR
System variable that holds the error number of the last known error.
Will be 0 if no error record.

EXAMPLE:
PRINT ERR

OUTPUT:
1

Back to Table of Contents


EXEC "filename"
Can start a different program from within a program.

EXAMPLE:
EXEC "POKEMON"

OUTPUT:
Cannot locate file.

Back to Table of Contents


EXP(number)
Takes the natural number e (about 2.718) to the requested power.

EXAMPLE:
PRINT EXP(2)

OUTPUT:
7.389

Back to Table of Contents


FALSE
A named constant that has a value of 0. The logical opposite of TRUE (which is 1).
The ! operator in the example means "opposite of".

EXAMPLE:
PRINT TRUE,!TRUE,FALSE,!FALSE

OUTPUT:
1 0 0 1

Back to Table of Contents


FILES "PRGorMEMorCOLorGRPorSCRorCHR" (all optional)
Run Mode only. This command will produce a full list of programs and resource files if left blank. You can also specify a certain
type of file as shown in the bolded type above.

EXAMPLE:
FILES

OUTPUT:
A full list of all programs and resource files will be produced.

Back to Table of Contents


FLOOR(number)
Rounds down to the nearest whole number.

EXAMPLE:
PRINT FLOOR(3.999)

OUTPUT:
3

Back to Table of Contents


FOR
Part of the FOR TO STEP NEXT loop structure which is used to repeat a section of code a certain number of times.

EXAMPLE:
FOR I=0 TO 10
PRINT I;
NEXT I


OUTPUT:
012345678910

QR

Back to Table of Contents


FREEMEM
System variable that shows how much disk space in KBytes you have left for your homebrew creations (in reserved space on the DSi--not SDcard). You have
about 1024 KBytes to start with and will dwindle as your collection grows. You can offload games to the SD card to make more space, but they are not accessible
there. The only way to load them back onto the DSi is to convert the .PTC files into QR codes and scan them back in.

EXAMPLE:
PRINT FREEMEM

OUTPUT:
1023

Back to Table of Contents


FREEVAR
System variable that shows how many variables you have left to use in your program. You have 2047 to begin with and arrays of any size only count
as one variable.

EXAMPLE:
PRINT FREEVAR

OUTPUT:
2047

Back to Table of Contents


FUNCNO
System variable that shows which of the 5 function tabs are being pressed on the touch panel. The values are 0-5 with 0 meaning not pressed.
These 1-5 values only last for one frame before returning to 0.

EXAMPLE:
PRINT "PRESS 1 OF THE FIVE TABS AT TOP OF TOUCH PANEL"

@LOOP
IF FUNCNO > 0 THEN PRINT FUNCNO
VSYNC 1
GOTO @LOOP


OUTPUT:
PRESS 1 OF THE FIVE TABS AT TOP   
OF TOUCH PANEL

3
2

QR

Back to Table of Contents


GBOX
Simply draws a rectangle based on top left and botton right corner coordinates. Defaults to GCOLOR if left blank.

EXAMPLE:
GBOX 20,20,70,70,12


OUTPUT:
A small yellow square.

Back to Table of Contents


GCIRCLE xCoordinate0-255 , yCoordinate0-191 , radius , color0-255 , startAngle0-360 , endAngle0-360
Draws an un-filled circle.

EXAMPLE:
GCIRCLE 128,96,95,6,0,360

OUTPUT:
A large blue circle in the middle of the screen.

Back to Table of Contents


GCLS color0-255
Clears the screen of drawing functions like GCIRCLE, GLINE and the like. You can optionally add a color number
as a parameter and the screen's background will become that solid color. Try color 4 for a nice Commodore 64 look. :)

EXAMPLE:
GLINE 10,10,150,150,13
WAIT 60
GCLS 4

OUTPUT:
Screen is cleared of graphics then the background assumes a nostalgic shade of blue.

QR

Back to Table of Contents


GCOLOR color0-255
Designates a drawing color for graphics.

EXAMPLE:
GCOLOR 4
GFILL 10,10,150,150


OUTPUT:
A blue box.

QR

Back to Table of Contents


GCOPY page0-3, topLeftX0-255, topLeftY0-191 , bottomRightX0-255 , bottomRightY0-191 , destinationX0-255 , destinationY0-192 , copyTransparentTRUEorFALSE
Copys the drawing graphics (GFILL, GCIRLE, etc.) to a new destination.

EXAMPLE:
ACLS
GFILL 20,20,70,70,12
WAIT 30
GCOPY 0,20,20,70,70,100,0,TRUE

OUTPUT:
Two small yellow squares side-by-side.

QR

Back to Table of Contents


GDRAWMD TRUEorFALSE
Called XOR drawing mode. When this is enabled, you can erase graphics by drawing over the image with the same image in the same location.
This is faster than other forms of erasure due to the magic of bitwise arithmatic.

EXAMPLE:
ACLS
GDRAWMD TRUE
GFILL 20,20,70,70,12
WAIT 30
GFILL 20,20,70,70,12

OUTPUT:
Yellow square, then disappears.

QR

Back to Table of Contents


GFILL topLeftX0-255, topLeftY0-191 , bottomRightX0-255 , bottomRightY0-191 , color0-255
Simply draws a filled rectangle based on top left and botton right corner coordinates. Defaults to GCOLOR if left blank.

EXAMPLE:
GFILL 20,20,70,70,12


OUTPUT:
A small, solid yellow square.

Back to Table of Contents

GLINE startX0-255 , startY0-191 , endX0-255 , endY0-191 , color0255
Draws a line based on start and end point coordinates. Defaults to GCOLOR if left blank.

EXAMPLE:
GLINE 20,20,150,150,12

OUTPUT:
A yellow diagonal line.

Back to Table of Contents

GOSUB @label or text variable
Jumps the program to a subroutine (block of code) that is identified by the @label name. When finished with the subroutine,
the program resumes where it left off.

EXAMPLE:
GOSUB @HERE

PRINT "WORLD"

END

@HERE
PRINT "HELLO"
RETURN


OUTPUT:
HELLO
WORLD

QR

Back to Table of Contents

GOTO @label
Jumps to the part of a program that you specify with a label. ( @whatever ).

EXAMPLE:
@HERE
PRINT RND(42)
GOTO @HERE


OUTPUT:
Random numbers coming really fast at you. (Press Select to abort)

QR

Back to Table of Contents

GPAGE screen0-1 , drawPage0-3 , displayPage0-3
Unique images can be drawn to four different screen pages (screen buffers). You can then call them into view by changing
the 2nd and 3rd parameter -- warning: keep them the same number to avoid poor results! See example.

EXAMPLE:
'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


OUTPUT:
Four different colored squares are displayed sequentially.

QR

Back to Table of Contents

GPAINT x0-255 , y0-191 , fillColor0-255 , borderColor0-255
Pick a point on the screen and this function will fill in the same color region. Works simiar to the "bucket fill" tool in image editors
such as msPaint and GIMP. Cannot work with the GDRAWMD function (XOR mode).

EXAMPLE:
GCIRCLE 128,96,75,13,0,360
WAIT 30
GPAINT 128,96,13

OUTPUT:
An empty circle is drawn then it is filled in with a solid color.

QR

Back to Table of Contents

GPSET x0-255 , y0-191 , color0-255
Draws a colored dot.

EXAMPLE:
GPSET 100,100,12

OUTPUT:
A colored dot.

Back to Table of Contents

GPRIO priority0-3
Adjusts the order in which graphics (lines, circles, squares, etc.) are drawn in relation to other visual elements in the game. 0 is highest (in front of everything) 3 is lowest
(behind everything).

EXAMPLE:
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"

OUTPUT:
First, background is drawn in front of graphics, then the graphics (solid square) gets drawn in front

QR

Back to Table of Contents

GPUTCHR x0-255 , y0-191 , "BGU0-3 or SPU0-7" , characterNumber , paletteNumber1-15, scale(1,2,4,8)
Takes a background or sprite ("BGU0-3 or SPU0-7") tile and writes over it with a solid color. Then you can place it on the screen at x,y coordinates.

EXAMPLE:
GPUTCHR 100,100,"BGU0",1,5,1

OUTPUT:
A small square tile.

Back to Table of Contents

GSPOIT(x0-255 , y0-191)
Checks for the color at the x,y location. Returns the 0-255 color value.

EXAMPLE:
GPSET 32,32,34
PRINT GSPOIT(32,32)

OUTPUT:
34

QR

Back to Table of Contents

HEX$(number, decimal(optional)1-5)
Returns the hex value of a number in the form of a string.

EXAMPLE:
PRINT HEX$(255)

OUTPUT:
FF

Back to Table of Contents

ICONCHK( )
Checks if user has touched an icon on the bottom-right of the keyboard. These are numbered 0-3 and that same value will be returned
the instant one is pressed for 1 frame only (none pressed is -1). To "catch" that return value, you must use a loop with vsync 1. The example below will demonstrate
how this is done.

EXAMPLE:
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

OUTPUT:
The number of the icon 0-3 will be displayed every time an icon is touched.

QR

Back to Table of Contents

ICONCLR  iconNumber0-3
Clears the keyboard icon you specify.

EXAMPLE:
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


OUTPUT:
The keyboard icons slowly disappear one-by-one.

QR

Back to Table of Contents

ICONPAGE  ICONPMAX  ICONPUSE
Writable system variables. These variables are used to create extra sets (or pages -- 4 per page) of icons for use on the bottom-right of the
touch panel. First, enable the page feature by setting ICONPUSE to TRUE. Secondly, set the max page number with ICONPMAX. Note that the total
number of pages will be one more than this number (ex. 0-3 pages would be 4 total). Third, set the initial page value with ICONPAGE. It will default
to 0 if ignored. This ICONPAGE value is also changed with the user pressing the up/down buttons on the touchpad and can usually just be left alone.

EXAMPLE:
ICONPUSE=TRUE
ICONPMAX=15
ICONPAGE=0

@LOOP
FOR I=0 TO 3
P=ICONPAGE
ICONSET I,P*4+I
NEXT

VSYNC 1
GOTO @LOOP

OUTPUT:
Sixteen sets of icons can be scrolled through with the arrow buttons to the left of the icons.

QR

Back to Table of Contents

ICONSET iconID0-3 , iconImage0-63
Sets alternate touch input icons for the bottom-right of touch panel. There are four icons available and have an ID of 0-3.
Use ICONCHK and a loop to check for when they are pressed.

EXAMPLE:
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

OUTPUT:
Touch icons appear in the bottom-right of touch panel. Shows icon ID 0-3 when tapped.

QR

Back to Table of Contents

IF
Part of the IF THEN branch statement of SmileBasic. What comes after THEN is executed if the IF condition is met. If  the IF condition
is not met, then nothing happens. (the != in the example means "not equal to").

EXAMPLE:
ANSWER=9000
PRINT "42? THE ANSWER?"
IF ANSWER != 42 THEN PRINT "NO? HEARESAY!"

OUTPUT:
42? THE ANSWER?
NO? HEARESAY!

QR

Back to Table of Contents

INKEY$( )
A function that returns the single character that the user is pressing on the touch keyboard. Outputs "" when no key touched.
Needs a loop and vsync to function properly.

EXAMPLE:
@LOOP
IF TCHTIME==1 THEN PRINT INKEY$()
VSYNC 1
GOTO @LOOP


OUTPUT:
The keys you press appear as you type them.

QR

Back to Table of Contents

INPUT "string" ; numberOrString$
Use the first parameter to query the user for input. Then their input is stored in the second parameter for you to use in the program.

EXAMPLE:
INPUT "ENTER A NUMBER";G
PRINT "YOU ENTERED",G
INPUT "ENTER SOME TEXT";S$
PRINT "YOU ENTERED",S$

OUTPUT:
ENTER A NUMBER?
67
YOU ENTERED 67
ENTER SOME TEXT?
COME AGAIN?
YOU ENTERED COME AGAIN?


QR

Back to Table of Contents

INSTR("largerString","smallString")
Checks inside the larger first string for the start position of the smaller second string. Returns the position value.
-1 is returned if nothing found.

EXAMPLE:
P=INSTR("YOU CANT FIND ME","FIND")
PRINT P


OUTPUT:
9

QR

Back to Table of Contents

KEY number1-5 , "stringUpTo256characters"
Changes one of the function keys at the top of the touch panel. The 1st 4 characters of the string you enter will be
displayed on the key, but the entire string will be entered when pressed. Useful for creating convenient hot-keys.

EXAMPLE:
KEY 1,"ACLS:CLEAR:BGMSTOP"

OUTPUT:
Changes 1st function key to ACLS. Will print ACLS:CLEAR:BGMSTOP when pressed.

Back to Table of Contents

KEYBOARD
System variable that shows the current character value of the key pressed. 0 is reported when nothing is pressed.

EXAMPLE:
@LOOP
IF KEYBOARD THEN PRINT KEYBOARD
VSYNC 1
GOTO @LOOP


OUTPUT:
Prints the character number of the keys you press as you type.

QR

Back to Table of Contents

LEFT$("string", number)
Extracts the number of characters in the 2nd parameter from the left side of the string and returns the string.

EXAMPLE:
S$=LEFT$("PWNIFICATION",3)
PRINT S$


OUTPUT:
PWN

QR


Back to Table of Contents

LEN("string")
Returns the length in characters of the string.

EXAMPLE:
PRINT LEN("THIS IS A CLOWN FUNCTION BRO")

OUTPUT:
28

Back to Table of Contents

LINPUT "string"; string$
Stores user-entered text in a string variable. Much like INPUT except it can only accept strings -- although a greater variety of characters like "," can be used.

EXAMPLE:
LINPUT "ENTER SOME TEXT";S$
PRINT "YOU ENTERED",S$


OUTPUT:
ENTER SOME TEXT
LOL
YOU ENTERED LOL

QR

Back to Table of Contents

LIST lineNumberOr@label
Run mode only. You can jump to the line number or label inside a program with this command.

EXAMPLE:
LIST 45

OUTPUT:
Jumps to line 45 in your program (can't do this in edit mode).

Back to Table of Contents
LOAD "resource:filename" , TRUEorFALSE
Loads a resource or program ("resource:filename"). Optionally enter FALSE as a 2nd parameter if you don't want the confirmation dialog box to appear.

EXAMPLE:
LOAD "MEM:MYSAVE",FALSE
LOAD "MYGAME",FALSE

OUTPUT:
The files are loaded without a dialog box prompt.

Back to Table of Contents

LOCATE x0-31 , y0-23
Moves curser to the tile position specified to enter text at that location.

EXAMPLE:
LOCATE 12,12
PRINT "THE CENTER"

OUTPUT:
THE CENTER

QR

Back to Table of Contents

LOG(number)
Returns the natural logarithm of the number.

EXAMPLE:
PRINT LOG(100)

OUTPUT:
4.605

Back to Table of Contents

MAINCNTL
System variable that shows the amount of frames (1/60th of second) elapsed since the program started. At about 145 minutes this
variable becomes too large (> 524287) for the integer max and has to reset to 0. This is an important thing to take into account if you
have game logic that relies on this variable. See  MAINCNTH for a workaround.

EXAMPLE:
@LOOP
PRINT MAINCNTL
VSYNC 1:CLS
GOTO @LOOP


OUTPUT:
Number rapidly counts up.

QR

Back to Table of Contents

MAINCNTH
System variable that counts the number of times  MAINCNTL wraps-around after it maxes out at 524287.

EXAMPLE:
@LOOP
PRINT MAINCNTH
VSYNC 1:CLS
GOTO @LOOP


OUTPUT:
Starts at 0 then increases by 1 about every 145 minutes. Should wrap around to 0 in about 145 years.

QR

Back to Table of Contents

MEM$
Writable system variable (limit 256 characters). When the command SAVE "MEM:filename" is used the string written to MEM$ is saved with it. Afterwards, when
LOAD "MEM:filename" is used, the MEM$ variable will contain the saved string for you to use.

EXAMPLE:
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"

OUTPUT:
First time run:
RUN THIS PROGRAM TWICE FOR MEM$ SAVE DEMO

Second time run:
RUN THIS PROGRAM TWICE FOR MEM$ SAVE DEMO
THIS IS YOUR SAVED TEXT. PLEASE, JUST RELAX AND ENJOY IT.

QR

Back to Table of Contents

MID$("string", startingPositionNumber , numberCharacters)
Beginning at the startingPositionNumber of the "string", returns the numberCharacters to the right of the the startingPositionNumber as a new string.

EXAMPLE:
S$="IN THE MIDDLE OF THE ACTION"
PRINT MID$(S$,7,6)


OUTPUT:
MIDDLE

QR

Back to Table of Contents

NEW
Run Mode usage only. Deletes the program code from the Edit Mode view though it does not delete the file the code came from. However, if the code was not previously saved,
it is lost permanently.

EXAMPLE:
NEW

OUTPUT:
Nothing.

Back to Table of Contents

NEXT
Part of the FOR TO STEP NEXT loop structure which is used to repeat a section of code a certain number of times.

EXAMPLE:
FOR I=0 TO 10
PRINT I;
NEXT I


OUTPUT:
012345678910

QR

Back to Table of Contents

NOT number
Operator that produces the bitwise NOT of a number. Flips all the bits of a numerical variable to the opposite bits.
Numerals after the decimal point (floating point digits) are ignored.

Visual example:
00101010 becomes
11010101

As you can see, all of the bits become the opposite in the 2nd line.

EXAMPLE:
PRINT NOT 42

OUTPUT:
-43

Back to Table of Contents

ON number GOSUB @0 , @1 , @2 etc...
Part of a multiple branching statement (similar to switch/case in the C language). The value of the variable after ON determines which GOSUB
is executed (0 would be first GOSUB, 2 would be third GOSUB and so on). Can also use GOTO in place of GOSUB.

EXAMPLE:
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


OUTPUT:
2ND FUNCTION

QR

Back to Table of Contents

number OR number
Bitwise operator that compares two numbers and produces the bitwise "OR" value. If either bit in each bit comparison is 1
then the result bit is 1. If both bits are 0, the result bit is 0.

Visual example:
01100100
01000111
--------
01100111


EXAMPLE:
PRINT 100 OR 71

OUTPUT:
103

Back to Table of Contents

PACKAGE$
System variable that stores the last package string used for a successful package build.

EXAMPLE:
PRINT PACKAGE$

OUTPUT:
E342A

Back to Table of Contents

PI( )
Function that returns the constant value π (3.141)

EXAMPLE:
PRINT 2*PI()

OUTPUT:
6.283

Back to Table of Contents

PNLSTR x0-31 , y0-23 ,"string" , palette0-15
In conjunction with PNLTYPE "OFF", this will allow printing text on the bottom screen.

EXAMPLE:
PNLSTR 5,10,"A LITTLE STRING",3

@LOOP
PNLTYPE "OFF"
VSYNC 1
GOTO @LOOP


OUTPUT:
A LITTLE STRING

QR

Back to Table of Contents

PNLTYPE "OFForPNLorKYAorKYMorKYK"
Put this function in a loop with one of the above strings for different touch panel modes.

OFF no panel
PNL no keyboard
KYA english keyboard
KYM symbol keyboard
KYK kana keyboaed

EXAMPLE:
@LOOP
PNLTYPE "PNL"
VSYNC 1
GOTO @LOOP


OUTPUT:
Touch panel without keyboard.

QR

Back to Table of Contents

POW(number , power)
Raises a number to an exponential power. Can't use negative or non-integer values as powers.

EXAMPLE:
PRINT POW(2,8)

OUTPUT:
256

Back to Table of Contents

PRGNAME$
System variable string that holds the last filename used with LOAD, EXEC, or RECVFILE.

EXAMPLE:
PRINT PRGNAME$

OUTPUT:
TETRIS

Back to Table of Contents

PRINT "string" or variable or string$ etc.
Will output text of almost every conceivable data type in almost every conceivable way.
? is shorthand for PRINT.

EXAMPLE:
PRINT "HELLO WORLD",PI()
PRINT "HELLO WORLD";PI()
PRINT STR$( PI() ) * 2
? "HELLO WORLD"

OUTPUT:
HELLO WORLD 3.141
HELLO WORLD3.141
3.1413.141
HELLO WORLD

QR

Back to Table of Contents

RAD(degrees0-360)
Returns radians given the degress.

EXAMPLE:
PRINT RAD(180)

OUTPUT:
3.141

Back to Table of Contents

READ numberVariableOrString$ ,  numberVariableOrString$ ,  . . . etc.
Assigns previos DATA values or strings into the corresponding READ variables.  See DATA for a more advanced example on how to
read data from an array.

EXAMPLE:
DATA 42,34,77,11,89
READ A,B,C,D,E

PRINT A,B,C,D,E


OUTPUT:
42 34 77 11 89

QR

Back to Table of Contents

REBOOT
Run-mode only. Returns to the Petit Computer home menu.

EXAMPLE:
REBOOT

OUTPUT:
Home menu.

Back to Table of Contents

RECVFILE "filename"
Run or Edit mode. Sets up transfer of a file to user's system from another system.

Requirments:
EXAMPLE:
RECVFILE "PACMAN"

OUTPUT:
Various dialog boxes guiding the user through the process.

Back to Table of Contents

REM(or ' ) comment
Programmer comments for source code explanation. Does not output text. Unlike a compiled language such as C, in the interpreted SmileBASIC,
 these have a performance impact on your program. So use them -- but judiciously (especially in loops).

Note: an apostrophe ' is the more commnly used shorthand for REM.

EXAMPLE:
REM THIS IS A COMMENT
'THIS IS THE EASIER WAY TO COMMENT

OUTPUT:
None.

QR

Back to Table of Contents

RENAME "oldFilename" , "newFilename"
Renames a file.

EXAMPLE:
RENAME "BUBSY3D","MARIO64"

OUTPUT:
Dialog box to confirm renaming  BUBSY3D to MARIO64.

Back to Table of Contents

RESTORE @label
Moves the READ position to the location of the label. In the example below, the READ position is restored to the beginning of the DATA
in the middle of assigning variables A-F. This is why the printed data repeats 3,4,5,3,4,5 instead of showing all data 3,4,5,6,7,8

EXAMPLE:
@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


OUTPUT:
3 4 5 3 4 5

QR

Back to Table of Contents

RESULT
System variable that shows the outcome of the last file-related action. If a successful action, RESULT will be 1. If a failed action,
RESULT will be 0. The example below shows first a successful file load, then a failed file load.
and "failed" doesn't.

EXAMPLE:
LOAD "EXAMPLE"
PRINT RESULT

LOAD "FAILED"
PRINT RESULT


OUTPUT:
1
0

QR

Back to Table of Contents

RETURN
Completes a GOSUB subroutine and returns the program to where the GOSUB was originally called.

EXAMPLE:
@LOOP
GOSUB @TI
GOTO @LOOP

@TI
PRINT TIME$
VSYNC 1:CLS
RETURN

OUTPUT:
The current time.

QR

Back to Table of Contents

RIGHT$("string", number)
Extracts the number of characters in the 2nd parameter from the right side of the string and returns the new string.

EXAMPLE:
S$=RIGHT$("THE FAR SIDE",4)
PRINT S$


OUTPUT:
SIDE

QR

Back to Table of Contents

RND(number)
Returns an automatically seeded random number from 0 to one less than the parameter. (ex. RND(10) would be 0-9)

EXAMPLE:
@LOOP
PRINT RND(10),
WAIT 30
GOTO @LOOP

OUTPUT:
3 0 2 6 3 5 6 9 ...

QR

Back to Table of Contents

RSORT startNumber , numberElements , arrayName (more arrays can be added)
Sorts the values in a 1-dimensional array in decending order. The first parameter is the array index to start with and the 2nd is
the number of elements to sort from that starting position. The array name is without any ()'s or ""s. Extra arrays can be sorted by
adding their names as extra parameters.

EXAMPLE:
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


OUTPUT:
5802083009

9885320000

QR

Back to Table of Contents

RUN
Run Mode only. Runs the currently loaded program.

EXAMPLE:
RUN

OUTPUT:
Varies.

Back to Table of Contents

SAVE "filename"
Saves the current program to "filename". You can save different types of files using the "resource:filename" format.

EXAMPLE:
SAVE "AGAME"

OUTPUT:
Confirmation dialog box.

Back to Table of Contents

SENDFILE
Run or Edit mode. Sets up transfer of a file to another system from the user's system.

Requirments:
EXAMPLE:
SENDFILE "PACMAN"

OUTPUT:
Various dialog boxes guiding the user through the process.

Back to Table of Contents

SGN(number)
Returns a code based on the sign of the parameter. 1 for positive, -1 for negative, 0 for 0.

EXAMPLE:
PRINT SGN(-25)

OUTPUT:
-1

Back to Table of Contents

SIN(radians)
Returns the sin value of the given radians.

EXAMPLE:
PRINT SIN( PI()/6 )

OUTPUT:
0.5

Back to Table of Contents

SORT startNumber , numberElements , arrayName (more arrays can be added)
Sorts the values in a 1-dimensional array in ascending order. The first parameter is the array index to start with and the 2nd is
the number of elements to sort from that starting position. The array name is without any ()'s or ""s. Extra arrays can be sorted by
adding their names as extra parameters.

EXAMPLE:
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


OUTPUT:
5802083009

0000235889

QR

Back to Table of Contents

SPANGLE IDnumber0-99 , degrees0-360 , movementTime(1/60th sec) , clockwise 1 Or counterClockwise -1
Can change the angle of a sprite. The optional 3nd parameter can define a gradual angle change in 1/60ths sec increments and the 4th parameter can
adjust the direction of the rotation. 1 clkwise, -1 counterclkwise

EXAMPLE:
SPSET 0,96,0,0,0,0
SPHOME 0,8,8
SPOFS 0,100,100
SPANGLE 0,359,120,1


OUTPUT:
A wizard sprite appears mid-screen and rotates 360 degrees clockwise.

QR

Back to Table of Contents

SPANIM IDnumber0-99 , numberOfFrames , timeBetweenFrames , numberLoops
Animates a sprite through a given number of frames. The numberOfFrames (2nd param) is the number of images from the original image number
defined in the 2nd parameter of SPSET. For instance, the example below animates sprite images 96-99 (a total of 4). The 3rd parameter is the ticks (1/60th sec)
between frames. The fourth param is the number of times the frame sequence is repeated. 0 is infinite loops.

EXAMPLE:
ACLS
SPSET 0,96,0,0,0,0
SPANIM 0,4,15,0


OUTPUT:
A walking wizard.

QR

Back to Table of Contents

SPCHK(IDnumber0-99) 
Checks 4 ways a sprite can be moving and returns a 0-15 bitwise value to represent the info.
Below is the number 9 in binary form. It represents the 4 different movement types as shown below it in brackets.

1001

[ 1 --animation on] [ 0 - scaling off] [ 0 - rotating off] [ 1 - x,y movement on]

As you can see, this make believe sprite with a SPCHK() of 9 would be currently animating and moving across the screen,
but not rotating or scaling.

Now how do you separate these values from the single number that SPCHK() returns? Use SPCHK() AND 8,4,2, or 1 to get
the 4 separate values!

EXAMPLE:
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


OUTPUT:
A wizard moving across the screen and a small table of debug text.

QR

Back to Table of Contents

SPCHR spriteIDnumber0-99, imageNumber0-511 , palette0-15 , horizontalRotation0-1 , verticalRotation0-1 , imagePriority0-3
Changes the image parameters of a sprite. Parameters 3-6 are optional. Horizontal rotation is flipping the image symmetrically about the y-axis. Vertical rotation is
the same but around the x-axis. This function has very similar parameters to SPSET, which is the all-important sprite creation function. The advantage with SPCHR is that
you can leave off the all but two parameters for convenience as seen in the example.

EXAMPLE:
ACLS
SPSET 0,96,0,0,0,0
WAIT 60
SPCHR 0,64
WAIT 120

OUTPUT:
Wizard turns into generic blue-haired RPG hero.

QR

Back to Table of Contents

SPCLR spriteIDnumber0-99
Erases a sprite. If left blank, it will erase all sprites.

EXAMPLE:
ACLS
SPSET 0,96,0,0,0,0
WAIT 60
SPCLR 0

WAIT 60

OUTPUT:
The wizard disappears.

QR

Back to Table of Contents

SPCOL spriteIDnumber0-99 , xUpperLeftCorner , yUpperLeftCorner , boxWidth , boxHeight , scalingAdjustTRUEorFALSE , group0-255
Builds a collision box around the sprite. Start the box with the upper left corner coordinates' x,y to the width and height in pixels. Scaling adjustment will scale the
collision box with the sprite itself. Group is an 8bit variable with each bit representing a group (optional).

The example builds an oversized collision box for the wizard sprite that will trip a collision early as the boy sprite approaches.
Notice the SPCOL is 0,0 and size 32,16. The 32 pix width is twice the size if the sprite leading to the early collision.
EXAMPLE:
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


OUTPUT:
The boy sprite approaches the wide collision box of the wizard and trips it.

QR

Back to Table of Contents

SPCOLVEC spriteIDnumber0-99 , xSize , ySize
Forms a collision box outside the sprite that is used to detect speed and direction (the vector) of an approaching sprite.
This function will fill the SPHITX , SPHITY ,and SPHITT system variables with collision data. The SPHITX and SPHITY
will start at the sSize and ySize and reduce to 0 as the approaching sprite comes into contact with the SPCOLVEC sprite.
The SPHITT system variable seems to be the percentage of the collision box the approaching sprite has left to go to get to the
end. 

EXAMPLE:
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


OUTPUT:
Boy sprite approaches stationary wizard sprite diagonally and debug text is displayed.

QR

Back to Table of Contents

SPGETV(spriteIDnumber0-99 , variable0-7)
After SPSETV is used to set the sprite variable0-7, this function may be used to check its value.

EXAMPLE:
SPSET 0,64,0,1,1,0
SPSETV 0,0,34
PRINT SPGETV(0,0)


OUTPUT:
34

QR

Back to Table of Contents

SPHIT(spriteIDnumber0-99 , initialIDofOtherSprite(optional))
Returns 1 (or TRUE--same thing) when two sprites collide, otherwise returns 0. The 2nd parameter is the first ID number of the other
sprite you want to check for up to the max of spriteIDnumber 99. If you set SPHIT(0,95), for instance, SPHIT would return 1 if sprite 95-99 collided
with sprite ID 0.

EXAMPLE:
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

OUTPUT:
Wizard sprite collides with boy sprite causing 1 to appear below it.

QR

Back to Table of Contents

SPHITNO.
System variable that reports the spriteID number of the other colliding sprite from what was defined in SPHIT( ) type functions.
If no hit yet, -1 will be reported. This variable seems to be persistant even when CLEAR is called to reset memory.
Only returning to Petit's main menu will reset it to -1.

EXAMPLE:
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

OUTPUT:
Before collision:
-1
After collision:
1

QR

Back to Table of Contents

SPHITRC(spriteIDnumber0-99 , collisionBoxX , collisionBoxY , collisionBoxWidth , collisionBoxHeight , displacementX(opt) , displacementY(opt))
Returns 1 if the spriteID named hits a created collision box defined in parameters 2-5. Otherwise returns 0. Optional parameters 6-7 can modify the box to return displacement data to
be used to determine speed and direction of sprite (SPHITT).

EXAMPLE:
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

OUTPUT:
1 is displayed when boy sprite reaches collision box at 150,150.

QR

Back to Table of Contents

SPHITSP(spriteIDnumber0-99 , spriteIDnumber0-99)
Returns 1 if the two sprites listed in the parameters are colliding, otherwise 0.

EXAMPLE:
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


OUTPUT:
1 is displayed while sprites are colliding otherwise 0.

QR

Back to Table of Contents

SPHITT
System variable that records the percentage of the collision box that a sprite has traveled through.

EXAMPLE:
See SPCOLVEC

Back to Table of Contents

SPHITX
System variable that records the X coordinate when sprites collide. It is filled with data when a SPHIT type
function is used.

EXAMPLE:
See SPCOLVEC

Back to Table of Contents

SPHITY
System variable that records the Y coordinate when sprites collide. It is filled with data when a SPHIT type
function is used.

EXAMPLE:
See SPCOLVEC

Back to Table of Contents

SPHOME spriteIDnumber0-99 , x , -y
Sets the default x,y coordinate at which a sprite will first appear. Subsequent sprite coordinates will be in reference to
this offset (think of it as a new cartisian coordinate origin). Note that the y coordinate is the opposite sign from normal
coordinates for some reason.

EXAMPLE:
SPSET 0,64,0,0,0,0
SPHOME 0,128,-96


OUTPUT:
Sprite is set in the middle of the screen.

QR

Back to Table of Contents

SPOFS spriteIDnumber0-99 , x , y , movementTime(optional)
Moves the choosen sprite to a new x,y location. The optional movementTime is the time in 1/60ths of a second to complete
its movement.

EXAMPLE:
SPSET 0,64,0,0,0,0
SPOFS 0,128,96,120


OUTPUT:
Moves sprite to the center of the screen in 2 seconds.

QR

Back to Table of Contents

SPPAGE screen0-1
Selects the sceen that sprites are displayed on. 0 is top screen, 1 is bottom. Note that default sprite tiles on bottom screen
are different than the top screen and are only numbered 0-117 -- not 0-511 like the top screen.

EXAMPLE:
SPPAGE 1
SPSET 0,0,0,0,0,0

@LOOP
PNLTYPE "OFF"
GOTO @LOOP


OUTPUT:
A slash sprite icon is displayed on the bottom screen.

QR

Back to Table of Contents

SPREAD(spriteIDnumber0-99) , userVariableX , userVariableY , userVariableANGLE , userVariableSCALE , userVariableIMAGE
Reads the sprite's debug data into 2 to 5 user chosen variables. The last 3 are optional.

EXAMPLE:
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


OUTPUT:
Sprite moves across screen and debug text is shown.

QR

Back to Table of Contents

SPSCALE spriteIDnumber0-31 , scale0-200 , scaleTime
Scales the sprite in percentage. This can be 0-200 with 100 percent being the original size. Optionally, the scale time in 1/60ths per second
can be added as the 3rd parameter, otherwise the scaling is instant.

EXAMPLE:
SPSET 0,64,0,0,0,0
SPSCALE 0,200,120

OUTPUT:
The sprite scales to 200 percent in the span of 2 seconds.

QR

Back to Table of Contents

SPSET spriteIDnumber0-99 , imageNumber0-511 , paletteNumber0-15 , horizontalFlip0-1 , verticalFlip0-1, imagePriority0-3
Initializes and displays a sprite. SpriteIDnumber is the value used to identify the sprite so it can be distinguished from other sprites. ImageNumber is the ID of the
particular image tile the sprite uses. Petit Computer has 0-511 default tiles for the top screen and 0-117 for the bottom screen. PaletteNumber is a 16 sets of 16 colors
each. The sets are identified 0-15. HorizontalFlip symmetrically flips the tile about the sprite's x-axis, verticalFlip does the same about the y-axis. ImagePriority
is the order (0 highest, 3 lowest) the sprite is shown if it overlaps with any other visual element (other elements can have their imagePriority set as well).
EXAMPLE:
SPSET 0,64,2,1,1,0

OUTPUT:
An upside-down, backwards sprite with an unusual color pallete is shown on the upper left of the top screen.

Back to Table of Contents

SPSETV spriteIDnumber0-99 , variableID0-7 , variable'sValue
Sets a sprite variable's value for any given sprite. These can be used for any sprite data needed to be stored like health, money, powerups, etc.
Use SPGETV to check on any of these variables if desired.

EXAMPLE:
SPSET 0,64,0,1,1,0
SPSETV 0,0,34
PRINT SPGETV(0,0)


OUTPUT:
34

QR

Back to Table of Contents

SQR(number)
Returns the square root of a number. Can't square a negative number.

EXAMPLE:
PRINT SQR(4.5)

OUTPUT:
2.121

Back to Table of Contents

STEP number
An optional part of a FOR loop. The number sets the amount the loop increases/decreases each time (iteration).
If STEP is not present, the loop increments 1 each time (iteration).

EXAMPLE:
FOR I=0 TO 10 STEP 2
PRINT I,
NEXT I


OUTPUT:
0 2 4 6 8 10

QR

Back to Table of Contents

STOP
Interrupts a running program and returns to the OS. If in Write Program mode, the program can be resumed with CONT.

EXAMPLE:
STOP

OUTPUT:
BREAK in 1

Back to Table of Contents

STR$(number)
Converts a number to a string.

EXAMPLE:
S=1234
S$=STR$(S)
PRINT S+S,S$+S$

OUTPUT:
2468 12341234

QR

Back to Table of Contents

SUBST$("string1", positionNumber , numberOfCharsToReplace , "string2")
Places a string within a string. String2 goes into string1 at positionNumber with numberOfCharactersToReplace overwriting the
desired number of chars in string1.

EXAMPLE:
S$="I LOVE YOU"
SC$=SUBST$(S$,2,0,"DON'T ")
PRINT SC$

OUTPUT:
I DON'T LOVE YOU

QR

Back to Table of Contents

SWAP numberOrStringVar , numberOrStringVar
Swaps the values or contents of the two variables.

EXAMPLE:
A=1:B=100
SWAP A,B
PRINT A,B


OUTPUT:
100 1

QR

Back to Table of Contents

SYSBEEP
Writable system varible that controls whether system sound effects can be heard (like the loading noise and keystrokes).
Game sounds like BEEP 3 can still be heard. FALSE (or 0) is off, TRUE (or 1) is on.

EXAMPLE:
SYSBEEP=0

OUTPUT:
Silence.

Back to Table of Contents

TABSTEP
Writable system variable that sets the number of spaces the TAB key moves the text curser to the right. Also applies to the
comma ( , ) in PRINT statements. Value can be 0-16. Default is 5.

EXAMPLE:
TABSTEP=16
PRINT "TAB","STEP"


OUTPUT:
TAB                STEP

QR

Back to Table of Contents

TAN(radians)
Returns the tan value of the given radians.

EXAMPLE:
PRINT TAN( PI()/2 )

OUTPUT:
0.999

Back to Table of Contents

TCHST TCHTIME TCHX TCHY
System variables that report the state of touchscreen input.

TCHST -- 1 if screen is being touched, 0 if not
TCHTIME -- amount of time in 1/60ths per second touchscreen has been continually pressed
TCHX -- x coordinate of touch location
TCHY -- y coordinate of touch location

EXAMPLE:
@LOOP
PRINT "TCHST   ";TCHST
PRINT "TCHTIME ";TCHTIME
PRINT "TCHX    ";TCHX
PRINT "TCHY    ";TCHY
PNLTYPE"OFF"
VSYNC 1:CLS
GOTO @LOOP


OUTPUT:
The four touchscreen variables are labeled and their current values shown to the right.

QR

Back to Table of Contents

THEN
Part of the IF THEN branch statement of SmileBasic. What comes after THEN is executed if the IF condition is met. If  the IF condition
is not met, then nothing happens. (the != in the example means "not equal to").

EXAMPLE:
ANSWER=9000
PRINT "42? THE ANSWER?"
IF ANSWER != 42 THEN PRINT "NO? HEARESAY!"

OUTPUT:
42? THE ANSWER?
NO? HEARESAY!

QR

Back to Table of Contents

TIME$
System variable that reports the time in HH:MM:SS format.

EXAMPLE:
@LOOP
PRINT TIME$
VSYNC 1:CLS
GOTO @LOOP

OUTPUT:
08:23:34

QR

Back to Table of Contents

TMREAD(TIME$), userVariable, userVariable, userVariable
Reads the TIME$ string and writes the hours, minutes, and seconds to three variables of your choosing.

EXAMPLE:
TMREAD(TIME$),H,M,S
PRINT H,M,S

OUTPUT:
8 23 34

QR

Back to Table of Contents

TO
Part of the FOR TO STEP NEXT loop structure which is used to repeat a section of code a certain number of times.
What comes after TO is the number the initial variable (right after FOR) is progressing toward.

EXAMPLE:
FOR I=0 TO 10
PRINT I;
NEXT I


OUTPUT:
012345678910

QR

Back to Table of Contents

TRUE
A named constant that has a value of 1. The logical opposite of FALSE (which is 0).
The ! operator in the example means "opposite of".

EXAMPLE:
PRINT TRUE,!TRUE,FALSE,!FALSE

OUTPUT:
1 0 0 1

Back to Table of Contents

VAL(string)
Converts a string into a number (if a number character is contained in the string).

EXAMPLE:
PRINT "ENTER A NUMBER"
LINPUT S$
PRINT VAL(S$)*2


OUTPUT:
ENTER A NUMBER
4200 (enter)
8400

QR

Back to Table of Contents

VERSION
Stores the version number of Petit Computer. The higher the number the more recent the version. This is important
to check as earlier versions (or different regions) may not support the same features as newer versions and could produce
errors if made to run the same code.

EXAMPLE:
PRINT VERSION

OUTPUT:
8224

Back to Table of Contents

VISIBLE text0-1 , keyboard0-1 , backgroundLayer0 0-1 , backgroundLayer1 0-1 , sprites0-1 , graphics0-1
Turns the above listed visual elements on/off with 1 or 0 respectively.

EXAMPLE:
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


OUTPUT:
Each of 6 different visual elements are revealed by gradually changing the parameters of VISIBLE from 0 to 1.

QR

Back to Table of Contents

VSYNC number0-?
Slows down the CPU so it doesn't try to draw the next frame before it finishes the current one (which causes flickering).
Always use this when drawing moving images. The number is the time in 1/60ths of second between frames and you may have to
increase this number in graphically intense games to avoid flickering. 0 skips the command while negative numbers are illegal.

EXAMPLE:
@LOOP
PRINT "PRESS ANY BUTTON TO ENGAGE VSYNC"
IF BUTTON() THEN VSYNC 1
CLS
GOTO @LOOP

OUTPUT:
Flickering text until button is pressed.

QR

Back to Table of Contents

WAIT number0-?
Pauses the game for the specified amount of time. The number is the amount of wait time in 1/60ths of a second.
Rumor has it this command is the same thing as VSYNC : ^)

EXAMPLE:
?"HELLO":WAIT 60:?" WORLD"

OUTPUT:
HELLO WORLD

Back to Table of Contents

number XOR number
Bitwise operator that compares two numbers and produces the "eXclusive OR" value. It's
easier to understand visually:

10011010
10010001
--------
00001011


The digits that are both different result in a 1 digit. Digits that are the same translate to 0.

EXAMPLE:
PRINT 154 XOR 154
PRINT 154 XOR 145
PRINT 11 XOR 145

OUTPUT:
0
11
154

QR

Back to Table of Contents