<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">

<language name="Motorola DSP56k" section="Assembler" version="5" kateversion="5.62" extensions="*.asm;*.inc;*.ASM;*.INC" author="Miro Kropacek (miro.kropacek@gmail.com)" license="LGPL">

  <highlighting>
    <list name="Data Registers">
      <item>x</item>
      <item>x0</item>
      <item>x1</item>
      <item>y</item>
      <item>y0</item>
      <item>y1</item>
      <item>a2</item>
      <item>a1</item>
      <item>a0</item>
      <item>a</item>
      <item>a10</item>
      <item>ab</item>
      <item>b2</item>
      <item>b1</item>
      <item>b0</item>
      <item>b</item>
      <item>b10</item>
      <item>ba</item>
    </list>

    <list name="Address Registers">
      <item>r0</item>
      <item>r1</item>
      <item>r2</item>
      <item>r3</item>
      <item>r4</item>
      <item>r5</item>
      <item>r6</item>
      <item>r7</item>
    </list>

    <list name="Offset Registers">
      <item>n0</item>
      <item>n1</item>
      <item>n2</item>
      <item>n3</item>
      <item>n4</item>
      <item>n5</item>
      <item>n6</item>
      <item>n7</item>
    </list>

    <list name="Modifier Registers">
      <item>m0</item>
      <item>m1</item>
      <item>m2</item>
      <item>m3</item>
      <item>m4</item>
      <item>m5</item>
      <item>m6</item>
      <item>m7</item>
    </list>

    <list name="Control Registers">
      <item>la</item>
      <item>lc</item>
      <item>pc</item>
      <item>ssh</item>
      <item>ssl</item>
      <item>omr</item>
      <item>sr</item>
      <item>sp</item>
      <item>mr</item>
      <item>ccr</item>
    </list>

    <list name="Instructions">
      <item>abs</item>
      <item>adc</item>
      <item>add</item>
      <item>addl</item>
      <item>addr</item>
      <item>and</item>
      <item>andi</item>
      <item>asl</item>
      <item>asr</item>
      <item>bchg</item>
      <item>bclr</item>
      <item>bset</item>
      <item>btst</item>
      <item>clr</item>
      <item>cmp</item>
      <item>cmpm</item>
      <item>div</item>
      <item>do</item>
      <item>enddo</item>
      <item>eor</item>
      <item>illegal</item>
      <item>jcc</item>
      <item>jhs</item>
      <item>jcs</item>
      <item>jls</item>
      <item>jec</item>
      <item>jeq</item>
      <item>jes</item>
      <item>jge</item>
      <item>jgt</item>
      <item>jlc</item>
      <item>jle</item>
      <item>jls</item>
      <item>jlt</item>
      <item>jmi</item>
      <item>jne</item>
      <item>jnr</item>
      <item>jpl</item>
      <item>jnn</item>
      <item>jclr</item>
      <item>jmp</item>
      <item>jscc</item>
      <item>jshs</item>
      <item>jscs</item>
      <item>jsls</item>
      <item>jsec</item>
      <item>jseq</item>
      <item>jses</item>
      <item>jsge</item>
      <item>jsgt</item>
      <item>jslc</item>
      <item>jsle</item>
      <item>jsls</item>
      <item>jslt</item>
      <item>jsmi</item>
      <item>jsne</item>
      <item>jsnr</item>
      <item>jspl</item>
      <item>jsnn</item>
      <item>jsclr</item>
      <item>jset</item>
      <item>jsr</item>
      <item>jsset</item>
      <item>lsl</item>
      <item>lsr</item>
      <item>lua</item>
      <item>mac</item>
      <item>macr</item>
      <item>move</item>
      <item>movec</item>
      <item>movem</item>
      <item>movep</item>
      <item>mpy</item>
      <item>mpyr</item>
      <item>neg</item>
      <item>nop</item>
      <item>norm</item>
      <item>not</item>
      <item>or</item>
      <item>ori</item>
      <item>rep</item>
      <item>reset</item>
      <item>rnd</item>
      <item>rol</item>
      <item>ror</item>
      <item>rti</item>
      <item>rts</item>
      <item>sbc</item>
      <item>stop</item>
      <item>sub</item>
      <item>subl</item>
      <item>subr</item>
      <item>swi</item>
      <item>tcc</item>
      <item>ths</item>
      <item>tcs</item>
      <item>tls</item>
      <item>tec</item>
      <item>teq</item>
      <item>tes</item>
      <item>tge</item>
      <item>tgt</item>
      <item>tlc</item>
      <item>tle</item>
      <item>tls</item>
      <item>tlt</item>
      <item>tmi</item>
      <item>tne</item>
      <item>tnr</item>
      <item>tpl</item>
      <item>snn</item>
      <item>tfr</item>
      <item>tst</item>
      <item>wait</item>
    </list>

    <list name="Directives">
      <item>endif</item>
      <item>endc</item>
      <item>else</item>
      <item>ifne</item>
      <item>if</item>
      <item>ifeq</item>
      <item>ifle</item>
      <item>iflt</item>
      <item>ifge</item>
      <item>ifgt</item>
      <item>include</item>
      <item>incbin</item>
      <item>printval</item>
      <item>pass1val</item>
      <item>pass2val</item>
      <item>fail</item>
      <item>endm</item>
      <item>end</item>
      <item>org</item>
      <item>ds</item>
      <item>dsm</item>
      <item>list</item>
      <item>nolist</item>
      <item>macro</item>
      <item>dc</item>
      <item>equ</item>
    </list>

    <list name="Functions">
	    <item>@abs</item>
	    <item>@acs</item>
	    <item>@asn</item>
	    <item>@at2</item>
	    <item>@atn</item>
	    <item>@cel</item>
	    <item>@coh</item>
	    <item>@cos</item>
	    <item>@flr</item>
	    <item>@l10</item>
	    <item>@log</item>
	    <item>@max</item>
	    <item>@min</item>
	    <item>@pow</item>
	    <item>@rnd</item>
	    <item>@sgn</item>
	    <item>@sin</item>
	    <item>@snh</item>
	    <item>@sqt</item>
	    <item>@tan</item>
	    <item>@tnh</item>
	    <item>@xpn</item>
	    <item>@cvf</item>
	    <item>@cvi</item>
	    <item>@cvs</item>
	    <item>@fld</item>
	    <item>@frc</item>
	    <item>@lfr</item>
	    <item>@lng</item>
	    <item>@lun</item>
	    <item>@rvb</item>
	    <item>@unf</item>
	    <item>@len</item>
	    <item>@pos</item>
	    <item>@scp</item>
	    <item>@arg</item>
	    <item>@cnt</item>
	    <item>@mac</item>
	    <item>@mxp</item>
	    <item>@ccc</item>
	    <item>@chk</item>
	    <item>@ctr</item>
	    <item>@def</item>
	    <item>@exp</item>
	    <item>@int</item>
	    <item>@lcv</item>
	    <item>@lst</item>
	    <item>@msp</item>
	    <item>@rel</item>
    </list>

    <contexts>
      <context name="Normal Text" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="Operation">
        <DetectSpaces attribute="Normal Text"/>

        <DetectChar attribute="Comment" context="Comment" char="*" firstNonSpace="1"/>

        <DetectIdentifier attribute="Label" context="Label" column="0"/>
        <DetectChar attribute="Local label" context="LocalLabel" char="_" column="0"/>

        <keyword attribute="Instructions" context="Operation" String="Instructions"/>
        <keyword attribute="Directives" context="Operation" String="Directives"/>

        <RegExpr attribute="Label" context="EndLabel" String="[a-zA-Z][a-zA-Z0-9._]*+(?=:)"/>
        <RegExpr attribute="Local label" context="EndLabel" String="_[a-zA-Z][a-zA-Z0-9._]*+(?=:)"/>

        <DetectIdentifier attribute="Unknown Instructions" context="Operation"/>
      </context>

      <context name="Operation" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="Expression">
        <AnyChar attribute="Constant" context="Addressing Mode" String="#&lt;&gt;"/>
        <RegExpr attribute="Memory" context="#stay" String="[xylpXYLP]:"/>
      </context>

      <context name="Addressing Mode" attribute="Constant" lineEndContext="#pop" fallthroughContext="#pop!Constant_Expression">
        <AnyChar attribute="Constant" context="#pop!Constant_Expression" String="&lt;&gt;"/>
      </context>

      <context name="Expression" attribute="Normal Text" lineEndContext="#pop">
        <DetectChar attribute="Hex" context="Number16" char="$"/>
        <DetectChar attribute="Binary" context="Number2" char="%"/>
        <DetectChar attribute="Number" context="Number8OrFunc" char="@" lookAhead="1"/>
        <Float attribute="Float" context="#stay"/>
        <Int attribute="Number" context="#stay"/>
        <IncludeRules context="Inc_Expression"/>
        <DetectIdentifier attribute="Normal Text"/>
      </context>

      <context name="Constant_Expression" attribute="Constant" lineEndContext="#pop">
        <DetectChar attribute="Constant" context="Constant_Number16" char="$"/>
        <DetectChar attribute="Constant" context="Constant_Number2" char="%"/>
        <DetectChar attribute="Constant" context="Constant_Number8OrFunc" char="@" lookAhead="1"/>
        <Float attribute="Constant" context="#stay"/>
        <Int attribute="Constant" context="#stay"/>
        <IncludeRules context="Inc_Expression"/>
        <DetectIdentifier attribute="Label"/>
      </context>

      <context name="Inc_Expression" attribute="Normal Text" lineEndContext="#pop">
        <DetectChar attribute="Comment" context="#pop!Comment" char=";"/>
        <DetectChar attribute="Symbol Separator" context="#pop" char=","/>
        <DetectSpaces attribute="Normal Text" context="#pop"/>
        <AnyChar attribute="Symbols" context="#stay" String="+-*/%?&amp;|&lt;&gt;^!=[]{}()"/>

        <DetectChar attribute="String" context="SQ_String" char="'"/>
        <DetectChar attribute="String" context="DQ_String" char="&quot;"/>

        <keyword attribute="Data Registers" context="#stay" String="Data Registers"/>
        <keyword attribute="Address Registers" context="#stay" String="Address Registers"/>
        <keyword attribute="Offset Registers" context="#stay" String="Offset Registers"/>
        <keyword attribute="Modifier Registers" context="#stay" String="Modifier Registers"/>
        <keyword attribute="Control Registers" context="#stay" String="Control Registers"/>
      </context>

      <context name="Constant_Number16" attribute="Constant" lineEndContext="#pop" fallthroughContext="#pop">
        <RegExpr attribute="Constant" context="#pop" String="[A-Fa-f0-9]+"/>
      </context>

      <context name="Constant_Number2" attribute="Constant" lineEndContext="#pop" fallthroughContext="#pop">
        <RegExpr attribute="Constant" context="#pop" String="[01]+"/>
      </context>

      <context name="Constant_Number8OrFunc" attribute="Constant" lineEndContext="#pop" fallthroughContext="#pop">
        <keyword attribute="Functions" context="#pop!Constant_Func" String="Functions"/>
        <DetectChar attribute="Constant" context="#pop!Constant_Number8OrFunc_2" char="@"/>
      </context>
      <context name="Constant_Number8OrFunc_2" attribute="Constant" lineEndContext="#pop" fallthroughContext="#pop">
        <DetectIdentifier attribute="Constant" context="#pop!Constant_Func"/>
        <RegExpr attribute="Constant" context="#pop" String="[0-7]+"/>
      </context>
      <context name="Constant_Func" attribute="Functions" lineEndContext="#pop" fallthroughContext="#pop">
        <DetectChar attribute="Symbols" context="#pop!Constant_InnerFunc" char="("/>
      </context>
      <context name="Constant_InnerFunc" attribute="Functions" lineEndContext="#pop">
        <DetectChar attribute="Symbols" context="#pop" char=")"/>
        <DetectChar attribute="Symbols" context="Constant_InnerFunc" char="("/>
        <DetectChar attribute="Symbol Separator" context="#stay" char=","/>
        <DetectChar attribute="Constant" context="Constant_Number16" char="$"/>
        <DetectChar attribute="Constant" context="Constant_Number2" char="%"/>
        <DetectChar attribute="Constant" context="Constant_Number8OrFunc" char="@" lookAhead="1"/>
        <Float attribute="Constant" context="#stay"/>
        <Int attribute="Constant" context="#stay"/>
        <IncludeRules context="Inc_Expression"/>
        <DetectIdentifier attribute="Normal Text"/>
      </context>

      <context name="Number8OrFunc" attribute="Octal" lineEndContext="#pop" fallthroughContext="#pop">
        <keyword attribute="Functions" context="#pop" String="Functions"/>
        <DetectChar attribute="Octal" context="#pop!Number8OrFunc_2" char="@"/>
      </context>
      <context name="Number8OrFunc_2" attribute="Octal" lineEndContext="#pop" fallthroughContext="#pop">
        <RegExpr attribute="Octal" context="#pop" String="[0-7]+"/>
        <DetectIdentifier attribute="Functions" context="#pop"/>
      </context>

      <context name="Number16" attribute="Hex" lineEndContext="#pop" fallthroughContext="#pop">
        <RegExpr attribute="Hex" context="#pop" String="[A-Fa-f0-9]+"/>
      </context>

      <context name="Number2" attribute="Binary" lineEndContext="#pop" fallthroughContext="#pop">
        <RegExpr attribute="Binary" context="#pop" String="[01]+"/>
      </context>

      <context name="Label" attribute="Label" lineEndContext="#pop" fallthroughContext="#pop!EndLabel">
        <DetectChar attribute="Label" context="Label2" char="."/>
      </context>
      <context name="Label2" attribute="Label" lineEndContext="#pop" fallthroughContext="#pop#pop!EndLabel">
        <DetectIdentifier attribute="Label" context="#stay"/>
        <DetectChar attribute="Label" context="#stay" char="."/>
      </context>

      <context name="LocalLabel" attribute="Local label" lineEndContext="#pop" fallthroughContext="#pop!EndLabel">
        <DetectChar attribute="Local label" context="LocalLabel2" char="."/>
      </context>
      <context name="LocalLabel2" attribute="Local label" lineEndContext="#pop" fallthroughContext="#pop#pop!EndLabel">
        <DetectIdentifier attribute="Local label" context="#stay"/>
        <DetectChar attribute="Local label" context="#stay" char="."/>
      </context>

      <context name="EndLabel" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
        <DetectChar attribute="Symbols" context="#stay" char=":"/>
        <DetectSpaces attribute="Normal Text" context="#stay"/>
        <keyword attribute="Instructions" context="#pop!Operation" String="Instructions"/>
        <keyword attribute="Directives" context="#pop!Operation" String="Directives"/>
        <DetectIdentifier attribute="Unknown Instructions" context="#pop!Operation"/>
      </context>

      <context name="SQ_String" attribute="String" lineEndContext="#pop">
        <DetectChar attribute="String" context="#pop" char="'"/>
        <DetectChar attribute="Char" context="Escape" char="\"/>
      </context>

      <context name="DQ_String" attribute="String" lineEndContext="#pop">
        <DetectChar attribute="String" context="#pop" char="&quot;"/>
        <DetectChar attribute="Char" context="Escape" char="\"/>
      </context>

      <context name="Escape" attribute="Char" lineEndContext="#pop" fallthroughContext="#pop">
        <AnyChar attribute="Char" context="#pop" String="bfnrt\'"/>
      </context>

      <context name="Comment" attribute="Comment" lineEndContext="#pop">
        <DetectSpaces attribute="Comment"/>
        <IncludeRules context="##Comments"/>
        <DetectIdentifier attribute="Comment"/>
      </context>

    </contexts>

    <itemDatas>
      <!-- keywords -->
      <itemData name="Normal Text" defStyleNum="dsNormal"/>
      <itemData name="Data Registers" defStyleNum="dsDataType"/>
      <itemData name="Address Registers" defStyleNum="dsDataType"/>
      <itemData name="Offset Registers" defStyleNum="dsDataType"/>
      <itemData name="Modifier Registers" defStyleNum="dsDataType"/>
      <itemData name="Control Registers" defStyleNum="dsDataType"/>
      <itemData name="Instructions" bold="true" defStyleNum="dsKeyword"/>
      <itemData name="Unknown Instructions" defStyleNum="dsKeyword"/>
      <itemData name="Directives" bold="true" defStyleNum="dsControlFlow"/>
      <itemData name="Memory" bold="true" defStyleNum="dsOthers"/>
      <itemData name="Functions" bold="true" defStyleNum="dsFunction"/>
      <!-- defined in contexts -->
      <itemData name="Comment" italic="false" defStyleNum="dsComment"/>
      <itemData name="Label" defStyleNum="dsFunction"/>
      <itemData name="Local label" defStyleNum="dsFunction"/>
      <itemData name="Constant" defStyleNum="dsConstant"/>
      <itemData name="Octal" defStyleNum="dsBaseN"/>
      <itemData name="Hex" defStyleNum="dsBaseN"/>
      <itemData name="Binary" defStyleNum="dsBaseN"/>
      <itemData name="Float" defStyleNum="dsFloat"/>
      <itemData name="Number" defStyleNum="dsDecVal"/>
      <itemData name="Char" defStyleNum="dsChar"/>
      <itemData name="String" defStyleNum="dsString"/>
      <itemData name="Symbol Separator" defStyleNum="dsOperator"/>
      <itemData name="Symbols" defStyleNum="dsOperator"/>
    </itemDatas>
  </highlighting>

  <general>
    <keywords casesensitive="0" weakDeliminator="@"/>
    <comments>
      <comment name="singleLine" start=";"/>
    </comments>
  </general>

</language>
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->
