Ref files — SkoolKit 9.6 documentation (original) (raw)

If you want to configure or augment an HTML disassembly, you will need one or more ref files. A ref file can be used to (for example):

A ref file must be formatted into sections separated by section names inside square brackets, like this:

The contents of each section that may be found in a ref file are described below.

[AudioWriter]

The AudioWriter section contains configuration parameters that control audio file creation by the #AUDIO macro. The parameters are in the format:

Recognised parameters and their default values are:

Version Changes
9.1 Added default values for the 128K model
8.7 New

[Colours]

The Colours section contains colour definitions that will be used when creating images. Each line has the form:

or:

where:

Recognised colour names and their default RGB values are:

Version Changes
3.4 Added support for hexadecimal RGB triplets
2.0.5 New

[Config]

The Config section contains configuration parameters in the format:

Recognised parameters are:

The Expand parameter can be used along with the #INCLUDE macro to place all the text to be expanded in its own section. This is particularly useful when that text cannot easily be placed on a single line. For example:

[Config] Expand=#INCLUDE(Expand)

[Expand] ; Multiple lines of text to be expanded here ...

For information on using the HtmlWriterClass parameter and creating your own Python class for writing an HTML disassembly, see the documentation onextending SkoolKit.

The InitModule parameter can be used to modify the built-in HtmlWriterclass before it is imported by skool2html.py. This is an alternative to creating your own HtmlWriter class that is suitable when the required modification is small.

Note that the Config section must appear in a ref file that is read automatically by skool2html.py by virtue of having the same filename root as the skool file given on the command line (i.e. game*.ref if the skool file is game.skool).

Version Changes
8.6 Added the Expand parameter
8.5 Added the InitModule parameter
5.0 Added the RefFiles parameter
3.3.1 Added support to the HtmlWriterClass parameter for specifying a module outside the module search path
2.2.3 Added the HtmlWriterClass parameter
2.0 New

[EntryGroups]

The EntryGroups section defines groups of entries (routines and data blocks) whose disassembly pages can then be given custom titles and headers via the [Titles] and [PageHeaders] sections. Each line in this section has the form:

where:

An address specification can be either a single address (e.g. 30000), or an address range (e.g. 30000-30010).

For example:

SpriteVariables=32768,32770-32772

This defines an entry group named ‘SpriteVariables’ that consists of the entries at 32768 and any others between addresses 32770 and 32772 inclusive. The titles and headers of the disassembly pages for these entries can then be specified like this:

[Titles] Asm-SpriteVariables=Sprite variable at {entry[address]}

[PageHeaders] Asm-SpriteVariables=Sprite variables

Entry group names may also be used in the Includes parameter of a[MemoryMap:*] section. For example:

[MemoryMap:SpriteVariables] Includes=SpriteVariables

This defines a memory map page named ‘SpriteVariables’ consisting of only the entries that belong to the group of the same name.

Version Changes
8.5 Added support for identifying entries by address ranges
8.4 New

[Game]

The Game section contains configuration parameters that control certain aspects of the HTML output. The parameters are in the format:

Recognised parameters are:

Every parameter in this section may contain skool macros.

The AddressAnchor parameter contains a standard Python format string that specifies the format of the anchors attached to instructions on disassembly pages and entries on memory map pages. The default format string is{address}, which produces decimal addresses (e.g. #65280). To produce 4-digit, lower case hexadecimal addresses instead (e.g. #ff00), changeAddressAnchor to {address:04x}. Or to produce 4-digit, upper case hexadecimal addresses if the --hex option is used withskool2html.py, and decimal addresses otherwise:{address#IF({mode[base]}==16)(:04X)}.

Version Changes
9.4 Added the Download and LinkInternalOperandsMinDistanceparameters
8.7 Added the AudioFormats parameter
8.4 Added the Address and Length parameters
8.0 Added the AsmSinglePage parameter
7.2 Added the Bytes and DisassemblyTableNumCols parameters
6.0 Every parameter (not just Logo) may containskool macros
4.3 Added the AddressAnchor parameter
4.1 Added the LinkInternalOperands parameter
4.0 Set default values for the InputRegisterTableHeader andOutputRegisterTableHeader parameters; added theCopyright, Created and Release parameters (which used to live in the [Info] section in SkoolKit 3)
3.7 Added the JavaScript parameter
3.5 Added the Font, LogoImage and StyleSheet parameters (all of which used to live in the [Paths] section,LogoImage by the name Logo)
3.4 Added the LinkOperands parameter
3.1.2 Added the InputRegisterTableHeader andOutputRegisterTableHeader parameters
2.0.5 Added the Logo parameter

[ImageWriter]

The ImageWriter section contains configuration parameters that control SkoolKit’s image creation library. The parameters are in the format:

Recognised parameters are:

Version Changes
3.0.1 Added the PNGAlpha and PNGEnableAnimation parameters
3.0 New

[Index]

The Index section contains a list of link group IDs in the order in which the link groups will appear on the disassembly index page. The link groups themselves - with the exception of OtherCode - are defined in[Index:*:*] sections. OtherCode is a special built-in link group that contains links to the index pages of secondary disassemblies defined by[OtherCode:*] sections.

To see the default Index section, run the following command:

$ skool2html.py -r Index$

Version Changes
2.0.5 New

[Index:*:*]

Each Index:*:* section defines a link group (a group of links on the disassembly home page). The section names and contents take the form:

[Index:groupID:text] Page1ID Page2ID ...

where:

To see the default link groups and their contents, run the following command:

$ skool2html.py -r Index:

Version Changes
2.0.5 New

[Links]

The Links section defines the link text for the various pages in the HTML disassembly (as displayed on the disassembly index page). Each line has the form:

where:

Recognised page IDs are:

The default link text for a page is the same as the header defined in the[PageHeaders] section, except where indicated above.

The link text for a page defined by a [MemoryMap:*], [OtherCode:*] or[Page:*] section also defaults to the page header text, but can be overridden in this section.

If the link text starts with some text in square brackets, that text alone is used as the link text, and the remaining text is displayed alongside the hyperlink. For example:

MemoryMap=[Everything] (routines, data, text and unused addresses)

This declares that the link text for the ‘Everything’ memory map page will be ‘Everything’, and ‘(routines, data, text and unused addresses)’ will be displayed alongside it.

Version Changes
5.3 Added the AsmSinglePage page ID
2.5 Added the UnusedMap page ID
2.2.5 Added the Changelog page ID
2.0.5 New

[MemoryMap:*]

Each MemoryMap:* section defines the properties of a memory map page. The section names take the form:

where PageID is the unique ID of the memory map page.

Each MemoryMap:* section contains parameters in the form:

Recognised parameters and their default values are:

Every parameter in this section may contain skool macros.

To see the default memory map pages and their properties, run the following command:

$ skool2html.py -r MemoryMap

A custom memory map page can be defined by creating a MemoryMap:* section for it. By default, the page will be written to maps/PageID.html; to change this, add a line to the [Paths] section. The title, page header and link text for the custom memory map page can be defined in the [Titles],[PageHeaders] and [Links] sections.

Every memory map page is built using the HTML template whose name matches the page ID, if one exists; otherwise, the stock Layouttemplate is used.

Version Changes
8.5 Added support for address ranges in the Includes parameter
8.4 The EntryTypes parameter defaults to an empty string
8.1 Added the LabelColumn parameter
6.2 Added the Includes parameter
6.0 Every parameter (not just Intro) may containskool macros
4.0 Added the EntryDescriptions and LengthColumn parameters
2.5 New

[OtherCode:*]

An OtherCode:* section defines a secondary disassembly that will appear under ‘Other code’ on the main disassembly home page. The section name takes the form:

where CodeID is a unique ID for the secondary disassembly; it must be limited to the characters ‘$’, ‘#’, 0-9, A-Z and a-z. The unique ID may be used by the #R macro when referring to routines or data blocks in the secondary disassembly from another disassembly.

An OtherCode:* section may either be empty or contain a single parameter named Source in the form:

where fname is the path to the skool file from which to generate the secondary disassembly. If the Source parameter is not provided, its value defaults to CodeID.skool.

When a secondary disassembly named CodeID is defined, the following page and directory IDs become available for use in the [Paths], [Titles],[PageHeaders] and [Links] sections:

By default, the index page is written to CodeID/CodeID.html, and the disassembly pages are written in a directory named CodeID; if a single-page template is used, the disassembly page is written to CodeID/asm.html.

Note that the index page is a memory map page, and as such can be configured by creating a [MemoryMap:*] section (MemoryMap:CodeID-Index) for it.

Version Changes
5.0 Made the Source parameter optional
2.0 New

[Page:*]

A Page:* section either declares a page that already exists, or defines a custom page in the HTML disassembly. The section name takes the form:

where PageID is a unique ID for the page. The unique ID may be used in an[Index:*:*] section to create a link to the page in the disassembly index.

A Page:* section contains parameters in the form:

Recognised parameters are:

Every parameter in this section may contain skool macros.

Note that the Content, SectionPrefix and PageContent parameters are mutually exclusive (and that is their order of precedence); one of them must be present.

By default, the custom page is written to a file named PageID.html in the root directory of the disassembly; to change this, add a line to the[Paths] section. The title, page header and link text for the custom page default to ‘PageID’, but can be overridden in the [Titles],[PageHeaders] and [Links] sections.

Every custom page is built using the HTML template whose name matches the page ID, if one exists; otherwise, the Layout template is used.

Version Changes
6.0 Added support for SectionType=BulletPoints; every parameter (not just PageContent) may containskool macros
5.4 Added the SectionType parameter
5.3 Added the SectionPrefix parameter
3.5 The JavaScript parameter specifies the JavaScript file(s) to use
2.1 New

[Paths]

The Paths section defines the locations of the files and directories in the HTML disassembly. Each line has the form:

where:

Recognised file IDs and their default paths are:

Recognised directory IDs and their default paths are:

Every parameter in this section may contain skool macros.

The CodeFiles parameter contains a standard Python format string that specifies the format of a disassembly page filename based on the address of the routine or data block. The default format string is {address}.html, which produces decimal addresses (e.g. 65280.html). To produce 4-digit, upper case hexadecimal addresses instead (e.g. FF00.html), change CodeFilesto {address:04X}.html. Or to produce 4-digit, upper case hexadecimal addresses if the --hex option is used with skool2html.py, and decimal addresses otherwise: {address#IF({mode[base]}==16)(:04X)}.html.

Version Changes
8.7 Added the AudioPath directory ID
6.3 Added the ImagePath directory ID and the ability to define one image path ID in terms of another
6.0 Paths may contain skool macros; added theUDGFilename parameter (which used to live in the[Game] section)
5.3 Added the AsmSinglePage file ID
4.3 Added the CodeFiles file ID
3.1.1 Added the FontPath directory ID
2.5 Added the UnusedMap file ID
2.2.5 Added the Changelog file ID
2.1.1 Added the CodePath directory ID
2.0.5 Added the FontImagePath directory ID
2.0 New

[Resources]

The Resources section lists files that will be copied into the disassembly build directory when skool2html.py is run. Each line has the form:

where:

The files to be copied must be present in skool2html.py’s search path in order for it to find them. To see the search path, run:

fname may contain the special wildcard characters *, ? and [], which are expanded as follows:

If destDir contains a path ID replacement field (e.g. {AudioPath}), the corresponding parameter value from the [Paths] section will be substituted.

If your disassembly requires pre-built images or other resources that SkoolKit does not build, listing them in this section ensures that they will be copied into place whenever the disassembly is built.

Version Changes
9.3 Added support for path ID replacement fields in the destDirparameter
8.0 Added support for the ** pattern
6.3 Added support for pathname pattern expansion using wildcard characters
3.6 New

[Template:*]

Each Template:* section defines a template used to build an HTML page (or part of one).

To see the contents of the default templates, run the following command:

$ skool2html.py -r Template:

For more information, see HTML templates.

Version Changes
4.0 New

[Titles]

The Titles section defines the title (i.e. text used to compose the<title> element) for every page in the HTML disassembly. Each line has the form:

where:

Recognised page IDs and their default titles are:

Every parameter in this section may contain skool macros.

The Asm-* parameters are formatted with an entry dictionary identical to the one that is available in the asm template.

The title of a page defined by a [MemoryMap:*], [OtherCode:*] or[Page:*] section defaults to the page ID, but can be overridden in this section.

The title of each disassembly page for the entries belonging to a group defined in the [EntryGroups] section defaults to the title for that page’s entry type, but can be overridden in this section.

Version Changes
8.0 An entry dictionary is available when formatting Asm-*parameters; the default title for each Asm-* page includes the entry address as a replacement field
6.0 The default title for Asm-t pages is ‘Text at’; titles may contain skool macros
5.3 Added the AsmSinglePage page ID
4.0 Added the Asm-* page IDs
2.5 Added the UnusedMap page ID
2.2.5 Added the Changelog page ID
2.0.5 New

Box pages

A ‘box page’ is an HTML page that contains entries (blocks of arbitrary text) distinguished by alternating background colours, and a table of contents (links to each entry). It is defined by a [Page:*] section that contains aSectionPrefix parameter, which determines the prefix of the ref file sections from which the entries are built.

SkoolKit defines some box pages by default. Their names and the ref file sections that can be used to define their entries are as follows:

To see the contents of the default [Page:*] sections, run the following command:

If anchor is omitted from an entry section name, it defaults to the title converted to lower case with parentheses and whitespace characters replaced by underscores.

By default, a box page entry section is parsed as a sequence of paragraphs separated by blank lines. For example:

[Bug⚓title] First paragraph.

Second paragraph.

...

However, if the SectionType parameter in the [Page:*] section is set toListItems, each entry section is parsed as a sequence of single-line list items with indentation. For example:

[Changelog:title] Intro text.

First top-level item. First subitem. Second subitem. First subsubitem.

Second top-level item. ...

The intro text and the first top-level item must be separated by a blank line. Lower-level items are created by using indentation, as shown. Blank lines between items are optional and are ignored. If the intro text is a single hyphen (-), it is not included in the final HTML rendering.

If your list items are long, you might prefer to set the SectionTypeparameter to BulletPoints; in that case, each entry section is parsed as a sequence of multi-line list items prefixed by ‘-’. For example:

[Changes:title] Intro text.

An entry section’s anchor, title and contents may contain HTML markup and skool macros.

Changed in version 6.0: Added support for parsing an entry section as a sequence of multi-line list items prefixed by ‘-’ (SectionType=BulletPoints). The anchor andtitle of an entry section name may contain skool macros.

Changed in version 5.4: The anchor part of an entry section name is optional.

Appending content

Content may be appended to an existing ref file section defined elsewhere by adding a ‘+’ suffix to the section name. For example, to add a line to the[Game] section:

[Game+] AddressAnchor={address:04x}

New in version 7.0.

Square brackets

If a ref file section needs to contain a line that looks like a section header (i.e. like [SectionName]), then to prevent that line from being parsed as a section header it can be escaped by doubling the opening square bracket:

[Glossary:term] [[This is not a section header]

The content of this section will be rendered thus:

[This is not a section header]

In fact, any line that starts with two opening square brackets will be rendered with the first one removed.

New in version 4.0.