SPC  Version 0.9.5
 All Files Functions Groups Pages
The asm statement

The asm statement is used to define many of the SPC API calls.

The syntax of the statement is shown below.

asm {
one or more lines of SPRO assembly language
}

The statement simply emits the body of the statement as SuperPro ASM code and passes it directly to the compiler's backend. The asm statement can often be used to optimize code so that it executes as fast as possible on the SuperPro firmware. The following example shows an asm block containing variable declarations, labels, and basic SPRO ASM statements as well as comments.

asm {
MVI WORK2, 12
MOV PTR, WORK2
MOV (PTR), WORK1
INC PTR
}

The asm block statement and these special ASM keywords are used throughout the SPC API. You can have a look at the SPCDefs.h header file for several examples of how they are used. To keep the main SPC code as "C-like" as possible and for the sake of better readability SPC asm block statements can be wrapped in preprocessor macros and placed in custom header files which are included using #include.