・You can define another constant by writing a comma after one definition.
・Constant names have the same format as variable names and begins with #.
・Numeric values, strings, other constants, CHR$, RGB, RGBF, HSV, HSVF, DEG, RAD functions, and their operations can be used as constant expressions.
CONST #C1=1,#C2="ABC",#C3=RAD(180) ?#C1,#C2,#C3
・Unlike CONST, only Int constants can be defined.
・Constant expressions can be omitted.
・If not specified, the set value +1 in the previous constant definition is used.
・Constant names have the same format as variable names and begins with '#'.
・Int, other Int constants, RGB, RGBF, HSV, HSVF, DEG, RAD, and their operations can be used for constant expressions.
・If the constant expression is a Real, the decimal part is rounded toward zero.
・If not specified, the set value +1 in the previous constant definition is used.
ENUM #TYPE1=2,#TYPE2,#TYPE3 ?#TYPE1,#TYPE2,#TYPE3
・Numeric values, strings, other constants, CHR$, RGB, RGBF, HSV, HSVF, DEG, RAD functions, and their operations can be used as constant expressions.
・If it is a constant expression, both numerical values and strings can be mixed.
DATA 123,#C_RED,56,"SAMPLE"+CHR$(20)
・If there is no data that can be read, Out of data error occurs.
Variable to store information to be read (multiple variables can be specified)
・Get sequentially from the first DATA statement.
・Use the RESTORE command to change the DATA statement to be read.
READ X,Y,Z,G$ DATA 200,120,0,"JAN" DATA 210,120,0,"FEB"
@LabelName added to the beginning of the DATA statement to be read
・When you put RESTORE "1:@LabelName" or/and the "Number:" before the label names, then it can refer to other program slots.
・When specifying a program slot, it is necessary to enable the program in the target program slot beforehand with the EXEC command.
・If a string is specified instead of a label, the value of the expression is considered as a label at runtime and the label is referenced.
・In addition to labels, each of the following strings has a special function.
"PUSH" | Stops the READ reading position on the stack. The current READ reading position remains unchanged. |
"POP" | Set the READ reading position to the location where the reading occurred from the stack. |
"BEGIN" | Set the READ reading position to the beginning of a DATA statement in the program. |
"Number:BEGIN" | Set the READ reading position to the beginning of a DATA statement in the specified program slot. |
RESTORE @DATATOP READ X,Y,Z,T$ @DATATOP DATA 123,345,56,"SAMPLE"
STRICT | Variable definition is mandatory and assignment to an undefined variable results in an error. |
DEFINT | The default value of the variable is set to the Int 0 instead of a Real. The default type for numeric arrays is an Int array. |
OPTION STRICT
Specify elapsed frame count from the present time
・If 0 is specified, it does not stop.
・If not specified, it's 1.
WAIT 60
・Unlike WAIT, specify the frame count from the previous VSYNC execution.
Specify elapsed frame count since the last VSYNC
・If 0 is specified, it does not stop.
・If not specified, it's 1.
VSYNC 1
・REM or ' and after the end of the line are regarded as comments and they will be ignored.
・Comments do not affect program execution.
' MAIN ROUTINE
Time string in "HH:MM:SS" format
・HH is a numerical character from 00 to 23, MM and SS are numerical characters from 00 to 59.
・Current time is the default.
H | Variable that receives the hour |
M | Variable that receives the minute |
S | Variable that receives the second |
TMREAD "12:59:31" OUT H,M,S
Date string in "YYYY/MM/DD" format
・YYYY is a numeric character from 0000 to 9999, MM is from 01 to 12, and DD is from 01 to 31.
・The default is the current date.
Y | Variable that receives the year |
M | Variable that receives the month |
D | Variable that receives the day |
W | Variable that receives the day of the week (a number with Sunday as 0) (optional) |
DTREAD "2014/10/12" OUT Y,M,D
The string to search for as a label
・CHKLABEL "1:@LabelName" can also check labels in other program slots.
・When specifying a program slot, the target program slot must be enabled with the EXEC command in advance.
Specify whether to search labels outside DEF when CHKLABEL is used in DEF
0 | Search only in DEF |
1 | Search global labels if not in DEF |
・0, if not specified.
1 if it exists, 0 if not exist
A=CHKLABEL("@MAIN")
String to search for as an command/function
1 if it exists, 0 if not exist
A=CHKCALL("KEYCHECK")
String to search for as a variable
1 if it exists, 0 if not exist
A=CHKVAR("COUNTX")
・Pressed button information can be obtained with the RESULT function.
・1: OK, -1: Cancel, 0: Timeout
String to be displeday in the dialog
・Up to 256 characters can be displayed.
・If there is CHR$(10) or CHR$(13) in the display string, a line break will occur.
0 | OK (Default) |
1 | No / Yes |
2 | Back / Next |
3 | Cancel / OK |
4 | Cancel / Execute |
5 | Next |
・If not specified, it's 0.
String to be displayed in the caption field at the top of the dialog
・If the caption string is longer than 46 characters, only 46 characters are displayed.
・If not specified, "DIALOG" is displayed in the caption column.
Number of seconds before closing the dialog automatically
・If a negative value is specified, it is specified in frame count units.
・If 0 is specified, it waits until the user operates.
・If not specified, it's 0.
DIALOG "Let's get started",5,"Scenario",-120
String to be displayed in the dialog
・Up to 256 characters can be displayed.
・If there is CHR$(10) or CHR$(13) in the display string, a line break will occur.
bit0 | X Button |
bit1 | B Button |
bit2 | Y Button |
bit3 | A Button |
bit4 | Up Button |
bit5 | Down Button |
bit6 | Left Button |
bit7 | Right Button |
bit8 | L Button |
bit9 | R Button |
bit10 | ZL Button |
bit11 | ZR Button |
bit12 | Press the L Stick |
bit13 | Press the R Stick |
bit14 | Any from A/B/X/Y Button |
bit15 | Any from Up/Down/Left/Right Button |
bit16 | Any button other than press the Stick |
bit17 | Touch Screen |
・Specify the OR of the above bit values.
・Specifying zero causes an error.
String to be displayed in the caption field at the top of the dialog
・If the caption string is longer than 46 characters, only 46 characters are displayed.
・If not specified, "DIALOG" is displayed in the caption column.
Number of seconds before closing the dialog automatically
・If a negative value is specified, it is specified in frame count units.
・If 0 is specified, it waits until the user operates.
・If not specified, it's 0.
Depending on the button pressed, it returns the value which becomes 1 corresponding to a bit value of the button type argument.
・Except for touch, the same value as BUTTON() is returned.
・0 is returned in case of timeout.
R=DIALOG("ABXYLR/DirectionalKey/Touch",(1 << #B_ANY) OR (1 << 17),"Special",0)
File name string set in advance as an input value
・An error occurs if characters that cannot be used in the file name are used.
The string to display in the caption
・If the caption string is longer than 39 characters, only 39 characters are displayed.
Up to 32 characters
Obtained string
・If the return value of the RESULT function is -1, it'll be canceled (string invalid).
T$=DIALOG("NEWNAME0","SAVE",14)
・Returns the execution results of commands that require execution results such as DIALOG, file operation commands, and XCTRLSTYLE.
・Use after execution of an command that updates RESULT.
Command execution result
・The result value varies depending on each command, but as a common element, 1 indicates success and 0 indicates failure in all commands.
The number associated with the callback
・For CALL SPRITE, the sprite ID that called the callback.
・For CALL TEXT, the text screen ID that called the callback.
・If you call outside the callback, a meaningless value is returned.
String to be stored on the clipboard
CLIPBOARD "Good morning"
String in the clipboard
PRINT CLIPBOARD()
・The contents set with Ctrl+F1 to F5 can be entered.
Function key number to register: 1 to 5
String to be registered in the function key
・The maximum length of the string is 256 characters.
KEY 1,"PRINT"
Function key number for acquiring the contents: 1 to 5
String registered in the function key
A$=KEY(1)
・Get the storage coordinates of the specified font in GRPF.
Character code of the character you want to check
・User-defined characters cannot be specified.
String that contains the first character you want to check
・Ignore characters other than the first character.
・User-defined characters cannot be specified.
The type of font you want to check
・8 or 16 can be specified.
Returns the coordinates where characters are stored in GRPF
・The unit of capacity is bytes. SmileBASIC consumes 2 bytes per character, 4 bytes per Int array element, and 8 bytes per Real array element.
・When it's used in function format, the total free space is returned.
Total size of unused memory
Size of unused memory that can be used at one time
・Unit is milliseconds (1/1000th of a second)
Elapsed time since startup
・The time per frame count is about 1/60th of a second when no processing loss occurs.
・Used to measure how many times the display has been updated. Not suitable for accurate timekeeping.
Frame count since startup
Specify the name of the item you want to get/set as a string
The item names that can be specified are as follows:
LANG | Language name set in Nintendo Switch™ (Get) |
SYSBEEP | System UI sound effect playback flag (Set/Get) |
TABSTEP | Number of spaces inserted when using the TAB key in the editor (Get) |
KEYREPEAT | Setting menu on the key repeat value (Get) |
MOUSECURSOR | Mouse cursor display (Set/Get) |
TVMODE | Whether TV Mode (Get) |
TOOL1 | Tool 1 file name (Get) |
TOOL2 | Tool 2 file name (Get)) |
TOOL3 | Tool 3 file name (Get) |
・KEYREPEAT returns two values: repeat start and repeat interval
Returns a value according to the item name
PRINT SYSPARAM("LANG") SYSPARAM "KEYREPEAT" OUT ST,IT
・Used in combination with the PERFEND command.
Number of measurement information to use: 0 to 7
Color when indicatng information on the performance gauge
・Optional
・If the same measurement number is specified and PERFBEGIN has not been called, correct measurement results cannot be obtained.
Number of measurement information to use: 0 to 7
・If the same measurement number is specified and PERFBEGIN has not been called, correct measurement results cannot be obtained.
・When it's used as a function, the execution time between PERFBEGIN and PERFEND can be obtained.
・If the measurement time exceeds 2147 seconds, correct results will not be returned.
Number of measurement information to use: 0 to 7
Returns the elapsed time from PERFBEGIN to PERFEND in microseconds (1 millionth of a second)
・Read the icons and descriptions of the specified project to the memory and makes them editable.
Project name string to be read
・If it is not specified, the current project will be read.
Specify the metadata item to be set as a numeric value
0 | Title |
1 | Description |
2 | Icon |
Specify the value to set
・The type and contents of the value differ for each metadata item number.
・For a title, set a string of up to 24 characters.
・For a description, set a string of up to 240 characters. Line feed with CHR$(10).
・For an icon, an icon image is designated by a numerical array with the number of elements 1600(Height40,Width40).
Specify the metadata item to be acquired as a numeric value
0 | Title |
1 | Description |
2 | Icon |
The returned value is different for each metadata item number.
・For a title, a string of up to 24 characters is returned.
・For a description, a string of maximum 24 characters x 10 lines is returned. Line feed with CHR$(10).
・For an icon, a 2D Int array with the number of elements 1600(Height40,Width40) is returned as an icon image.
・The metadata of the current project is rewritten.