Skip to content
Merged

Docs #998

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.18.1
current_version = 1.18.2

[bumpversion:file:src/zxbc/version.py]
search = VERSION: Final[str] = "{current_version}"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[v1.18.2](https://github.com/boriel-basic/zxbasic/tree/v1.18.1)
===
+ ! Allows installation with `pip install` in python 3.11 environments
+ * Add `hmirror.bas` library

[v1.18.1](https://github.com/boriel-basic/zxbasic/tree/v1.18.1)
===
+ ! Fixes crash on simple cast from i32 to u32 and vice versa
Expand Down
12 changes: 6 additions & 6 deletions docs/archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ repository (git).
You can contribute to ZX BASIC by reporting possible bugs or improvement suggestions at the
[forum](http://www.boriel.com/forum) or in social media.

The latest stable version is <span style={{color: "green"}}>**1.18.1**</span>.
The latest stable version is <span style={{color: "green"}}>**1.18.2**</span>.
Click on the desired icon below to download the package suitable for your platform:

* [<img src="https://zxbasic.readthedocs.io/en/docs/img/win32.png" alt="win32zip" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.1-win32.zip](https://www.boriel.com/files/zxb/zxbasic-1.18.1-win32.zip)
https://www.boriel.com/files/zxb/zxbasic-1.18.2-win32.zip](https://www.boriel.com/files/zxb/zxbasic-1.18.2-win32.zip)
<br />Windows .exe zip package. No install needed, just uncompress it in a directory of your choice.
<br/>&nbsp;
* [<img src="https://zxbasic.readthedocs.io/en/docs/img/macos.png" alt="macostargz" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.1-macos.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.1-macos.tar.gz)
https://www.boriel.com/files/zxb/zxbasic-1.18.2-macos.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.2-macos.tar.gz)
<br />Mac OS x64 package. No install needed, just uncompress it in a directory of your choice (needs Python installed
in your system).
<br/>&nbsp;
* [<img src="https://zxbasic.readthedocs.io/en/docs/img/linux.png" alt="macostargz" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.1-linux64.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.1-linux64.tar.gz)
https://www.boriel.com/files/zxb/zxbasic-1.18.2-linux64.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.2-linux64.tar.gz)
<br />Linux x64 binary package. No install needed, just uncompress it in a directory of your choice.
<br/>&nbsp;
* [<img src="https://zxbasic.readthedocs.io/en/docs/img/zip-package.png" alt="zip" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.1.zip](https://www.boriel.com/files/zxb/zxbasic-1.18.1.zip)
https://www.boriel.com/files/zxb/zxbasic-1.18.2.zip](https://www.boriel.com/files/zxb/zxbasic-1.18.2.zip)
<br />Windows, Linux, Mac zip package, with python scripts. Requires python installed in your system.
<br/>&nbsp;
* [<img src="https://zxbasic.readthedocs.io/en/docs/img/driver-down.png" alt="tar.gz" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.1.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.1.tar.gz)
https://www.boriel.com/files/zxb/zxbasic-1.18.2.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.2.tar.gz)
<br />Windows, Linux, Mac tar.gz package, with python scripts. Requires python installed in your system.

### What's new
Expand Down
2 changes: 1 addition & 1 deletion docs/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ code(<value>)

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

## Examples

Expand Down
2 changes: 1 addition & 1 deletion docs/const.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CONST <varname> [AS <type>] = <value>
**CONST** declares a non-modifable variable.

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

## Examples
Expand Down
6 changes: 3 additions & 3 deletions docs/dim.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ empty string, so you don't need to initialize them, though it's recommended.
ZX BASIC allows you to use undeclared variables. In Sinclair BASIC, using an unassigned variable triggered
the error _Variable not found_, but in ZX BASIC it will default to 0 value.

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

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

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

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

### Examples

Expand Down
12 changes: 6 additions & 6 deletions docs/for.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Syntax

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

## Examples

```
```basic
REM Counts from 1 to 10
FOR i = 1 TO 10: PRINT i: NEXT
```

### Counts downwards
```
```basic
FOR i = 10 TO 1 STEP -1: PRINT i: NEXT
```

### Loops using odd numbers
```
```basic
FOR i = 1 TO 10 STEP 2: PRINT i: NEXT
```

Expand All @@ -43,7 +43,7 @@ FOR i = 1 TO 10 STEP 2: PRINT i: NEXT
* Note that variable types can cause issues with ZX Basic For...Next Loops. If the upper limit of the iterator exceeds
the upper limit of the variable type, the loop may not complete.
For example:
```
```basic
DIM i as UByte

FOR i = 1 to 300
Expand All @@ -59,7 +59,7 @@ incremented by `<step>` amounts.

For example, this loop will neved end

```
```basic
DIM i as UInteger

FOR i = 65000 TO 65500 STEP 100
Expand Down
12 changes: 6 additions & 6 deletions docs/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The user is now allowed to define his/her own functions.
## Syntax
Basic function declaration is:

```
```vbnet
FUNCTION <function name>[(<paramlist>)] [AS <type>]
<sentences>
...
Expand All @@ -20,7 +20,7 @@ Basic function declaration is:
## Example
A simple function declaration:

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

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

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

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

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

```
```vbnet
FUNCTION Factorial(x AS Ulong) AS Ulong
IF x < 2 THEN RETURN x
RETURN Factorial(x - 1) * x
Expand Down
14 changes: 7 additions & 7 deletions docs/identifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Identifiers shown in bold are taken from the Sinclair BASIC (beware their meanin
* **[ASN](asn.md)** **(function)**
* **[AT](at.md)**
* **[ATN](atn.md)** **(function)**
* **[bAND](bitwiselogic.md)** **(operator)**
* **[bNOT](bitwiselogic.md)** **(operator)**
* **[bOR](bitwiselogic.md)** **(operator)**
* **[bXOR](bitwiselogic.md)** **(operator)**
* **[bAND](bitwiselogic.md#bAND)** **(operator)**
* **[bNOT](bitwiselogic.md#bNOT)** **(operator)**
* **[bOR](bitwiselogic.md#bOR)** **(operator)**
* **[bXOR](bitwiselogic.md#bXOR)** **(operator)**
* **[BEEP](beep.md)** **(statement)**
* [BOLD](bold.md)
* **[BORDER](border.md)** **(statement)**
Expand All @@ -44,7 +44,7 @@ Identifiers shown in bold are taken from the Sinclair BASIC (beware their meanin
* **[DATA](data.md)** **(statement)**
* **[DRAW](draw.md)** **(statement)**
* [ELSE](if.md)
* [ELSEIF](if.md)
* [ELSEIF](if.md#using-elseif)
* [END](end.md)
* [EXIT](exit.md) **(statement)**
* **[EXP](exp.md)** **(function)**
Expand All @@ -68,7 +68,7 @@ Identifiers shown in bold are taken from the Sinclair BASIC (beware their meanin
* **[LN](ln.md)** **(function)**
* **[LOAD](load.md)** **(statement)**
* [LOOP](do.md) **(statement)**
* [MOD](operators.md#Arithmetic Operators) **(operator)**
* [MOD](operators.md#Arithmetic-Operators) **(operator)**
* **[NEXT](for.md)** **(statement)**
* **[NOT](operators.md#NOT)** **(operator)**
* **[ON ... GOTO](on_goto.md)** **(statement)**
Expand Down Expand Up @@ -110,7 +110,7 @@ Identifiers shown in bold are taken from the Sinclair BASIC (beware their meanin
* **[VERIFY](load.md)** **(statement)**
* [WEND](while.md) **(statement)**
* [WHILE](while.md) **(statement)**
* **[XOR](operators.md#logical_operators.md)** **(operator)**
* **[XOR](operators.md#logical-operators)** **(operator)**

## Inbuilt library Functions
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.
Expand Down
2 changes: 1 addition & 1 deletion docs/in.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ IN <port number>
## Description

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

## Examples

Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* [SDK tools](tools.md)
<br />Tools available in the SDK.

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

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

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

## Compiler internals
Only for true hackers: This explains how the compiler does its job, how to expand it, etc.
Expand Down
4 changes: 4 additions & 0 deletions docs/inkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ The above code will echo keys pressed to the screen. Note that the loop has to b

## Remarks
* This sentence is 100% Sinclair BASIC Compatible

## See also

* [INPUT](input.md)
2 changes: 1 addition & 1 deletion docs/lbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PRINT LBound(a, 0): REM Prints 2, since 'a' has 2 dimensions

## Remarks

* This function does not exists in Sinclair BASIC.
* This function does not exist in Sinclair BASIC.

## See also

Expand Down
4 changes: 2 additions & 2 deletions docs/library/stdlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Some libraries might be available only for some architectures. If so,
they will be signaled as such. If no notice is shown, they are available for
all.

* [keys.bas](d)<br />
* [keys.bas](keys.bas.md)<br />
Faster and efficient way to detect keys pressed.

* [string.bas](.md)<br />
* [string.bas](string.bas.md)<br />
Library for string manipulation.
Loading