You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/comparing.rst
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,14 @@ No linker
34
34
35
35
Data types
36
36
----------
37
-
- There are byte, word (16 bits) and float datatypes for numbers. There are no bigger integer types natively available.
38
-
- There is no automatic type enlargement: calculations remain within the data type of the operands. Any overflow silently wraps or truncates.
37
+
- There are byte, word (16 bits), long (32 bits) and float datatypes for numbers.
38
+
- floats are available as native data type on systems that have a supported floating point library in ROM.
39
+
- **There is no automatic type enlargement:** all calculations remain within the data type of the operands. Any overflow silently wraps or truncates.
39
40
You'll have to add explicit casts to increase the size of the value if required.
40
41
For example when adding two byte variables having values 100 and 200, the result won't be 300, because that doesn't fit in a byte. It will be 44.
41
42
You'll have to cast one or both of the *operands* to a word type first if you want to accomodate the actual result value of 300.
43
+
Similarly, ``long v = w1 * w2`` doesn't automatically give you the full 32 bits multiplication result, instead it is still constrained in the word range.
44
+
If you need the full 32 bits result you'll have to call a specialized routine such as ``math.mul32`` or ``math.mul16_last_upper()``.
42
45
- strings and arrays are allocated once, statically, and never resized.
43
46
- strings and arrays are mutable: you can change their contents, but always keep the original storage size in mind to avoid overwriting memory outside of the buffer.
44
47
- maximum string length is 255 characters + a trailing 0 byte.
Copy file name to clipboardExpand all lines: docs/source/compiling.rst
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ Mac OS (and Linux, and WSL2 on Windows):
41
41
42
42
**Or, use the Gradle build system to build it yourself from source:**
43
43
44
-
The Gradle build system is used to build the compiler.
44
+
The Gradle build system is used to build the compiler. You will also need at least Java version 17 or higher to build it.
45
45
The most interesting gradle commands to run are probably the ones listed below.
46
46
(Note: if you have a recent gradle installed on your system already, you can probably replace the ``./gradlew`` wrapper commands with just the regular ``gradle`` command.)
47
47
@@ -68,7 +68,7 @@ For normal use, the ``installDist`` task should suffice and after succesful comp
68
68
69
69
.. hint::
70
70
Development and testing is done on Linux using the IntelliJ IDEA IDE,
71
-
but the actual prog8 compiler should run on all operating systems that provide a java runtime (version 11 or newer).
71
+
but the actual prog8 compiler should run on all operating systems that provide a Java runtime (version 11 or newer).
72
72
If you do have trouble building or running the compiler on your operating system, please let me know!
73
73
74
74
To successfully build and debug in IDEA, you have to do two things manually first:
@@ -99,7 +99,8 @@ It's easy to compile yourself, but a recent precompiled .exe (only for Windows)
99
99
*You need at least version 1.58.0 of this assembler.*
100
100
If you are on Linux, there's probably a "64tass" package in the repositories, but check if it is a recent enough version.
101
101
102
-
A **Java runtime (jre or jdk), version 11 or newer** is required to run the prog8 compiler itself.
102
+
A **Java runtime (jre or jdk), version 11 or newer** is required to run the prog8 compiler itself. Version 17 or higher if you want to
103
+
build the compiler from source.
103
104
If you're scared of Oracle's licensing terms, get one of the versions of another vendor. Even Microsoft provides their own version.
104
105
Other OpenJDK builds can be found at `Adoptium <https://adoptium.net/temurin/releases/?version=11>`_ .
105
106
For MacOS you can also use the Homebrew system to install a recent version of OpenJDK.
Copy file name to clipboardExpand all lines: docs/source/structpointers.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ dealing with all of them separately. You first define the struct type like so::
130
130
bool elite
131
131
}
132
132
133
-
You can use boolean fields, numeric fields (byte, word, float), and pointer fields (including str, which is translated into ^^ubyte).
133
+
You can use boolean fields, numeric fields (byte, word, long, float), and pointer fields (including str, which is translated into ^^ubyte).
134
134
You cannot nest struct types nor put arrays in them as a field.
135
135
Fields in a struct are 'packed' (meaning the values are placed back-to-back in memory), and placed in memory in order of declaration. This guarantees exact size and place of the fields.
136
136
``sizeof()`` knows how to calculate the combined size of a struct, and ``offsetof()`` can be used to get the byte offset of a given field in the struct.
Copy file name to clipboardExpand all lines: docs/source/todo.rst
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,10 @@ TODO
3
3
4
4
LONG TYPE
5
5
---------
6
-
- document the new long type! and mklong(a,b,c,d) and mklong2(w1,w2) , print_l , print_ulhex (& conv.str_l) and pokel, peekl, cbm.SETTIML/RDTIML, math.mul32, verafx.muls/muls16, and the use of R0:R1 when doing LONG calculations, asmsub call convention: @R0R1_32 to specify a 32 bits long combined register R0:R1
7
-
- how hard is it to also implement the other comparison operators (<,>,<=,>=) on longs?
6
+
- implement the other comparison operators (<,>,<=,>=) on longs
0 commit comments