Basic Tickflow Syntax

Every line in tickflow is one of four things:

  • Function Calls, which directly correspond to a single bytecode instruction. These are the only lines of tickflow that translate into bytecode;
  • Compile-time variable assignments, which do not correspond to bytecode, but rather allow you to use constant variables to replace magic numbers;
  • Markers, which allow you to use locations in the tickflow code as variables;
  • and Directives, which include custom function aliases and file metadata.

Function Calls

Function calls are of the form

op<special> arg1, arg2...

Here, op is either a name or a number; it determines what operation is performed. In bytecode, the opcode is a number between 0 and 0x3FF. This is an accepted value for op in Tickflow, but there are a number of known operations that have defined names in Tickflow. Examples include rest, if and case.

<special> is an expression enclosed in <>, which is used as a special argument for the operation. The function of this special argument varies per operation, but it can also be used to differentiate similar operations in place of creating a separate op value for it. <special> can be omitted, in which case it defaults to 0.

Following the special argument is a comma-separated list of arguments. These are all expressions, and their effect and amount depends on the operation. There can be from 0 up to 15 arguments.

Expressions

Expressions resolve to numbers. They consist of variables, numbers and mathematical operations. The operators you can use for expressions are multiplication (*), addition (+), subtraction (-), integer division (/), bitwise right shift (>>), bitwise left shift (<<), bitwise AND (&), bitwise OR (|), and bitwise XOR (^).

Examples of expressions include 5, 0xFE3, 0xFF << 5, and x + 2.

Compile-time Variables

Compile-time variables can be used to store numbers for later use in your Tickflow code. For example, you could save a variable beat with value 0x30, since one beat of music corresponds to this value in timing-related functions. Variable assignment is of the form

var = expr

var denotes the variable name. Variable names must start with a letter and contain only alphanumeric characters and underscores. expr is an expression denoting the value you are setting the variable to.

Markers

Markers ‘mark’ locations in your tickflow code, saving the location into a variable so that they can be used in other parts of the file. These are usually used for functions like call, which execute tickflow at a specific location. Markers are of the form

name:

name is the name of the marker and has the same constraints as variable names. Markers generated by the decompiler will have a naming scheme locXX:, where the number XX is based on the order the locations are referenced in the file.

Directives

Directives carry metadata about the file, but are also used for custom operation aliases. Current directives are:

  • #index num sets the index of the rhythm game this file will replace when patched into the game.
  • #start loc sets the location in the file at which tickflow execution will begin. This is often 0.
  • #assets loc sets the location in the file where certain assets, like the intro screen, are loaded. This is needed for insertion into the game.
  • #alias name num creates a custom function alias under the name name for the operation number num.