|
||||||||
|
Technical Support On-Line Manuals C166 User's Guide |
Traditional Inline AssemblyThe traditional inline assembler merges assembly instructions with the code generated by the compiler and creates assembly source files that you assemble with the A166 Assembler. The ASM and ENDASM directives enclose the assembly source code and the SRC directive directs the compiler to generate an assembler source file. For example:
#pragma SRC
#pragma SMALL
unsigned int asmfunc1 (
unsigned int arg)
{
#pragma ASM
INC R8
#pragma ENDASM
return (arg);
}
For this example, the compiler generates the following SRC file.
$NOMACRO
$SEGMENTED CASE MOD167
;
; '.\asmfunc1.SRC' GENERATED FROM INPUT FILE 'asmfunc1.c'
; COMPILER INVOKED BY:
; C:\Keil\C166\BIN\C166.EXE asmfunc1.c BROWSE
; MOD167 DEBUG SRC(.\asmfunc1.SRC)
;
$MODINF (43)
NAME ASMFUNC1
NCODE CGROUP ?PR?ASMFUNC1
ASSUME DPP3 : SYSTEM
REGDEF R0 - R15
?PR?ASMFUNC1 SECTION CODE WORD 'NCODE'
; line 1: #pragma SRC
; line 2: #pragma SMALL
; line 3:
; line 4: unsigned int asmfunc1 (
asmfunc1 PROC NEAR
PUBLIC asmfunc1
; FUNCTION asmfunc1 (BEGIN RMASK = @0x0010)
;---- Variable 'arg' assigned to Register 'R8' ----
; line 4: unsigned int arg)
; line 5: {
; line 6: #pragma asm
; line 7: ADD R8,#1
ADD R8,#1
; line 8: #pragma endasm
; line 9:
; line 10: return (arg);
MOV R4,R8
; line 11: }
RET
; FUNCTION asmfunc1 (END RMASK = @0x0010)
asmfunc1 ENDP
?PR?ASMFUNC1 ENDS
END
Note
| |||||||
|
||||||||