Releases: irmen/prog8
version 11.3.2
Prog8 version 11.3.2
Fixed
- allow bitwise operation between different types as long as they're the same size. (11.3.1 broke this)
- various bugs around word-indexing combined with address-of: &buffer[2000]
- code gen error for certain goto array[index] where sometimes the first entry was taken regardless of index
other changes
- documentation tweaks
v11.3.1
Bug fix release for C64 mostly.
goto array[idx]
now assembles correctly again on C64 (or more specifically, on 6502 cpu targets)- fix
strings.hash()
to correctly assemble on C64 and other targets with a "full zeropage" - fix const evaluation of bitwise expressions (&, |, ^, <<, >>) with signed numbers
- fix Java version incompatibility with Java versions older than 21
other improvements:
- the
math.randrange()
family of routines are now much faster - some redundant variable initialization was removed so programs are now smaller
- a bit stricter assignment type compatibility checking
- added
-version
switch to just print the compiler version string and license - fixed some IR problems
v11.3
what's new: ROMable programs
Use the new %option romable
to tell prog8 to generate programs that can be run from ROM.
This means no inline variables and no self-modifying code (something which prog8 uses for 'normal' programs because sometimes it creates smaller or faster code.
Almost all library routines have been made ROM-compatible to support programs like this.
Read the paragraph in the manual for more details.
Note: some routines such as math.rnd
have not been modified for ROM use, because the performance hit might be unacceptable for regular programs. Instead, a slower math.rnd_rom
has been introduced for ROM use.
other changes
- a floating point value is now allowed to be part of a multi-value-return
psg
module no longer writes vera psg registers for voices it doesn't use- compiler now supports symlinks in paths
- an integer range is now allowed as a choice value in
when
statements, but be aware that checking large ranges is slow because it will be done simply by value inclusion check and not < or > comparisons - added diskio.loadlib() convenience function to load library blobs
- custom compiler targets now include an
output_type
setting which is XEX for the atari target, for instance. - added
-quiet
flag to no longer print noise output - examples/vm was renamed to examples/virtual
- added
cx16.memory_decompress_from_func
- added
cx16.push_rambank/rombank
andcx16.pop_rambank/rombank
to avoid having to sacrifice a variable when temporarily setting the bank to another value and restoring it - new routines
palette.get_default
andpalette.set_default
to get and set the full 256 colors default VERA palette (requires cx16 kernal rom V49) strings.rfind
now returns the correct result for empty strings
bugfixes
- fixed
diskio.f_read
returning 1 byte less than the actual size read - fixed
diskio.f_read_all
to deal with errors in a more robust manner, this fixes a problem with the X16 Calypso - better EOF handling in diskio
- fix memtop limit when using -varshigh option
- fix IRQ related crash because stored vector was overwritten
- various other bugfixes and improvements
version 11.2
Important bug fix release with some new features.
Bugs fixed:
- C64: graphics.plot() now works again , it was broken since version 10.5
- X16: introduced a workaround for SMC issue that could make
sys.reset_system()
andsys.poweroff_system()
not work properly on hardware boards - X16:
cx16.VERA_FX_POLY_FILL_H
constant value typo fixed - clear error messages instead of compiler crashes for several source code errors
- symbol prefixing bug fixed for certain use of
%option no_symbol_prefixing
- you can once again call a label as a subroutine (but this is now also a footgun warning)
- fix code generation error when assigning address of split word array without explicit adressof syntax
- better error if module name clash occurs caused by case-insensitive names
- fix codegen for
@(ptr-offset)=value
that was writing bogus values to memory
New stuff:
- some range checks can now be evaluated at compile time
- introduced
%option romable
as a start to help generate code that can be put into ROM. There's still a long way to go. But this option now starts generating warnings of code that is generated that will not be able to be put into ROM, so it can help to identify problem points. - Added
strings.ncompare
to compare strings up to n characters - improved some syntax highlights
- more forgiving handling of constants of different types
- various optimizations in generated code
- internal compiler refactoring to reduce project dependencies and improve API surface for future code generators or tools
- more often print the offending source code position that triggers an internal compiler crash
- added a sprites/coroutines/defer benchmark module to the benchmarking program
version 11.1
breaking changes
txt.get_cursor()
now returns column+row as 2 valuesabs()
returntype is now unsigned-sourcelines
command line option is changed into-nosourcelines
because the default is now to include those source lines in the generated assembly.
libraries
- added fileselector example (cx16 and c64)
monogfx
can fill with stippling again- added
cx16.get_charset()
- added
sprites.getxy()
diskio
: added several routines to only list files or directories
other new stuff
- normal (non-asmsub) subroutines can now also return multiple values
- support multi-value variable initialization: ubyte a,b,c = multi()
- added configurable compilation targets
- atari and neo targets are no longer built-in but available as such configurable targets in the examples
- added
%output library
to make it easier to produce loadable libraries - added
%jmptable
directive to build a JMP-table meant for libraries - added
c64os
character encodings - no longer clears msb on asmsub argument byte
@r0
(r0 was treated as a word before, but it is specified as a byte, so only the Lsb is significant) - code generation improvements and bugfixes
version 11.0.1
Fixing some problems found in 11.0
Fixes
- fixed two possible compiler crashes in library import code (1 for filename CaSiNg issues on widows, 1 for transitive imports done by library modules)
- fixed a compiler crash related to array parameter types for subroutines
- pet32 target: fixed
txt.plot()
putting the cursor in the wrong position (col/row were mixed up) cbm.PLOT()
: the order of the return values when getting the cursor position has been swapped, is now colum (in Y) followed by row (in X). This is the same order as the arguments to the routine are given to set the cursor position.diskio.diskname()
could hang on a disk error, this has been fixed- some stricter type checking for multivalue assigns, to avoid possible faulty code generation due to missing type conversion
Additions/changes
- added
txt.t256c()
on the commander X16 to turn 256 color tile mode on or off - updated zsmkit library blob for a fix in the zsm_clearisr() routine
- added
coroutines
library andmultitasking
example - modified the cx16images.py Python script to work again with newer pillow library version
version 11.0
This is Prog8 version 11.0 - just in time for a nice Christmas present!
It is a new major compiler version because some fundamental things have changed and many new features have been added since version 10.
Breaking changes
- the
string
module has been renamed tostrings
to be more consistent with others - removed the
anyall
module. It was inefficient and didn't work correctly romsub
keyword has been removed,extsub
is now the only recognized way- the
-addmissingrts
compiler flag has been removed. No sudden RTS instructions will be inserted in your code. You have to take care that your assembly routines contain one to properly return to their caller. - removed
txt.VERA_TEXTMATRIX_BANK
andtxt.VERA_TEXTMATRIX_ADDR
, it's now justtxt.VERA_TEXTMATRIX
(a long const, see below at new language features) - the sort order of blocks has been changed: blocks with addresses are now sorted last
- word arrays are now split by default. To store them in the old sequential memory layout, you can use
@nosplit
. - the
-splitarrays
compiler option was changed to-dontsplitarrays
and the purpose was inverted accordingly. cx16.set_screen_mode
no longer returns anything. No need to use void anymore. You can still use the actual kernal routine if you are interested in the return status values.math.crc32
now returns the crc32 value according to the ISO-HDLC standard, which is what zlib/pkzip also usessys.sizeof_xxx
are renamed tosys.SIZEOF_XXX
for consistency
New language features
- you can now define
const long
numbers (that can hold values larger than a word). You can use them in compile time expressions. But there are no long variables yet so the result of such expressions that need to be placed in a variable still has to fit in a byte or word. - new
msw
andlsw
builtin functions (similar to the existing lsb and msb) that return the most and least significant words of a value, respectively. Handy with const long values to be able to put them into word variables.
Themsw
result can also be used as the ram/rom bank byte! (as long as the address put in is within 24 bits) - the
extsub
address can now be an expression, handy to define jump tables with offsets. Combine this with the@bank
support for extra smooth external library routine integration. - normal subroutines can now also take their arguments in R0-R15 'registers' similarly as asmsubs already could. This is a footgun however! Use wisely!
palette.set_monochrome()
has been removed- added a start color index parameter to several routines in the
palette
module so you can now modify other parts of the color palette instead of only from color 0 onwards - boolean variables, including boolean arrays, can now be memory mapped too.
goto
can now jump to a calculated address using any expression instead of just a constant number or identifier- new operators
&<
and&>
to get the address of the LSB and MSB sub-arrays of a split word array, respectively.
New or improved library functions
- the zsmkit music player example has been extended with the new zsmkit V2.4 library version. This version is much easier to integrate in prog8 programs
- added several float limits contants such as floats.EPSILON, floats.E
- added sys.MIN_FLOAT, sys.MAX_FLOAT, and the MIN/MAX values for the integer types as well
- added
floats.interpolate
andmath.interpolate
to complement the existing LERP routines. Addedinterpolation
example that shows how to use this - added several decompression routines to the
compression
library: for RLE, ZX0 and TSCrunch compressed data. - improved
buffers
library and now documented - added
sorting
library to sort bytes, words, and string arrays. - all flood fill graphics routines (in monogfx, gfx_lores, gfx_hires) now no longer fail to fill certain areas because their out of stack memory problem is fixed (by using the much larger stack from the buffers library)
- in
diskio
, the IO channels are now always reset back to their defaults (screen/keyboard) so that you don't have to do this yourself when you want to read or write stuff to the screen while a file is open. - the
palette
module has been optimized to be a lot faster and smaller - added
palette.set_rgb_nosplit()
andset_rgb_be_nosplit()
to support passing of@nosplit
color arrays.
(the existing routines were modified to work on@split
arrays which are now the default storage format for word arrays) - added
sprits.pos_batch_nosplit
to allow passing@nosplit
x/y arrays. The existing pos_batch routine now expects@split
word arrays because that is the default - added
diskio.get_loadaddress
to retrieve the load address of a PRG file (= the first 2 bytes) - added
math.crc32_end_result
to more naturally retrieve the resulting low and high words of the crc32 result.
Other changes
- a problem with diskio was fixed that triggered a bug in the Vice C64 emulator when running on host fs where half of the data disappeared
- value range checking has been improved
- documentation has been overhauled, redundant syntax chapter mer 8000 ged with the rest
- new compiler options
-plain
to remove ansi escapes from the output, and-ignorefootguns
to well... ignore the footgun problems - new
coroutines
example that shows possible multitasking - various code generation improvements to create smaller and faster code
- big internal compiler change to make the type system more versatile for future changes
- bugfixes
version 10.5.1
A patch release that fixes some problems and oversights in the 10.5 release. It is strongly advised to upgrade to this version if you are using 10.5 now.
Changes:
gfx_hires4
module is now namedgfx_hires
to be consistent with thegfx_lores
module- added
sprites.reset()
routine to remove sprites from the screen progstart()
was added to complementprogend()
repeat
now supports 65536 iterationsdefer
can now also be used inside if-statements (the semantics don't change though)%memtop
now specifies the first address NOT to use, to reflect the semantics of the memtop kernal call- memtop now automatically adjusts when you use
%address
beyond the default - documentation improvements
- assembly optimization regression fixed that was caused by wrong label prefixing
- fix several compiler crashes
math.mul16_last_upper()
is fixed again- internal diskio library restructuring (shouldn't be noticeable for user code)
version 10.5
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 intogfx_lores
andgfx_hires4
optimized for a single resolution each.
thewidth
andheight
symbols were renamed toWIDTH
andHEIGHT
(constants)
and the screen_mode routine is now calledgraphics_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 intoextsub
(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
andc64.getbanks
including an example program - added routines for manual memory banking on the C128
c128.banks
andc128.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
andgfx_hires4
modules (formerlygfx2
). 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
andfloats.lerp
andfloats.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 aroundAYINT
(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.
version 10.4.2
This release fixes some bugs and improves some things, and adds some new library modules and exampoles, but no major language changes.
breaking changes
- removed the broken
verafx.mult
routine (verafx doesn't support unsigned multiplications. The muls routine is still there, that one works fine) - added
verafx.mult16
for just the 16 bit unsigned results that worked fine. - string assignments got somewhat stricter to avoid problematic cases. If your code doesn't compile anymore, you should use
string.copy
explicitly now to set a new value to a string.
other changes
- fixed assembly optimization bug that removed a RTS sometimes. This broke
floats.ceil
and some other routines. - fixed "raw" output to also properly initialize variables.
- fixed C64 floating point sign problem
- added experimental
compression
library, it provides RLE compression and decompression routines. (the RLE algorithm supported is Byterun1/Packbits, which is used in Amiga IFF ILBM images among others) - cx16: added
audio
module with subroutines to simplify calling the Audio routines in the kernal. The 'audioroutines' example has been updated to use this. - cx16: kernal bank 0 is once again activated at startup to speed up kernal calls
- cx16: added
callfar2
builtin function that allows you to set A,X,Y and Carry parameters instead of only AY. - cx16: added color fade routines to the
palette
module - cx16: added a port of the c64's "balloonflight" example. Added 'starszoom' example.
- added
sys.sizeof_byte
etc etc constants that are the memory sizes of the given datatypes - many code optimizations
- several error message improvements.
- documentation improvements.
- added 'fractal-tree' example.
Thanks to the people in the Prog8 channel on the X16 discord for their contributions.