Skip to content

version 10.5

Compare
Choose a tag to compare
@irmen irmen released this 09 Nov 15:15
· 200 commits to master since this release

This is a pretty big release with a lot of changes, some of which that are not backwards compatible with older versions.

Breaking changes:

  • the compiler is now named 'prog8c' and the jar file accordingly 'prog8-10.5-all.jar'
  • gfx2 module is gone, it's split into gfx_lores and gfx_hires4 optimized for a single resolution each.
    the width and height symbols were renamed to WIDTH and HEIGHT (constants)
    and the screen_mode routine is now called graphics_mode.
  • arrays can no longer be initialized with a single numerical value, it is now required to write out the full initialization array. Or omit it as before to get an array of all zeros. However there is a new syntax to create array literals with repeated values, see below at New Stuff
  • array to array assignments is no longer supported (other than initialization of variable declaration).
    Just use an explicit sys.memcopy(src, dest, sizeof(dest)) or assign array elements individually.
  • removed block level memory alignment via %option align you now have to use the new @align tags on individual variables
  • asmsubs no longer get an RTS instruction inserted at the end if it is missing. Make sure you correctly return from assembly routines.
  • the math module is no longer automatically imported in your program. If you use it you'll need to add %import math
  • romsub keyword renamed into extsub (because it's not only for ROM routines)
  • on the C64, the BASIC ROM at $a000-$bfff is now banked out by default. Prog8 programs have a whopping ~50 Kb of contiguous RAM at their disposal ($0801 - $cfff) without having to do memory banking by themselves.
  • on the C128, the BASIC ROM at $4000-$bfff is now banked out by default. Prog8 programs can now use ~41 Kb of contiguous RAM ($1c00-$bfff) without having to do memory banking by themselves.
  • program bootstrap code has been moved from the end to the beginning of the program. This shifts up the actual address of the start() routine.

New stuff:

  • automatic support for calling routines in banked memory, via @bank tag on extsub definitions (formerly romsub). This makes Prog8 the first language on the Commander X16 at least, where you no longer have to manually switch banks when calling routines in another memory bank. This is supported on the X16, C64 and the C128.
  • added routines for manual memory banking on the C64 c64.banks and c64.getbanks including an example program
  • added routines for manual memory banking on the C128 c128.banks and c128.getbanks
  • defer statement for delayed execution (useful for resource cleanups for example). Inspired by the defer statement from Zig, Go, or Swift.
  • if-expression (prog8's alternative for a ternary operator): result = if x>10 "yes" else "no" It's like an if statement but it is an expression. The if and else parts are also expressions.
  • per-variable memory alignment via @alignword @alignpage and @align64
  • new directive %align <interval> inserts a memory alignment command for the assembler at that precise place
  • new directive %memtop <address> changes the expected max memory location the program is going to use. Can be used to "reserve" a bunch of memory at the end of the available space.
  • alias statement that aliases a symbol (possibly from another module) by another name locally. Can shorten/clarify code.
  • added sys.memcmp memory comparison routine (like strcmp, but doesn't stop at 0 byte)
  • the way block merging is done using %option merge has been overhauled. You can now monkeypatch existing code if you merge in subroutines with an exactly matching signature including the names of the parameters.
  • added a few new graphics routines in the gfx_lores and gfx_hires4 modules (formerly gfx2). gfx_lores now has a draw mode selection and can draw in EOR mode, useful for non destructive drawing
  • added diskio.exists to check if a file is already present
  • added linear interpolation routines math.lerp and floats.lerp and floats.lerp_fast
  • replaced the old ZSOUND example by the new ZSMKIT example that plays .zsm music on the Commander X16.
  • floats: added AYINT2 as a safe wrapper around AYINT (used to convert floats to integers). The new routine no longer depends on internal kernal variable locations and should always be used over AYINT.
  • added experimental neo compiler target (for the Neo6502). Still pretty bare bones but functional
  • variables can now be marked @dirty to omit initialization of their value. This saves code, but leaves their initial value undefined which is a dangerous footgun, so beware when using this that you properly assign a value to them yourself
  • array literals with repeated values can now be created using the similar syntax as what was already possible for string literals, type the base array and add * <repeats>. For example [42] * 99 creates an array of 99 times the value 42. That base array can consist of multiple values.

Other changes:

  • optimizations and bug fixes, as usual.