Petit Computer
Petit Computer
1. Introduction
1-1
User Agreement
Programs and graphics created using this software can be shared with large
numbers of users. Please refrain from creating any content other users may find
offensive, or any content that might reveal personal information about yourself
or others, or violate any other party's intellectual property rights.
You risk prosecution if any programs you create cause offence, are obscene, or
are libelous.
1-3
Program Precautions
The BASIC language used in this software is not compatible with pre-existing
versions of BASIC. Please be aware of the differences in the programming
languages when attempting to port over older BASIC programs.
This software uses fixed-point number representation, which can have large
margins of error for certain calculations, resulting in precision loss. This means
it should not be used for programs which require precise calculations.
This software does not use branch instructions giving line numbers. Branch
instructions use the @ mark and the line tag for specific lines.
If commands that write to files such as SAVE, RECVFILE and DELETE are
repeatedly used, it may take longer to save or load these files.
If you enter reserved commands in lower case letters, they will automatically be
converted to upper case.
In this software, comparisons are represented using == for 'equals' and != for
'differs'. (Similar to the C programming language)
When FOR commands are entered in this software, the conditions are
determined first. For a case like FOR I=0 TO -1 where STEP1 will not function, it
will skip the FOR command and carry on running the commands after NEXT.
Unlike existing BASIC programs, it is not guaranteed to carry out the command
once.
This software's program text editing function allows you to store a maximum of
100 characters per line, with a maximum of 9999 lines. However, when the
memory allocated to saving text is exceeded, you will no longer be able to enter
text. The maximum number of characters you can use in a program is
approximately 520,000.
Occasionally, graphics which you have included in your program are not properly
displayed on screen. This may be caused by a variety of factors, such as the
previously run program specifying that the display should be on the Lower
Screen. If this should occur, switch to Run Mode and run the following routine:
ACLS (Enter)
If your graphics are still not displayed, it may be because the color selected is
not visible, or the graphics are made up of transparent characters. In this case,
use the COLINIT or CHRINIT commands to reset the display.
If the numbers you wish to use when performing divisions or other calculations
are all integers, use the FLOOR command. The calculation will then only be
performed using integers. When calculating coordinates, calculation errors may
combine to give slight inaccuracies.
Label names can be replaced by character string variables for a certain set of
commands. But this can only be done for those commands with which labels can
be used.
1-4
Controls
This software is a development tool, so its controls differ from those of normal
games.
+Control Pad
L,R Button
This function like the Shift key on a keyboard, letting you input
the purple characters on the keyboard. It can be used while a
program is running.
START Button
If you have a program saved, press START to run it. This can be
used while a program is running.
SELECT Button
SELECT functions like the ESC key when programs are running.
In Run Mode, the screen display can be reset by simultaneously pressing left on the
+ Control Pad, the R Button, and START. This also restores the font to its default,
making it useful after a game program when elements of the display are difficult to
view.
1-5
What is a Program?
Computers are marvelous machines that can do all manner of things, from following
people's instructions and displaying certain images on screen, to playing sounds or
detecting what is inputted via the Touch Screen.
A program is a set of instructions that tells the computer precisely what to do. Petit
Computer uses a language called BASIC, and its structure is close to the grammar
we use every day to communicate.
For example:
Display text on screen with a PRINT command
Play a sound with a BEEP command
Draw a circle on screen with a GCIRCLE command
Display a character with an SPSET command
Store a certain number in the memory by
Assigning a variable
Find out the value of a number using
Comparison and branch commands
Save your program with a SAVE command
BASIC has a huge range of instructions to get the computer to do what you want it
to. While it would be hard work to remember every single command, if you try out
different commands, you'll learn them little by little and be able to program games
and tools.
It may be challenging at first, but this software is all you need to create and run your
very own programs. Of course, sometimes you might enter the wrong command by
mistake, creating a bug.
Many of the programmers who create video games got started by using BASIC. If
you've set your sights on developing games in the future, this is a great way to
experience the fun of programming first-hand.
1-6
Glossary
Term
Characters
Info
The 8x8 pixel 16-color images used to make up sprites and BG
screens.
Color
Palette
Background(BG)
Sprite
System Icons
Pixel
Frame
VSYNC
File
Resources
The general name used in BASIC for images and programs read
from files. Some are saved in the internal memory, while others
are saved in the video memory.
Track
Channel
MML
Start Point x
Start Pont y
of a rectangular area.
End Pont x
End Point y
Transfer
Destination x
Transfer
Destination y
2. Home Menu
This lets you select and run programs and samples, Touching the Run button will
launch Petit Computer and run the program.
Error in program
SELECT pressed
In any of the cases listed above, the program that is currently running will be
cancelled you will exit Petit Computer and return to the Home Menu. All current
variable data will be lost when the program finishes. Utilize the SAVE command to
store data if required. When running programs in this mode, use the Edit button to
view the program list.
2-4 File Management
See File Management (detail) for more information on managing files.
File Management(detail)
This function allows you to delete saved files by following the instructions below:
3-2-1 Select the file you wish to delete.
3-2-2 Confirm that you wish to delete the selected file.
3-2-3 The file will now have been deleted.
3-3 Send File
This function allows you to send saved files to other users by following the
instructions below:
3-3-1 Select the file you wish to send.
3-3-2 Dialog box will appear.
(The operation is then identical to that performed by the SENDFILE command.)
3-4 Receive File
This function allows you to receive files from other users by following the
instructions below:
3-4-1 Enter the name of the file you wish to receive.
3-5-2 When the QR Code is detected, the number of pages will be displayed.
3-5-4 After the pages are read, the file will be created."
3-6 Save to SD Memory Card
"This function allows you to copy saved files onto an SD Memory Card by following
the instructions below:
3-6-1 Select the file you wish to write
3-6-2 The writing process will begin
3-6-3 The selected file will be written onto the SD Memory Card
\private\ds\app\4B4E414A\File Name
Once the file has been successfully written to the SD Memory Card, the folder above
will be created and the administrative file will be accessed.
<Please Note When Transferring Files>
Not enough available space on Memory Card/Write-Protect switch ON:
In these cases, it will not be possible to transfer data onto the SD Memory Card.
Please ensure that there is enough space and that the Write-Protect switch on your
SD Memory Card is OFF.
The properties of files on SD Memory Cards are not accessible, meaning that users
will be unable to view details of the files. Please refrain from trying to analyze or
modify file contents.
3-7 Create QR Code Tool
You cannot retrieve files saved to SD Memory Cards, but file contents can be viewed
and QR Codes created by making use of a free online application via your web
browser. For more details, please see the official Petit Computer homepage.
Touch the 'Create Program' button on the Home Menu to launch SmileBASIC.
SmileBASIC has the following three modes:
Run Mode
You can enter directly executable commands using the keyboard. (Switch from Edit
Mode with the Run button.)
Edit Mode
An editing function that allows you to write program source code. (Switch from Run
Mode with the Edit button.)
Help
See instructions for programming and a list of BASIC commands. (Switch with
Manual button.)
Manual Icon
This explains how to use this software.
Copy
Copy the line at current cursor position.
Paste
Insert a copied line into the program at current cursor position.
ABC
Symbols
Kana
Touching the Input Switch button will change the characters available on the
keyboard. Pressing SHIFT will enable you to input further characters. In Run Mode,
PNLTYPE will not switch the keyboard.
"Delete files saved using the SAVE command or change file names in Run Mode.
For more details, see 12 Run Mode Commands."
4-3 Edit Mode
Write your own programs in Edit Mode. The varieties of commands at your disposal
give you plenty of scope to create programs in your own way. To see the commands
you can use, open this manual and refer to the sections on commands and functions.
Upper Screen: Source display
Displays strings entered using the keyboard. Line numbers are automatically added
when page breaks are inserted. Up to 100 characters per line can be displayed on
screen. If the line is too long to be displayed, the line will scroll horizontally to display
the other characters.
As in Run Mode, touching the Input Switch button will change the keyboard.
4-4 Command Entry Support
If you forget commands when writing a program, you can enter letters and numbers
to search for a list of suggested commands and functions.
1) Suggestion List
Choose from suggested commands and functions in the white area below the
function keys on the lower screen.
4) Selecting a Suggestion
If you find the term you are looking for, touch it and it will be entered in your
program. This reduces the time it takes to enter a command such as GCIRCLE.
When there are too many terms to fit in the Suggestion List, press this button
to go to the next page.
4-5 Searching (in Edit Mode)
Touch the magnifying glass icon at the bottom right of the keyboard in Edit Mode and
you will be able to enter a search term below the function keys. This is useful when
you are writing a long program and wish to quickly search for labels and function
names.
Enter the search term and press ENTER to begin the search. By pressing up or down
on the +Control Pad, you can indicate whether to search above or below the current
line in the program. Press the magnifying glass icon again to exit Search Mode.
console screen and play sound. After starting Petit Computer, execute the following
commands, ensuring you have not run any sample programs beforehand. (When
there are no programs, you will always start in Run Mode )
1) Touch the Edit button to enter Edit Mode.
2) Enter PRINT ""WORDS"" in the first line.
3) Enter BEEP in the second line.
0001 PRINT ""WORDS""
0002 BEEP
4) Touch the Run button to enter Run Mode.
5) Input RUN (Enter).
WORDS
OK
Text will be displayed on screen, and a sound will be played. It is also possible to run
commands directly in Run Mode.
GLINE 0,0,255,191,15 (Enter)
This command will draw a diagonal line from the top left of the upper screen to the
bottom right.
GCLS (Enter)
This command will remove the line without affecting the text. When you're
experimenting with different commands to find out precisely what they do, it's a
good idea to do it directly in Run Mode.
Sample File
This software includes the following sample programs. For more details, see the
programming code for each.
5-1 Using Sample Files
1) Go to Run Mode
2) EXEC"SAMPLE2" (Press Enter)
3) Press SELECT to pause
4) View program in Edit Mode
By entering other sample names instead of the SAMPLE2 contained within the "",
you can check out other sample programs. You are also free to save any of the
samples included in the software under different names. You can then tweak them
to your heart's content without needing approval from SmileBoom first.
5-2 Basic Samples
These are simple programs designed to teach users how to use the standard
commands in BASIC. You can view the programs in Edit Mode and use them as a
reference when writing your own BASIC programs.
File Name
Description
SAMPE1
SAMPLE2
SAMPLE3
SAMPLE4
A number-guessing game.
SAMPLE5
A bio-rhythm program.
SAMPLE6
SAMPLE7
SAMPLE8
SAMPLE9
SAMPLE10
SAMPLE11
SAMPLE12
Description
CHRED
SCRED
GRPED
DRWED
GAME1
GAME2
A dungeon-crawling RPG.
GAME3
GAME4
GAME5
This tool can be used to create character data for backgrounds or sprites.
Select color samples and tools and input them in the Edit Area. Press A Button to
access File Mode, enter L (or S) and then press ENTER to load or save. You can
access and use saved data via programs.
(ex.) LOAD "BGU0:MYBG00"
5-5 BG Screen Creation Tool
EXEC "SCRED" (Press Enter to Run)
This is a tool for creating BG screen data, for example, creating rows of
houses. Select a character from the samples to paste them to the Edit Area. You can
access and use saved data via programs.
(ex.) LOAD "SCU0:MYSC00"
5-6 Graphic Creation Tool
EXEC "GRPED" (Press Enter to Run)
This is a tool for creating graphic data for the graphics Screen, utilizing up
to 256 colors. Select a color from the samples and draw a picture in the Edit Area.
You can access and use saved data via programs.
(ex.) LOAD "GRP0:MYGRP00"
5-7 DRWED (Drawing Pictures)
EXEC "DRWED" (Press Enter to Run)
This drawing tool can store up to 8000 commands for drawing elements
such as lines and squares. It differs from pixel art by allowing you to replay stored
data and adjust the picture as many times as you like. The picture data is stored on
the upper screen in the form of colors.
To learn more about how this tool recreates pictures using stored color data, view its
program in Edit Mode. You can take the elements used to recreate images and use
these in your own programs.
6 Sample Games
These are sample games that have been created using Petit Computer. You can view
the code for these games in Edit Mode. Feel free to adapt the program to your own
needs, making enemies weaker, for example, or adjusting the speed of bullets.
6-1 GAME 1 (Road Racer)
EXEC "GAME1" (Press Enter to Run)
Steer your car with the +Control Pad, aiming to pass over all the dots on the screen.
Your car will accelerate as it passes over dots.
three layers.
7 SPRITE
7-1 SPU0 - 1(0-127)
SPU0: Standard Game Elements
SPU7: Battleship
7-5 SPS
Standard Characters for Lower Screen
8-2 BGU1(256-511)
8-3 BGU2(512-767)
8-4 BGU3(768-1023)
9 Sound-Related Table
Preset commands and other items related to background music, BEEP and TALK are
gathered in one table.
9-1 Preset Music
No.
Info
0
Tension is Rising
Upbeat Emotion
Opening Jingle
Clear Jingle
Game Over
Menu Select
Result Screen
Staff List
10
Staff List 2
11
Classical Drama
12
Marching Band
13
Ultra-hard Rock
14
15
WOND
16
Deep in Thought
17
WOND2
18
19
BAL
20
BAL_2
21
Espionage
22
SCI
23
Shooting Song
24
Pad
25
SEN
26
Pure
27
ROA
28
CUA
29
FIG
Info
0
Beep
Noise
Cursor Movement
Confirm
Cancel
Ascend
Descend
Coin
Jump
Land
10
Fire
11
Damage
12
Metal
13
Explosion
14
Scream
15
Brake
16
Banjo
17
Synth Strings
18
Synth Brass
19
Synth Bass
20
Guitar
21
Organ
22
Piano
23
Cow Bell
24
Tom-Toms
25
Cymbals
26
27
ROA
28
CUA
29
FIG
30
Snare Drum
31
Bass Drum
32
OK2
33
BALL
34
Japan Style
35
VOLT
36
AUTO
37
SHOCK
38
ESC
39
Banjo 2
40
Scratching
41
Guitar 2
42
Organ 2
43
Piano 2
44
PASS
45
UP2
46
Record
47
Synth Tom-Toms
48
Cow Bell 2
49
Metro
50
Tri
51
Conga
52
Dance BD
53
Dance SD
54
Dance HH
55
Hit
56
Timpani
57
Chinese Cymbal
58
Mini Cymbal
59
Shaker
60
Bell
61
Japanese Drum
62
Synthesizer
63
Canorus
64
Puff!
65
Nohkan
66
Humandr1
67
Humandr2
68
Dog
69
Cat
Channel Select(:0-:7)
A single piece of music can be played using up to 8 channels.
(Please ensure that the channels are written with the lowest
number first.)
T Value
Temp(T1-T240)
$ variable
Replacing Variables
number = value
L Value
Q Value
&
Tie(Slur)
This refers to joining two sounds together to create a longer
sound.
Commands Relating to Pitch and Scale
CDEFGAB
Designating Scale
C=Do, D=Re, E=Mi, F=Fa, G=So, A=La, B=Ti.
C# D# E# F#
G# A# B#
(# can also be
note name, e.g. G4E#16, you can adjust the length of time
represented
by
+)
C- D- E- F- G- ABR
Rests
As with scales, the duration of rests can be appended to the end.
N Value
(O4C=40)
O Value
Octave (O0-O8)
This value changes the octave in which notes are played.
<
Go to Higher Octave
>
Go to Lower Octave
@D Value
Detune (@D-128-@D127)
This subtly distorts the sound waves to give a detuned effect.
_(underscore)
Portamento
This allows you to slide smoothly between two sound
frequencies.
Commands Relating to Volume and Panning
V Value
Velocity (V0-V127)
This adjusts volume when playing scales.
( Value
) Value
P Value
Panpot (P0-P127)
This value determines the panning between left and right
channels. P64=Center.
@V Value
Tone ( @0-@255 )
Values above
sound louder
than the
instrumental
151 Noise
track.
@ E Value
Define Envelope
Attack
This function lets you adjust the way the sound is played.
Value Decay
Value Sustain
(e.g.) ""@E0,99,64,64"
Value Release
Lower ADSR
values slow the
speed at which
the sound is
played, while
higher values
speed it up.
@ER
Deactivating Envelope
Commands Relating to Special Controls
Start Loop
Up to 3 elements can be nested within a loop.
] Value
This returns the sound being played to before the start of the
preceding Start Loop command. (If this value is zero or
undefined, the loop will be endless.)
An error will occur when saving MML commands if loop commands do not contain
scale, rest, and N values.
Commands Relating to Macro Definition
{Label=MML}
Macro Definition
Definition regularly-used phrases (labels can be up to 8
characters long)
{Label}
@MON
Modulation ON
This activates modulation previously assigned with @MA, @MP.
@MOF
Modulation OFF
This cancels modulation.
@MA Value
Tremolo
Depth,
Value Range,
Value Speed,
(e.g.) "@MA0,99,64,64"
Value Delay
@MP Value
Vibrato
Depth,
Value Range,
applied to notes.
Value Speed,
(e.g.) "@MP0,99,64,64"
Value Delay
@MA and @MP cannot be used at the same time. These effects can be heard as soon
as these settings are applied.
9-4 Standard Instruments (@0@127)
No.
Instrument
0
Honky-tonk Piano
Electric Piano 1
Electric Piano 2
Harpsichord
Clavi
Celesta
Glockenspiel
10
Music Box
11
Vibraphone
12
Marimba
13
Xylophone
14
Tubular Bells
15
Dulcimer
16
Drawbar Organ
17
Percussive Organ
18
Rock Organ
19
Church Organ
20
Reed Organ
21
Accordion
22
Harmonica
23
Tango Accordion
24
Acoustic Guitar(nylon)
25
Acoustic Guitar(steel)
26
Electric Guitar(jazz)
27
Electric Guitar(clean)
28
Electric Guitar(muted)
29
Overdriven Guitar
30
Distortion Guitar
31
Guitar Harmonics
32
Acoustic Bass
33
Electric Bass(finger)
34
Electric Bass(pick)
35
Fretless Bass
36
Slap Bass 1
37
Slap Bass 2
38
Synth Bass 1
39
Synth Bass 2
40
Violin
41
Viola
42
Cello
43
Contrabass
44
Tremolo Strings
45
Pizzicato Strings
46
Orchestral Harp
47
Timpani
48
String Ensembles 1
49
String Ensembles 2
50
Synth Strings 1
51
Synth Strings 2
52
Voice Aahs
53
Voice Oohs
54
Synth Voice
55
Orchestra Hit
56
Trumpet
57
Trombone
58
Tuba
59
Muted Trumpet
60
French Horn
61
Brass Section
62
Synth Brass 1
63
Synth Brass 2
64
Soprano Sax
65
Alto Sax
66
Tenor Sax
67
Baritone Sax
68
Oboe
69
English Horn
70
Bassoon
71
Clarinet
72
Piccolo
73
Flute
74
Recorder
75
Pan Flute
76
Blown Bottle
77
Shakuhachi
78
Whistle
79
Ocarina
80
Lead 1(square)
81
Lead 2(sawtooth)
82
Lead 3(calliope)
83
Lead 4(chiff)
84
Lead 5(charang)
85
Lead 6(voice)
86
Lead 7(fifths)
87
Lead 8(bass+lead)
88
89
Pad 2(warm)
90
Pad 3(polysynth)
91
Pad 4(choir)
92
Pad 5(bowed)
93
Pad 6(metallic)
94
Pad 7(halo)
95
Pad 8(sweep)
96
FX 1(rain)
97
FX 2(soundtrack)
98
FX 3(crystal)
99
FX 4(atmosphere)
100
FX 5(brightness)
101
FX 6(goblins)
102
FX 7(echoes)
103
FX 8(sci-fi)
104
Sitar
105
Banjo
106
Shamisen
107
Koto
108
Kalimba
109
Bag pipe
110
Fiddle
111
Shanai
112
Tinkle Bell
113
Agogo
114
Steel Drums
115
Woodblock
116
Taiko Drum
117
Melodic Tom
118
Synth Drum
119
Reverse Cymbal
120
121
Breath Noise
122
Seashore
123
Bird Tweet
124
Telephone Ring
125
Helicopter
126
Applause
127
Gunshot
Instrument
O1B
909BD
O2C
808BD
O2C#
Side Stick
O2D
Acoustic Snare
808SD
O2D#
Hand Clap
O2E
Electric Snare
909SD
O2F
808Tom LF
O2F#
Closed Hi-hat
808CHH
O2G
808Tom HF
O2G#
Pedal Hi-hat
808CHH
O2A
Low Tom
808Tom L
O2A#
Open Hi-hat
808OHH
O2B
Low-Mid Tom
808Tom LM
O3C
808Tom HM
O3C#
Crash Cymbal 1
808Cymbal
O3D
High Tom
808Tom H
O3D#
Ride Cymbal 1
O3E
Chinese Cymbal
O3F
Ride Bell
O3F#
Tambourine
O3G
Splash Cymbal
O3G#
Cowbell
808Cowbell
O3A
Crash Cymbal 2
O3A#
Vibra-slap
O3B
Ride Cymbal 2
O4C
High Bongo
O4C#
Low Bongo
O4D
Mute Hi Conga
808Conga MH
O4D#
Open Hi Conga
808Conga OH
O4E
Low Conga
808Conga L
O4F
High Timbale
O4F#
Low Timbale
O4G
High Agogo
O4G#
Low Agogo
O4A
Cabasa
O4A#
Maracas
808Maracas
O4B
Short Whistle
O5C
Long Whistle
O5C#
Short Guiro
O5D
Long Guiro
O5D#
Claves
808Claves
O5E
Hi Wood Block
O5F
O5F#
Mute Cuica
O5G
Open Cuica
O5G#
Mute Triangle
O5A
Open Triangle
Instrument
144
145
146
147
148
149
150
151
Noise
224
255
Character
Types
Numerical
Values
Hexadecimal
&H
(Base 16)
Notation
Binary
&B
Notation
Variables
Array
Multiple
Commands
Sub-Routines
and Nesting
available memory)
File Control
When files are being saved or loaded, users will be unable to input
Structure
Save/Load
Resource units (The user cannot freely load and save files as they
Units
File Names
Addition (A+B)
Subtraction (A-B)
Multiplication (A*B)
<
>=
Value on left is equal or greater than value on right (A=B) NOTE = will
not function
<=
Value on left is equal or less than value on right (A=B) NOTE = will not
function
==
/=
OR
Logical OR (A OR B)
XOR
Exclusive OR (A XOR B)
NOT
Negation (NOT A)
Order of Operations
1
Sections inside ( ) [ ]
Minus, NOT
Functions
+-
The text editor in Edit Mode allows you to edit one line at a time.
Pressing ENTER will automatically assign a line number. Text will not be
wrapped.
Line
1-9999 (when individual lines are very long, you may be unable to use
Limitations
Line
Line numbers are treated as lines in a text editor. When new line
Numbers
Characters
Up to 100 characters can be entered on a single line. The line will scroll
Per Line
Software keyboard
(alphanumeric characters and symbols)
Hardware
Can be used. (SELECT is used as the ESC key. The L Button and START
Buttons
Touch
Panel
10-5 Display
Display Order
Priority
screens.
Front
Console Screen
Upper Screen
Display Levels
Back
Front
Keyboard or Panel
Lower Screen
Display Levels
Back
Graphic
256x192 pixels
Resolution
Characters on
Console Screen
additional 1 line)
Animation
Functions
Character
Functions
SPU
Number of
Colors
Displayed
BG
Simultaneously
SP
GRP
Palette
Colors for SPRITE and BG are divided into units called palettes.
Palettes each have 16 colors, including a transparent one, each of
which has a number assigned to it.
Text Color
The 15th color in the designated palette for SPRITE and BG is used
for text color. If this color is changed, the color of the text on
screen will change accordingly.
Background
Color
Simultaneous
Channels
Sound Effects
Voice
Text entered is read using voice synthesis. The emotion, pitch, and
Synthesis
Background
Music Source
Background
Music
Waveform
Definition
BGM
30 Preset Songs
128 User-Defined Songs
Maximum of 8 Songs Played Simultaneously
Syntax error
Out of range
Out of memory
Undefined label
Out of DATA
Duplicate definition
Cant continue
10
Missing operand
11
Duplicate label
12
13
14
15
Division by zero
16
Overflow
17
18
Type mismatch
19
20
21
22
Illegal MML
While user's programs are running, SPSET or SPCHR commands can be used to
adjust the order of precedence in which sprites are displayed on the graphic, front
and rear BG screens.
Background
Color
Graphic
The screen which you can color or draw lines, curves and more on.
Screen
User BG
Screen
(Rear)
User BG
Screen
(Front)
Console
This screen is where the keyboard, control panel, file select etc. are
Screen
displayed
Lower Screen
The lower screen is composed of five separate layers, listed from the back: the
background color screen, the graphic screen, the user's rear BG (background)
screen, the user's foremost BG (background) screen, the keyboard, and the panel
components. It normally displays the keyboard screen, but when running programs,
background and graphics can be used via PNLTYPE commands.
Background
Color
Graphic
The screen on which you can color or draw lines, curves and more.
Screen
User BG
User BG Screens
Screens
(Front Rear)
Keyboard,
This screen is where the keyboard, control panel, file select etc. are
Panel
displayed
components
11-2 Color Palette
In this software, the console, background screens, and sprites and graphics are all
distinct graphical elements:
- Console characters and BG (background) screens
- Sprites
- Graphics
For each element, a separate color palette is available. For the BG screens,
characters and sprites, colors are divided into units of 16 (the color code 0 is
transparent). For graphics, a palette of 256 colors can be used.
Each color available for the BG screens and sprites is divided into 16 with color codes
along the top, and palette codes along the side.
Use the COLSET command to change the palette to your preferred colors. In general,
if you keep darker shades on the left side of the screen, and have brighter colors as
you move towards the right, this will avoid having a confusing mix of colors in your
palette."
For Console Characters, Background or Sprites
Palette / Color code
(Color code 0 = Transparent)
Colors are divided, with 3 colors assigned for each application (App. 1-4). Colors are
defined as dark, normal and bright.
Graphics
Palette / Color code
BGU1
BGU2
BGU3
11-3 User Sprite Characters
When you wish to display a character on the sprite screen and have it move in four
directions, select each of the four directions (up, down, left, right) by assigning a
sprite character number from the SPU resources.
For example, for SPU1 resources, inputting sprite character numbers 64-67 (right),
68-71 (down), 72-75 (left) and 76-79 (up) will cause the sprite to move in a
clockwise direction on the screen. The SPANIM command allows simple animation.
Character images can be freely adjusted by users.
11-5 Keyboard Display
Touch a string and that string will be displayed on the console screen. Touch SHIFT
or press
Alphabet
Symbols
Kana
Unlike previous BASIC programs, this program does not contain control codes from
0-31.
Screen
Characters
Color
SPU0SPU7
Graphics
BGU0BGU3
Memory
LOAD
SAVE
PRG
CHR
CHR
CHR
CHR
COL
RPG
SCR
COL
COL
GRP
COL
MEM
GRP
CHR
GRP
PRG
MEM
GRP
MEM
PRG
SCR
SCR
SEND FILE
RECV FILE
SEND FILE
RECV FILE
Files
PRG
COL
CHR
SCR
LOAD
Files
MEM
PRG
PRG
CHR
MEM
SAVE
Resources
LOAD
SAVE
Resources
12-2 Loading
Input the LOAD command:
LOAD "PRG:SAMPLE01"
Process is paused.
Data loaded from file to designated
memory resource.
Error dialog box is displayed and
Loading is completed. Continue
process ends.
operations.
12-3 Saving
Input the SAVE command:
SAVE "PRG:SAMPLE01"
Process is paused.
Dialog box displayed: 'Save file' Select 'OK' to continue.
If a file of the same name already
is insufficient memory.
ends.
DATA 123,345,56,"SAMPLE"
DATE$
Variable=DEG(radian value)
DELETE "resource name:file name"
DIM pos[4]
<color rgb5=00001f>DIM sample[10,5]
DTREAD (date string),YEAR,MON,DAY
E
ELSE
END
ERL
ERR
EXEC "PRG:file name"
Variable=EXP (number)
F
FALSE
FILES [resource name[,resource name...]]
Variable=FLOOR (number)
FOR variable=initial value TO final value [STEP increase]
FREEMEM
FREEVAR
FUNCNO
G
GBOX start x, start y, end x, end y [,color]
GCIRCLE x, y, radius [,color [, initial angle, final angle]]
GCLS [color]
GCOLOR color number
GCOPY [transfer page,] start x, start y, end x, end y, destination x, destination y,
copy mode
GDRAWMD status
GFILL start x, start y, end x, end y [,color]
GLINE start x, start y, end x, end y [,color]
GOSUB label
GOSUB variable$
GOTO @label
GOTO variable $
GPAGE screen [, drawing page][, display screen]
GPAINT x, y [, color [, border color]]
GPRIO number
GPSET x, y [,color]
GPUTCHR x, y, "character name", number, palette number, scale
Variable=GSPOIT(x,y)
H
Variable$=HEX$ (numerical value[, decimal places])
I
Numerical value=ICONCHK()
ICONCLR [ icon position ]
ICONPAGE
ICONPMAX
ICONPUSE
ICONSET icon position,icon number
When the IF condition is met, the designated command following THEN will be
performed.
IF condition is met THEN @label
When the IF condition is met, the designated command following THEN will be
performed. When these conditions are not met, the command following ELSE will be
performed.
IF condition THEN @label ELSE label
IF (condition) GOTO @label
IF condition is met GOTO @label. If condition is not met, the command after ELSE is
performed.
IF condition GOTO @label ELSE @label
Variable$=INKEY$()
INPUT ["string";] received variable
INPUT ["string";] received variable$
INPUT ["string";] received variable,
received variable$
Variable = INSTR ("string", "search target string")
K
PRINT "string"
PRINT variable
PRINT variable$
PRINT variable;variable$;"string"
PRINT "string",variable,variable$
R
Variable=RAD(angle)
READ obtained variable1[,obtained variable2...]
READ A
READ B$
READ X,Y,Z,G$
REBOOT
RECVFILE "resource name:file name"
REM The following is a comment
'commenttext
RENAME "resource name:file name","new name"
RESTORE @label
RESTORE variable$
RESULT
RETURN
Variable$ = RIGHT$ ("string", character count)
Variable=RND(max value)
RSORT start point, number of elements, array 1 [, array 2...]
RUN
S
SAVE "resource name:file name"
SENDFILE "resource name:file name"
Variable=SGN(variable)
Variable=SIN(radian value)
SORT start point, number of elements, array 1 [, array 2...]
SPANGLE control number,angle [,interpolation time,change direction]
SPANIM control number,number of frames,time [,loop]
Variable=SPCHK(control number)
SPCHR control number, sprite character number [,palette number, horizontal
rotation, vertical rotation, order of precedence]
THEN
TIME$
TMREAD (time string),HOUR,MIN,SEC
TO
TRUE
V
Variable=VAL(string)
VERSION
VISIBLE console,panel,BG0,BG1,SPRITE,256 color graphics
VSYNC frame number
W
WAIT frame number
X
XOR
15 System Variables
15-1 Numeric System Variables
R
(R=Read, W=Write)
CSRX
CSRY
FREEMEM
VERSION
ERR
ERL
RESULT
TCHX
TCHY
TCHST
Touch status
(TRUE = Touched)
TCHTIME
MAINCNTL
MAINCNTH
TABSTEP
TRUE
Always 1
FALES
Always 0
CANCEL
Always -1
ICONPUSE
FALSE=Don't use
TRUE=Use
ICONPAGE
ICONPMAX
FUNCNO
FREEVAR
SYSBEEP
OFF)
KEYBOARD
SPHITNO
SPHITX
SPHITY
SPHITT
(R=Read, W=Write)
TIME$
DATE$
MEM$
PRGNAME$
PACKAGE$
The package data for the last file read by the system
is stored.
The system variable KEYBOARD is a special variable that allows the gathering of
keyboard data that cannot be gained from INKEY$. The values gained are not
numbers corresponding to characters, but are values that correspond to keys on the
keyboard. If nothing is inputted, the KEYBOARD variable will be 0.
NEW
Parameters
None
Returns
None
Error
16-2 LIST
Switches to Edit Mode and begins edit.
Format
LIST
LIST @label
LIST line number
Parameters
Line number
@label
Returns
None
Error
16-3 RUN
This runs the program.
Format
RUN
Parameters
None
Returns
None
Error
17 CONT
Continues a program stopped with a STOP command.
Format
CONT
Parameters
None
Returns
None
Error
16-5 FILES
Format
Parameters
Returns
PRG
MEM
Memory
COL
Color
GRP
Graphics
SCR
User screen
CHR
User character
None
Error
16-6 REBOOT
Exit BASIC and return to the Home Menu.
Programs you are currently editing will be lost, as well as other data, including
characters you are creating and color settings. If you wish to use any elements from
your current program again, please use the SAVE command.
Format
REBOOT
Parameters
None
Returns
None
Error
CLEAR
Parameters
None
Returns
None
Error
17-2 =(LET)
Assign (an abbreviation of the LET command)
Format
ABC=123
TEXT$=ABCDE
Parameters
None
Returns
None
Error
17-3 DIM
Array declarations
Element count for up to 2 dimensions.
Element count can be defined up to a total of 262144."
Format
DIM pos(4),size(4)
DIM sample(10,5)
DIM MSG$(15)
Parameters
None
Returns
None
Error
17-4 `(REM)
For annotations(comments).
The text following this command up to the next linebreak will be ignored.
Format
Parameters
None
Returns
None
Error
17-5 @(Label definition)
Declaration of the name, giving the line number.
This always needs to be added at the start of a row. The character string following @
will become the name under which it is saved. It can be used to give destinations
with commands such as GOTO and GOSUB.
Format
@label name
Parameters
Label name
Returns
None
Error
17-6 KEY
Assigning Strings to Function Keys
When used in a user-created program, the string data assigned to the function key
will be entered in the program when that key is pressed.
Format
Parameters
Number
String
Returns
None
Error
Parameters
Returns
Variable 1
First variable
Variable 2
Second variable
None
Error
18-2 SORT
This arranges values in ascending order (199) in a one-dimensional array.
Format
Parameters
Start Position
Number of Elements
Total to be Arranged
Array 1
[ array 2 ]...
Returns
None
Error
NEXT
SORT 0,10, V, IX
PRINT
FOR I=0 TO 9
PRINT I;"=";IX(I);":";V(I)
NEXT
18-3 RSORT
This arranges values in descending order (991) in a one-dimensional array.
Format
Parameters
Refer to SORT
Returns
None
Error
18-4 VSYNC
Same length as screen renewal time (waiting for graphics to be renewed).
Format
Parameters
Frame number
Returns
None
Error
18-5 WAIT
A simple wait command.
Format
Parameters
Frame number
Returns
Error
None
19 Branch Instructions
The following commands allow you to call routines and set branch instruction
conditions:
ONGOTO, ONGOSUB, GOTO, GOSUB, RETURN, STOP, END
19-1 ON GOTO
Causes program to branch depending on numeric values.
Format
Parameters
Variables
Returns
None
Branch Number (0
Error
19-2 ON GOSUB
Calls a sub-routine based on number
Format
Parameters
Variables
Returns
None
Branch Number (0
Error
19-3 GOTO
Forced branch.
Instead of an label, you can also use a text string variable substituted for the label
name.
Format
GOTO @label
GOTO variable
Parameters
@label
Returns
None
Error
19-4 GOSUB
Call sub-routine
Instead of an label, you can also use a text string variable substituted for the label
name.
Format
GOSUB @label
GOSUB variable
Parameters
@label
Returns
None
Error
19-5 RETURN
Returns from a sub-routine.
Always use this command in conjunction with GOSUB.
Format
RETURN
Parameters
None
Returns
None
Error
19-6 STOP
Forces the currently running program to stop and returns to the console.
Format
STOP
Parameters
None
Returns
None
Error
19-7 END
Ends the program.
Format
END
Parameters
None
Returns
None
Error
20 Repeat/Comparison Commands
The following commands allow you to repeat routines the designated number of
times or judge conditions:
FOR~TO~STEP, NEXT,
IF~THEN, IF~GOTO
20-1 FOR TO STEP
Repeat the designated number of times
If STEP has been omitted, it will be treated as STEP1. If increase is added and the
final value is less than the initial value, the FOR command will be skipped and the
NEXT and subsequent commands will be run.
Format
Parameters
Variables
Initial Value
Number at Start
Final Value
Number at End
Increase
Returns
None
Error
20-2 NEXT
End of Loop
Always use as in conjunction with a FOR command
Format
Parameters
Variable name
Returns
None
Repeated variable
Error
20-3 IF THEN ELSE
Conditional Judgment
The IF command does not work across multiple lines.
Format
Parameters
Conditional
If condition met
Command/Branch destination
Command/Branch destination
None
Error
20-4 IF GOTO ELSE
Conditional Judgment
The IF command does not work across multiple lines.
Format
Parameters
Returns
Error
Conditional
If condition met
Command/Branch destination
Command/Branch destination
None
21 READ
Read Commands
The following commands relate to reading data and related tasks:
READ, DATA, RESTORE,
TMREAD(), DTREAD()
21-1 READ
Reads DATA.
Format
Parameters
Obtained variable...
Returns
None
Error
21-2 DATA
Definition of data to be read with READ command
can include a mix of alphanumeric characters.
Format
Parameters
Data
Returns
None
Error
21-3 RESTORE
Changes position of DATA to be READ.
Instead of an label, you can also use a text string variable substituted for the label
name.
Format
RESTORE @label
RESTORE variable</color>
Parameters
@label
Acquisition Position
Returns
None
Error
22-4 TMREAD()
Convert time string into number.
Format
Parameters
Time string
Returns
HOUR
MIN
SEC
None
Error
22-5 DTREAD()
Convert the date string into a number.
Format
Parameters
DATA string
Returns
Error
YEAR
MON
DAY
None
CLS
Parameters
None
Returns
None
Error
22-2 COLOR
Caractor coler is specified on console display.
Format
Parameters
Character Color
Background Color
Returns
015 (0=transparent)
None
Error
22-3 LOCATE
Designates the position of the character display on the console.
Format
Parameters
x coordinate
y coordinate
Returns
None
Error
22-4 PRINT
Displays characters on the console.
Format
PRINT "string"
PRINT variable
PRINT variable$
PRINT variable;variable$;string
PRINT "string",variable,variable
Parameters
Returns
None
Error
22-5 CHKCHR()
Search for character numbers on the console.
Format
Parameters
x coordinate
y coodinate
Returns
Number
0-255=character code
(-1=outside range)
Error
22-6 ACLS
Reset Graphic Display Environment
Format
ACLS
Parameters
None
Returns
None
Error
The program below will return settings such as console, SPRITE, BG, graphic display
status and color settings to their default:
VISIBLE 1,1,1,1,1,1: ICONCLR
COLOR 0: CLS: GDRAWMD FALSE
FOR P=1 TO 0 STEP -1
GPAGE P,P,P: GCOLOR 0: GCLS: GPRIO 3
BGPAGE P: BGOFS 0,0,0: BGOFS 1,0,0
BGCLR: BGCLIP 0,0,31,23
SPPAGE P: SPCLR
NEXT
FOR I=0 TO 255
COLINIT "BG", I: COLINIT "SP", I
COLINIT "GRP",I
NEXT
22-7 VISIBLE
Control of screen display elements (using 0 will cause a particular element not to be
displayed, while using 1 will display it).
Format
Parameters
Console
Panel
BG0
BG1
Sprite
Graphic
Returns
Error
None
Variable$=INKEY$0
Parameters
None
Returns
Character variable
Error
23-2 INPUT
Obtain numbers or strings.
Format
Parameters
String
Received variable
Returns
None
Error
23-3 LINPUT
Retrieves string, including characters like ',' which cannot be entered via INPUT.
Format
Parameters
String
Received variable
Returns
None
Error
23-4 BUTTON()
This returns data from each button pressed.
When buttons are pressed simultaneously, the data is retrieved in bit from. For
instance, if up and right are pressed at the same time, the value 9 is returned. When
using values beside those for buttons being pressed, use VSYNC1 to synchronize the
action, completing it within 1/60th of a second during the man loop. Completing it
within 1/60th of a second during the main loop.
Format
Variable=BUTTON( [type] )
Parameters
Returns
Pressed
Instant pressed
Instant released
Up on +Control Pad
16
A Button
32
B Button
64
X Button
128
Y Button
256
L Button
512
R Button
1024
START
Error
23-5 BTRIG()
This returns data from the instant a button is pressed.
To use a precise value, use VSYNC1 to synchronize the a action, completing it within
1/60th of a second during the main loop.
Format
Variable=BTRIG()
Parameters
None
Returns
Variable
Variable corresponding to
button *BUTTON() Reference
Error
23-6 BREPEAT
Data Settings for Repeated Button Presses
The multiple button press function is usually set to OFF. Use this command to
activate it. When you designate a button using the Button ID, that button's repeated
press function will be switched OFF as standard. The unit of time 1 corresponds to
1/60th of a second.
Format
Parameters
Up on +Control Pad
A Button
B Button
X Button
Y Button
L Button
R Button
10
Returns
Error
START
Start Time
0-
Interval
1 (0=Pause)
None
Parameters
Panel name
Strings that select type to be displayed on Lower Screen:
Returns
OFF
No panel is displayed
PNL
KYA
English keyboard
KYM
Symbol keyboard
KYK
Kana keyboard
None
Error
24-2 PNLSTR
String Display on Lower Screen.
Unlike on the console on the upper screen, line breaks will not be added
automatically, even when displaying the last line.
Format
Parameters
x coordinate
y coordinate
Palette number
Returns
0 15
None
Error
24-3 ICONSET
Settings for user system icon characters (or to initiate display).
Format
Parameters
Icon position
Icon number
Returns
None
Error
24-4 ICONCLR
Cancels display of user system icons.
Format
Parameters
Icon position
Returns
None
Error
24-5 ICONCHK()
Check current status of user system icons.
Format
Number = ICONCHK()
Parameters
None
Returns
Number
Error
Parameters
Resource Name
Strings assigned to the resources to be read.
PRG
MEM
Memory
COL0
BG Colors
COL1
SPRITE Collors
COL2
Graphic Colors
GRP0
:
GRP3
SCU0
Foreground layer
SCU1
Background layer
BGU0
Users GB Characters(Bank x 4)
:
BGU3
SPU0
:
SPU3
Display control
Returns
None
Error
Result
FALES
TRUE
CANCEL
25-2 SAVE
This saves a file. (A dialog box confirming the decision will appear.)
You cannot use filenames that match the names of files included as samples with
this software.
Format
Parameters
Resource name
Returns
None
Error
RESULT
*Refer to LOAD
FALES
TRUE
CANCEL
25-3 DELETE
Erases file.
You cannot delete files included as samples with this software.
Format
Parameters
Returns
None
Error
RESULT
*Refer to FILES
FALES
TRUE
CANCEL
25-4 RENAME
Changes file names.
Format
Parameters
Returns
None
Error
RESULT
*Refer to FILES
FALES
TRUE
CANCEL
25-5 RECVFILE
Receive a Petit Computer file another user has saved on their DSi system (displays
confirmation message).
Format
Parameters
Returns
None
*Refer to FILES
Error
RESULT
FALES
TRUE
CANCEL
25-6 SENDFILE
Send files to another user who has a DSi with Petit Computer saved on it.
Format
Parameters
Returns
None
Error
RESULT
*Refer to FILES
FALES
TRUE
CANCEL
Parameters
File name
Returns
None
Error
RESULT
FALES=Failure
26-2 EXEC
Loads and runs other programs from within the current program.
Format
Parameters
File name
Returns
None
Error
RESULT
Parameters
Returns
None
Error
RESULT
FALES
TRUE
CANCEL
BGU0U
COL1U
SPU7
SCU0U
SPU6
SCU1U
SPU0
0011
0110
0001
1100
0001
b01
b02
b03
b04
b05
b06
b07
b08
b09
b10
b11
b12
b13
b14
b15
b16
b17
b18
b19
b20
b21
b22
b23
System Reservation
b24
System Reservation
b25
System Reservation
b26
System Reservation
b27
b28
b29
b30
b31
b32
b33
b34
b35
b36
b37
System Reservation
b38
System Reservation
b39
System Reservation
b40
System Reservation
b41
System Reservation
b42
System Reservation
b43
System Reservation
b44
System Reservation
b45
Unused
b46
Unused
b47
Unused
Parameters
Number
Number
Returns
Number
Requested result
Error
27-2 RND()
Gives a random number up to the designated value.
Format
Parameters
Maximum Number
Returns
Number
Error
27-3 ABS()
Obtains an absolute value.
Format
Parameters
Number
Returns
Number
Absolute value
Error
27-4 SGN()
Obtains a code.
Format
Parameters
Number
Returns
Number
0 or +1,-1
Error
Parameters
Number
Returns
Number
Requested result
Error
28-2 EXP()
Looks for the exponent value.
Format
Parameters
Number
Returns
Number
Requested result
Error
28-3 LOG()
Calculated natural logarithm.
Format
Parameters
Number
Returns
Number
Calculated result
Error
28-4 POW()
Use this command to return an exponential value - multiplying a number by the
power of another number.
Format
Parameters
Number
Returns
Exponential value
Error
When the value is a negative number and the exponential value is not
a whole number (integer).
29 Trigonometric Functions
The following mathematical functions allows you to perform calculations including
the value of sine and cosine:
PI(), RAD(), DEG(), SIN(), COS(), TAN(), ATAN()
29-1 PI()
Obtains value of PI.
Format
Variable=PI()
Parameters
None
Returns
Number
Error
29-2 RAD()
Obtain a radian figure from angle data.
Format
Variable=RAD(angle)
Parameters
Angle
0 360
Returns
Number
Error
29-3 DEG()
Obtains angle data from radian value.
Format
Variable=DEG(radian)
Parameters
Radian
0 2
Returns
Number
Error
29-4 SIN()
Returns sine value.
Format
Variable=SIN(radian)
Parameters
Radian
Returns
Number
Requested result
Error
29-5 COS()
Returns cosine value.
Format
Variable=COS(radian)
Parameters
Radian
Returns
Number
Requested result
Error
29-6 TAN()
Returns tangent value.
Format
Variable=TAN(radian)
Parameters
Radian
Returns
Number
Requested result
Error
29-7 ATAN()
Obtains the arc tangent value.
Can also be used as a function for determining direction from 2 parameters ( Y, X )
and displacement. Desired direction=ATAN( destination y-y, destination x-x )
Format
Variable=ATAN(radian)
Parameters
Radian
Returns
Number
Requested result
Error
Variable=ASC(character)
Parameters
Character
Single Character
Returns
Number
Error
30-3 VAL()
Obtains a number from a string.
Format
Variable=VAL(string)
Parameters
String
Returns
Number
Error
30-4 STR$()
Obtain a string from a number.
Format
Variable=STR$(number)
Parameters
Number
Returns
Character
Error
30-5 HEX$()
Gives a hexadecimal string from a number.
Format
Decimal Places
Character
Error
Variable=LEN(string)
Parameters
String
Returns
Number
Error
31-2 MID$()
Extracts a string of a designated length starting from the initial position within the
target string.
Format
Parameters
String
Original string
Initial position
Number of characters
Number of characters to be
retrieved
Returns
Character
Extracted string
Error
31-3 RIGHT$()
The designated number of characters will be obtained, counting from the right side
of the character string.
Format
Parameters
Number of characters
Original string
Number of characters
Number of characters to be
retrieved
Returns
Error
31-4 LEFT$()
Character
Extracted string
The designated number of characters will be obtained, counting from the left side of
the character string.
Format
Parameters
String
Original string
Number of characters
Number of characters to be
retrieved
Returns
Character
Extracted string
Error
31-5 INSTR
This will search for a particular character string within the designated search range.
Format
Parameters
Number of characters
Original string
Number
Returns
(0, -1=None)
Error
31-6 SUBST$
Use this command to replace a character string.
Format
Parameters
String
Original string
Initial position
Returns
Number of characters
Character
Error
GPAGE screen
Parameters
Screen
0=Upper Screen
1=Lower Screen
Returns
None
Error
32-2 GCOLOR
Assigns graphic color on graphic screen.
Format
Parameters
Color number
Returns
None
0 - 255
Error
32-3 GCLS
Erases images on designated graphic screen.
Format
GCLS [ color ]
Parameters
Color
Returns
None
0 - 255
Error
32-4 GSPOIT()
Checks color of designated location.
Format
Parameters
x coordinate
y coordinate
Color
Returns
Error
None
Parameters
x coordinate
y coordinate
Color
Returns
None
Error
33-2 GPAINT
Fills in color from designated point.
Where the border color has been designated, the area this border surrounds will be
filled with a single color. To save time, any color adjacent to the designated location
which has the same color will be filled in. This does not work in XOR display mode.
Format
Parameters
x coordinate
y coordinate
Returns
Color
Border Color
0 255
None
Error
33-3 GLINE
Draws a line.
Format
GLINE x start point, y start point, x end point, y end point [ ,color ]
Parameters
x start point
y start point
x end point
y end point
Color
Returns
None
Error
33-4 GBOX
Draws a box.
Format
GBOX x start point, y start point, x end point, y end point [ ,color ]
Parameters
x start point
y start point
x end point
y end point
Color
Returns
None
Error
33-5 GFILE
Fills in color of a rectangle.
Format
GFILE x start point, y start point, x end point, y end point [ ,color ]
Parameters
x start point
y start point
x end point
Color
Returns
None
Error
33-6 GCIRCLE
Drawas a circle.
Format
Parameters
x coordinate
y coordinate
Radius
Color
Initial angle
Final angle
Returns
Error
None
Parameters
Screen
0=Upper Screen
1=Lower Screen
Returns
Drawing Page
03
Display Page
03
None
Error
On the upper and lower screen, you can allocate the pages to be displayed from a
total of 4. First, select either the upper or lower screen and then allocate the pages
you wish to have displayed on it. You can use drawing commands such as GPAINT to
draw on a page that has not been selected for on-screen display. When you have
finished the graphics, it is possible to then switch to this screen when you wish to
have it displayed.
34-2 GPRIO
Modifying Display Order Priority on the Graphic Screen
As standard, the display always appears behind the sprites on screen. The values for
the display order priority are designed for sprite display.
Format
GPRIO Number
Parameters
Number
Returns
None
03
Error
34-3 GDRAWMD
This is used to designate drawing color in XOR Display Mode.
When using the XOR display mode, you can erase the contents of an image by
drawing an image twice in the same place.
Format
GDRAWMD Status
Parameters
Status
FALSE=Normal color
TRUE=XOR
Returns
None
Error
34-4 GCOPY
This command copies the graphic screen.
Format
Parameters
x coordinate
y coordinate
Returns
Character name
*Refer to CHRINIT
Character number
Scale
Magnification (1,2,4,8)
None
Error
34-5 GPUTCHR
This displays the assigned character graphic data on the graphic screen.
This command will copy the data for the designated palette number to the graphic
palette. The assigned location will be colored with the 16th shade of the 16th color
from the designated palette number.
Format
03
Start point x
Start point y
End point x
END point y
Transfer destination x
0 255
Transfer destination y
0 191
Copy mode
Copy of Color 0
FALES = Do not perform
True = Perform
Returns
Error
None
Parameters
BG screens
SP
Sprites
GRP
Color number
Returns
Graphics
0 255
None
Error
35-2 COLSET
Assign new color
BG number 0 is the background color
Format
Parameters
*Refer to COLINIT
Color number
*Refer to COLINIT
Returns
None
Error
35-3 COLREAD()
Retrieves designated color data. (Each element 0~255)
Format
Parameters
*Refer to COLINIT
Color number
*Refer to COLINIT
Returns
None
Error
35-4 CHRINIT
Resets designated character to initial state.
Format
Parameters
Character name
Strings designating character:
BGU0
User BG character
:
BGU3
SPU0
:
SPU7
Returns
None
Error
35-5 CHRSET
Define a single character (8x8 pixel units)
Format
Parameters
Character name
*Refer to CHRINIT
Character Number
0 255
Graphic string
Returns
Error
None
(e.g.) A hexadecimal string has been generated from the character shown above:
5554441255444111544411164441116644111666411166671116667731666777
(each character represents 1 pixel)
35-6 CHRREAD()
Retrieves data for the designated character.
Format
Parameters
Character name
*Refer to CHRINIT
Character Number
*Refer to CHRINIT
C$
Returns
Error
None
SPPAGE screen
Parameters
Screen
0 = Upper Screen
1 = Lower Screen
Returns
None
Error
36-2 SPSET
Sprite definition (activation).
Activates a sprite designated by a control number. The coordinates are reset to 0,0.
Once a sprite has been activated using SPSET and you wish only to change the
character number, use the SPRCHR command.
Format
Parameters
Control number
0 99
Palette number
015
horizontal rotation
0=None
1=Horizontal rotation
Vertical rotation
0=None
1=Vertical rotation
Order of Priority
In front of console
In front of BG (front
layer)
Between 2 BG layers
8, 16, 32, 64
(Unless specified, this value will
be 16)
height
8, 16, 32, 64
(Unless specified, this value will
be 16)
Returns
None
Error
The following combinations of height and width values cannot be assigned: 8x64,
16x64, 64x8, 64x16
36-3 Rules for Storing Sprites
When the SPSET command has been used to assign sprite size, attention should be
paid to the size and the character number of the displayed sprite. A character
defined in the normal way will be stored as a unit of 16x16 pixels. If a character of a
different size is used, its positioning will have to be adjusted as required.
8x8
16x8
32x8
64x8(Not
Permitted)
8x16
16x16
32x16
64x16(Not
Permitted)
8x32
16x32
32x32
64x32
8x64 (Not
16x64 (Not
Permitted)
Permitted)
32x64
64x64
36-4 SPCLR
Erase sprite (Prevent sprites being activated)
Format
Parameters
Control number
Returns
None
Error
36-5 SPHOME
Designating Start Point for Sprite Display
When this command is omitted, the start point for the display will be assigned as top
left (0,0).
Format
Parameters
Control number
0~99
0~63
0~63
Returns
Error
None
Parameters
x coordinate
1024
(Values outside valid range may
be used)
y coordinate
1024
(Values outside valid range may
be used)
Interpolation time
Returns
None
Error
37-2 SPCHR
Changes the sprite character number.
Format
Parameters
Control number
0 99
Returns
Palette number
0 15
Horizontal rotation
0=none, 1=rotate
Vertical rotation
0=none, 1=rotate
Order of precedence
03
None
Error
37-3 SPANIM
Displays sprite animation.
Starting with the current designated character number, using this command will
make the character number change at defined intervals, It will change within the
range of the designated number of frames.
Format
Parameters
Control number
0 99
Number of frames
Time
Loop
Returns
None
Error
37-4 SPANGLE
This is used to modify the angle of sprites.
From the initial position, the start point for rotation will be at the top left of the sprite.
To modify the point around which the sprite rotates, use the SPHOME command.
Format
Parameters
Control number
0 31
Angle
Interpolation time
Change direction
1=Clockwise
-1=Anticlockwise
(if omitted, will be clockwise)
Returns
None
Error
37-5 SPSCALE
Changes the scaling of sprites.
When using SPANGLE to rotate a sprite with a scale of 200%, any section of the
sprite that protrudes beyond the rectangular area corresponding to this 200% will
not be displayed.
Format
Parameters
Control number
0 31
Scale
Interpolation time
Returns
Error
None
Parameters
Control number
0 99
Returns
Number
Coordinate
b01
Angle
b02
Scale
b03
Play Animation
Error
38-2 SPREAD()
This command is used to read sprite data.
This allows you to obtain data relating to angles and new coordinates when
interpolation is used.
Format
Parameters
Control number
0 99
Scale
Returns
Error
38-3 SPSETV
None
Parameters
Control number
0 99
Variable number
07
Value
Number
Returns
None
Error
38-4 SPGETV()
This is used to read the pre-set variables assigned to each sprite.
Format
Parameters
Control number
0 99
Variable number
07
Number
Variable control
Returns
Error
Parameters
Control number
0 99
64
64
Width
1 64
Height
1 64
Scale Adjustment
FALSE=Ignore
TRUE=Synchronize
Group
Returns
None
Error
You can allocate bits as you like within the group. For instance, the 4 lower bits could
be player data, while the 4 upper bits could be enemy data. For collision detection
between players and enemies, insert an &HF0 into the group.
b00
Player
b01
Players Shots
b02
Effect
b03
Item
b04
Enemy
b05
Enemys Shots
b06
Boss
b07
Background Obstacles
39-2 SPCOLVEC
This defines movement speed for use in collision detection.
This is used when the amount of movement (displacement) needs to be defined.
When this is not required, the displacement can be omitted. When this command is
not run, it will be automatically calculated using the time assigned with SPOFS and
the value obtained from the destination. When movement time is not assigned with
SPOFS, the displacement will be given as 0.
Format
Parameters
Control number
0 99
Displacement x
16.0
Displacement y
16.0
Returns
None
Error
39-3 SPHIT()
This detects sprite collision.
This command is used to detect collision between sprites from the same group.
When sprites collide, data from the other sprite will be preserved as system
variables.
Format
Parameters
Control number
0 99
Returns
Results
TRUE = Collision
Error
39-4 SPHITSP()
This detects collision between sprites.
This command is used to detect collision between the user's sprites, and those of the
designated opponent's sprites. Following collision, the opponent's sprite data will be
retained as system variables.
Format
Parameters
Control number
0 99
0 99
Results
TRUE = Collision
Returns
Error
39-5 SPHITRC()
This detects collision between sprites and blocks.
This command detects collision between sprites and blocks of the size designated by
you. Following collision, the sprite data of the sprite defined as the opponent will be
retained as system variables.
Format
Parameters
Returns
Error
Control number
0 99
x start point
1024
y start point
1024
Width
Height
Displacement x
16.0
Displacement y
16.0
Results
TRUE = Collision
40 BG Basic Commands
The following commands allow you to perform tasks such as designating the BG
screen to be controlled, altering display offsets and writing onto assigned BG screen
positions:
BGPAGE, BGCLIP, BGOFS, BGPUT, BGREAD()
40-1 BGPAGE
Designates the BG screen to be controlled.
Format
BGPAGE screen
Parameters
Screen
0=Upper Screen
1=Lower Screen
Returns
None
Error
40-2 BGCLR
Clears the BG screen (filling it with character 0)
Format
BGCLR [ layer ]
Parameters
Layer
0=Foreground,1=Background
(Applies to both if not specified)
Returns
None
Error
40-3 BGCLIP
Assigns display parameters (for all layers).
Format
Parameters
x start point
031
y start point
023
x end point
031
y end point
023
Returns
None
Error
40-4 BGOFS
Alters offset of BG screen display.
Format
Parameters
Layer
0=Foreground
1=Rear
x coordinate
y coordinate
Interpolation time
Returns
None
Error
40-5 BGPUT
Writes onto designated location on BG screens.
Format
Parameters
Layer
0=Foreground
1=Rear
x coordinate
y coordinate
Character number
0 1023
Palette number
0 15
Horizontal rotation
0=None,
1=rotation
Vertical rotation
0=None,
1=rotation
Returns
Error
None
40-6 BGFILE
This command fills the BG screen within assigned block limitations.
Format
Parameters
Layer
0=Foreground
1=Rear
x start point
0 63
y start point
0 63
x end point
0 63
y end point
0 63
Character number
0 1023
Palette number
0 15
Horizontal rotation
0=None,
1=rotation
Vertical rotation
0=None,
1=rotation
Returns
None
Error
40-7 BGREAD()
Obtains data from designated location on BG screens.
Format
Parameters
Layer
0=Foreground
1=Rear
x coordinate
y coordinate
CHR
PAL
Returns
Error
None
41 BG Commands (Expert)
The following commands can be used to obtain data on BG status, draw special
shapes, or fill the screen with color:
BGCHK(), BGCOPY, BGPUT, BGFILL, BGREAD()
41-1 BGCHK()
Obtains data on the status of the BG screen which has been modified using the
BGOFS command.
Format
BGCHK(layer)
Parameters
Layer
0=Foreground,
1=Rear
Returns
Number
Coordinate
Error
41-2 BGCOPY
This command copies the assigned block area of the BG screen.
Format
Parameters
Layer
0=Foreground,
1=Rear
Returns
x start point
0 63
y start point
0 63
x end point
0 63
y end point
0 63
Transfer destination x
0 63
transfer destination y
0 63
None
Error
41-3 Screen Data Features
Screen Data
This combines the character and palette numbers of the BG screen, as well as data
on horizontal and vertical rotation. It is expressed in a 16-bit value.
b00
b01
b02
b03
b04
b05
b06
b07
b08
b09
b10
b11
b12
b13
b14
b15
Screen Data Character String
The screen data is converted into a 4-digit, hexadecimal number.
(e.g.)
If screen data = &H103F
The screen data character string will be "103F"
41-4 BGPUT (Expert)
Writing Screen Data
Format
Parameters
Layer
0=Foreground,
1=Rear
Returns
x coordinate
0 63
y coordinate
0 63
Screen Data
None
Error
Write Screen Data Character String
Format
Parameters
Layer
0=Foreground,
1=Rear
Returns
x coordinate
0 63
y coordinate
0 63
Strings
4 character strings
None
Error
41-5 BGFILL(Expert)
Fill Screen Data Area
Format
Parameters
Layer
0=Foreground,
1=Rear
Returns
x start point
0 63
y start point
0 63
x end point
0 63
y end point
0 63
Screen Data
None
Error
Fill Screen Data Area From Character String
Format
Parameters
Layer
0=Foreground,
1=Rear
Returns
x start point
0 63
y start point
0 63
x end point
0 63
y end point
0 63
Strings
4 character strings
None
Error
41-6 BGREAD(Expert)
Obtain Screen Data
Format
Parameters
Layer
0=Foreground,
1=Rear
Returns
x coordinate
0 63
y coordinate
0 63
SC
None
Error
Obtain Data Using Screen Data Character String
Format
Parameters
Layer
0=Foreground,
1=Rear
x coordinate
0 63
y coordinate
0 63
SC$
Returns
Error
None
Parameters
Waveform number
Pitch
Volume
0=No sound
127=Maximum
Panpot
0=from left
64=from center
127=from right
Returns
None
Error
How to Calculate Pitch and Scale
An octave is made up of a scale with a resolution of 4096 different elements, so to
calculate the pitch (P) of a half tone, you can use P=4096/12. Calculating pitch using
this value will work out as follows:
<Changes to Musical Interval>
=P*0
=P*1
=P*2
=P*3
=P*4
=P*5
=P*6
=P*7
=P*8
=P*9
=P*10
=P*11
42-2 BGMPLAY
Starts playing song. (Up to 8 songs can be played at the same time).
When specifying the volume for a track, the track number cannot be omitted. Track
numbers after 128 will play songs you have written yourself.
Format
Parameters
Track number
Song number
029
128255
Track Volume
Returns
0127
None
Error
42-3 BGMSTOP
Stops playing song.
By assigning a Fade Time (measured in seconds), you can cause the music to
steadily reduce in volume.
When the track number is omitted, a BEEP command can be used to stop the sound
effects and all tracks being played.
Format
Parameters
Track number
Fade Time
Returns
None
Error
42-4 BGMCHK()
This lets you check on current music status.
Format
Parameters
Track number
Returns
Number
FALSE=Music stopped
TRUE=Music playing
Error
42-5 BGMVOL
Parameters
Track number
Track Volume
0 127
Returns
Error
None
Parameters
Song number
128 255
Returns
None
Error
43-2 BGMSETD
This saves pre-set MML data.
When describing MML data in a string, you need to use the expression DATA 0 to
signify the end of the MML data.
Format
Parameters
Song number
128 255
@label
Returns
None
Error
e,g,
@MMLDATA
DATA ""CDEFGABC""
DATA ""CCCEEEGGG""
DATA 0
'---
Parameters
Song number
Returns
None
Error
43-4 BGMPLAY(Expert)
Use MML directly and play music.
When playing a track using MML, the track will be defined with a 0. The tracks
volume cannot be adjusted.
(If a track between 1- 7 is assigned, it will result in an error)
Format
Parameters
Returns
None
Error
43-5 BGMSETV
This command writes to variables within MML.
Format
Parameters
Track number
0-7
Variable number
Value
0 - 255
Returns
Error
None
43-6 BGMGETV()
Read variables in MML.
The cycle in which replacement variables within MML will be reflected in the program
lasts for 1/60th of a second. Be sure to leave at least a period of VSYNC 1.
Format
Parameters
Track number
0-7
Variable number
Number
Returns
Error
43-7 BGMPRG
Save waveforms of instruments that can be used with MML.
For more information on the A, D, S, R commands used to define the waveform
envelope, see MML Commands@E.
Format
Parameters
Instrument number
224 255
A Attack
0 127
D Decay
0 127
S Sustain
0 127
0 127
Returns
None
Error
Waveform character strings are 8-bit values displayed in two-digit hexadecimal
form.
If the digits inside the blue frame above are converted into waveform character
strings, they will appear like this:
"00204060402000E0C0A0C0E0"
In this way, 64-character waveform strings will be treated as the waveform for a
single cycle. A 128-character string can be used to define a more complex waveform.
While complex waveforms used to sample real instruments cannot be saved, it can
be used as a basic synthesizer.
44 DS Wireless Play
What you will need
- Two Nitendo DSi systems on which Petit Computer has been saved.
<Procedure>
1. Turn the systems power ON.
2. Touch Petit Computer on the DSi Menu Screen.
3. When sending or receiving data, select File Management from the Home Menu
and then touch either the Send or Receive button. Alternatively, after
launching BASIC, you can use the SENDFILE command to transmit resources
and the RECVFILE command to receive them.
4. For more information about files, resources and the transmission and receipt of
data, please see 13. Files and Resources.
Important Wireless Communication Guidelines
During wireless game play, an icon (
screen showing the strength of the wireless signal. The icon has four modes
depending on the signal strength, asa shown below.
Number of Bars
Signal Strength
Weaker
Stronger
Begin with the distance between systems at about 30 feet or less and move closer or
farther apart as desired, keeping the signal strength at two or more bars for best
results.
Keep the maximum distance between systems at 65 feet or less.
The systems should face each other as directly as possible.
Avoid having people or other obstructions between the DS systems.
Avoid interface from other devices. If communication seems to be affected by other
devices (wireless LAN, microwave ovens, cordless devices, computers), move to
another location or turn off the interfering device.
To play wirelessly, you must first set wireless Communications to ON in the Nintendo
DSi System settings.