Skip to content

Releases: cardillan/mindcode

3.13.0

18 Jan 20:22

Choose a tag to compare

3.13.0 – 2026-01-18

Note

The atomic code blocks are only guaranteed to execute correctly in the latest BE version (build 26609 or higher). The latest beta release (v154.3) doesn't provide necessary support for atomic code blocks.

Fixed

  • Fixed incorrect emulation of the instruction accumulator for targets 6 and 7 affecting instruction scheduling.

Added

  • Added new @maxUnits sensable property.
  • Added an atomic code block: a block of code guaranteed to be executed atomically (without interruption), meaning that other processors or game updates do not change the world state.
  • Added the setrate and ipt compiler options. These options specify the rate at which a world processor executes instructions (used by the compiler when building atomic blocks).
  • Added the volatile-atomic compiler option governing the way atomic blocks are created.
  • Added the processor-id, program-name and program-version compiler options. These options take string values, which are then encoded into a *id variable and can be used to identify the processor in the schematics.
  • Added the emulator-fps compiler options to specify the frame rate to be emulated by the processor emulator. While frames are always emulated fully by Mindcode emulator, the change in instruction scheduling caused by different frame rate only affects situations where an interaction between two or more processors is being emulated.
  • Added the ability to run the compiled schematics on the schematics emulator to the tool app.
  • Added support for sensing @x and @y in blocks when emulating schematics.
  • Added the encode-zero-characters compiler option, which allows encoding zero characters in string literals. Use with caution: resulting code cannot be edited or passed via clipboard. Option has no effect in the web app.

Changed

  • Runtime errors generated when running the code in the processor emulator no longer prevent outputting the compiled code in the tool app.
  • Changed the format of the target compiler option. Instead of a processor edition (standard or world), a particular processor type is now specified, using the first letter of the type name (i.e., m for micro-, l for logic-, h for hyper-, and w for world-processor, case-insensitive), for example, #set target = 8L;.
  • When compiling Mindcode for a processor in a schematic, the target type of the processor is determined by the block type in the schematic.
  • Compiler-defined constants now follow the @@VARIABLE pattern, instead of earlier __VARIABLE__ (for example, @@MINDUSTRY_VERSION).
  • Changed the emulator handling of the wait instruction with zero argument to match the latest Mindustry BE behavior.

Miscellaneous

  • The system of compiler options has been updated to allow determining whether a given option has been set. This allows the default values of unset options to be derived from the values of other options.
  • The transfer variable, defined for uncached external and remote variables, is no longer used for reads. Instead, a fresh new temporary variable is used each time. This may increase the number of temporary variables generated but avoids unnecessary instructions when using postfix operators on these variables. This became quite important with atomic blocks.

3.12.1

12 Jan 21:34

Choose a tag to compare

3.12.1 - 2026-01-12

Fixed

  • Fixed the Data Flow optimization incorrectly marking a variable as uninitialized (#296).

3.12.0

11 Jan 13:45

Choose a tag to compare

3.12.0 - 2026-01-11

Fixed

  • Fixed incorrect evaluation of some numeric mlog constants (#295).
  • Fixed the Mandelbrot schematic sample not rendering after build.

Changed

  • The Loop Rotation optimization has been updated:
    • Full loop rotation is performed even for conditions which contain complex code (such as nested loops or function calls).
    • A full loop rotation is also considered alongside a partial rotation if it could be beneficial to Loop Hoisting.
  • The Loop Hoisting optimization has been extended:
    • The optimizer gathers information to support the Loop Rotation optimization.
    • When a loop is fully rotated, an instruction can be hoisted in such a way that it's executed at most once, but only if the loop actually runs.
    • When a loop is not known to execute at least once, an instruction affecting just the loop can still get hoisted entirely out of the loop if the loop is nested.
  • The mlog processor emulator has been completely rewritten. The emulator now matches the behavior if a Mindustry processor of the version identified by the target (or emulator-target compiler options.
  • The execution flags have been updated to match the new processor emulator. Some flags have been removed, some have been added, and some have been renamed.
  • The processor emulator is now able to execute supported instructions even when created using an mlog() fuction or an mlog block. This includes the code generated by the compatibility library.

3.11.0

25 Dec 12:05

Choose a tag to compare

3.11.0 - 2025-12-25

Note: the new features in this release bring about changes to the best practices for writing Mindcode.

Fixed

  • Some select optimizations were not applied when optimizing for size. As a result, code optimized for size might end up larger than code optimized for speed.
  • Some select optimizations may have been incorrect. Due to the previous bug, the probability of them being applied was low (#290).
  • Fixed the wrong optimization of volatile variables in If Expression Optimization (#291).
  • Fixed instructions being hoisted in front of the loop even when the loop is not guaranteed to run (#293).
  • Fixed loop-dependent instructions being possibly hoisted in front of the loop (#294).

Added

  • Breaking: new keywords have been added to the language: public and private and are reserved for future use. Code that uses any of these keywords as a function or variable name will not compile, and the variable or function will have to be renamed.
  • Added the no-argument-padding compiler option. When activated, instructions are not padded to the maximum number of arguments.
  • Added the author compiler option. The option adds an entry to the list of authors, which is then displayed alongside the usual compiler signature.
  • Added support for new instruction opcode (ucontrol deconstruct).
  • Added a binary in operator for testing whether a value is contained in a given range or a list of values.

Changed

  • Breaking: The and and or operators now perform short-circuit evaluation.
  • The Jump Optimization has been renamed to Condition Optimization, and has been significantly extended:
  • Breaking: The jump-optimization command-line option and compiler directive has been renamed to condition-optimization.
  • The Loop Optimization has been renamed to Loop Rotation, and has been extended to support short-circuit conditions. Full and partial loop rotations are now supported.
  • Breaking: The loop-optimization command-line option and compiler directive has been renamed to loop-rotation.
  • The Boolean Optimization, previously included in the If Expression Optimization as a Select Optimization, has been extracted into a separate optimization class and enhanced:
    • Several optimizations aimed at short-circuited conditional expressions were added.
    • Where possible, an op instruction is used instead of select. This allows applying some optimizations even when the compilation target doesn't support select.
  • The Expression Optimization has been updated:
    • More cases where a select instruction can be replaced with a set instruction are now supported.
    • When the resulting values of select are 0 and 1 and the condition allows it, the instruction is replaced with an op instruction.
    • The instruction normalizing the result of an || operator to 0 or 1 is removed when not needed.
    • Added an optimization turning a read instruction with a constant string and a constant index into a set instruction setting the character value directly.
  • When evaluating jump and select conditions during optimizations, cases where the operands of the condition are identical (the same variable) are handled.
  • The compatibility system library now also performs a test to find out whether assigning null to @counter is ignored by the processor.
  • The mimex metadata have been updated to match the current BE version. The most significant change is a new set of sound constants.
  • The documentation has been restructured. Individual optimizers are described in separate files, and the description of Logic functions with links to the Function reference was also moved to a separate file.

Miscellaneous

  • A new optimization, Instruction Reordering, is being developed. The corresponding compiler directive is already present, but the optimization, even when explicitly enabled, is not yet functional.
  • All experimental features are now considered standard. The default optimization level is now advanced. Going forward, only features controllable via compiler options will be marked experimental, and the default optimization level will be advanced. Note that Mindcode is a live system and features may be modified to support new functionalities. A reasonable effort will be spent to ensure smooth conversion or backwards compatibility, but all features, both well-established and relatively recent, can be changed or removed in a new release.

3.10.0

17 Nov 22:13

Choose a tag to compare

3.10.0 - 2025-11-17

Fixed

  • Fixed an error in the Single Step Elimination optimization causing some superfluous jumps not being removed.

Added

  • A new fast dispatch optimization is available for case expressions. Fast dispatch uses just a single instruction to transfer the control to the desired branch of a case expression, including the else branch.
  • A new value translation optimization, which reads values encoded into a text string using the read instruction, may be applied on case expressions (#289).
  • Added the use-text-translations compiler option to allow/disallow using encoding values into a text string for the above optimization.

Changed

  • Breaking: the text-tables compiler option has been renamed (yet again - sorry) to use-text-jump-tables.
  • The Case Switcher optimization was updated to fully support null values in when branches (even in integer expressions).
  • The Extended testing tool now accepts values for any compiler directive in the settings file.

3.9.0

27 Oct 19:24

Choose a tag to compare

3.9.0 - 2025-10-27

Fixed

  • Fixed error on the Schematic Decompiler page (#288).
  • Fixed the compiler not rejecting integer and double compiler option values outside their allowed range.
  • Fixed the compiler not stopping the compilation when an error in compiler directive gets detected.
  • Fixed rare internal error in Jump Threading optimization.
  • Fixed broken reporting of source file positions when compiling Mindcode within a schematic.

Added

  • Breaking: new keywords have been added to the language: debug and export. Code that uses any of these keywords as a function or variable name will not compile, and the variable or function will have to be renamed.
  • Added support for implementing the !== operator using a select stricEqual instruction in target 8.
  • Added the emulate-strict-not-equal compiler option to allow/disallow using select instead of jump strictNotEqual.
  • Added new internal array implementations using new Mindustry 8 logic capabilities:
  • Added support for using text-based table dispatch in array implementations.
  • Added the use-lookup-arrays and use-short-arrays options.
  • Added warnings when a name specified by the mlog modifier collides with another user-defined variable or array element in the current processor.
  • Added the ability to output the final code size broken down by function and an accompanying print-code-size options.
  • Added the error() function, which can be used to report errors detected at runtime.
  • Added the debug compiler option for compiling code with debug support.
  • Added debug code blocks. Compiled only when debug is set to true.
  • Added debug functions. Calls to debug functions are ignored unless debug is set to true.
  • Added target selection to the Mindcode Compiler and Schematics Builder pages in the web app.

Changed

  • Breaking: change to options governing runtime check generation:
    • the error-reporting option now specifies the mechanism to be used by the compiler to report runtime errors. When set to none, no runtime checks occur, regardless of other settings. This was previously governed by the boundary-checks option.
    • the boundary-checks option now takes a value of true or false, activating/deactivating boundary checks on array accesses.
    • the error-function option takes a value of true or false. When true, the error is reported using the mechanism specified by error-reporting; when false, the error()` function has no effect.
  • Breaking: specifying the mlog name of a variable using the remote modifier is no longer supported. The remote modifier now takes only the name of the remote processor as a parameter, enclosed in parentheses. Use the mlog modifier to specify the mlog name of the remote variable.
  • The mlog variable name must not match a linked block name.
  • The mlog modifier accepts multiple expressions, allowing to specify names for individual array elements.
  • The mlog modifier also accepts one of the lookup keywords (:block, :unit, :item, :liquid or :team) in array declarations, allowing to specify the lookup type used by the array.
  • The cached and noinit cached modifiers can be used with variables declared remote, with the same effect as in case of variables declared external.
  • Warnings are no longer issued for unused volatile variables. It is assumed that an unused volatile variable will be accessed indirectly.
  • Changed the default value of the mlog-block-optimization from false to true.

Deprecated

  • Using the remote modifier to mark functions and variables to be accessible remotely is deprecated. Use the export keyword instead.
  • Using parameters with the external or remote modifiers without parentheses is deprecated.

Removed

  • The loop keyword, deprecated earlier and optional in the do while loop syntax, has been removed.
  • The optimization level setting was removed from the user interface on the web page.

3.8.0

25 Sep 18:21

Choose a tag to compare

3.8.0 - 2025-09-25

Fixed

  • Circular module dependencies get correctly identified and reported (#226).
  • Fixed a possible internal compiler error when performing the Temp Variable Elimination optimization.

Added

Changed

  • Breaking: files included via the require directive or via the -a command-ine argument must contain a module declaration.
  • Breaking: modules must be compiled using the strict syntax mode. The strict mode is the default for any source file containing a module declaration, regardless of whether the module contains remote functionality or not.
  • Breaking: the text-jump-tables compiler option has been renamed to text-tables.

Miscellaneous

3.8.0 beta 5

07 Sep 19:55

Choose a tag to compare

3.8.0 beta 5 Pre-release
Pre-release

3.8.0-beta.5 - 2025-09-07

Note: this is a beta release. It's been released to provide bugfixes and new enhancements to Mindcode and Schemacode.

The newly added features are fully functional. There's an unfinished support for the #setlocal directive. It doesn't have any effect at this time.

Fixed

  • Fixed Jump Threading optimization causing an internal error (#283).
  • Fixed Compiler error unrolling an unreachable loop (#285).

Added

  • Added support for calling remote functions locally.
  • Added support for evaluating the @name property of all objects (not just objects with a logic ID) to compile-time evaluator. The @name property is always compile-time evaluated when possible, regardless of the builtin-evaluation option.
  • Added support for evaluating the @name property to the Expression Optimization. The @name property is always compile-time evaluated when possible, regardless of the builtin-evaluation option.
  • Added new filename attribute to schematic definition, allowing to specify the name of the output file to use for the generated schematic.
  • Breaking added new target attribute to schematic definition, allowing to specify the target version for the schematic. This might break existing schematics, as previously schematics were compiled using the latest metadata version only.
  • Added support for a content map in schematics, both when reading and when writing them. The content map is included in all schematic files, regardless of target (older Mindustry versions which do not support a content map will ignore them when reading schematics).
  • Added the --output-directory command-line option; if the output directory isn't specified as part of an explicit output file designation, the file will be placed in the output directory.

Changed

  • Breaking: mlog variable name specified using the mlog and remote specifier must be enclosed in parentheses. Any constant string expression is supported.

Miscellaneous

  • Separated the mimex data into a standalone repository, which is now included as a git submodule at compiler/src/main/resources/mimex.
  • Updated the BE version metadata to the latest available BE build.

3.8.0 beta 4

28 Jul 13:48

Choose a tag to compare

3.8.0 beta 4 Pre-release
Pre-release

3.8.0-beta.4 - 2025-07-28

Note: this is a beta release. It's been released primarily to support the newest Mindustry Logic instructions (select), and as a preview of the newest optimization features (namely, text-based jump tables).

The newly added features are fully functional. There's an unfinished support for the #setlocal directive. It doesn't have any effect at this time.

Fixed

  • Fixed a possible internal compiler error when using the Temp Variable Elimination and the select optimization.

Added

Changed

  • Breaking: remote functions and variables/arrays must always be specified with a fully qualified name (e.g. processor1.x or processor2.foo()) when accessing or calling them from a main processor.
  • Removed restrictions on requiring the same source files from different modules.
  • Remote variables are not reported as unused.

3.8.0 beta 3

24 Jul 08:00

Choose a tag to compare

3.8.0 beta 3 Pre-release
Pre-release

3.8.0-beta.3 - 2025-07-24

Note: this is a beta release. It's been released primarily to support the newest Mindustry Logic instructions (select), and as a preview of the newest optimization features (namely, text-based jump tables).

The newly added features are fully functional. There's an unfinished support for the #setlocal directive. It doesn't have any effect at this time.

Fixed

  • Fixed the Data Flow Optimization not optimizing global variables (#280).
  • Fixed Loop Hoisting processing instructions that change variables already read by the loop (#282). Loop Hoisting can process global variables again.
  • Fixed a bug in the bubblesort function in the arrays system library.

Changed

  • Changed the Jump Threading optimization to redirect jumps to a function call directly to the function. The optimization may currently only take place when symbolic-labels is set to false.
  • Improved the select optimization in the If Expression Optimization to handle more cases as well as nested or chained conditional expressions.