1<?php
2/*************************************************************************************
3 * 6502kickass.php
4 * -------
5 * Author: Warren Willmey
6 * Copyright: (c) 2010 Warren Willmey.
7 * Release Version: 1.0.9.1
8 * Date Started: 2010/06/07
9 *
10 * MOS 6502 (6510) Kick Assembler 3.13 language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 * 2010/07/22
15 *  -  First Release
16 *
17 * TODO (updated 2010/07/22)
18 * -------------------------
19 *
20 *************************************************************************************
21 *
22 *     This file is part of GeSHi.
23 *
24 *   GeSHi is free software; you can redistribute it and/or modify
25 *   it under the terms of the GNU General Public License as published by
26 *   the Free Software Foundation; either version 2 of the License, or
27 *   (at your option) any later version.
28 *
29 *   GeSHi is distributed in the hope that it will be useful,
30 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
31 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32 *   GNU General Public License for more details.
33 *
34 *   You should have received a copy of the GNU General Public License
35 *   along with GeSHi; if not, write to the Free Software
36 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
37 *
38 ************************************************************************************/
39
40$language_data = array (
41    'LANG_NAME' => 'MOS 6502 (6510) Kick Assembler format',
42    'COMMENT_SINGLE' => array(1 => '//'),
43    'COMMENT_MULTI' => array('/*' => '*/'),
44    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
45    'QUOTEMARKS' => array("'", '"'),
46    'ESCAPE_CHAR' => '',
47    'KEYWORDS' => array(
48        /* 6502/6510 Opcodes including undocumented opcodes as Kick Assembler 3.13 does not make a distinction - they are ALL valid. */
49        1 => array(
50            'adc', 'ahx', 'alr', 'anc', 'anc2', 'and', 'arr', 'asl',
51            'axs', 'bcc', 'bcs', 'beq', 'bit', 'bmi', 'bne', 'bpl',
52            'brk', 'bvc', 'bvs', 'clc', 'cld', 'cli', 'clv', 'cmp',
53            'cpx', 'cpy', 'dcp', 'dec', 'dex', 'dey', 'eor', 'inc',
54            'inx', 'iny', 'isc', 'jmp', 'jsr', 'las', 'lax', 'lda',
55            'ldx', 'ldy', 'lsr', 'nop', 'ora', 'pha', 'php', 'pla',
56            'plp', 'rla', 'rol', 'ror', 'rra', 'rti', 'rts', 'sax',
57            'sbc', 'sbc2', 'sec', 'sed', 'sei', 'shx', 'shy', 'slo',
58            'sre', 'sta', 'stx', 'sty', 'tas', 'tax', 'tay', 'tsx',
59            'txa', 'txs', 'tya', 'xaa',
60            ),
61        /* DTV additional Opcodes. */
62        2 => array(
63            'bra', 'sac', 'sir'
64            ),
65        /* Index Registers, yes the 6502 has other registers by they are only
66        * accessable by specific opcodes. */
67        3 => array(
68            'x', 'y'
69            ),
70        /* Directives. */
71        4 => array(
72            '.pc', '.pseudopc', 'virtual', '.align', '.byte', '.word', '.text', '.fill',
73            '.import source', '.import binary', '.import c64', '.import text', '.import', '.print', '.printnow',
74            '.error', '.var', '.eval', '.const', '.eval const', '.enum', '.label', '.define', '.struct',
75            'if', '.for', '.macro', '.function', '.return', '.pseudocommand', '.namespace', '.filenamespace',
76            '.assert', '.asserterror',
77            ),
78        /* Kick Assembler 3.13 Functions/Operators. */
79        5 => array(
80            'size', 'charAt', 'substring', 'asNumber', 'asBoolean', 'toIntString', 'toBinaryString', 'toOctalString',
81            'toHexString', 'lock',                                       // String functions/operators.
82            'get', 'set', 'add', 'remove', 'shuffle',                    // List functions.
83            'put', 'keys',                                               // Hashtable functions.
84            'getType', 'getValue', 'CmdArgument',                        // Pseudo Commands functions.
85            'asmCommandSize',                                            // Opcode Constants functions.
86            'LoadBinary', 'getSize',
87            'LoadSid', 'getData',
88            'LoadPicture', 'width', 'height', 'getPixel', 'getSinglecolorByte', 'getMulticolorByte',
89            'createFile', 'writeln',
90            'cmdLineVars',
91            'getX', 'getY', 'getZ',                                             // Vector functions.
92            'RotationMatrix', 'ScaleMatrix', 'MoveMatrix', 'PerspectiveMatrix', // Matrix functions.
93
94            ),
95
96        /* Kick Assembler 3.13 Math Functions. */
97        6 => array(
98            'abs', 'acos', 'asin', 'atan', 'atan2', 'cbrt', 'ceil', 'cos', 'cosh',
99            'exp', 'expm1', 'floor', 'hypot', 'IEEEremainder', 'log', 'log10',
100            'log1p', 'max', 'min', 'pow', 'mod', 'random', 'round', 'signum',
101            'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'toDegrees', 'toRadians',
102            ),
103
104        /* Kick Assembler 3.13 Objects/Data Types. */
105        7 => array(
106            'List',          // List() Object.
107            'Hashtable',     // Hashtable() Object.
108            'Vector',        // Vector() Object.
109            'Matrix',        // Matrix() Object.
110            ),
111
112        /* Kick Assembler 3.13 Constants. */
113        8 => array(
114            'PI', 'E',                                                         // Math Constants.
115            'AT_ABSOLUTE' , 'AT_ABSOLUTEX' , 'AT_ABSOLUTEY' , 'AT_IMMEDIATE',  // Pseudo Commands Constants.
116            'AT_INDIRECT' , 'AT_IZEROPAGEX' , 'AT_IZEROPAGEY' , 'AT_NONE',
117            'BLACK', 'WHITE', 'RED', 'CYAN', 'PURPLE', 'GREEN', 'BLUE',        // Colour Constants.
118            'YELLOW', 'ORANGE', 'BROWN', 'LIGHT_RED', 'DARK_GRAY', 'GRAY',
119            'LIGHT_GREEN', 'LIGHT_BLUE', 'LIGHT_GRAY',
120            'C64FILE',                                                         // Template Tag names.
121            'BF_C64FILE', 'BF_BITMAP_SINGLECOLOR', 'BF_KOALA' , 'BF_FLI',      // Binary format constant
122            ),
123
124        ),
125    'SYMBOLS' => array(
126//        '[', ']', '(', ')', '{', '}',    // These are already defined by GeSHi as BRACKETS.
127        '-', '+', '-', '*', '/', '>', '<', '<<', '>>', '&', '|', '^', '=', '==',
128        '!=', '>=', '<=', '!', '&&', '||', '#',
129        ),
130    'CASE_SENSITIVE' => array(
131        GESHI_COMMENTS => false,
132        1 => false,
133        2 => false,
134        3 => false,
135        4 => true,
136        5 => true,
137        6 => true,
138        7 => true,
139        8 => true,
140        ),
141    'STYLES' => array(
142        'KEYWORDS' => array(
143            1 => 'color: #00f; font-weight:bold;',
144            2 => 'color: #00f; font-weight:bold;',
145            3 => 'color: #00f; font-weight:bold;',
146            4 => 'color: #080; font-weight:bold;',
147            5 => 'color: #80f; font-weight:bold;',
148            6 => 'color: #f08; font-weight:bold;',
149            7 => 'color: #a04; font-weight:bold; font-style: italic;',
150            8 => 'color: #f08; font-weight:bold;',
151            ),
152        'COMMENTS' => array(
153            1 => 'color: #999; font-style: italic;',
154            ),
155        'ESCAPE_CHAR' => array(
156            0 => 'color: #009; font-weight: bold;'
157            ),
158        'BRACKETS' => array(
159            0 => 'color: #000;'
160            ),
161        'STRINGS' => array(
162            0 => 'color: #080;'
163            ),
164        'NUMBERS' => array(
165            GESHI_NUMBER_INT_BASIC          => 'color: #f00;',
166            GESHI_NUMBER_HEX_PREFIX_DOLLAR  => 'color: #f00;',
167            GESHI_NUMBER_BIN_PREFIX_PERCENT => 'color: #f00;',
168            GESHI_NUMBER_FLT_NONSCI         => 'color: #f00;',
169            ),
170        'METHODS' => array(
171            ),
172        'SYMBOLS' => array(
173            0 => 'color: #080;'
174            ),
175        'REGEXPS' => array(
176            0 => 'color: #933;',
177            1 => 'color: #933;',
178            2 => 'color: #933;',
179            3 => 'color: #00f; font-weight:bold;',
180            ),
181        'SCRIPT' => array(
182            )
183        ),
184    'URLS' => array(
185        1 => '',
186        2 => '',
187        3 => '',
188        4 => '',
189        5 => '',
190        6 => '',
191        7 => '',
192        8 => '',
193        ),
194    'OOLANG' => false,
195    'OBJECT_SPLITTERS' => array(
196        ),
197    'NUMBERS' =>
198        GESHI_NUMBER_INT_BASIC |
199        GESHI_NUMBER_FLT_NONSCI |
200        GESHI_NUMBER_HEX_PREFIX_DOLLAR |
201        GESHI_NUMBER_BIN_PREFIX_PERCENT,
202        // AMCE Octal format not support and gets picked up as Decimal unfortunately.
203    'REGEXPS' => array(
204        //Labels end with a collon.
205        0 => '[!]{0,1}[_a-zA-Z][_a-zA-Z0-9]*\:',
206        //Multi Labels (local labels) references start with ! and end with + or - for forward/backward reference.
207        1 => '![_a-zA-Z][_a-zA-Z0-9]*[+-]',
208        //Macros start with a colon :Macro.
209        2 => ':[_a-zA-Z][_a-zA-Z0-9]*',
210        // Opcode Constants, such as LDA_IMM, STA_IZPY are basically all 6502 opcodes
211        // in UPPER case followed by _underscore_ and the ADDRESS MODE.
212        // As you might imagine that is rather a lot ( 78 supported Opcodes * 12 Addressing modes = 936 variations)
213        // So I thought it better and easier to maintain as a regular expression.
214        // NOTE: The order of the Address Modes must be maintained or it wont work properly (eg. place ZP first and find out!)
215        3 => '[A-Z]{3}[2]?_(?:IMM|IND|IZPX|IZPY|ZPX|ZPY|ABSX|ABSY|REL|ABS|ZP)',
216        ),
217    'STRICT_MODE_APPLIES' => GESHI_NEVER,
218    'SCRIPT_DELIMITERS' => array(
219        ),
220    'HIGHLIGHT_STRICT_BLOCK' => array(
221        ),
222    'TAB_WIDTH' => 8,
223    'PARSER_CONTROL' => array(
224        'NUMBERS'  => array(
225            'PRECHECK_RX' => '/[\da-fA-F\.\$\%]/'
226            ),
227        'KEYWORDS' => array(
228            5 => array (
229                'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\;>|^&'\"])"
230                ),
231            6 => array (
232                'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\;>|^&'\"])"
233                ),
234            8 => array (
235                'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\;>|^&'\"])"
236                )
237            )
238        ),
239);
240