Program metadata
The first 32 bytes of a Bedrock program can contain structured information about the program.
Identifier
This value is a literal-mode jump instruction encoded as the three bytes 0x410020
. The value is used to identify Bedrock programs from other types of file. A set of bytes in this role is also known as a ‘magic number’. This exact value was chosen as it prevents the program metadata from being executed as code when the program is run.
If the value of these bytes is not 0x410020
, the meaning of the following bytes is undefined, and the file is likely not a Bedrock program.
Bedrock string
This value is the string “BEDROCK” encoded as the seven bytes 0x424544524F434B
. This value is used as a secondary method of identifying a Bedrock program from other types of file, and as a human-readable and searchable identifier.
The value of these bytes must be 0x424544524F434B
.
Program memory size
This value is a double representing the number of bytes of program memory required for the correct operation of this program.
A value of zero represents the full size of 65536 bytes.
Working stack size
This value is a byte representing the number of bytes of working stack memory required for the correct operation of this program.
A value of zero represents the full size of 256 bytes.
Return stack size
This value is a byte representing the number of bytes of return stack memory required for the correct operation of this program.
A value of zero represents the full size of 256 bytes.
Required devices
This value is a double representing the list of devices which are required for the correct operation of this program. Each bit of this value is associated with a device from the Devices specification, as per the ‘Bit’ column of the Device mapping table of the System device specification. The bit associated with a particular device is set only if that device is required by this program.
Name
This value is a double representing the program memory address at which a null-terminated UTF-8 string is stored which represents the name and version of the program. The content of the bytestring is the name of the program, followed by a forward-slash character 0x2F
, followed by a version string which identifies which version of the program this is. The format of the version string is implementation defined.
A value of zero indicates that a name is not available.
Authors
This value is a double representing the program memory address at which a UTF-8 encoded null-terminated bytestring representing the names of the authors of the program is stored. The content of the bytestring is a number of lines, each line identifying one of the authors of this Bedrock system implementation, and each line being terminated by a newline character 0x0A
. The content of each line is a name identifying an author of the program, followed by a newline character 0x0A
.
A value of zero indicates that author information is not available.
Description
This value is a double representing the program memory address at which a UTF-8 encoded null terminated bytestring representing a description of the program is stored. The content of the bytestring is a short sentence which succinctly describes the general category or purpose of this program. The sentence should be around 20 characters in length.
Background colour
This value is a double representing the background colour to use for the icon and general branding of this program, in the format used by the Palette port of the Screen device specification. The highest four bits of the value must all be set.
A value of zero indicates that an implementation defined default colour should be used.
Foreground colour
This value is a double representing the foreground colour to use for the icon and general branding of this program, in the format used by the Palette port of the Screen device specification. The highest four bits of the value must all be set.
A value of zero indicates that an implementation defined default colour should be used.
Small icon
This value is a double representing the program memory address at which a small icon for this program is stored. A small icon is a 24 pixel by 24 pixel square monochrome image, encoded as 9 contiguous 8-byte blocks of memory, each block representing a 1-bit sprite. The sprites are grouped in left-to-right rows, with rows ordered top-to-bottom.
A value of zero indicates that a small icon is not available.
Large icon
This value is a double representing the program memory address at which a large icon for this program is stored. A large icon is a 64 pixel by 64 pixel square monochrome image, encoded as 64 contiguous 8-byte blocks of memory, each block representing a 1-bit sprite. The sprites are grouped in left-to-right rows, with rows ordered top-to-bottom.
A value of zero indicates that a large icon is not available.
Path buffer
This value is a double representing a program memory address. If the current program was loaded from the filesystem, the Bedrock-encoded path to the file from which the program was loaded should be written to program memory starting at this address. If the current program was loaded from a remote system, the path of the remote location from which the program was loaded should be written to program memory starting at this address. At most 255 bytes will be written to this program memory address.
A value of zero indicates that a path should not be written to program memory.