Skip to content

Commit 52cc174

Browse files
committed
docs: updates types.md page
1 parent 33762e4 commit 52cc174

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

docs/types.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Types
22

3-
## Introductions
3+
## Introduction
44

55
Although ZX BASIC was originally designed with ZX Spectrum in mind, it is a three-stage _retargeable_ compiler. This means it should not be difficult to hack ZX BASIC SDK to compile for other target machines (E.g. Commodore 64) or current machines (PC) or even virtual machines like Java or .NET. Porting ZX BASIC to other Z80 architectures like Amstrad or MSX should be almost straightforward (only the library.asm should need some work to use different ROM routines).
66

@@ -25,14 +25,14 @@ They can be _unsigned_ (their value is always 0 or positive) or _signed_ (can ta
2525
ZX Basic integer types sizes are 8, 16 and 32 bits. Unsigned types have the prefix _U_.
2626

2727

28-
| Type name | Size (bytes) | Signed? | Range | Description |
29-
|:-----------|:-----:|:--------:|:------:|:-------------|
30-
| Byte | 1 | yes | -128..127 | 8 bits signed integer |
31-
| UByte| 1 | no | 0..255 | 8 bits unsigned integer |
32-
| Integer | 2 | yes | -32768..32767 | 16 bits signed integer |
33-
| UInteger | 2 | no | 0..65535 | 16 bits unsigned integer |
34-
| Long | 4 | yes | <small>−2,147,483,648 .. +2,147,483,647</small> | 32 bit signed integer |
35-
| ULong | 4 | yes | <small>0 .. 4,294,967,295</small>| 32 bit unsigned integer |
28+
| Type name | Size (bytes) | Signed? | Range | Description |
29+
|:----------|:------------:|:-------:|:-----------------------------------------------:|:-------------------------|
30+
| Byte | 1 | yes | -128..127 | 8 bits signed integer |
31+
| UByte | 1 | no | 0..255 | 8 bits unsigned integer |
32+
| Integer | 2 | yes | -32768..32767 | 16 bits signed integer |
33+
| UInteger | 2 | no | 0..65535 | 16 bits unsigned integer |
34+
| Long | 4 | yes | <small>−2,147,483,648 .. +2,147,483,647</small> | 32 bit signed integer |
35+
| ULong | 4 | yes | <small>0 .. 4,294,967,295</small> | 32 bit unsigned integer |
3636

3737

3838
### Decimals
@@ -41,7 +41,7 @@ Their sizes are 32 bit for `Fixed` type and 40 bits for `Float` one.
4141

4242
#### Fixed
4343
32 bit Fixed Point decimal. First 16 bits are the integer part, whilst remaining 16 contains the decimal one.
44-
Ranges from -32767.9999847 to 32767.9999847 with a precision of 1 / 2^16 (0.000015 approx.).
44+
Ranges from `-32767.9999847` to `32767.9999847` with a precision of 1 / 2<sup>16</sup> (0.000015 approx.).
4545
Fixed points decimal are less precise than Floating ones, but much faster and requires
4646
less space (1 byte less). Also, their range is much limited.
4747
They're usually used on screen drawing when Floating point is too slow and decimal
@@ -50,7 +50,8 @@ calculations are required.
5050
#### Float
5151
Floating point type is **identical** to the Sinclair BASIC one.
5252
It requires 5 bytes (1 byte for exponent, 4 bytes for mantissa).
53-
Read the ZX Spectrum manual or [here](http://www.worldofspectrum.org/ZXBasicManual/zxmanchap24.html).
53+
Read the [Chapter 24 of the ZX Spectrum manual](http://www.worldofspectrum.org/ZXBasicManual/zxmanchap24.html)
54+
for further information.
5455

5556
>To store the number in the computer, we use five bytes, as follows:
5657
>
@@ -75,7 +76,7 @@ At this moment, ZX BASIC is not an <abbr title="Object Oriented Programming">OOP
7576
Vars are _scalar_ variables. Scalar variables are those which store a single value.
7677
Almost all variables are scalars:
7778

78-
```
79+
```basic
7980
REM A simple scalar variable
8081
DIM a = 3
8182
```
@@ -85,7 +86,7 @@ DIM a = 3
8586
Unlike scalars, array variables can hold more than a single value at once.
8687
You access a single value within the array container using an integer _index_:
8788

88-
```
89+
```basic
8990
REM An array variable
9091
DIM a(1 TO 10) AS UBYTE
9192
LET a(3) = 5: REM pick a(3) cell and store the number 5 in it
@@ -97,7 +98,7 @@ Unlike the above, [labels](labels.md) are not variables.
9798
They refer to memory positions. Line numbers are also treated as labels and they are completely optional:
9899

99100

100-
```
101+
```basic
101102
10 REM here '10' is a Label
102103
5 REM here '5' is another label, so the number order does not matter
103104
REM Line numbers are optional. So this line is ok either.

0 commit comments

Comments
 (0)