Skip to content

Instantly share code, notes, and snippets.

@AntonioND
Last active June 21, 2018 15:25
Show Gist options
  • Select an option

  • Save AntonioND/eb5a870e9900a312fde8 to your computer and use it in GitHub Desktop.

Select an option

Save AntonioND/eb5a870e9900a312fde8 to your computer and use it in GitHub Desktop.
Game Boy RGBDS asm syntax highlight for gedit.

Game Boy RGBDS-GBZ80 syntax highlight for gedit

Based on a Z80 language file made by Rafael de Oliveira Jannone. Adaptation to RGBDS-GBZ80 by Antonio Niño Díaz (AntonioND) [email protected]

Copy the file "gbz80.lang" to "~/.local/share/gtksourceview-2.0/language-specs/gbz80.lang" Recognised extensions are *.asm, *.s and *.inc.

You can also change the text color style: Copy the file "cobaltex.xml" to "~/.gnome2/gedit/styles/cobaltex.xml". Select it in the preferences.

<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2015 Antonio Niño Díaz <[email protected]>
Copyright (C) 2006-2007 Will Farrington <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<style-scheme id="cobaltex" _name="CobaltEx" version="1.0">
<author>Antonio Niño Díaz</author>
<_description>Blue-based color scheme, based on the style Cobalt by Will Farrington.</_description>
<!-- Colors -->
<color name="faded_yellow" value="#ffee80"/>
<color name="red" value="#ff0000"/>
<color name="light_red" value="#ff8080"/>
<color name="bright_orange" value="#ff9d00"/>
<color name="faded_orange" value="#ffb054"/>
<color name="nail_polish_pink" value="#ff0044"/>
<color name="neon_yellow" value="#ffdd00"/>
<color name="sky_blue" value="#0088ff"/>
<color name="teal_blue" value="#80ffbb"/>
<color name="light_blue" value="#0065bf"/>
<color name="medium_blue" value="#003b70"/>
<color name="dark_blue" value="#001b33"/>
<color name="black_blue" value="#000d1a"/>
<color name="white" value="#ffffff"/>
<color name="pale_grey" value="#eeeeee"/>
<color name="steel_grey" value="#333333"/>
<color name="spring_green" value="#3ad900"/>
<color name="light_grey" value="#cccccc"/>
<color name="bluish_grey" value="#777777"/>
<color name="steelblue3" value="#4f94cd"/>
<!-- Global Settings -->
<style name="text" foreground="white" background="dark_blue"/>
<style name="cursor" foreground="white"/>
<style name="current-line" background="medium_blue"/>
<style name="line-numbers" foreground="light_blue" background="black_blue"/>
<style name="draw-spaces" foreground="medium_blue"/>
<!-- Bracket Matching -->
<style name="bracket-match" foreground="bright_orange" bold="true"/>
<style name="bracket-mismatch" background="black_blue" bold="true"/>
<style name="search-match" foreground="white" background="sky_blue"/>
<!-- Comments -->
<style name="def:comment" foreground="sky_blue" italic="true"/>
<style name="def:shebang" foreground="sky_blue" italic="true"/>
<style name="def:doc-comment-element" foreground="sky_blue" bold="true"/>
<!-- Constants and Variables-->
<style name="def:constant" foreground="faded_yellow"/>
<style name="def:string" foreground="spring_green"/>
<style name="def:special-char" foreground="light_red"/>
<style name="def:special-constant" foreground="neon_yellow" bold="true"/>
<style name="def:boolean" foreground="neon_yellow"/>
<style name="def:number" foreground="neon_yellow"/>
<style name="def:floating-point" foreground="neon_yellow"/>
<style name="def:keyword" foreground="bright_orange" bold="true"/>
<style name="def:builtin" foreground="bright_orange" bold="true"/>
<style name="def:variable" foreground="light_grey"/>
<!-- Identifiers -->
<style name="def:identifier" foreground="light_red"/>
<!-- Statements -->
<style name="def:statement" foreground="bright_orange"/>
<!-- Types -->
<style name="def:type" foreground="teal_blue"/>
<!-- Others -->
<style name="def:error" foreground="white" background="black_blue" bold="true"/>
<style name="def:note" foreground="neon_yellow" bold="true"/>
<style name="def:net-address-in-comment" foreground="teal_blue" italic="false" underline="true"/>
<style name="def:preprocessor" foreground="red"/>
<!-- Unknown? -->
<style name="def:specials" foreground="white" background="neon_yellow"/>
<!-- C Styles -->
<style name="c:preprocessor" map-to="def:special-char"/>
<!-- Diff Styles -->
<style name="diff:ignore" foreground="bluish_grey"/>
<!-- Ruby Styles -->
<style name="ruby:module-handler" foreground="teal_blue"/>
<style name="ruby:symbol" foreground="nail_polish_pink"/>
<style name="ruby:regex" foreground="teal_blue"/>
<!-- SH Styles -->
<style name="sh:function" foreground="neon_yellow"/>
<style name="sh:others" map-to="text"/>
<!-- XML Styles -->
<style name="xml:attribute-name" foreground="light_grey"/>
<style name="xml:element-name" foreground="teal_blue"/>
</style-scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Game Boy RGBDS-GBZ80 syntax highlight
_____________________________________
Authors: Antonio Niño Díaz (AntonioND)
Copyright (C) 2015 Antonio Niño Díaz <[email protected]>
Based on the work of:
Authors: Rafael de Oliveira Jannone
Copyright (C) 2008 Rafael de Oliveira Jannone <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<language id="gbz80asm" _name="Game Boy RGBDS ASM" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">text/x-asm-file</property>
<property name="globs">*.asm;*.ASM;*.s;*.S;*.inc;*.INC</property>
<property name="line-comment-start">;</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="character" _name="Character" map-to="def:string"/>
<style id="directive" _name="Directive" map-to="def:preprocessor"/>
<style id="mnemonic" _name="Mnemonic" map-to="def:statement"/>
<style id="data" _name="Data" map-to="def:type"/>
<style id="decimal" _name="Decimal number" map-to="def:decimal"/>
<style id="base-n-integer" _name="Base-N integer" map-to="def:base-n-integer"/>
<style id="gb-graphics" _name="Game Boy Graphics" map-to="def:base-n-integer"/>
<style id="label" _name="Label" map-to="def:keyword" />
<style id="register" _name="Register" map-to="def:identifier"/>
<style id="operator" _name="Operator" map-to="def:type"/>
<style id="trailing-spaces" _name="Trailing Spaces" map-to="def:error"/>
</styles>
<default-regex-options case-sensitive="false"/>
<definitions>
<context id="gbz80asm">
<include>
<!-- gtk-doc -->
<context ref="gtk-doc:inline-docs-section"/>
<!-- Comments -->
<context id="comment" style-ref="comment" end-at-line-end="true">
<start>;</start>
<include>
<context ref="def:in-line-comment"/>
</include>
</context>
<context id="string" style-ref="string" end-at-line-end="true">
<start>"</start>
<end>"</end>
</context>
<context id="character" style-ref="character" end-at-line-end="true">
<start>'</start>
<end>'</end>
</context>
<context id="base-n-integer" style-ref="base-n-integer">
<match extended="true">
(?&lt;![\w\.])
((\$[a-fA-F0-9]+)|(%[0-1]+)|(&amp;[0-7]+)|([0-9]+\.[0-9]+))
(?![\w\.])
</match>
</context>
<context id="gb-graphics" style-ref="gb-graphics">
<match extended="true">
(?&lt;![\w\.])
(`[0-3]+)
(?![\w\.])
</match>
</context>
<context id="decimal" style-ref="decimal">
<match extended="true">
(?&lt;![\w\.])
[0-9]+
(?![\w\.])
</match>
</context>
<context id="mnemonics" style-ref="mnemonic">
<keyword>ADC</keyword>
<keyword>ADD</keyword>
<keyword>AND</keyword>
<keyword>BIT</keyword>
<keyword>CALL</keyword>
<keyword>CCF</keyword>
<keyword>CP</keyword>
<keyword>CPL</keyword>
<keyword>DAA</keyword>
<keyword>DEC</keyword>
<keyword>DI</keyword>
<keyword>EI</keyword>
<keyword>HALT</keyword>
<keyword>INC</keyword>
<keyword>JP</keyword>
<keyword>JR</keyword>
<keyword>LD</keyword>
<keyword>LDD</keyword>
<keyword>LDI</keyword>
<keyword>LDH</keyword>
<keyword>NOP</keyword>
<keyword>OR</keyword>
<keyword>POP</keyword>
<keyword>PUSH</keyword>
<keyword>RES</keyword>
<keyword>RET</keyword>
<keyword>RETI</keyword>
<keyword>RL</keyword>
<keyword>RLA</keyword>
<keyword>RLC</keyword>
<keyword>RLCA</keyword>
<keyword>RLD</keyword>
<keyword>RR</keyword>
<keyword>RRA</keyword>
<keyword>RRC</keyword>
<keyword>RRCA</keyword>
<keyword>RST</keyword>
<keyword>SBC</keyword>
<keyword>SCF</keyword>
<keyword>SET</keyword>
<keyword>SLA</keyword>
<keyword>SRA</keyword>
<keyword>SRL</keyword>
<keyword>STOP</keyword>
<keyword>SUB</keyword>
<keyword>SWAP</keyword>
<keyword>XOR</keyword>
</context>
<context id="directives" style-ref="directive">
<!-- Doesn't work.
<keyword>\@</keyword>
-->
<keyword>__DATE__</keyword>
<keyword>__LINE__</keyword>
<keyword>__TIME__</keyword>
<keyword>_NARG</keyword>
<keyword>_PI</keyword>
<keyword>_RS</keyword>
<keyword>ACOS</keyword>
<keyword>ASIN</keyword>
<keyword>ATAN</keyword>
<keyword>ATAN2</keyword>
<keyword>BANK</keyword>
<keyword>COS</keyword>
<keyword>DEF</keyword>
<keyword>DIV</keyword>
<keyword>ELSE</keyword>
<keyword>ENDC</keyword>
<keyword>ENDM</keyword>
<keyword>ENDR</keyword>
<keyword>EQU</keyword>
<keyword>EQUS</keyword>
<keyword>EXPORT</keyword>
<keyword>FAIL</keyword>
<keyword>GLOBAL</keyword>
<keyword>IF</keyword>
<keyword>IMPORT</keyword>
<keyword>INCBIN</keyword>
<keyword>INCLUDE</keyword>
<keyword>MACRO</keyword>
<keyword>MUL</keyword>
<keyword>OPT</keyword>
<keyword>POPO</keyword>
<keyword>POPS</keyword>
<keyword>PRINTF</keyword>
<keyword>PRINTT</keyword>
<keyword>PRINTV</keyword>
<keyword>PURGE</keyword>
<keyword>PUSHO</keyword>
<keyword>PUSHS</keyword>
<keyword>REPT</keyword>
<keyword>RB</keyword>
<keyword>RSRESET</keyword>
<keyword>RSSET</keyword>
<keyword>RW</keyword>
<keyword>SECTION</keyword>
<keyword>SET</keyword>
<keyword>SHIFT</keyword>
<keyword>SIN</keyword>
<keyword>STRCAT</keyword>
<keyword>STRCMP</keyword>
<keyword>STRIN</keyword>
<keyword>STRLEN</keyword>
<keyword>STRLWR</keyword>
<keyword>STRSUB</keyword>
<keyword>STRUPR</keyword>
<keyword>TAN</keyword>
<keyword>WARN</keyword>
<keyword>XDEF</keyword>
<keyword>XREF</keyword>
<keyword>HOME</keyword>
<keyword>CODE</keyword>
<keyword>DATA</keyword>
<keyword>BSS</keyword>
<keyword>ROM0</keyword>
<keyword>ROMX</keyword>
<keyword>VRAM</keyword>
<keyword>WRAM</keyword>
<keyword>SRAM</keyword>
<keyword>WRAM0</keyword>
<keyword>WRAMX</keyword>
<keyword>HRAM</keyword>
</context>
<context id="data" style-ref="data">
<keyword>DB</keyword>
<keyword>DS</keyword>
<keyword>DW</keyword>
</context>
<context id="registers" style-ref="register">
<keyword>AF</keyword>
<keyword>HL</keyword>
<keyword>BC</keyword>
<keyword>DE</keyword>
<keyword>SP</keyword>
<keyword>A</keyword>
<keyword>H</keyword>
<keyword>L</keyword>
<keyword>B</keyword>
<keyword>C</keyword>
<keyword>D</keyword>
<keyword>E</keyword>
</context>
<context id="condition" style-ref="register">
<!-- Repeated in register list
<keyword>C</keyword>
-->
<keyword>NC</keyword>
<keyword>Z</keyword>
<keyword>NZ</keyword>
</context>
<context id="operator" style-ref="operator">
<!-- Unary operators. They don't work...
<keyword>\~</keyword>
<keyword>\+</keyword>
<keyword>\-</keyword>
<keyword>\!</keyword>
-->
<keyword>\+</keyword>
<keyword>\-</keyword>
<keyword>\*</keyword>
<keyword>/</keyword>
<keyword>%</keyword>
<keyword>&lt;&lt;</keyword>
<keyword>&gt;&gt;</keyword>
<keyword>&amp;</keyword>
<keyword>\|</keyword>
<keyword>\^</keyword>
<keyword>!=</keyword>
<keyword>==</keyword>
<keyword>&lt;=</keyword>
<keyword>&gt;=</keyword>
<keyword>&lt;</keyword>
<keyword>&gt;</keyword>
<keyword>&amp;&amp;</keyword>
<keyword>\|\|</keyword>
</context>
<!-- Global labels can't use a "." or a "\@". -->
<context id="label" style-ref="label">
<match extended="true">
(^(\.)([A-Za-z_]([A-Za-z0-9_#]+)?)?((\\\@)([A-Za-z0-9_#]+)?)?(:)(?!:))|
(^[A-Za-z_]([A-Za-z0-9_#]+)?(\\\@)?([A-Za-z0-9_#]+)?(:)(?!:))|
(^[A-Za-z_]([A-Za-z0-9_#]+)?(:{1,2})(?!:))
</match>
</context>
<context id="trailing-spaces" style-ref="trailing-spaces">
<match extended="true">
([\t ]+)$
</match>
</context>
</include>
</context>
</definitions>
</language>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment