1 /*****************************************************************************/
5 /* Predefined macro packages for the ca65 macroassembler */
9 /* (C) 1998-2003 Ullrich von Bassewitz */
10 /* Römerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
46 /*****************************************************************************/
48 /*****************************************************************************/
52 /* Predefined packages */
55 static char MacGeneric[] =
56 ".macro add Arg1, Arg2\n"
58 " .if .paramcount = 2\n"
64 ".macro sub Arg1, Arg2\n"
66 " .if .paramcount = 2\n"
73 /* Long branch macros */
74 static char MacLongBranch[] =
76 " .if .match(Target, 0)\n"
79 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
87 " .if .match(Target, 0)\n"
90 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
98 " .if .match(Target, 0)\n"
101 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
108 ".macro jpl Target\n"
109 " .if .match(Target, 0)\n"
112 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
119 ".macro jcs Target\n"
120 " .if .match(Target, 0)\n"
123 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
130 ".macro jcc Target\n"
131 " .if .match(Target, 0)\n"
134 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
141 ".macro jvs Target\n"
142 " .if .match(Target, 0)\n"
145 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
152 ".macro jvc Target\n"
153 " .if .match(Target, 0)\n"
156 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
164 /* Commodore specific macros */
165 static char MacCBM[] =
166 ".macro scrcode str\n"
167 " .repeat .strlen(str), i\n"
168 " .if (.strat(str, i) >= '@' .and .strat(str, i) <= 'z')\n"
169 " .byte .strat(str, i) - '@'\n"
170 " .elseif (.strat(str, i) >= 'A' .and .strat(str, i) <= 'Z')\n"
171 " .byte .strat(str, i) - 'A' + 65\n"
172 " .elseif (.strat(str, i) = '[')\n"
174 " .elseif (.strat(str, i) = ']')\n"
176 " .elseif (.strat(str, i) = '^')\n"
178 " .elseif (.strat(str, i) = '_')\n"
181 " .byte .strat(str, i)\n"
187 static char MacCPU[] =
188 "CPU_ISET_6502 = $01\n"
189 "CPU_ISET_65SC02 = $02\n"
190 "CPU_ISET_65C02 = $04\n"
191 "CPU_ISET_65816 = $08\n"
192 "CPU_ISET_SUNPLUS = $10\n"
197 "CPU_SUNPLUS = $10\n";
201 /* Table with pointers to the different packages */
202 static char* MacPackages [] = {
211 /*****************************************************************************/
213 /*****************************************************************************/
217 void InsertMacPack (unsigned Id)
218 /* Insert the macro package with the given id in the input stream */
220 /* Check the parameter */
221 CHECK (Id < sizeof (MacPackages) / sizeof (MacPackages [0]));
223 /* Insert the package */
224 NewInputData (MacPackages [Id], 0);