{%- macro comment_before(i) -%} {% if i.comment_before %}
{%- for line in i.comment_before.splitlines() -%} ; {{line}} {% endfor -%}
{%- endif -%} {%- endmacro -%} {%- macro comment_after(i) -%} {% if i.comment_after %}
{%- for line in i.comment_after.splitlines() -%} ; {{line}} {% endfor -%}
{%- endif -%} {%- endmacro -%} {%- macro comment_inline(i) -%} {%- if i.comment -%} ; {{i.comment}} {%- endif -%} {%- endmacro -%} {%- macro tabs() %} {% endmacro -%} {%- macro address(i) -%} {{"{:04x}".format(i.address)}} {%- endmacro -%} {%- macro address_range(i) -%} {{"{:04x}-{:04x}".format(i.ivl.first, i.ivl.last)}} {%- endmacro -%} {%- macro label(i) -%} {% if i.label %} {{i.label}}:
{%- endif %} {%- endmacro -%} {%- macro anchor(i) -%} {% if i.is_destination -%} {%- endif %} {%- endmacro -%} {%- macro operand(i) -%} {%- if i.instruction.is_source -%} {%- endif -%} {{i.instruction.operand|e}} {%- if i.instruction.is_source -%} {%- endif -%} {{i.instruction.op_adjust}} {%- endmacro -%} {%- macro instruction(i) -%} {{i.instruction.mnemonic}} {{i.instruction.pre}}{{operand(i)}}{{i.instruction.post}} {%- endmacro -%} {#- ----------------section handlers---------------- -#} {#- ----------------intro---------------- -#} {%- macro intro_handler(section) -%}
{{section.section_type}} section @ {{-address_range(section)-}}
{%- endmacro -%} {#- ----------------prefix---------------- -#} {%- macro prefix_handler(section) -%} {{ anchor(section) }} {{ comment_before(section) }} {{ label(section) }} {{ comment_after(section) }} {%- if section.authoring_info -%} {{section.authoring_info.type}} section @ {{-address_range(section.authoring_info)-}} {%- endif -%} {%- endmacro -%} {#- ----------------code---------------- -#} {%- macro code_handler(section) -%}
{%- for i in section.lines -%} {{anchor(i)}}{{address(i)}}{{tabs()}}{{i.bytes|seq2str("{:02x}",w=8)}}{{tabs()}}{{instruction(i)-}} {{-comment_inline(i)}} {% endfor -%}
{%- endmacro -%} {#- ----------------data---------------- -#} {%- macro data_handler(section) -%}
{%- for i in section.lines -%} {{anchor(i)}}{{address(i)}}{{tabs()}}{{i.bytes|seq2str("{:02x}", s=[(1," "), (4, " ")])}} {% endfor -%}
{%- endmacro -%} {#- ----------------ptr16---------------- -#} {%- macro ptr16_handler(section) -%} {%- for i in section.lines -%} {%- for v in i.vals -%} {%- endfor -%} {% endfor -%}
{{address(i)}}    {%- if v.is_source -%} {%- endif -%} {{v.val.name}} {%- if v.is_source -%} {%- endif -%} {{v.val.op_adjust}}   
{%- endmacro -%} {#- ----------------chars---------------- -#} {%- macro chars_handler(section) -%} {{"{:04x}".format(section.address)}}

{%- endmacro -%} {#- ----------------hole---------------- -#} {%- macro hole_handler(section) -%}
{% if section.next %}Next hole

{% endif %} {%- for r in section.contents -%} {{ r.type|dispatch(r) }} {% endfor -%}
{%- endmacro -%} {#- ----------------basic---------------- -#} {%- macro basic_handler(section) -%}
{%- for ln in section.lines -%} {{- anchor(ln) }}{#{{address(ln)}}{{tabs() -}}-#} {%- for tkn in ln.tokens -%} {{ tkn.type|cbmbasic_dispatch(tkn) }} {%- endfor %} {% endfor -%}
{%- endmacro -%} {%- macro cbmbasic_line_num_handler(tkn) -%} {{ tkn.val }} {% endmacro -%} {%- macro cbmbasic_text_handler(tkn) -%} {{ tkn.val }} {%- endmacro -%} {%- macro cbmbasic_command_handler(tkn) -%} {{ tkn.val }} {%- endmacro -%} {%- macro cbmbasic_quoted_handler(tkn) -%} {{ tkn.val }} {%- endmacro -%} {%- macro cbmbasic_line_ref_handler(tkn) -%} {%- if tkn.is_source -%} {%- endif -%} {{ tkn.val }} {%- if tkn.is_source -%} {%- endif -%} {%- endmacro -%} {%- macro cbmbasic_address_handler(tkn) -%} {%- if tkn.is_source -%} {%- endif -%} {{ tkn.val }} {%- if tkn.is_source -%} {%- endif -%} {%- endmacro -%} {#- ----------------dontcare---------------- -#} {%- macro dontcare_handler(section) -%}
{{address_range(section)}} : {{section.title}}
{%- endmacro -%} {#- ********************************BODY******************************** #}
{% if builton %}built on {{builton}}
{% endif %} {% if title %}

{{title}}

{% endif %} {#- ----------------first hole link---------------- -#} {%- if have_holes %} First hole

{% endif -%} {#- ----------------index---------------- -#} {%- if has_index %} {%- for ii in index -%} {{ii.name}}
{% endfor -%}
{% endif -%} {#- ----------------sections---------------- -#} {%- for section in items -%} {{ section.type|dispatch(section) }} {% endfor -%}