0. Quick Start
This manual describes about how to program by HSP and HSP language general specification.
A person, who is first time trying to program, please read first, The HSP introduction guide for beginner.
If you have some experience of programming but the first time to HSP, we recommend you to read the quick start and to actually use HSP.
If you do not understand when you use, please refer to this manual and investigate.
-
The program list performed by HSP is called 'script'. The HSP script editor (hsed2.exe) can edit the program list, script. You can start the editor and write scripts, then press [F5] key to execute the scripts. Please try attached sample programs.
-
At HSP, as shown in 'rnd a, 10', a script is written in the form 'command' + 'parameter(s) separated by ','.
A command is executed in an order from the 1st line.
If you focus on a keyword (instruction) in the editor and [F1] is pressed, a HSP help reference can be easily referred to.
-
The foundations of command are the things close to BASIC. Assignment can be carried out for a 'variable = numerical value', or the formula which can be mixed the numerical value and the variable like 'screen 0, x*64, y' as a parameter.
However, unlike many languages, evaluation of a formula does not have a priority. Operation is always performed in an order from the left.
When it gives a priority, it is necessary to put in a parenthesis '(' and ')' clearly.
-
A 'variable = numerical value' or 'variable = string' can be used for an assignment formula. Neither variable type nor declaration is needed.
A character string is written in the form surrounded by double quotation marks like 'a="string"'.
The operation of a character string is only combined with ('+').
-
The array of a variable is separated using '.' in the form of a 'variable.element'. In order to use array, it is necessary to secure a memory by dim and sdim command beforehand.
-
For controlling the flow of a program, 'goto' and 'gosub' command can be used. The label to specify is defined as the head of a line in the form of '* labelname'. Repeat execution is usually performed by 'repeat' and 'loop' commands. This can be thought with what simplified of the C language, 'for', 'while' and 'do'.
In addition, C like command, such as 'while - wned', 'do - until', 'for - next', and 'switch - case' are there.
Please refer to a 'standard macro commands' for details.
-
The created scripts can be converted for an executable file by [ctrl]+ [F9].
Please refer to 'the how to create a EXE and a SCR file' for details.