Skip to content

Commit 069b9f3

Browse files
authored
Merge pull request #998 from boriel-basic/docs
Docs
2 parents 8e26192 + 0da6517 commit 069b9f3

19 files changed

+109
-102
lines changed

docs/code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ code(<value>)
1111

1212
Returns the ASCII code of the first character of the given string value.
1313
If the string is empty, the returned value is 0.
14-
Returned value type is [UByte](types.md#UByte).
14+
Returned value type is [UByte](types.md#Integral).
1515

1616
## Examples
1717

docs/const.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CONST <varname> [AS <type>] = <value>
1313
**CONST** declares a non-modifable variable.
1414

1515
`<type>` can be something like `Integer`, `Byte`, `Float`, etc.
16-
See the list of [available types](types.md#types.md). If type is not specified,
16+
See the list of [available types](types.md). If type is not specified,
1717
`Float` will be used, unless you use a modifier like `$` or `%`.
1818

1919
## Examples

docs/dim.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ empty string, so you don't need to initialize them, though it's recommended.
2626
ZX BASIC allows you to use undeclared variables. In Sinclair BASIC, using an unassigned variable triggered
2727
the error _Variable not found_, but in ZX BASIC it will default to 0 value.
2828

29-
You can enforce variable declaration using the `--explicit` [command line option](zxb.md#Command_Line_Options).
29+
You can enforce variable declaration using the `--explicit` [command line option](zxb.md#command-line-options).
3030
When it's used, the compiler will require every variable to be declared with DIM before being used for the 1st time.
3131

32-
You can also enforce explicit type declaration using the `--strict` [command line option](zxb.md#Command_Line_Options).
32+
You can also enforce explicit type declaration using the `--strict` [command line option](zxb.md#command-line-options).
3333
This way, if you use `DIM` you will be required to declare also the type needed.
3434

3535
When you use an undeclared variable, ZX BASIC will try to guess its type by looking at the context in which
@@ -166,7 +166,7 @@ DIM a([<lower_bound> TO] <upper_bound> [, ...]) AS <type>
166166
### Description
167167

168168
By default, array indexes starts from 0, not from 1 as in Sinclair BASIC. You can change this behavior setting
169-
a different array base index using either a [#pragma option](pragma.md) or a [command line option](zxb.md#Command Line Options).
169+
a different array base index using either a [#pragma option](pragma.md) or a [command line option](zxb.md#command-line-options).
170170

171171
### Examples
172172

docs/for.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Syntax
44

5-
```
5+
```basic
66
FOR iterator = startvalue TO endvalue [ STEP stepvalue ]
77
[ sentences ]
88
NEXT [ iterator ]
@@ -22,18 +22,18 @@ _stepvalue_ until it reaches or exceeds _endvalue_. If _stepvalue_ is not explic
2222

2323
## Examples
2424

25-
```
25+
```basic
2626
REM Counts from 1 to 10
2727
FOR i = 1 TO 10: PRINT i: NEXT
2828
```
2929

3030
### Counts downwards
31-
```
31+
```basic
3232
FOR i = 10 TO 1 STEP -1: PRINT i: NEXT
3333
```
3434

3535
### Loops using odd numbers
36-
```
36+
```basic
3737
FOR i = 1 TO 10 STEP 2: PRINT i: NEXT
3838
```
3939

@@ -43,7 +43,7 @@ FOR i = 1 TO 10 STEP 2: PRINT i: NEXT
4343
* Note that variable types can cause issues with ZX Basic For...Next Loops. If the upper limit of the iterator exceeds
4444
the upper limit of the variable type, the loop may not complete.
4545
For example:
46-
```
46+
```basic
4747
DIM i as UByte
4848
4949
FOR i = 1 to 300
@@ -59,7 +59,7 @@ incremented by `<step>` amounts.
5959

6060
For example, this loop will neved end
6161

62-
```
62+
```basic
6363
DIM i as UInteger
6464
6565
FOR i = 65000 TO 65500 STEP 100

docs/function.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The user is now allowed to define his/her own functions.
1111
## Syntax
1212
Basic function declaration is:
1313

14-
```
14+
```vbnet
1515
FUNCTION <function name>[(<paramlist>)] [AS <type>]
1616
<sentences>
1717
...
@@ -20,7 +20,7 @@ Basic function declaration is:
2020
## Example
2121
A simple function declaration:
2222

23-
```
23+
```vbnet
2424
REM This function receives and returns a byte
2525
FUNCTION PlusOne(x AS Byte) AS Byte
2626
RETURN x + 1
@@ -32,7 +32,7 @@ PRINT x; " plus one is "; PlusOne(x)
3232

3333
If `AS` _type_ is omitted, the function is supposed to return a `Float`.
3434

35-
```
35+
```vbnet
3636
REM This function returns a float number because its type has been omitted.
3737
REM Also, the 'x' parameter will be converted to float,
3838
REM because it's type has been omitted too
@@ -48,7 +48,7 @@ PRINT "Square of "; x; " is "; Square(x)
4848
## Recursion
4949
Recursion is a programming technique in which a function calls itself. A classical recursion example is the factorial function:
5050

51-
```
51+
```vbnet
5252
FUNCTION Factorial(x)
5353
IF x < 2 THEN RETURN 1
5454
RETURN Factorial(x - 1) * x
@@ -58,11 +58,11 @@ END FUNCTION
5858
However, not using types explicitly might have a negative impact on performance.
5959
Better redefine it using data types. Factorial is usually defined on unsigned integers and also returns an unsigned
6060
integer. Also, keep in mind that factorial numbers tends to _grow up very quickly_ (e.g. Factorial of 10 is 3628800),
61-
so `ULong` [type](types.md) (32 bits unsigned) seems to be the most suitable for this function.
61+
so `ULong` [type](types.md#Integral) (32 bits unsigned) seems to be the most suitable for this function.
6262

6363
This version is faster (just the 1st line is changed):
6464

65-
```
65+
```vbnet
6666
FUNCTION Factorial(x AS Ulong) AS Ulong
6767
IF x < 2 THEN RETURN x
6868
RETURN Factorial(x - 1) * x

docs/identifier.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Identifiers shown in bold are taken from the Sinclair BASIC (beware their meanin
2020
* **[ASN](asn.md)** **(function)**
2121
* **[AT](at.md)**
2222
* **[ATN](atn.md)** **(function)**
23-
* **[bAND](bitwiselogic.md)** **(operator)**
24-
* **[bNOT](bitwiselogic.md)** **(operator)**
25-
* **[bOR](bitwiselogic.md)** **(operator)**
26-
* **[bXOR](bitwiselogic.md)** **(operator)**
23+
* **[bAND](bitwiselogic.md#bAND)** **(operator)**
24+
* **[bNOT](bitwiselogic.md#bNOT)** **(operator)**
25+
* **[bOR](bitwiselogic.md#bOR)** **(operator)**
26+
* **[bXOR](bitwiselogic.md#bXOR)** **(operator)**
2727
* **[BEEP](beep.md)** **(statement)**
2828
* [BOLD](bold.md)
2929
* **[BORDER](border.md)** **(statement)**
@@ -44,7 +44,7 @@ Identifiers shown in bold are taken from the Sinclair BASIC (beware their meanin
4444
* **[DATA](data.md)** **(statement)**
4545
* **[DRAW](draw.md)** **(statement)**
4646
* [ELSE](if.md)
47-
* [ELSEIF](if.md)
47+
* [ELSEIF](if.md#using-elseif)
4848
* [END](end.md)
4949
* [EXIT](exit.md) **(statement)**
5050
* **[EXP](exp.md)** **(function)**
@@ -68,7 +68,7 @@ Identifiers shown in bold are taken from the Sinclair BASIC (beware their meanin
6868
* **[LN](ln.md)** **(function)**
6969
* **[LOAD](load.md)** **(statement)**
7070
* [LOOP](do.md) **(statement)**
71-
* [MOD](operators.md#Arithmetic Operators) **(operator)**
71+
* [MOD](operators.md#Arithmetic-Operators) **(operator)**
7272
* **[NEXT](for.md)** **(statement)**
7373
* **[NOT](operators.md#NOT)** **(operator)**
7474
* **[ON ... GOTO](on_goto.md)** **(statement)**
@@ -110,7 +110,7 @@ Identifiers shown in bold are taken from the Sinclair BASIC (beware their meanin
110110
* **[VERIFY](load.md)** **(statement)**
111111
* [WEND](while.md) **(statement)**
112112
* [WHILE](while.md) **(statement)**
113-
* **[XOR](operators.md#logical_operators.md)** **(operator)**
113+
* **[XOR](operators.md#logical-operators)** **(operator)**
114114

115115
## Inbuilt library Functions
116116
You should also avoid defining (with a SUB or FUNCTION command) routines with the following names, as they are available in the internal library for your use, though you are almost certainly going to need to use #include before using them. Note that some Sinclair Basic words are listed here. Some Freebasic commands are also available through #include options for compatibility with freebasic.

docs/in.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ IN <port number>
1111
## Description
1212

1313
Returns the byte value read in the given port.
14-
Argument must be a numeric expression. Returned value type is [Ubyte](types.md#Ubyte).
14+
Argument must be a numeric expression. Returned value type is [Ubyte](types.md#Integral).
1515

1616
## Examples
1717

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* [SDK tools](tools.md)
1313
<br />Tools available in the SDK.
1414

15-
* [Command line options](zxb.md#Command_Line_Options)
15+
* [Command line options](zxb.md#Command-Line-Options)
1616
<br />Command line options table for the compiler (zxb)
1717

1818
## Download
@@ -63,7 +63,7 @@ Get the latest version of Boriel BASIC from the [archive](archive.md).
6363
<br />Library of functions and subroutines you can use in your programs. You might find them really useful.
6464

6565
## Inline assembler
66-
Embedding inline assembler in your code is pretty easy. There's a [tutorial](tutorials.md) on it.
66+
Embedding inline assembler in your code is pretty easy. There's a [tutorial](tutorials.md#how-to-use-inline-assembly) on it.
6767

6868
## Compiler internals
6969
Only for true hackers: This explains how the compiler does its job, how to expand it, etc.

docs/inkey.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ The above code will echo keys pressed to the screen. Note that the loop has to b
2626

2727
## Remarks
2828
* This sentence is 100% Sinclair BASIC Compatible
29+
30+
## See also
31+
32+
* [INPUT](input.md)

docs/lbound.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ PRINT LBound(a, 0): REM Prints 2, since 'a' has 2 dimensions
3535

3636
## Remarks
3737

38-
* This function does not exists in Sinclair BASIC.
38+
* This function does not exist in Sinclair BASIC.
3939

4040
## See also
4141

0 commit comments

Comments
 (0)