1 /*****************************************************************************/
5 /* Predefined macro packages for the ca65 macroassembler */
9 /* (C) 1998 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
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 */
53 static char MacGeneric [] = /* Generic macros */
54 ".macro add Arg1, Arg2\n"
56 " .if .paramcount = 2\n"
62 ".macro sub Arg1, Arg2\n"
64 " .if .paramcount = 2\n"
73 static char MacLongBranch [] = /* Long branch macros */
75 " .if .match(Target, 0)\n"
78 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
86 " .if .match(Target, 0)\n"
89 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
97 " .if .match(Target, 0)\n"
100 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
107 ".macro jpl Target\n"
108 " .if .match(Target, 0)\n"
111 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
118 ".macro jcs Target\n"
119 " .if .match(Target, 0)\n"
122 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
129 ".macro jcc Target\n"
130 " .if .match(Target, 0)\n"
133 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
140 ".macro jvs Target\n"
141 " .if .match(Target, 0)\n"
144 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
151 ".macro jvc Target\n"
152 " .if .match(Target, 0)\n"
155 " .elseif .def(Target,local) .and ((*+2)-(Target) <= 127)\n"
165 /* Table with pointers to the different packages */
166 static char* MacPackages [] = {
173 /*****************************************************************************/
175 /*****************************************************************************/
179 void InsertMacPack (unsigned Id)
180 /* Insert the macro package with the given id in the input stream */
182 /* Check the parameter */
183 CHECK (Id < sizeof (MacPackages) / sizeof (MacPackages [0]));
185 /* Insert the package */
186 NewInputData (MacPackages [Id], 0);