version 14.0-BETA4预发布2026-11-23
Prog8 14.0-BETA4 重点补齐了 Amiga 裸机开发能力:新增基于 VBR 的中断框架,提供 sethandler/restorehandler/irqtrampoline 及 enableirq/disableirq/ackirq 等接口,配合 CIA 定时器、TOD 闹钟与 VERTB 示例可直接上手。图形方面扩展到 OCS/ECS/AGA 精灵、bob、blitter 填充与 copper/playfield,原 text 库更名为 gfxtext。
语言层面,结构体实例变量现已支持所有目标平台,包括内存映射实例与静态初始化中的取地址;同时新增子程序局部结构体类型、结构体 swap()、字符串指针 for 循环等。性能上 m68k 完成第一阶段帧指针省略与大量窥孔优化,6502 则改进了结构体字段寻址与指针复用。
修复涉及编译器崩溃、Amiga 精灵/blitter/waitvsync 等多处问题。注意破坏性变更:enablevertb/ackvertb 已被统一的 IRQ 接口取代,IRQSource 枚举移除,CX16 旧 PSG 相关 API 也已清理。
version 12.3.52026-10-30
prog8 12.3.5 是 12 系列的收官版本,之后主线将转入正在 beta 测试的 14 版。本次主要是一轮修复,另有一项功能增强:alias 现在支持整个 block,可通过 block 别名调用子程序(含嵌套调用)、读取常量以及访问数组/结构体成员;整枚 enum 不再支持别名,需逐个成员设置。
修复方面:not 与 and/or 混用同一表达式不再导致编译器崩溃;min/max 在赋值目标与操作数存在别名时(如 speed = min(err / 8, speed),issue #247)不再算错。6502 平台上,裸类型指针解引用(temp^^)不再破坏指针变量本身,指针指向结构体字段的二次解引用(foo.bar.baz^^)也一并修好。内置的 lsb/msb/lsw/msw/pop/popw 不再把 CX16 虚拟寄存器(如 @R0)当作非法结果寄存器。虚拟目标上,短路布尔 and/or 结果错误、popw/popl/popf 误报字节类型、byte downto 0 循环死循环等问题均已解决。
version 14.0-BETA3预发布2026-10-28
这版更新的重头戏是 M68K 后端(amiga500、amiga1200、qemu68k)的寄存器分配器与栈帧:子程序的局部变量和参数改用 CPU 栈上的活动记录,子程序从此可以递归和重入;热点值由过程内分配器驻留在 D2-D6、A2-A4、FP2-FP7 等硬件寄存器中,溢出槽挂在 A5 帧尾。asmsub 需自行保留这些寄存器,自行操作栈的子程序可加 %option noframe。同时补齐一批 M68K 代码生成优化(存储/加载折叠、分支反转、尾调用窥孔等),扩展加载合并为 loadmz/loadms 等单条 IR 指令,6502 也新增了基于 IR 的窥孔优化器。
语言层面,pointer 保留为类型名,^^pointer 解析与指针字段解引用修复;新增 via/until 语法遍历链表。库方面新增 easygfx、emudbg 模块,lists 全平台支持双向链表,M68K 数学例程扩充并汇编化。工具链上 -emu 改为启动 Copperline 模拟器,编译器版本写入生成的汇编文件,标签哈希保持稳定。另修复了 peek/poke 语境错误、not 与 or/and 组合、虚拟目标短路求值等多处崩溃。
version 14.0-BETA2预发布2026-10-10
2nd beta release of the upcoming Prog8 version 14.0
Changes since v14.0-BETA1. The big theme of this beta is the new stack-based memory model for the experimental m68k targets, which makes ordinary m68k subroutines recursive and re-entrant, plus a batch of new Amiga/C64 libraries and codegen optimizations.
Breaking / behavior changes
- M68K calling convention is now stack-frame based. Ordinary subroutine locals and parameters live in an activation record on the CPU stack (frame pointer A5), so subroutines can be recursive/re-entrant. Hand-written assembly that calls a normal Prog8 subroutine must follow the new all-stack argument convention and preserve A5.
- Storing or returning the address of a variable that lives in a call-stack frame is now an error (m68k); such addresses are only valid until the subroutine returns. The compiler emits best-effort escape warnings.
- @shared now guarantees program-static storage with a stable address on all targets, and pins the variable to static storage on m68k. Locals referenced from inline assembly get this suggested automatically.
- A defer body that touches locals/parameters of a recursive or dynamically re-entered subroutine is rejected on m68k.
- Pointer subtraction semantics: subtracting two typed pointers of the same type now yields the number of elements (C-style), using the target's address type.
M68K stack-based memory model
- Full activation-record model with link a5,#-N / unlk a5, negative-offset locals, padded 4-byte argument slots, and caller-pops argument cleanup.
- Clean locals (including arrays) are zero-initialized on every call; the compiler warns about large framed arrays, and @dirty skips the clear.
- Subroutine inlining, frame teardown on branch/jump exits, @shared pinning, and optimized stack-frame zeroing.
- New %option noframe (subroutine level) forces the legacy static convention for routines that manipulate the machine stack themselves.
- Coroutines library reworked to use per-task stacks; sys.stack_size() reports remaining stack bytes.
- Single framed local limited to 16 KiB; the built-in VM does not execute frame-based IR and rejects such programs.
Language / compiler features
- union types: every field is at offset 0 and storage equals the largest field; only zero-init [] allowed, values written at runtime through typed pointers.
- Whole-enum aliasing: aliasing an enum now aliases each of its members.
- New -o / --output option to name the exact output program file; all auxiliary files use its stem. Mutually exclusive with -out.
- Custom m68k compilation targets: the m68k codegen is selected from the target's cpu property (M68000/M68020), and a per-target link.ld linker script supplies the memory layout.
- Multiple status-flag returns in a single multi-assignment now work on all codegens (except amiga500/68000, which cannot save the status register non-privileged).
- sys.die() on m68k shows an Intuition alert; sys.exit() takes a word status in D0 on m68k.
- 6502 assembly output now emits _size symbols for struct/union memory; m68k assembly output emits struct field definitions.
New libraries and modules
- VERA64 support library for the c64 target: vera, veragfx, verapalette, vera_sprites.
- Amiga: ahi (amiga1200 high-quality audio), asyncio.library, lowlevel.library, trackdisk.device, and a dos.read_file helper.
- Shared m68k implementations of adpcm and wavfile (table-driven/asm decoder, big-endian correct).
- New examples: qemu68k recursive maze solver, Amiga fractal-tree, adpcmbench, ahiplay, ahimodes, stream-adpcm, wavc, lowlevel-timer, and c64 verademo.
Optimizations
- 6502: constant multiplications via shifts (byte and word), uword * ubyte, inlined clamp() with constant bounds, square() range check moved out of call sites.
- 6502/IR: redundant lea elimination, extended index-reload peephole, faster long multiplication, and signed-division-by-power-of-two is no longer folded unsafely.
- m68k: improved subroutine inlining and stack-frame zero-clear coalescing.
- cx16 gfxlores/gfxhires text() routines optimized; adpcm decoder roughly twice as fast.
Other changes
- Bug fixes and internal improvements clumped together: struct-array initializer prefixing, min/max rewrite aliasing, 6502 pointer-field augmented assignment, defer stack-save ordering for multi-value returns, sizeof for large structs, %jmptable crashes, VM label-valued initializers, several IR/new6502 codegen bugs, and various compiler-crash and diagnostics fixes.
- Documentation cleanups and added sections for unions, custom m68k targets, and the m68k memory model.
- Build/runtime housekeeping: Gradle wrapper update and a JDK --enable-native-access flag to silence newer-JDK native-library warnings.
release 14.0-BETA1预发布2026-09-15
first beta release of the upcoming Prog8 version 14.0
A new major version bringing some pretty major changes and additions to Prog8. And yes, we skipped version 13 because of raisins :black_cat: :ladder:
A short overview of the major new features can be found at the bottom of https://prog8.readthedocs.io/en/latest/history.html
Breaking changes
- list module renamed to lists. Update %import list to %import lists, and uses like list.xxx / ^^list.node to lists.xxx.
- -expericodegen option renamed to -newcodegen. Same meaning: use the experimental IR-based 6502 code generator instead of the AST one. Scripts using the old flag must be updated.
- Virtual target is now 32-bit. The VM uses m68k-style 32-bit registers. pointer / addresses on virtual (and on the new m68k targets) are 4 bytes (long), vs 2 bytes (uword) on the 6502 targets. Code that assumes 16-bit pointers, register width, or VM internals on virtual will need updating. strings, floats, math and other virtual lib routines were adapted accordingly.
- New pointer address type. A plain untyped address that is 2 bytes on 8-bit targets and 4 bytes on 32-bit targets (m68k, virtual). Prefer pointer over uword for addresses in portable code. See pointers.
- defer behavior change: deferred blocks now also unwind at program exit() / return from start(), not just at the end of the enclosing subroutine. Useful for Amiga resource cleanup, but existing start() code with defer will now run that cleanup on exit too.
- CLI overhaul: argument parsing moved from kotlinx-cli to Clikt, terminal output uses Mordant (colors/styling). Help text and console formatting changed - update scripts that parse compiler output.
New targets (experimental)
- 32-bit Motorola 68000/68020 support, IR-based code generator.
- amiga500 (68000), amiga1200 (68020 + optional FPU), qemu68k (Qemu m68k simulator).
- Arrays/strings up to 32K on m68k targets, endian-aware msb/lsb/msw/lsw, long mul/div (utility.library on Amiga where available).
- Full Amiga library suite: exec, dos, intuition, graphics, custom (incl. cpuVBR, isPAL, filter_on/off), copper, blitter, audio (audio.device), ptplayer (ProTracker playback with feedback), arexx, timer, icon, iffparse, bcd, compression, conv, coroutines, sys.arguments (CLI args), sys.memcopy via exec.CopyMem. Plus new examples: screen, iff, modplay, blitcop, amiga3d, window, rasters, and more.
Language / compiler features
- %assert <const expr> [, "message"] - compile-time assertion, e.g. %assert sizeof(Enemy) <= 32, "enemy struct grew too large".
- Named struct-field initializers - e.g. ^^Enemy:[hp=100, x=10] in any order, omitted fields are zero-initialized.
- %option private_symbols + public keyword - make all symbols private by default, selectively expose with public.
- const type can be omitted - const A = 42 defaults to long for integers (float/bool inferred, memory() infers pointer).
- For-loop upgrades:
- implicit loop var - for i in 0 to 10 no longer needs a predeclared i,
- optional explicit type to override inference,
- variable step (not just const),
- iteration over lists list/nodes, reverse str/array iteration with step -1.
- Arrays of struct instances - MyStruct[N] vars, incl. whole-struct copy; strings can init arrays in struct instances.
- Deref assignment targets - (expr as ^^Struct).field = v, func().field = v; unary ops through pointers.
- Const expressions for 2D array dimensions (and struct field array sizes).
- %bssaddress / %slabsaddress - directly control those segment addresses.
- arena allocator library on all targets (bump allocator: init/alloc/reset; word-sized on 6502, long-sized + even-aligned on 32-bit).
- verafx line routine on cx16 + new cobramk3-verafx example.
- C64 sprite multiplexer improvements.
- Diagnostics: -dumpvars works on all targets, warning when %zpreserve/%zpallowed excludes fixed scratch locations, better errors for builtin names as block names and for aliased/qualified struct types.
- 6502: tighter for code for word/long loop vars plus ongoing IR-based backend optimizations.
Other changes
- Bug fixes and internal improvements (structured/counted-loop IR, LOADX/STOREX scaling, EXTL opcodes, VM/m68k/6502 peepholes, status-flag fusion, Kotlin 2.4.20).
version 12.3.42026-09-12
Prog8 v12.3.4是维护版本,集中修复结构体与指针相关问题,并解决虚拟机上的死循环。
结构体写法更灵活了:字段数组长度可以直接用常量表达式,比如uword[STACKSIZE] values,其中STACKSIZE是const。6502目标上,索引式结构体指针字段也能用+=、-=这类原地修改运算符,例如list^^.items[i] += 1。
修复方面,6502目标此前对结构体指针字段的数组下标会生成错误代码,另有几处相关缺陷也一并纠正。编译器现在会正确提示把内置函数名或保留字用作块名的情况;别名指向枚举成员不再出错,指向枚举类型本身的别名则会被拒绝。虚拟目标上,for x in N downto 0字节循环会无限挂起——虚拟机的decm不更新状态标志,导致bstpos读到过期值,现改为显式比较后分支,问题解决。
version 12.3.32026-09-08
12.3.3是bug修复版本。修复方面,内联展开(inliner)在处理给自身参数赋值的子程序时会崩溃,现已解决;带寄存器映射参数的子程序此前可能被错误内联,也一并纠正。内联汇编另有两处问题:管道符|用作非标准位置的指令分隔符时名称修饰会出错,以及%asm行分组不当,导致汇编优化器把多行块误判为单条指令。此外新增一条编译错误提示——变量声明后若紧跟其他语句且写在同一行,编译器会直接报错,便于尽早发现排版疏漏。
version 12.3.22026-08-31
本次更新以修复为主。6502代码生成方面,索引指针数组、指针存储与指针运算、原地取反和取负等场景的错误输出已修正,结构体内的数组也补上了缺失的边界检查。类型转换、结构体指针字段访问、混合类型常量以及浮点结构体字段此前会导致编译器崩溃或结果错误,现已一并解决;uword的双重自增/自减行为也已校正。编译器对不支持的语言构造现在会给出更清晰的报错,守护进程的错误提示与输出信息也做了简化,另外修复了Commander X16平台sys.restore_irq()生成无效代码的问题(#233)。改进部分,3D旋转示例经过优化,文档与拼写也有所更新。
release 12.3.12026-08-11
Prog8编译器12.3.1发布,本次以修复为主,没有新增功能。
编译器端修复了两处代码生成问题:数组赋零值的IR生成有误,以及在状态标志不保留的情况下比较指令会被漏掉,二者都可能生成错误的机器码。另外,嵌套作用域里多值变量初始化此前会出错,daemon模式下的错误输出和文件处理也一并修好了。
针对Windows用户,库导入不再因InvalidPathException而失败。图形方面,实心圆的绘制例程存在overdraw(重复着色)问题,现已修正。
version 12.32026-08-05
Prog8编译器v12.3发布。破坏性变更有三项:-nostdlib选项被移除,bankmanager模块改名bankselector,swap由函数改为语句。语言层面,结构体支持嵌入数组,@bank指令新增子程序名写法以实现动态banking,banked调用点获唯一ID、重复调用时编译更稳,零页分配按使用频率优先,内存映射指针不再被拒绝;内联也有所增强,单个简单参数的子程序纳入内联(实验性)。编译器内部新增基于IR的6502代码生成器(用-newcodegen启用,仅限c64、c128、cx16、pet32,实验性,勿用于生产),并加入m68k生成器骨架,IR新增LOADHR/STOREHR、单比特操作码等,解析器提速。库方面新增floats.mod()、PET32的petsnd音乐播放函数与music示例、串口getbaudstring()、sys.set_irq()等,floats.minf/maxf/clampf得到优化。构建系统改用Gradle,模块搜索顺序确定化并新增-traceimports,缺失模块的报错会列出全部搜索路径。