Commit Graph
63 Commits
Author SHA1 Message Date
Irmen de Jong fe90ca572d slice 2 for m68k stack mememory model 2026-10-07 19:06:16 +02:00
Irmen de Jong 26bbd6c1fe vertical slice prototype for m68k stack mememory model 2026-10-07 19:06:16 +02:00
Irmen de Jong 1f8b42fae5 make user docs and some code comments less convoluted 2026-10-05 20:00:32 +02:00
Irmen de Jong 38db571f20 implemented -o / --output to specify specific output file 2026-10-02 22:33:43 +02:00
Irmen de Jong b8c975704a 6502 byte shift optimization for const multiplications 2026-09-26 03:25:25 +02:00
Irmen de Jong 69525ae67f 6502 codegen: emit _size symbol for struct and union memory size 2026-09-23 23:14:11 +02:00
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 468850bc47 structured IR 2026-09-11 20:20:40 +02:00
Irmen de Jong ce2b298d6f code cleanups 2026-09-08 22:36:54 +02:00
Irmen de Jong e074fe614f avoid extremely long array data source lines, and redundant label comments 2026-09-06 16:18:31 +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 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 1ba08ec6ec make -dumpvars work on all compilation targets 2026-09-01 03:51:13 +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 deae2e6422 Unify variable and memory slab relocation with vars address configuration 2026-08-29 01:17:44 +02:00
Irmen de Jong 937b520838 core: fix POINTER equalsSize target-aware for 32-bit 2026-08-27 03:15:57 +02:00
Irmen de Jong 250ddda11b ir,m68k: add LOADP_INC/STOREP_INC for pointer post-inc (a0)+ 2026-08-27 02:57:54 +02:00
Irmen de Jong 5857382242 add %bssaddress and %slabsaddress directives to directly control the addresses of those segments 2026-08-23 14:16:06 +02:00
Irmen de Jong 79dd8d6b92 vm: rnd() is now identical to the xorshift algorithm of the other compilation targets
m68k: implemented clamp IR syscalls
new6502: implement EXTL
2026-08-22 22:29:41 +02:00
Irmen de Jong df659d285b optimize imports 2026-08-18 01:28:35 +02:00
Irmen de Jong cc4f27d121 vm: making VM 32 bit
work in progress: see vm32.md there are failing tests still
2026-08-16 19:49:28 +02:00
Irmen de Jong 69eaaf29c4 amiga: added sys.arguments for any CLI argument string 2026-08-16 07:08:22 +02:00
Irmen de Jong 69def73f3f m68k: allow assigning string constant to long/pointer variable (to get its address) 2026-08-16 06:18:33 +02:00
Irmen de Jong 6c93254758 m68k assembly peephole optimizer 2026-08-16 01:58:17 +02:00
Irmen de Jong a68cdd13a6 IR: added EXTL and EXTLS opcodes to help with pointer math 2026-08-15 22:58:15 +02:00
Irmen de Jong 2b93efbb33 m68k: remove redundant 0-extension, optimize and fix MSB/LSB extraction 2026-08-15 18:21:16 +02:00
Irmen de Jong ba7bf3f4fe cache IRProgram.registersUsed() 2026-08-13 23:25:00 +02:00
Irmen de Jong a09942254d migrate CLI argument parsing from the obsolete kotlinx-cli library to Clikt 2026-08-13 22:33:16 +02:00
Irmen de Jong e5f488dcfb new6502: fix align and 0-assign into array 2026-08-06 20:13:42 +02:00
Irmen de Jong b8d38eccca new6502: fix long comparisons and STZ on 6502 2026-08-06 19:08:09 +02:00
Irmen de Jong e007d127f0 IR: smarter handling of x<<16 and x>>16 if x is a long 2026-08-05 02:01:21 +02:00
Irmen de Jong e5d9609db1 IR: added new multi-bit shifting opcodes 2026-08-05 01:42:49 +02:00
Irmen de Jong b5fd07bb91 IR: added STOREIM instruction for immediate store constant to memory 2026-08-04 23:11:07 +02:00
Irmen de Jong 368dce93d9 new6502 codegen: implement long multiplications and divisions 2026-08-04 19:09:41 +02:00
Irmen de Jong 42e8e91034 disable signed div bias-shift method because of code bloat 2026-08-04 18:38:35 +02:00
Irmen de Jong 49f5c30e8c 6502: better error message for missing signed divmod support 2026-08-04 13:09:06 +02:00
Irmen de Jong bef1678c2a IR: divmod no longer uses stack to return the quotient and remainer 2026-08-04 12:46:36 +02:00
Irmen de Jong 93b953cf60 implement IR ADDIM and SUBIM in the new codegens 2026-08-03 21:53:54 +02:00
Irmen de Jong b0cf649c2d register packer does't work well 2026-07-16 20:33:27 +02:00
Irmen de Jong aabd99e9eb fix uword to pointer assignment problems 2026-07-10 21:32:59 +02:00
Irmen de Jong cf6efd76f0 making sure memory() is long on m68k 2026-07-10 04:51:54 +02:00
Irmen de Jong 88b3291785 added ELF/RAW output type selection for m68k, fix div garbage register data 2026-07-07 21:49:45 +02:00
Irmen de Jong 1f4ffdffc1 fix IR constant prefixing/no prefixing 2026-07-07 01:45:55 +02:00
Irmen de Jong 7f51bbd777 working on encoding support for variable sized pointers in the IR 2026-07-07 00:06:28 +02:00
Irmen de Jong 5c36e21948 working on fixing pointer arithmethic
but see transformWithPointerArithmetic() still unfinished
2026-07-06 02:20:32 +02:00
Irmen de Jong 57055b3b55 map m68k cpu registers to and from slots 2026-07-05 16:25:20 +02:00
Irmen de Jong 11e3b39486 m68k (incomplete) attempt to fix 32 bits pointers 2026-07-05 06:31:24 +02:00
Irmen de Jong 1c50e397de m68k registers 2026-07-05 03:41:59 +02:00