1<?php
2/*************************************************************************************
3 * 6502tasm.php
4 * -------
5 * Author: Warren Willmey
6 * Copyright: (c) 2010 Warren Willmey.
7 * Release Version: 1.0.9.1
8 * Date Started: 2010/06/02
9 *
10 * MOS 6502 (6510) TASM/64TASS (64TASS being the super set of TASM) 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) TASM/64TASS 1.46 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. */
49        1 => array(
50            'adc', 'and', 'asl', 'bcc', 'bcs', 'beq', 'bit', 'bmi',
51            'bne', 'bpl', 'brk', 'bvc', 'bvs', 'clc', 'cld', 'cli',
52            'clv', 'cmp', 'cpx', 'cpy', 'dec', 'dex', 'dey', 'eor',
53            'inc', 'inx', 'iny', 'jmp', 'jsr', 'lda', 'ldx', 'ldy',
54            'lsr', 'nop', 'ora', 'pha', 'php', 'pla', 'plp', 'rol',
55            'ror', 'rti', 'rts', 'sbc', 'sec', 'sed', 'sei', 'sta',
56            'stx', 'sty', 'tax', 'tay', 'tsx', 'txa', 'txs', 'tya',
57            ),
58        /* Index Registers, yes the 6502 has other registers by they are only
59        * accessable by specific opcodes. The 65816 also has access to the stack pointer S. */
60        2 => array(
61            'x', 'y', 's'
62            ),
63        /* Directives. */
64        3 => array(
65            '.al', '.align', '.as', '.assert', '.binary', '.byte', '.cerror', '.char',
66            '.comment', '.cpu', '.cwarn', '.databank', '.dpage', '.else', '.elsif',
67            '.enc', '.endc', '.endif', '.endm', '.endp', '.error', '.fi', '.fill',
68            '.for', '.here', '.if', '.ifeq', '.ifmi', '.ifne', '.ifpl',
69            '.include', '.int', '.logical', '.long', '.macro', '.next', '.null', '.offs',
70            '.page', '.pend', '.proc', '.rept', '.rta', '.shift', '.text', '.warn', '.word',
71            '.xl', '.xs',
72//            , '*='        // Not a valid keyword (uses both * and = signs) moved to symbols instead.
73            ),
74
75        /* 6502/6510 undocumented opcodes (often referred to as illegal instructions).
76        *  These are present in the 6502/6510 but NOT in the newer CMOS revisions of the 65C02 or 65816.
77        *  As they are undocumented instructions there are no "official" names for them, these are the names
78        *  used by 64TASS V1.46.
79        */
80        4 => array(
81            'ahx', 'alr', 'anc', 'ane', 'arr', 'asr', 'axs', 'dcm',
82            'dcp', 'ins', 'isb', 'isc', 'jam', 'lae', 'las', 'lax',
83            'lds', 'lxa', 'rla', 'rra', 'sax', 'sbx', 'sha', 'shs',
84            'shx', 'shy', 'slo', 'sre', 'tas', 'xaa',
85            ),
86        /* 65c02 instructions, MOS added a few (much needed) instructions in the
87        *  CMOS version of the 6502, but stupidly removed the undocumented/illegal opcodes.  */
88        5 => array(
89            'bra', 'dea', 'gra', 'ina', 'phx', 'phy', 'plx', 'ply',
90            'stz', 'trb', 'tsb',
91            ),
92        /* 65816 instructions. */
93        6 => array(
94            'brl', 'cop', 'jml', 'jsl', 'mvn', 'mvp', 'pea', 'pei',
95            'per', 'phb', 'phd', 'phk', 'plb', 'pld', 'rep', 'rtl',
96            'sep', 'stp', 'swa', 'tad', 'tcd', 'tcs', 'tda',
97            'tdc', 'tsa', 'tsc', 'txy', 'tyx', 'wai', 'xba', 'xce',
98            ),
99        /* Deprecated directives (or yet to be implemented). */
100        7 => array(
101            '.global', '.check'
102            ),
103        ),
104    'SYMBOLS' => array(
105//        '[', ']', '(', ')', '{', '}',    // These are already defined by GeSHi as BRACKETS.
106        '*=', '#', '<', '>', '`', '=', '<', '>',
107        '!=', '>=', '<=', '+', '-', '*', '/', '//', '|',
108        '^', '&', '<<', '>>', '-', '~', '!',
109        ),
110    'CASE_SENSITIVE' => array(
111        GESHI_COMMENTS => false,
112        1 => false,
113        2 => false,
114        3 => false,
115        4 => false,
116        5 => false,
117        6 => false,
118        7 => false,
119        ),
120    'STYLES' => array(
121        'KEYWORDS' => array(
122            1 => 'color: #00f; font-weight:bold;',
123            2 => 'color: #00f; font-weight:bold;',
124            3 => 'color: #080; font-weight:bold;',
125            4 => 'color: #f00; font-weight:bold;',
126            5 => 'color: #80f; font-weight:bold;',
127            6 => 'color: #f08; font-weight:bold;',
128            7 => 'color: #a04; font-weight:bold; font-style: italic;',
129            ),
130        'COMMENTS' => array(
131            1 => 'color: #999; font-style: italic;',
132            ),
133        'ESCAPE_CHAR' => array(
134            0 => 'color: #009; font-weight: bold;'
135            ),
136        'BRACKETS' => array(
137            0 => 'color: #000;'
138            ),
139        'STRINGS' => array(
140            0 => 'color: #080;'
141            ),
142        'NUMBERS' => array(
143            GESHI_NUMBER_INT_BASIC          => 'color: #f00;',
144            GESHI_NUMBER_HEX_PREFIX_DOLLAR  => 'color: #f00;',
145            GESHI_NUMBER_BIN_PREFIX_PERCENT => 'color: #f00;',
146            ),
147        'METHODS' => array(
148            ),
149        'SYMBOLS' => array(
150            0 => 'color: #080;'
151            ),
152        'REGEXPS' => array(
153            ),
154        'SCRIPT' => array(
155            )
156        ),
157    'URLS' => array(
158        1 => '',
159        2 => '',
160        3 => '',
161        4 => '',
162        5 => '',
163        6 => '',
164        7 => '',
165        ),
166    'OOLANG' => false,
167    'OBJECT_SPLITTERS' => array(
168        ),
169    'NUMBERS' =>
170        GESHI_NUMBER_INT_BASIC |
171        GESHI_NUMBER_HEX_PREFIX_DOLLAR |
172        GESHI_NUMBER_BIN_PREFIX_PERCENT,
173        // AMCE Octal format not support and gets picked up as Decimal unfortunately.
174    'REGEXPS' => array(
175        ),
176    'STRICT_MODE_APPLIES' => GESHI_NEVER,
177    'SCRIPT_DELIMITERS' => array(
178        ),
179    'HIGHLIGHT_STRICT_BLOCK' => array(
180        ),
181    'TAB_WIDTH' => 8,
182    'PARSER_CONTROL' => array(
183        'NUMBERS' => array(
184            'PRECHECK_RX' => '/[\da-fA-F\.\$\%]/'
185            )
186        )
187);
188