The compiler treats the code format string in an __asm statement
similarly to the way the printf function treats a
format string, with the following exception: Instead of printing out
the string during program execution, the compiler inserts it after
the generated sequence of assembly statements, before the END statement.
More than one assembler instruction can be put into the code format
string. As shown in
Figure 1,
each assembler statement must be separated by the new line character
'\n' (like the new line character that is used in a
printf format
string).
Figure 1. Code format
string with two instructions void foo() {
__asm ( " AR 1,2\n AR 1,2" );
}
The example in
Figure 1 will
embed two
" AR 1,2" instructions in the HLASM source
code. You can make the statement more readable by breaking the string
into two. In C, adjacent string literals are automatically concatenated
and treated as one. The sample code in
Figure 1 and
Figure 2 generate the
same output.
Figure 2. Code
format string with two instructions, formatted for readability void foo() {
__asm ( " AR 1,2\n" 1
" AR 1,2" ); 2
}
Notes: - The character "\n" is still required to delimit statements.
- The second statement also begins with a blank space.