1 /*****************************************************************************/
5 /* Inline assembler statements for the cc65 C compiler */
9 /* (C) 2001 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 /*****************************************************************************/
47 /*****************************************************************************/
49 /*****************************************************************************/
53 void AsmStatement (void)
54 /* This function parses ASM statements. The syntax of the ASM directive
55 * looks like the one defined for C++ (C has no ASM directive), that is,
56 * a string literal in parenthesis.
62 /* Need left parenthesis */
66 if (CurTok.Tok != TOK_SCONST) {
67 Error ("String literal expected");
70 /* The string literal may consist of more than one line of assembler
71 * code. Separate the single lines and output the code.
73 const char* S = GetLiteral (CurTok.IVal);
76 /* Separate the lines */
77 const char* E = strchr (S, '\n');
89 /* Reset the string pointer, effectivly clearing the string from the
90 * string table. Since we're working with one token lookahead, this
91 * will fail if the next token is also a string token, but that's a
92 * syntax error anyway, because we expect a right paren.
94 ResetLiteralPoolOffs (CurTok.IVal);
97 /* Skip the string token */
100 /* Closing paren needed */