Commit Graph
3274 Commits
Author SHA1 Message Date
Irmen de Jong bf696bcf5e fix multiple status flag returns in new codegens 2026-09-23 03:10:59 +02:00
Irmen de Jong 34bbb46514 fix a few new6502 codegen bugs 2026-09-23 01:27:40 +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 521f7ffbe6 tweak amiga audio 2026-09-22 22:49:09 +02:00
Irmen de Jong 2d070aaec4 Fix 6502 pointer-field augmented assignment clobbering scratch pointer
Fixes #245
2026-09-21 22:51:11 +02:00
Irmen de Jong 044a4a1789 amiga: added trackdisk device support 2026-09-21 00:13:17 +02:00
Irmen de Jong ac4ae0440f vera64 restructure 2026-09-19 17:50:30 +02:00
Irmen de Jong efee8bde68 added preliminary VERA64 support library for the c64 target
vera64 = a board for the c64 containing a VERA graphics adapter
2026-09-19 00:14:11 +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 7f3b2e8aa6 m68k asm versions of adpcm decoder routines, now byte at a time instead of nibble 2026-09-17 21:53:13 +02:00
Irmen de Jong f254fc2b62 m68k asm versions of adpcm decoder routines 2026-09-17 02:53:48 +02:00
Irmen de Jong 457d55b392 fix potential endless loop in wavfile library, also made a correct implementation of it for m68k targets (little/big endianness problem resolved) 2026-09-17 00:04:34 +02:00
Irmen de Jong b21a984dbb even more optimized adpcm decoding routine 2026-09-16 19:04:49 +02:00
Irmen de Jong 192e0086f9 update plans 2026-09-16 00:52:40 +02:00
Irmen de Jong 7ba2ee9857 added named struct field initializers 2026-09-14 00:56:22 +02:00
Irmen de Jong a025d68291 added %assert expression, "message" 2026-09-13 23:04:56 +02:00
Irmen de Jong 81794aded3 use Mordant library to make some terminal output more sophisticated
this library is already used by the Clikt option parser library so no new dependency
2026-09-13 21:28:32 +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 5685a1f229 6502: tighter for loop code for word and long loop vars 2026-09-13 04:29:59 +02:00
Irmen de Jong ca729d279e update history and syntax files 2026-09-12 23:14:50 +02:00
Irmen de Jong ceffa4d83d todos 2026-09-11 19:25:43 +02:00
Irmen de Jong 302e4bdf8e m68k targets are experimental not for production code use 2026-09-10 20:41:00 +02:00
Irmen de Jong 4c65049817 proper error message when using a builtin function name as block name 2026-09-09 04:05:31 +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 d51ca62431 Fix poke->assignment optimizer dropping AddressOf index
StatementOptimizer rewrote pokel(&arena[1], x) to arena = x, ignoring
AddressOf.arrayIndex (and dereference), which miscompiled implicit
indexed-base struct field writes such as arena[1].s = X. All four
poke/pokew/pokel/pokef rewrites now require a plain variable address.
2026-09-09 02:05:20 +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 bd0457f262 Allow const expressions for 2D array dimensions (not just numeric literals) 2026-09-08 23:13:54 +02:00
Irmen de Jong cf7afaf77a update libraries, update to kotlin 2.4.20 2026-09-08 21:41:53 +02:00
Irmen de Jong 619a215a87 fix test size expectation 2026-09-07 19:14:58 +02:00
Irmen de Jong c12e27dacc cx16: added verafx-accelerated line routine, added cobramk3 example that uses it next to the cpu only version 2026-09-06 22:51:12 +02:00
Irmen de Jong db32b81d7a m68k: d0 caching 2026-09-06 20:32:16 +02:00
Irmen de Jong 687d86d36e added amiga1200 target (68020 + FPU) 2026-09-06 18:25:15 +02:00
Irmen de Jong 58f544fe14 Implement counted-loop IR (IRLoopChunk)
Replace the early lowering of constant repeat/for loops into p8_regfile
counter sequences with a first-class IRLoopChunk that carries the trip
count and body. This removes the fragile REGFILE-DEPENDENT m68k dbra
peephole and gives each backend explicit control.
2026-09-04 00:01:00 +02:00
Irmen de Jong 0771105694 fix sorting module on virtual target 2026-09-03 03:39:07 +02:00
Irmen de Jong b0f1f655c3 codeGenIntermediate: fold struct-array field access to single LOADX/STOREX
Replace arr[idx].field (arr:Struct[Sz], idx variable) from
EXT+MUL #Sz + ADDR + ADD #fieldOff + LOADI/STOREI (5 ops) to
single indexed op: LOADX/STOREX arr+fieldOff,S=Sz and
STOREZX for zero. Reuses existing ,S=N + +off encoding.
2026-09-02 01:35:30 +02:00
Irmen de Jong 59c41ad129 ir: add scaled indexing (S=) to LOADX/STOREX/STOREZX
Remove byte-offset pre-scaling from IR generation and encode
element index + explicit scale in the IR.  Effective address is
base + index*scale + disp (disp = symbolOffset).
2026-09-02 00:34:23 +02:00
Irmen de Jong 60eeaba791 streamline IR optimization proposals 2026-09-01 23:15:03 +02:00
Irmen de Jong 9d537ab3c0 warn when %zpreserve/%zpallowed excludes fixed zeropage scratch locations 2026-09-01 04:21:49 +02:00
Irmen de Jong 1ba08ec6ec make -dumpvars work on all compilation targets 2026-09-01 03:51:13 +02:00
Irmen de Jong 9c53791ef4 m68k: optimize small memcopies to inline copy 2026-08-30 21:35:48 +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 b0d50c2a68 preserve block comments in compiler AST and AST output 2026-08-30 02:33:30 +02:00
Irmen de Jong deae2e6422 Unify variable and memory slab relocation with vars address configuration 2026-08-29 01:17:44 +02:00
Irmen de Jong c8d29e6dc9 ir: more IR peephole optimizations 2026-08-29 00:29:50 +02:00
Irmen de Jong a7b14c2931 ir: more optimized inplace array assignments 2026-08-28 23:38:54 +02:00
Irmen de Jong a14a8f4e62 ir: deduplicate index canonicalization and strengthen regression tests 2026-08-28 23:00:51 +02:00
Irmen de Jong cf50372515 ir: canonicalize LOADX/STOREX/STOREZX index width and remove guessed-type workaround 2026-08-28 22:23:55 +02:00
Irmen de Jong da0df8f133 amiga: use defer for resource freeing, change custom.grab_system and restore_system value storage so they are now regular subroutines instead of inline 2026-08-28 21:27:02 +02:00