ASM templates¶
Each line of output produced by skool2asm.py is built from a template. A
template contains ‘replacement fields’ - identifiers enclosed by braces
({
and }
) - that are replaced by appropriate content (such as a label
or register name) when the template is formatted.
The default templates can be overridden by custom templates read from a file by
setting the Templates
configuration parameter of
skool2asm.py. To define a custom template, specify its
name in square brackets on a line of its own, and follow it with the content of
the template. For example:
[org]
.{org} {address}
comment¶
The comment
template is used to format a line in an entry title, entry
description, block start comment, mid-block comment, or block end comment.
; {text}
The following identifier is available:
text
- the text of the comment line
This template is also used to used to format lines between paragraphs in
comments, with text
set to an empty string.
equ¶
The equ
template is used to format an EQU directive produced by @equ.
{label} {equ} {value}
The following identifiers are available:
equ
- ‘EQU’ or ‘equ’ (depending on the case)label
- the labelvalue
- the value
instruction¶
The instruction
template is used to format an instruction line or
instruction comment continuation line.
{indent}{operation:{width}} {sep} {text}
The following identifiers are available:
indent
- the instruction indent (as defined by theindent
property)operation
- either the operation (e.g. ‘XOR A’), or an empty string (if formatting a comment continuation line)sep
- the comment separator (‘;’ if there is a comment, an empty string otherwise)text
- the text of the comment linewidth
- the width of the instruction field (as defined by theinstruction-width
property)
The indent
and instruction-width
properties can be set by either the
@set directive, or the Set-indent
and Set-instruction-width
configuration parameters of skool2asm.py.
label¶
The label
template is used to format an instruction label.
{label}{suffix}
The following identifiers are available:
label
- the instruction labelsuffix
- ‘:’ or an empty string (as defined by thelabel-colons
property)
The label-colons
property can be set by either the @set directive, or
the Set-label-colons
configuration parameter of
skool2asm.py.
org¶
The org
template is used to format an ORG directive produced by @org.
{indent}{org} {address}
The following identifiers are available:
address
- the ORG address (as a string)indent
- the instruction indent (as defined by theindent
property)org
- ‘ORG’ or ‘org’ (depending on the case)
The indent
property can be set by either the @set directive, or the
Set-indent
configuration parameter of skool2asm.py.
register¶
The register
template is used to format lines in the register section of an
entry header.
; {prefix:>{prefix_len}}{reg:<{reg_len}} {text}
The following identifiers are available:
max_reg_len
- the maximum length of all register names in the register sectionprefix
- the register prefix (e.g. ‘In:’ or ‘O:’), or an empty string (if formatting a register description continuation line)prefix_len
- the maximum length of all register prefixes in the register sectionreg
- the register name (e.g. ‘HL’), or an empty string (if formatting a register description continuation line)reg_len
- the length of the register nametext
- the text of a line of the register description
Changed in version 8.7: Added the ‘<’ alignment specifier to the reg
field (to handle the case
where reg_len
is 0).
Changed in version 8.0: Added the max_reg_len
identifier.