Instructions Available Only in DIRECT Mode
Instructions Available Only in DIRECT Mode
available only in DIRECT mode
Instructions that can be used only if DIRECT mode has been turned on by pressing the DIRECT button
These instructions cannot be included in programs in EDIT mode.
Erases programs
NEW DIRECT mode only
Format NEW [Program SLOT]
0-3: Erases the specified SLOT only
Arguments Program SLOT
If unspecified, all SLOTs are erased
NEW
Examples
NEW 3
Program execution
RUN DIRECT mode only
Format RUN [Program SLOT]
Arguments Program SLOT Specified program SLOT to be executed (0 to 3. If omitted, 0)
RUN
Examples
RUN 1
Basic instructions (variables and arrays)
Instructions for handling definitions of variables or arrays, array operations, etc.
Assigns a value or expression to a variable
= - A simplified notation of the LET instruction used in conventional BASIC
- In this software, the LET instruction itself is omitted; only '=' should be used for assignment
Format =
A=10
Examples
A$="HELLO"
PUSH Adds an element to the end of an array (The number of elements will increase by 1)
Format PUSH Array, Expression
Arguments Array Array to which the element will be added
Expression Value of the element to add
DIM WORK[10]
Examples
PUSH WORK, 123
POP Removes an element from the end of an array (The number of elements will decrease by 1)
Format Variable=POP( Array )
Arguments Array Array from which the element will be removed
Return Values Value of the element that was removed
DIM WORK[10]
Examples PUSH WORK, 123
A=POP(WORK)
UNSHIFT Adds an element to the start of an array (The number of elements will increase by 1)
Format UNSHIFT Array, Expression
Arguments Array Array to which the element will be added
Expression Value of the element to add
DIM WORK[10]
Examples
UNSHIFT WORK, 123
SHIFT Removes an element from the start of an array (The number of elements will decrease by 1)
Format Variable=SHIFT( Array )
Arguments Array Array from which the element will be removed
DIM WORK[10]
Examples UNSHIFT WORK, 123
A=SHIFT(WORK)
Basic instructions (control and branching)
Control instructions for comparison, branching, repeats, etc.
Name to indicate a program or data position
@ - It is not possible to specify the line number directly with GOTO or other instructions
- Branch destinations and data positions must be all specified using labels
Format @Label name
Arguments @Label name Alphanumerical or underscore (_) characters, prefixed with @
Examples @MAINLOOP
Executes Process 1 if the condition is satisfied, or Process 2 if the condition is not satisfied
IF (1) - GOTO can be omitted immediately after THEN or ELSE
- ENDIF should be used when the process spans multiple lines
IF Conditional expression THEN Process to execute when the condition is satisfied [ELSE Process to execute when
Format
the condition is not satisfied] [ENDIF]
== Equal to
!= Not equal to
Comparison > Greater than
Operators < Smaller than
>= Equal to or greater than
Conditional
<= Equal to or smaller than
Expressions
(Condition 1 AND Condition 2) Both of the conditions should be satisfied
Logical Operators
(Condition 1 && Condition 2) Both of the conditions should be satisfied
(for comparing
(Condition 1 OR Condition 2) Either one of the conditions should be satisfied
multiple
(Condition 1 || Condition 2) Either one of the conditions should be satisfied
conditions)
* The key for the "||" characters is located to the upper left of the "?" key on the keyboard.
IF A==1 THEN PRINT "OK"
IF A>1 THEN @JMP1 ELSE PRINT DATE$
IF A==1 THEN
PRINT "Congratulations":BEEP 72
Examples ELSE
PRINT "Bad luck"
ENDIF
@JMP1
END
Repeats the process from REPEAT until the conditional expression is satisfied
- The REPEAT instruction should be placed at the beginning of the loop
UNTIL - Unlike the WHILE instruction, this executes the process before determining the condition
- Exits the loop if the condition is satisfied or when the BREAK instruction is executed
Format UNTIL conditional expression
The same conditional expressions as in IF statements can be specified
== Equal to
!= Not equal to
Comparison > Greater than
Operators < Smaller than
Conditional >= Equal to or greater than
Expressions <= Equal to or smaller than
(Condition 1 AND Condition 2) Both of the two conditions must be satisfied
Logical operators
(Condition 1 && Condition 2) Both of the two conditions must be satisfied
(for comparison
(Condition 1 OR Condition 2) Either of the two conditions must be satisfied
with multiple
(Condition 1 || Condition 2) Either of the two conditions must be satisfied
conditions)
* The key for "||" can be found on the upper left of ? on your keyboard.
A=0:B=4
REPEAT
Examples
A=A+1
UNTIL A<B
END (2) Exits a DEF definition for a user function or user instruction.
Format END
DEF FUNC
Examples PRINT "FUNC"
END
Basic instructions (advanced control)
Instructions for user-defined functions, control of add-ons, etc.
About DEF user-defined instructions
1) USER (No arguments; no return values)
2) A=USER(X) (With argument; single return value)
DEF (1) 3) USER(X) OUT A,B (With argument; multiple return values)
DEF (2) Defines a user instruction with no return values and no arguments
Format DEF definition name
Arguments None
Return Values None
'--- Text display
DEF FUNC
PRINT "SAMPLE"
Examples
END
'--- Call
FUNC
CALL (1) Calls the user-defined instruction with the specified name
Format CALL "Instruction name" [,Argument…] [OUT Variable 1 [,Variable 2…]]
- User-defined instruction name string to call
Arguments Instruction name
- Being a string, it should either be enclosed in "" or specified using a string variable.
Arguments- Any arguments required for the specified instruction
Return Values Variable names to return as a result should be specified as necessary after OUT
CALL "USERCD",X,Y OUT A,B
'
Examples DEF USERCD X,Y OUT A,B
A=X+Y:B=X*Y
END
CALL (2) Calls the user-defined function with the specified name
Format Variable=CALL("Function name" [,Argument…])
- User-defined function name string to call
Arguments Function name
- Being a string, it should either be enclosed in "" or specified using a string variable.
Arguments Any arguments required for the specified function should be enumerated
A=CALL("USERFC",X,Y)
'
Examples DEF USERFC(X,Y)
RETURN X*Y
END
Calls a BG callback
CALL (4) Processes which have been specified for each sprite using SPFUNC are called together
Format CALL BG
Examples CALL BG
Basic instructions (data operations and others)
Instructions for reading data, vertical synchronization, comments, etc.
Reads the information enumerated with the DATA instruction into the variables
READ Information should be read in the same type as that enumerated with the DATA instruction
Format READ Acquisition variable 1 [, Acquisition variable 2…]
- Variables to store read information (Multiple variables can be specified)
Acquisition
Arguments - DATA in and after the line specified with the RESTORE instruction will be acquired
variables
- If RESTORE is omitted, acquisition will begin with the first occurrence of DATA
READ X,Y,Z,G$
Examples DATA 200,120,0,"JAN"
DATA 210,120,0,"FEB"
RESTORE Specifies the first DATA to read with the READ instruction
Format RESTORE @Label
- @Label name given to the beginning of the DATA instruction to be read
- A string variable to which a @Label name is assigned can also be specified
Arguments @Label - It is also possible to reference a label from a different SLOT by using the format RESTORE
"1:@Label name"
- The target SLOT should be enabled beforehand with USE, e.g., USE 1
RESTORE @DATATOP
Examples @DATATOP
DATA 123,345,56,"SAMPLE"
WAIT Stops the program until the specified number of vertically synchronized frames has been reached
Format WAIT [Number of frames]
Specify the number of frames to wait, starting from the present point (0: Ignore; if omitted,
Arguments Number of frames
1 is assumed)
Examples WAIT 60
Stops the program until the specified number of vertically synchronized frames has been reached
VSYNC Unlike WAIT, the VSYNC count starts from the last VSYNC
Format VSYNC [Number of frames]
Specify the number of frames to wait, starting from the last VSYNC (0: Ignore; if omitted, 1
Arguments Number of frames
is assumed)
Examples VSYNC 1
CHKLABEL Checks if there is a label that can be referenced with the specified string
Format Variable = CHKLABEL("@Label string"[,Flag])
- It is also possible to check a different SLOT by using CHKLABEL "1:@Label name"
Arguments @Label string
- The target SLOT should be enabled beforehand with USE, e.g., USE 1
0= Searches only within DEF (if omitted, 0)
Flag
1= If not found within DEF, searches for global labels
Return Values FALSE= Does not exist, TRUE= Exists
Examples A=CHKLABEL("@MAIN")
CHKCALL Checks if there is an instruction or function that can be referenced with the specified string
Format Variable = CHKCALL("Character string")
Arguments Character string Character string of the instruction or function to check
Return Values FALSE= Does not exist, TRUE= Exists
Examples A=CHKCALL("KEYCHECK")
CHKVAR Checks if there is a variable that can be referenced with the specified string
Format Variable = CHKVAR("Character string")
Arguments Character string Character string of the variable to check
Return Values FALSE= Does not exist, TRUE= Exists
Examples A=CHKVAR("COUNTX")
DIALOG (3) Displays a dialog and waits for the specified button to be pressed
Format Variable = DIALOG("Text string",[Selection type],["Caption string"],[Timeout period])
Arguments Text string Character string to display in the dialog
0: OK (default)
1: No/Yes
2: Back/Next
Selection type
3: Cancel/Confirm
4: Cancel/Execute
5: Next
Caption string Character string to display in the caption field at the top of the dialog
Timeout period Number of seconds to wait before closing the dialog automatically (If omitted, 0: Not closed)
-1: Negation (Left button)
0: Timeout
Return Values
1: Affirmation (Right button)
* These values will also remain in the system variable RESULT.
- Dialog are always displayed on the Touch Screen
Supplement (common
- The total length of the text string and caption string should be 256 characters or less
for DIALOG
- If CHR$(10) or CHR$(13) is included in the text string, a line break will occur at that point
instructions)
- If a negative value is set for the Timeout period, texts are handled in frame units
Examples R=DIALOG("Would you like to try again?" ,1," ",0)
DIALOG (4) Displays a dialog and waits for the Touch Screen or a hardware button to be pressed
Format Variable = DIALOG("Text string",Button type,["Caption string"],[Timeout period])
Arguments Text string Character string to display in the dialog
|b00| ABXY buttons (1)
|b01| +Control Pad (2)
|b02| L,R buttons (4)
|b03| Touch Screen (8)
Button type
- Specify a value for which the logical OR is calculated with the above bit value and the sign
is reversed
- ZL and ZR buttons cannot be detected
- -1 causes only ABXY to be specified
- For example, to detect ABXY and +Control Pad, -3 should be specified
Caption string Character string to display in the caption field at the top of the dialog
Timeout period Number of seconds to wait before closing the dialog automatically (if omitted, 0: Not closed)
128: A button pressed
129: B button pressed
130: X button pressed
131: Y button pressed
132: +Control Pad up pressed
Return Values 133: +Control Pad down pressed
134: +Control Pad left pressed
135: +Control Pad right pressed
136: L button pressed
137: R button pressed
140: Touch Screen pressed
Examples R=DIALOG("ABXYLR/+Control Pad/Touch",-15,"Special",0)
DIALOG (5) Displays a dialog used only for inputting file names
Format String=DIALOG( "Initial string", "Caption string" [,Maximum characters])
Initial string String that is initially input
Arguments Caption string String to be displayed in the caption field
Maximum characters Up to 14 characters
The obtained character string will be returned
Return Values
* If RESULT=-1, Canceled (the character string is invalid)
- Dialog are always displayed on the Touch Screen
Supplement (common
- The total length of the text string and caption string should be 256 characters or less
for DIALOG
- If CHR$(10) or CHR$(13) is included in the text string, a line break will occur at that point
instructions)
- If a negative value is set for the Timeout period, texts are handled in frame units
Examples T$=DIALOG( "NEWNAME0","SAVE", 14 )
Console input/output
Instructions related to display of characters, input of strings on the screen, etc.
CLS Clears the console screen (the screen specified with the DISPLAY instruction)
Format CLS
DISPLAY 0
Examples
CLS
Sets the rotation/inversion attributes of the characters to display on the console screen
ATTR Constants for text attributes are available (#TROT0-270, #TREVH,V)
Format ATTR Display attribute
|b00| ↑Rotation by 90 degrees (specified by using two bits: b00 and b01)
|b01| ↓#TROT0, #TROT90, #TROT180, #TROT270
Arguments Display attribute
|b02| Horizontal inversion (0=OFF, 1=ON), #TREVH
|b03| Vertical inversion (0=OFF, 1=ON), #TREVV
Examples ATTR 3:PRINT "ABC"
INKEY$ Gets a character input from the keyboard (without waiting for input)
Format String variable=INKEY$()
Arguments None
- A character (UTF-16) from the keyboard
Return Values
- If there is no input, "" will be returned
Examples C$=INKEY$()
Various kinds of input
Instructions for retrieving information from buttons, sticks, touch sensors, and microphones
Gets the status of hardware buttons
BUTTON Constants for buttons are available for return values
Format Variable=BUTTON( [Feature ID [,Terminal ID]] )
0: Held down
1: Moment pressed (with the repeat feature enabled)
Arguments Feature ID
2: Moment pressed (with the repeat feature disabled)
3: Moment released
Terminal ID (0-3) This should be specified to get information from another terminal via wireless communication
|b00| +Control Pad up (1), #UP
|b01| +Control Pad down (2), #DOWN
|b02| +Control Pad left (4), #LEFT
|b03| +Control Pad right (8), #RIGHT
|b04| A button (16), #A
|b05| B button (32), #B
|b06| X button (64), #X
|b07| Y button (128), #Y
Return Values |b08| L button (256), #L
|b09| R button (512), #R
|b10| Not used
|b11| ZR button (2048), #ZL
|b12| ZL button (4096), #ZR
- The buttons correspond to b0-b12 (If a button is pressed, its corresponding bit = 1)
- Contents in () next to button names are decimal numerals
- ZR and ZL buttons are available only when Circle Pad Pro is used
B=BUTTON()
Examples
B=BUTTON( 0,3 )
Loads a file
LOAD (1) - A confirmation dialog will be displayed
- It is impossible to load a program into the same program SLOT as a running program
Format LOAD "[Resource name:]File name"[,Dialog display flag]
If omitted: Current program SLOT
PRG0-PRG3: Program SLOT (PRG = PRG0)
Arguments Resource name:
GRP0-GRP5: Graphic page
GRPF: Font image page
File name Name of file to load
Dialog display
FALSE = Suppresses confirmation dialog
flag
LOAD "PROGNAME"
Examples
LOAD "GRP0:GRPDATA"
Saves a file
SAVE (1) - When run, a confirmation dialog will be displayed
- The confirmation dialog for SAVE cannot be hidden
Format SAVE "[Resource name:]File name"
If omitted: Current program SLOT
PRG0-PRG3: Program SLOT (PRG = PRG0)
Arguments Resource name:
GRP0-GRP5: Graphic page
GRPF: Font image page
File name Name to save the file under
Examples SAVE "PRG0:TEST"
Wireless communication
Instructions related to wireless communication sessions, which allow up to four systems to be connected
* In order to connect, each system must have SmileBASIC installed.
Screen control
Instructions related to screen display modes, etc.
Sets a screen mode
- Screen modes 2 and 3 can also be used in DIRECT mode, but the Touch Screen will be switched to a keyboard after
XSCREEN execution is started
- 3D specification can be disabled in the Parental Control settings
Format XSCREEN Screen mode [,Number of sprite assignments ,Number of BG assignments]
0: Upper screen-3D, Touch Screen-Not used (Default)
1: Upper screen-2D, Touch Screen-Not used
Arguments Screen mode 2: Upper screen-3D, Touch Screen-Used (Keyboard displayed during INPUT)
3: Upper screen-2D, Touch Screen-Used (Keyboard displayed during INPUT)
4: Upper and Touch screens combined (Upper screen 2D; INPUT and DIRECT mode not allowed)
Number of sprite - Number of sprites to assign to the upper screen: 0-512
assignments - Touch Screen: 512 - number of SPs on the upper screen
Number of BG - Number of BG layers to assign to the upper screen: 0-4
allocations - Touch Screen: 4 - number of BG layers on the upper screen
Examples XSCREEN 2,128,4
Resets the draw settings to their settings when BASIC was started
ACLS - The same operations as those shown after END in the Examples should be executed
- Sound settings such as BGM will not be affected
Format ACLS
ACLS
END
'---
XSCREEN 0
LOAD "GRP4:SYS/DEFSP.GRP"
LOAD "GRP5:SYS/DEFBG.GRP"
FONTDEF
SPDEF
DISPLAY 1
WIDTH 8
BACKCOLOR 0
FADE 0
Examples COLOR 15,0:LOCATE 0,0,0:ATTR 0:CLS
GPAGE 1,1:SPPAGE 4:BGPAGE 5
VISIBLE 1,1,1,1
DISPLAY 0
BACKCOLOR 0
FADE 0
WIDTH 8
COLOR 15,0:LOCATE 0,0,0:ATTR 0:CLS
FOR I=0 TO 3:GPAGE I,I:GCLS 0:NEXT
GPAGE 0,0:GPRIO 1024
SPPAGE 4:SPCLR
BGPAGE 5:BGCLR
VISIBLE 1,1,1,1
Graphics
Functions for drawing figures including lines and circles in pixel units
GPAGE (1) Specifies a page for graphic display and a page for manipulation
Format GPAGE Display page, Manipulation page
Arguments Display page 0-5: GRP0-GRP5
0-5: GRP0-GRP5
Manipulation page
* By default, GRP4 contains sprites and GRP5 contains BG images.
Examples GPAGE 0,0
GFILL Draws a quadrangle on the graphic screen and fills it with a color
Format GFILL Start point X,Start point Y, End point X,End point Y [,Color code]
Start point X,Y Start point coordinates (X: 0-399, Y: 0-239)
Arguments End point X,Y End point coordinates (X: 0-399, Y: 0-239)
Color code Color code consisting of an 8-bit value for each ARGB element * See GCOLOR
Examples GFILL 0,0,399,239
GLOAD (1) Copies image data from an array to the graphic screen
Format GLOAD [X,Y,Width,Height,] Image array,Color conversion flag,Copy mode
Start point X-coordinate, start point Y-coordinate, and width/height (in pixels) of the copy
X,Y,Width,Height
destination range
Image array Numerical value array containing image data stored with GSAVE
Arguments
Color conversion 0: Performs color conversion (Converts to 32-bit logical colors)
flag 1: Leaves the physical codes as they are (16-bit)
Copy mode TRUE = Copies the transparent color, FALSE = Does not copy the transparent color
Examples GLOAD 0,0,512,512, WORK, 1, 0
GTRI Draws a triangle on the graphic screen and fills it with a color
Format GTRI X1,Y1, X2,Y2, X3,Y3 [,Color code]
X1,Y1 Vertex 1(X: 0-399, Y: 0-239)
X2,Y2 Vertex 2 (X: 0-399, Y: 0-239)
Arguments
X3,Y3 Vertex 3 (X: 0-399, Y: 0-239)
Color code Color code consisting of an 8-bit value for each ARGB element * See GCOLOR
Examples GTRI 200,10,300,200,100,200
GPUTCHR (1) Draws a character string on the graphic screen
Format GPUTCHR X,Y, "String" [,Scale X,Scale Y][,Color code]
X,Y Display position (X: 0-399, Y: 0-239)
"String" String to display
Arguments
Scale X,Y Display magnification (No scaling=1.0)
Color code Color code consisting of an 8-bit value for each ARGB element * See GCOLOR
Examples GPUTCHR 10,10," "
Sprites
Functions related to display of images made up of rectangles that can be moved freely
SPPAGE (2) Gets the graphic page that has been assigned to sprites
Format Variable=SPPAGE()
Return Values Graphic page number (0-5)
Examples P=SPPAGE()
SPDEF (1) Resets the sprite character definition template to its initial state
Format SPDEF
Arguments None
Common Supplement - The sprite definition template is a common component for both the upper screen and the Touch Screen
for SPDEF - This is provided in order to simplify SPSET definition
Examples SPDEF
SPDEF (3) Creates templates for sprite character definition collectively from an array
Format SPDEF Numerical value array
Numerical value array containing sprite template data
- One sprite template consists of the following 7 elements: U,V,W,H,Origin X,Origin
Numerical value Y,Attribute
Arguments
array - The number of elements must be a multiple of 7
- A specific number of sprite templates (the number of elements divided by 7) will be defined
in order, starting with 0
Examples SPDEF SRCDATA
SPDEF (4) Creates templates for sprite character definition collectively from a DATA sequence
Format SPDEF "@Label string"
Label of the DATA instruction that enumerates the sprite template data
- The @Label name should be enclosed in "" or specified with a string variable
- The first data should be the number of sprites to define, followed by enumeration of the
Arguments @Label string
data for each sprite (7 data elements per sprite)
- One sprite template consists of the following 7 elements: U,V,W,H,Origin X,Origin
Y,Attribute
Examples SPDEF "@SRCDATA"
Finds an available sprite number and creates a sprite (using a definition template)
Finds an available sprite number from the whole range
- SPSET makes a sprite available for use
SPSET (3) - Executing SPSET will initialize rotation and all other information
- All values of SPVAR will be 0
- When any SPHIT instruction for collision detection is to be used, SPCOL should be called after SPSET
Format SPSET Definition number OUT IX
Arguments Definition number Definition number of the template defined with SPDEF: 0-4095
Return Values IX Variable to receive the generated number: 0-511 (-1 = No available number)
Examples SPSET 500 OUT IX
Finds an available sprite number and creates a sprite (using image and other information specified directly)
Finds an available sprite number from the whole range
- SPSET makes a sprite available for use
SPSET (4) - Executing SPSET will initialize rotation and all other information
- All values of SPVAR will be 0
- When any SPHIT instruction for collision detection is to be used, SPCOL should be called after SPSET
Format SPSET U,V,W,H,Attribute OUT IX
U,V Coordinates of the original image to define (U: 0-511, V: 0-511)
Size of the original image to define (If omitted: 16,16)
W,H
* U+W and/or V+H values greater than 512 will give an error.
|b00| Display (0=OFF, 1=ON) #SPSHOW
Arguments |b01| ↑Rotation by 90 degrees (Specified with two bits: b01 and b02)
|b02| ↓#SPROT0, #SPROT90, #SPROT0180, #SPROT270
Attribute
|b03| Horizontal inversion (0=OFF, 1=ON), #SPREVH
|b04| Vertical inversion (0=OFF, 1=ON), #SPREVV
|b05| Additive synthesis (0=OFF, 1=ON), #SPADD
Return Values IX Variable to receive the generated number: 0-511 (-1 = No available number)
Examples SPSET 0,0,32,32,1 OUT IX
Finds an available sprite number in a certain range and creates a sprite (using a definition template)
Finds an available number in the specified range
- SPSET makes a sprite available for use
SPSET (5) - Executing SPSET will initialize rotation and all other information
- All values of SPVAR will be 0
- When any SPHIT instruction for collision detection is to be used, SPCOL should be called after SPSET
Format SPSET Upper limit,Lower limit, Definition number OUT IX
Upper limit, Lower
Arguments Range in which to find an available number (0-511)
limit
Definition number Definition number of the template defined with SPDEF: 0-4095
Return Values IX Variable to receive the generated number: 0-511 (-1 = No available number)
Examples SPSET 100,120, 500 OUT IX
Finds an available sprite number in a certain range and creates a sprite (using image and other information
specified directly)
Finds an available number in the specified range
SPSET (6) - SPSET makes a sprite available for use
- Executing SPSET will initialize rotation and all other information
- All values of SPVAR will be 0
- When any SPHIT instruction for collision detection is to be used, SPCOL should be called after SPSET
Format SPSET Upper limit,Lower limit, U,V,W,H,Attribute OUT IX
Upper limit,Lower
Range in which to find an available number (0-511)
limit
U,V Coordinates of the original image to define (U: 0-511, V: 0-511)
Size of the original image to define (If omitted: 16,16)
W,H
* U+W and/or V+H values greater than 512 will give an error.
|b00| Display (0=OFF, 1=ON) #SPSHOW
Arguments |b01| ↑Rotation by 90 degrees (Specified with two bits: b01 and b02)
|b02| ↓#SPROT0, #SPROT90, #SPROT0180, #SPROT270
|b03| Horizontal inversion (0=OFF, 1=ON), #SPREVH
Attribute
|b04| Vertical inversion (0=OFF, 1=ON), #SPREVV
|b05| Additive synthesis (0=OFF, 1=ON), #SPADD
Hides a sprite
SPHIDE - This only hides the sprite; it continues to exist
- If used before SPSET, an error will occur
Format SPHIDE Management number
Arguments Management number Management number of the sprite to hide: 0-511
Examples SPHIDE 43
Specifies the reference point (home position) for the coordinates of a sprite
- Position reference point for the SPOFS instruction
SPHOME (1) - Center point for rotation and scaling
- Center coordinates for collision detection
- If used before SPSET, an error will occur
Format SPHOME Management number,Position X,Position Y
Arguments Management number Management number of the sprite for which to set the reference point: 0-511
Position X,Y Relative coordinates with the top left corner of the sprite as the origin (0,0)
Examples SPHOME 34,16,16
Gets the reference point (home position) for the coordinates of a sprite
SPHOME (2) If used before SPSET, an error will occur
Format SPHOME Management number OUT HX,HY
Arguments Management number Management number of the sprite: 0-511
Return Values HX,HY Variable to receive the coordinates of the reference point
Examples SPHOME 10 OUT HX,HY
Unlinks a sprite
SPUNLINK If used before SPSET, an error will occur
Format SPUNLINK Management number
Arguments Management number Management number of the sprite to unlink: 0-511
Examples SPUNLINK 15
Displays animation with a sprite (using animation data specified with an array)
If used before SPSET, an error will occur
- Animation waits for a specified time, according to the value input
SPANIM (1) - Animation starts from the frame following SPANIM execution
- Up to 32 pieces of data will be accepted for each target element
- If a negative value is specified for time, linear interpolation from the previous value will occur
Format SPANIM Management number,"Animation target",Data array [,Loop]
Management number Management number of the sprite for which to set the animation: 0-511
Numerical value or character string to control the elements that should change
- 0 or "XY": XY-coordinates
- 1 or "Z": Z-coordinates
- 2 or "UV": UV-coordinates (Coordinates of the definition source image)
- 3 or "I": Definition number
- 4 or "R": Rotation angle
Animation target - 5 or "S": Magnification XY
Arguments
- 6 or "C": Display color
- 7 or "V": Variable (Value of sprite internal variable 7)
- Adding 8 to the target numerical value will cause the value to be treated as being relative
to the run time
- Suffixing the character string with "+" will also cause the value to be treated as being
relative to the run time
Data array One-dimensional numerical value array storing the animation data
Loop Loop count: (1-) The value 0 specifies an endless loop
Animation data should be provided in a numerical value array in the following order (Up to 32 pieces of data):
Data Arrays
Time 1, Item 1,[Item2,] Time 2,Item 1,[Item 2,]…
DIM PANIM[ 6 ]
PANIM[0] = -60 'frame(-60=smooth)
PANIM[1] = 200 'offset X,Y
PANIM[2] = 100
Examples PANIM[3] = -30 'frame
PANIM[4] = 50 'offset
PANIM[5] = 20
SPSET 0,0
SPANIM 0,"XY",PANIM
Displays animation with a sprite (using animation data specified with the DATA instruction)
If used before SPSET, an error will occur
- Animation waits for a specified time, according to the value input
SPANIM (2) - Animation starts from the frame following SPANIM execution
- Up to 32 pieces of data will be accepted for each target element
- If a negative value is specified for time, linear interpolation from the previous value will occur
Format SPANIM Management number,"Animation target","@Label string" [,Loop]
Management number Management number of the sprite for which to set the animation: 0-511
Numerical value or character string to control the elements that should change
- 0 or "XY": XY-coordinates
- 1 or "Z": Z-coordinates
- 2 or "UV": UV-coordinates (Coordinates of the definition source image)
- 3 or "I": Definition number
- 4 or "R": Rotation angle
Animation target - 5 or "S": Magnification XY
- 6 or "C": Display color
Arguments
- 7 or "V": Variable (Value of sprite internal variable 7)
- Adding 8 to the target numerical value will cause the value to be treated as being relative
to the run time
- Suffixing the character string with "+" will also cause the value to be treated as being
relative to the run time
- First label of the DATA instruction storing the animation data
@Label string - This should be specified as a character string by enclosing the @Label name in "" (or as a
string variable)
Loop Loop count: (1-) The value 0 specifies an endless loop
Animation data should be provided in the DATA instruction in the following order:
DATA Number of key frames (maximum: 32)
Data DATA Time 1,Item 1[,Item 2]
DATA Time 2,Item 1[,Item 2]
:
@MOVDATA
DATA 2 'counter
DATA -60,200,100 'frame,offset
Examples
DATA -30,50,20 'frame,offset
SPSET 0,0
SPANIM 0,"XY","@MOVDATA"
Displays animation with a sprite (using animation data specified directly as arguments)
If used before SPSET, an error will occur
- Animation waits for a specified time, according to the value input
SPANIM (3) - Animation starts from the frame following SPANIM execution
- Up to 32 pieces of data will be accepted for each target element
- If a negative value is specified for time, linear interpolation from the previous value will occur
Format SPANIM Management number,"Animation target",Time 1,Item 1[,Item 2] [,Time 2,Item 1[,Item 2]]… [,Loop]
Management number Management number of the sprite for which to set the animation: 0-511
Numerical value or character string to control the elements that should change
- 0 or "XY": XY-coordinates
- 1 or "Z": Z-coordinates
- 2 or "UV": UV-coordinates (Coordinates of the definition source image)
- 3 or "I": Definition number
- 4 or "R": Rotation angle
Animation target - 5 or "S": Magnification XY
Arguments
- 6 or "C": Display color
- 7 or "V": Variable (Value of sprite internal variable 7)
- Adding 8 to the target numerical value will cause the value to be treated as being relative
to the run time
- Suffixing the character string with "+" will also cause the value to be treated as being
relative to the run time
Time,Item - Animation data itself (As many Time/Item sets as needed should be listed. Maximum: 32)
Loop Loop count: (1-) The value 0 specifies an endless loop
SPSET 0,0
Examples
SPANIM 0,"XY", -60,200,100, -30,50,20
For each bit, a target is assigned (If 0 is assigned for all bits, animation is being stopped)
ST=SPCHK(5)
'|b00|#CHKXY
'|b01|#CHKZ
'|b02|#CHKUV
Examples '|b03|#CHKI
'|b04|#CHKR
'|b05|#CHKS
'|b06|#CHKC
'|b07|#CHKV
Gets information on collision detection results (Time of collision, coordinates and speed)
SPHITINFO (3) If used before SPSET, an error will occur
Format SPHITINFO OUT TM,X1,Y1,VX1,VY1,X2,Y2,VX2,VY2
Arguments None
- Variable that returns time of collision: real-type number from 0 to 1
Time of collision
- Position at collision detection + speed x collision time = collision X-Y coordinates
X1,Y1 Variable that returns the X-Y coordinates of object 1 at the time of collision
Return Values
VX1,VY1 Variable that returns the speed of object 1 at the time of collision
X2,Y2 Variable that returns the X-Y coordinates of object 2 at the time of collision
VX2,VY2 Variable that returns the speed of object 2 at the time of collision
Examples SPHITINFO OUT TM,X1,Y1,VX1,VY1,X2,Y2,VX2,VY2
BG
Functions for displaying tiled 16x16-pixel rectangular images
BGPAGE (2) Gets the graphic page that has been assigned to BG
Format Variable=BGPAGE()
Return Values Graphic page number (0-5)
Examples P=BGPAGE()
- 16-bit numerical value that specifies the character number and the rotation information
- A 4-digit hexadecimal string can also be specified ("0000"-"FFFF")
BGPUT 0,0,0,5
Examples
BGPUT 0,20,15,"80FF"
BGFILL Fills the BG screen with a BG character
Format BGFILL Layer,Start point X,Start point Y,End point X,End point Y,Screen data
Layer Target layer number: 0-3
Start point coordinates (Each coordinate: 0 - the value specified with the BGSCREEN
Start point X,Y
instruction minus 1)
End point coordinates (Each coordinate: 0 - the value specified with the BGSCREEN instruction
End point X,Y
minus 1)
|b00| ↑
| | Character number (0-4095, repeated at the cycle of 1024)
Arguments |b11| ↓
|b12| ↑Rotation by 90 degrees (Specified with two bits: b12 and b13)
Screen Data |b13| ↓[ 00 = 0 degrees, 01 = 90 degrees, 10 = 180 degrees, 11 = 270 degrees ]
|b14| Horizontal inversion (0=OFF, 1=ON)
|b15| Vertical inversion (0=OFF, 1=ON)
- 16-bit numerical value that specifies the character number and the rotation information
- A 4-digit hexadecimal string can also be specified ("0000"-"FFFF")
BGFILL 0,0,0,19,15,1024
Examples
BGFILL 0,5,5,10,10,"C040"
Screen data
Examples C=BGGET(0,12,14)
Displays animation using the BG (Specifying animation data with the DATA instruction)
- Animation waits for a specified time, according to the value input
BGANIM (2) - Animation starts from the frame following BGANIM
- Up to 32 pieces of data will be accepted for each target element
- If a negative value is specified for time, linear interpolation from the previous value will occur
Format BGANIM Layer,"Animation target","@Label string" [,Loop]
Layer Number of the layer for which to set the animation: 0-3
Numerical value or character string to control the elements that should change
- 0 or "XY": XY-coordinates
- 1 or "Z": Z-coordinate
- 4 or "R": Rotation angle
- 5 or "S": Magnification XY
Animation target - 6 or "C": Display color
- 7 or "V": Variable (Value of BG internal variable 7)
Arguments
- Adding 8 to the target numerical value will cause the value to be treated as being relative
to the run time
- Suffixing the character string with "+" will also cause the value to be treated as being
relative to the run time
- First label of the DATA instruction storing the animation data
@Label string - This should be specified as a character string by enclosing the @Label name in " (or as a
string variable)
Loop Loop count: (1-) The value 0 specifies an endless loop
Animation data should be provided in the DATA instruction in the following order:
DATA Number of key frames (maximum: 32)
Data DATA Time 1,Item 1[,Item 2]
DATA Time 2,Item 1[,Item 2]
:
@MOVDATA
DATA 2 'counter
Examples DATA -60,200,100 'frame,offset
DATA -30,50,20 'frame,offset
BGANIM 0,"XY","@MOVDATA"
Displays animation using the BG (Specifying animation data with arguments directly)
- Animation waits for a specified time, according to the value input
BGANIM (3) - Animation starts from the frame following BGANIM
- Up to 32 pieces of data will be accepted for each target element
- If a negative value is specified for time, linear interpolation from the previous value will occur
Format BGANIM Layer,"Animation target",Time 1,Item 1[,Item 2] [,Time 2,Item 1[,Item 2]]… [,Loop]
Layer Number of the layer for which to set the animation: 0-3
Numerical value or character string to control the elements that should change
- 0 or "XY": XY-coordinates
- 1 or "Z": Z-coordinate
- 4 or "R": Rotation angle
- 5 or "S": Magnification XY
Animation target - 6 or "C": Display color
Arguments
- 7 or "V": Variable (Value of BG internal variable 7)
- Adding 8 to the target numerical value will cause the value to be treated as relative to the
run time
- Suffixing the character string with "+" will also cause the value to be treated as relative
to the run time/td>
Time, Item - Animation data itself (Up to 32 necessary data items can be listed)
Loop Loop count: (1-) The value 0 specifies an endless loop
Examples BGANIM 0,"XY", -60,200,100, -30,50,20
A target is assigned for each bit (If 0 is assigned for all bits, animation is being stopped)
ST=BGCHK(0)
'|b00|#CHKXY
'|b01|#CHKZ
Examples '|b04|#CHKR
'|b05|#CHKS
'|b06|#CHKC
'|b07|#CHKV
Sound
Functions for playing back music and sound effects, setting effectors, and generating synthesized voice
EFCWET Sets the respective effect amounts for BEEP, BGM, and TALK
Format EFCWET BEEP effect value, BGM effect value, TALK effect value
BEEP effect value Effect amount for BEEP (0-127)
BGM effect value Effect amount for BGM (0-127)
Arguments
- Effect setting for TALK (Less than 64: OFF; 64 or greater: ON)
TALK effect value
- For TALK, the only available setting is ON/OFF; the amount does not change
Examples EFCWET 0,100,64
Mathematics
Instructions for mathematical operations including trigonometric functions and logarithms
Gets the integer part (by rounding down to the whole number)
FLOOR - The largest integer that is not greater than the specified value will be obtained
- FLOOR(12.5) will be 12, while FLOOR(-12.5) will be -13
Format Variable = FLOOR( Numerical value )
Arguments Numerical value Source numerical value
Return Values Integer value after rounding down
See Also ROUND: Round-off, CEIL: Round-up
Examples A=FLOOR(12.345)
ROUND Gets the integer part (by rounding off to the nearest whole number)
Format Variable = ROUND( Numerical value )
Arguments Numerical value Source numerical value
Return Values Integer value after rounding off
See Also FLOOR: Round-down, CEIL: Round-up
Examples A=ROUND(12.345)
Gets the integer part (by rounding up to the whole number)
CEIL - The smallest integer that is not less than the specified value will be obtained
- CEIL(12.5) will be 13, while CEIL(-12.5) will be -12
Format Variable = CEIL( Numerical value )
Arguments Numerical value Source numerical value
Return Values Integer value after rounding up
See Also ROUND: Round-off, FLOOR: Round-down
Examples A=CEIL(12.345)
MIN (1) Gets the smallest value in the specified numerical value array
Format Variable = MIN( Numerical value array )
Numerical value
Arguments Name of a numerical value array storing multiple numerical values
array
Return Values Smallest number in the passed arguments
DIM TMP[2]
Examples TMP[0]=50:TMP[1]=3
A=MIN(TMP)
MIN (2) Gets the smallest value from the specified multiple numerical values
Format Variable = MIN( Numerical value [,Numerical value…] )
Numerical values
Arguments enumerated Enumerate multiple numerical values separated by commas
directly
Return Values Smallest number in the passed arguments
Examples A=MIN(1,2,3,4)
MAX (1) Gets the largest value in the specified numerical value array
Format Variable = MAX( Numerical value array )
Numerical value
Arguments Name of a numerical value array storing multiple numerical values
array
Return Values Largest number in the passed arguments
DIM TMP[2]
Examples TMP[0]=50:TMP[1]=3
A=MAX(TMP)
MAX (2) Gets the largest value from the specified multiple numerical values
Format Variable = MAX( Numerical value [,Numerical value…] )
Numerical values
Arguments enumerated Enumerate multiple numerical values separated by commas
directly
Return Values Largest number in the passed arguments
Examples A=MAX(1,2,3,4)
RNDF Gets a real-type random number (a real-type random number greater than 0 and less than 1.0)
Format Variable = RNDF( [ Seed ID ] )
Arguments Seed ID Random number series: 0-7
Return Values Real-type random number greater than 0 and less than 1
Examples A=RNDF()
ATAN (1) Returns the arc tangent value (from numerical values)
Format Variable = ATAN( Numerical value )
Arguments Numerical value Numerical value from which to find the angle
Return Values Arc tangent (radian) value found
Examples A=ATAN(1)
CLASSIFY Determines whether a given number is an ordinary numerical value, infinity, or not-a-number (NaN)
Format Variable = CLASSIFY( Numerical value )
Arguments Numerical value Real number to check
Return Values 0 = Ordinary numerical value, 1 = Infinity, 2 = NaN
Examples A=CLASSIFY(0.5)
Operations on strings
Instructions for specifying display formats for strings, extracting strings, etc.
ASC Gets a character code for the specified character (or string variable)
Format Variable = ASC( "Character" )
Arguments Character Character string (or string variable) storing the character to check
Return Values Character code (UTF-16) for the specified character
Examples A=ASC("A")
LEN Gets the number of characters in a character string/Gets the number of elements in an array
Format >Variable = LEN( "Character string" or Array variable )
For a character Character string, or the name of the string variable, in which to check the number of
Arguments
string characters
For an array
Name of the array variable in which to check the number of elements
variable
- For a character string: Number of characters (All characters will be counted as one character)
Return Values
- For an array variable: Number of elements
Examples A=LEN("ABC123")
Extracts a character string with the specified number of characters from the specified position in the specified
MID$ character string
Format String variable = MID$( "Character string", Start position, Number of characters )
Character string Source character string
Start position Position (in character units) from which to start extracting a character string
Arguments
Number of
Number of characters to extract
characters
Return Values Character string extracted
Examples S$=MID$("ABC",0,2)
Extracts a character string with the specified number of characters from the left end of the specified character
LEFT$ string
Format String variable = LEFT$( "Character string", Number of characters )
Arguments Character string Source character string
Number of
Number of characters to extract
characters
Return Values Character string extracted
Examples S$=LEFT$("ABC",2)
Extracts a character string with the specified number of characters from the right end of the specified character
RIGHT$ string
Format Variable$ = RIGHT$( "Character string", Number of characters )
Arguments Character string Source character string
Number of
Number of characters to extract
characters
Return Values Character string extracted
Examples S$=RIGHT$("ABC",2)
INSTR Searches for the target character string in another character string
Format Variable = INSTR( [Start position,] "Character string to search in", "Character string to search" )
- Position (in character units, larger than or equal to 0) in the source character string from
Start position which to start searching
- If omitted, the search will be started from the beginning of the source string
Arguments Character string
Source character string
to search in
Character string
Character string to search for in the source character string
to search for
- If the search string is found: Position in the source string (in character units)
Return Values
- Otherwise: -1
Examples A=INSTR( 0, "ABC","B" )
SUBST$ Substitutes one character string with another string
Format String variable = SUBST$( "Character string", Start position, [Number of characters,] "Substitute string" )
Character string Source character string
Position in the source character string from which to start substitution (0 - Number of
Start position
characters minus 1)
- Number of characters to substitute with another string
Arguments Number of
- If omitted, all characters after the substitution start position will be replaced with the
characters
substitute string
The specified number of characters from the start position will be substituted with this
Substitute string
string
Return Values Character string after the substitution
Examples A$=SUBST$( "ABC",0,2,"XY" )
Source code manipulation
Functions for writing program strings into specified SLOTs
PRGEDIT Specifies the program SLOT to manipulate, and the current line
Format PRGEDIT Program SLOT [,Line number]
- Program SLOT to manipulate: 0-3
Arguments Program SLOT
- Specifying the SLOT currently running will give an error
- Line to manipulate (Current line)
Line number - If this is omitted, the first line will be the current line
- If -1 is specified for the line number, the current line will be the last line
Examples PRGEDIT 0
Substitutes the contents of the current line with the specified string
PRGSET If PRGGET$ has returned an empty string, a line will be added
Format PRGSET "Character string"
Arguments Character string Character string to substitute the current line with
Examples PRGSET "'Comment"
Bit Operations
Instructions for performing a bit operation to numerical values
DIV Gets the integer value of Numerical value 1 divided by Numerical value 2
Format Variable=Numerical value 1 DIV Numerical value 2
Arguments Numerical value 1 Number (or expression) to divide
Numerical value 2 Number (or expression) to divide by (Dividing by zero gives an error)
Examples A=200 DIV 5
AND Logical AND of Numerical value 1 and Numerical value 2 (Multiplication of bits)
Format Variable=Numerical value 1 AND Numerical value 2
Arguments Numerical value 1 Bit string 1
Numerical value 2 Bit string 2
Examples A=200 AND &HE7
XOR Exclusive OR of Numerical value 1 and Numerical value 2 (If the values are the same, 0; if not, inversion)
Format Variable=Numerical value 1 XOR Numerical value 2
Arguments Numerical value 1 Bit string 1
Numerical value 2 Bit string 2
Examples A=100 XOR &H4C
<< Shifts a numerical value to the left by the specified number of bits
Format Variable=Numerical value << Number of times
Arguments Numerical value Bit string 1
Number of times Number of bit shifts
Examples A=100 << 2
>> Shifts a numerical value to the right by the specified number of bits
Format Variable=Numerical value >> Number of times
Arguments Numerical value Bit string 1
Number of times Number of bit shifts
Examples A=100 >> 2
MML
Commands for MML (Music Macro Language)
Special effect commands used to give a subtle fluctuation to sounds and volume
MML (6) * @MA, @MP, and @ML cannot be used at the same time.
Start modulation @MON
Stop modulation @MOF
Detuning (fine
frequency
@D-128 to @D127 (-128 is a tone lower; +127 is a tone higher)
adjustment)
setting◆
@MA + Depth, Range, Speed, Delay values (0-127 for each)
Tremolo setting
e.g., @MA64,1,16,32
@MP + Depth, Range, Speed, Delay values (0-127 for each)
Vibrato setting
e.g., @MP64,1,16,32
Auto pan pot @ML + Depth, Range, Speed, Delay values (0-127 for each)
setting e.g., @ML100,1,8,0
Error Table
If an error has occurred, the relevant information is stored in the system variable.
System Variable
ERRNUM (Error number)
for Error Handling
ERRLINE (Number of the line where the error occurred)
3: Syntax error (syntax does not follow the grammar rules)
4: Illegal function call (the number of arguments specified in an instruction or function is wrong)
5: Stack overflow (an overflow has occurred in the stack)
6: Stack underflow (an underflow has occurred in the stack)
7: Divide by zero (division by zero was attempted)
8: Type mismatch (an inconsistent variable type is specified)
9: Overflow (the calculation result exceeded the allowed range)
10: Out of range (a value outside the allowed range was specified)
11: Out of memory (sufficient memory area is not available)
12: Out of code memory (sufficient code memory area is not available)
13: Out of DATA (DATA that can be READ is insufficient)
14: Undefined label (the specified label could not be found)
15: Undefined variable (the specified variable could not be found)
16: Undefined function (the specified instruction/function could not be found)
17: Duplicate label (the same label has been defined twice)
18: Duplicate variable (the same variable has been defined twice)
19: Duplicate function (the same instruction/function has been defined twice)
20: FOR without NEXT (a FOR has no NEXT)
21: NEXT without FOR (a NEXT has no FOR)
22: REPEAT without UNTIL (a REPEAT has no UNTIL)
23: UNTIL without REPEAT (an UNTIL has no REPEAT)
24: WHILE without WEND (a WHILE has no WEND)
Common Errors 25: WEND without WHILE (a WEND has no WHILE)
26: THEN without ENDIF (a THEN has no ENDIF)
27: ELSE without ENDIF (an ELSE has no ENDIF)
28: ENDIF without IF (an ENDIF has no IF)
29: DEF without END (a DEF has no END)
30: RETURN without GOSUB (a RETURN has no GOSUB)
31: Subscript out of range (array subscripts are not within the allowed range)
32: Nested DEF (a DEF has been defined within another DEF)
33: Can't continue (the program cannot resume with CONT)
34: Illegal symbol string (a label string has been incorrectly described)
35: Illegal file format (the file is in a format that SmileBASIC cannot support)
36: Mic is not available (a microphone instruction was used without using XON MIC)
37: Motion sensor is not available (a motion instruction was used without using XON MOTION)
38: Use PRGEDIT before any PRG function (one of the PRG instructions was used without using PRGEDIT)
39: Animation is too long (animation definition is too long)
40: Illegal animation data (animation data is incorrect)
41: String too long (string is too long)
42: Communication buffer overflow (an overflow has occurred in the buffer for sending MPSEND)
43: Can't use from DIRECT mode (an instruction that does not work in DIRECT mode was used)
44: Can't use in program (an instruction that cannot be used in a program was used)
45: Can't use in tool program (an instruction that cannot be used from a tool program was used)
46: Load failed (failed to read the file)
47: Illegal MML (the MML [Music Macro Language] is incorrect)
System Variable
What is a System System variables are variables reserved in the system managed by SmileBASIC.
Variable? * Although they are primarily read-only, it is possible to populate values in some (they are writable).
CSRX 'Cursor position X
CSRY 'Cursor position Y
CSRZ 'Cursor position Z (depth)
FREEMEM 'Amount of free user memory available (in KB)
VERSION 'System version (&HXXYYZZZZ)
TABSTEP 'TAB movement amount (writable)
SYSBEEP 'System sound effects (writable, TRUE=allowed)
ERRNUM 'Error number
ERRLINE 'Line where an error occurred
ERRPRG 'Program SLOT where an error occurred
PRGSLOT 'Current program SLOT for the PRG instruction
RESULT 'Dialog result (TRUE/FALSE/-1=Suspended)
Examples
MAINCNT 'Number of frames since SmileBASIC was launched
MICPOS 'Current sampling location
MICSIZE 'Number of samples in the sampling buffer
MPCOUNT 'Number of participants in a session
MPHOST 'Host ID
MPLOCAL 'User ID
TRUE 'Always 1
FALSE 'Always 0
TIME$ 'Time string (HH:MM:SS)
DATE$ 'Date string (YYYY/MM/DD)
HARDWARE 'Hardware information (1=new3DS)
CALLIDX 'Number called by SPFUNC and BGFUNC
Constants
- 32-bit numerical value definitions prepared in the system
# - Used instead of a numerical value in order to specify a color or handle a button
- e.g., IF BUTTON() AND (#A OR #B) THEN
'--- Generic
#ON '1
#OFF '0
#YES '1
#NO '0
#TRUE '1
#FALSE '0
'--- RGB
#AQUA '&HFF00F8F8
#BLACK '&HFF000000
#BLUE '&HFF0000FF
#CYAN '&HFF0000F8
#FUCHSIA '&HFFF800F8
#GRAY '&HFF808080
#GREEN '&HFF008000
#LIME '&HFF00F800
#MAGENTA '&HFFF800F8
#MAROON '&HFF800000
#NAVY '&HFF000080
#OLIVE '&HFF808000
#PURPLE '&HFF800080
#RED '&HFFF80000
#SILVER '&HFFC0C0C0
#TEAL '&HFF008080
#WHITE '&HFFF8F8F8
#YELLOW '&HFFF8F800
'--- TEXTCOLOR
#TBLACK '1
#TMAROON '2
#TRED '3
#TGREEN '4
#TLIME '5
#TOLIVE '6
#TYELLOW '7
#TNAVY '8
#TBLUE '9
#TPURPLE '10
#TMAGENTA '11
#TTEAL '12
#TCYAN '13
#TGRAY '14
#TWHITE '15
'--- BUTTON
Examples #UP '&H0001
#DOWN '&H0002
#LEFT '&H0004
#RIGHT '&H0008
#A '&H0010
#B '&H0020
#X '&H0040
#Y '&H0080
#L '&H0100
#R '&H0200
#ZL '&H0800
#ZR '&H1000
'--- ATTR
#TROT0 '&H00
#TROT90 '&H01
#TROT180 '&H02
#TROT270 '&H03
#TREVH '&H04
#TREVV '&H08
'---SPSET/SPCHR ATTR
#SPSHOW '&H01, Display
#SPROT0 '&H00, Rotate by 0 degree
#SPROT90 '&H02, Rotate by 90 degrees
#SPROT180 '&H04, Rotate by 180 degrees
#SPROT270 '&H06, Rotate by 270 degrees
#SPREVH '&H08, Right/left
#SPREVV '&H10, Up/down
#SPADD '&H20, Additive synthesis
'--- BG ATTRE
#BGROT0 '&H0000
#BGROT90 '&H0800
#BGROT180 '&H1000
#BGROT270 '&H2000
#BGREVH '&H4000
#BGREVV '&H8000
'--- SPCHK/BGCHK
#CHKXY '&H01
#CHKZ '&H02
#CHKUV '&H04
#CHKI '&H08
#CHKR '&H10
#CHKS '&H20
#CHKC '&H40
#CHKV '&H80