Irmen de Jong
1f8b42fae5
make user docs and some code comments less convoluted
2026-10-05 20:00:32 +02:00
Irmen de Jong
f086918e6f
add union types: structs where every field is at offset 0, thus saving memory
2026-09-23 00:07:44 +02:00
Irmen de Jong
ef64e2f9a4
fix typed pointer arithmetic p2-p1 to yield the number of elements. fixes #244
2026-09-18 21:22:07 +02:00
Irmen de Jong
7ba2ee9857
added named struct field initializers
2026-09-14 00:56:22 +02:00
Irmen de Jong
9621552056
add 'arena' allocator library
...
6502 targets use uword sizes with no alignment overhead; m68k/virtual use
long sizes with even-address alignment. Updated the six pointer examples that used to have their own arena implementation.
2026-09-13 05:43:57 +02:00
Irmen de Jong
a7cbc2c5bf
Review fixes: pointer read desugaring and poke->assignment optimizer
2026-09-09 02:31:21 +02:00
Irmen de Jong
9ac60eec40
fix some more pointer syntax related issues
2026-09-09 01:33:43 +02:00
Irmen de Jong
c55b16f4cb
todo
2026-09-09 01:01:16 +02:00
Irmen de Jong
9bf8318b1c
Support arrays of struct instances
...
- Parser: parse `StructType[N] var` via elementToArray() for
STRUCT_INSTANCE (Prog8ANTLR.g4, Antlr2KotlinVisitor)
- Desugar: struct-instance bases via addressOfStructInstance(),
whole-struct `a[i]=a[j]` -> sys.memcopy, inferred `[[...]]`
and explicit `Struct : [...]` (without ^^) for value arrays;
reject `^^Struct : [...]` in instance arrays
- 6502: computeStructArrayElementAddress() with 16-bit
index*structSize scaling (AssignmentAsmGen, AsmGen)
- IR/VM/m68k/new6502: STRUCTDEFS round-trip, loaders, gens
- AstChecker/IdentifiersChecker: reject struct fields that are
arrays of structs; fix isArray guards
- Docs: structpointers.rst/variables.rst, todo.rst, examples/test.p8
- Tests: TestArraysOfStructs (pointer vs value init, IR round-trip,
16-bit strides)
2026-08-30 18:24:14 +02:00
Irmen de Jong
94822b8662
Add arrays of struct instances (StructType[N] vars)
...
Parser: accept `Type[N] name` between type and identifier
(Prog8ANTLR.g4, Antlr2KotlinVisitor) via elementToArray()
for STRUCT_INSTANCE; CodeDesugarer: handle struct-instance
bases, addressOfStructInstance(), whole-struct memcopy
(points[a]=points[b]), and fix variable-index 16-bit scaling
in 6502 AssignmentAsmGen.computeStructArrayElementAddress();
IR: preserve STRUCTDEFS round-trip, VM loader support;
m68k/new6502/intermediate backends; docs + todo updated.
Limitations: not as struct fields (AstChecker/
AstIdentifiersChecker error) nor as sub params.
2026-08-30 14:14:49 +02:00
Irmen de Jong
27070f31e8
Merge branch 'master' into new-codegens
...
# Conflicts:
# codeCore/src/prog8/code/core/DataTypes.kt
# docs/source/todo.rst
2026-08-28 05:23:30 +02:00
Irmen de Jong
56643f43df
tweak m68k tests and docs
2026-08-26 22:31:05 +02:00
Irmen de Jong
561f31329d
support pointer assignment targets like (expr as ^^Struct).field = v and func().field = v (grammar + CodeDesugarer poke desugar, IR pointer-cast widening, tests/docs)
2026-08-24 23:00:23 +02:00
Irmen de Jong
2bbbacc46e
normal error message instead of crash when typed pointer arrays are used as struct field (currently not supported by the compiler)
2026-08-24 19:21:30 +02:00
Irmen de Jong
894a3e90db
codegen: fix pointer-typed struct field reads on 32-bit targets to use peekl and long address arithmetic
2026-08-22 12:40:34 +02:00
Irmen de Jong
f3de26bf6c
for-loop support for list/node iteration, and reverse str/array iteration using step -1
2026-08-21 07:28:39 +02:00
Irmen de Jong
54a1a0704a
allow strings to be used to initialize arrays in struct instances
2026-08-16 23:25:41 +02:00
Irmen de Jong
a5978a913b
m68k: added coroutines module
2026-08-06 22:08:59 +02:00
Irmen de Jong
e645b0abe1
add pokep() and peekp() builtin functions
2026-07-12 12:54:29 +02:00
Irmen de Jong
57714efb40
added pushp() and popp() builtin functions
2026-07-11 21:49:22 +02:00
Irmen de Jong
0e978b250b
added 'pointer' as type alias for uword or long depending on the compilation target's pointer size
2026-07-11 16:59:24 +02:00
Irmen de Jong
f9b3514f2a
fixes and tests for embedded arrays in structs
2026-06-14 16:18:23 +02:00
Irmen de Jong
be12fb507e
arrays in structs
2026-06-14 15:35:30 +02:00
Irmen de Jong
f8b5037924
spelling corrections
2026-05-29 20:58:06 +02:00
Irmen de Jong
c291d7d4a8
const memory() support in struct initializers
2026-03-18 04:16:05 +01:00
Andrew Gillham
2bd74b8c44
Add an index and set some non-ASCII fonts to improve the resulting pdf. ( #210 )
...
* Add an index and set some non-ASCII fonts to improve the resulting pdf.
* Fix coroutines index interfering with code block
* Add genindex which is needed to get a link to the html index.
2026-01-30 22:03:40 +01:00
Irmen de Jong
014a82a1ee
always put all struct types as .struct in asm code to make them all accessible for size and offsets
2025-12-10 21:39:44 +01:00
Irmen de Jong
3e1386a987
remove the -dontsplitarrays compiler option
...
it was still there for backward compatibility reasons with really old prog8 code. If you need a word array to be not split, just use @nosplit on the array.
2025-10-05 14:44:29 +02:00
Irmen de Jong
71ffbe2ba7
document the long type
2025-10-04 22:33:43 +02:00
Irmen de Jong
2c7256a443
support assignment to indexed pointer targets
2025-09-27 14:52:04 +02:00
Irmen de Jong
54fa72fa98
added sys.waitrasterline() routine like sys.waitvsync() but wait for a given raster line
...
optimize uword <= $xx00 into msb(uword)<$xx
2025-09-23 01:09:54 +02:00
Irmen de Jong
19f19f3880
doc and opening borders
2025-09-20 21:44:48 +02:00
Irmen de Jong
ad0c767ea8
%breakpoint! introduced to place after an assignment to make it parse correctly
2025-09-20 00:46:15 +02:00
Irmen de Jong
a8bede17b2
fix defer() with the arena allocator ("return values are evaluated before the defer is executed")
2025-09-17 23:59:32 +02:00
Irmen de Jong
9461e4088c
fixed the hashtable example and workarounds for misbehaving defer in allocators
2025-09-17 22:53:01 +02:00
Irmen de Jong
633d6c34e2
add support for struct pointers and short-form initializers in arrays and assignments
2025-09-16 20:37:50 +02:00
Irmen de Jong
6de95f7a3b
new static struct initializer syntax ^^Node : [1,2,3]
...
avoids confusion with function calls
2025-09-10 13:47:12 +02:00
Irmen de Jong
3a0392df8a
there's a problem with the struct initializer syntax
2025-09-05 00:18:42 +02:00
Irmen de Jong
5999110e3f
avoid using temporary pointer to access struct fields if a simple Y indexed cpu instruction can be used
2025-09-03 18:37:56 +02:00
Irmen de Jong
3ef09d7d9a
use LOADFIELD instruction more instead of an extra explicit ADD
...
add implicit @zp to pointer variables if they don't have a preference
2025-08-31 15:53:44 +02:00
Irmen de Jong
2ca1820d4e
Merge branch 'master' into structs6502
2025-08-28 21:55:46 +02:00
Irmen de Jong
b52cee3154
use RST chapter notation to attempt to fix PDF chapters
2025-08-28 21:19:16 +02:00
Irmen de Jong
fad17cc094
support a few other simple cases of struct instance assignment
2025-08-21 00:04:30 +02:00
Irmen de Jong
826fb3e9c2
implemented assign indexed ptr byte
2025-08-17 13:21:31 +02:00
Irmen de Jong
324fb7dbf7
more basic pointer inplace operations (float)
...
basic pointers unit test now passes
2025-08-06 22:26:23 +02:00
Irmen de Jong
ea8935a346
doc
2025-08-02 00:02:29 +02:00
Irmen de Jong
dee761a99e
fix compiler crash on certain pointer assignments
2025-08-01 22:22:43 +02:00
Irmen de Jong
4ccd7f9f3a
improve docs about recursion
2025-07-29 22:49:24 +02:00
Irmen de Jong
1c9c5aeef7
todos
2025-07-28 23:29:18 +02:00
Irmen de Jong
08810c2749
proper error message for unsupported &&subroutine
2025-07-27 23:44:24 +02:00