Keil Logo

Using the SRC Directive

The C166 Compiler can create assembly source files that you assemble with the A166 Assembler. These SRC files can help you determine the argument passing conventions between C and assembly.

To create an assembly source file, you must use the SRC directive with the C166 Compiler. For example:

#pragma SRC
#pragma SMALL

unsigned int asmfunc1 (
  unsigned int arg)
{
return (1 + arg);
}

For this example, the compiler generates the following SRC file.

$NOMACRO
$SEGMENTED CASE NOMOD166
;
; 'ASM1.SRC' GENERATED FROM INPUT FILE 'ASM1.C'
; COMPILER INVOKED BY:
;       C166.EXE ASM1.C CODE SRC
;
$MODINF (11)
        NAME ASM1

        NCODE   CGROUP  ?PR?ASM1
        ASSUME  DPP3: SYSTEM
        REGDEF  R0 - R15

        ?PR?ASM1  SECTION  CODE WORD 'NCODE'
; line 1: #pragma SRC
; line 2: #pragma SMALL
; line 3:
; line 4: unsigned int asmfunc1 (unsigned int arg)  {

        asmfunc1  PROC  NEAR
        PUBLIC  asmfunc1
; FUNCTION asmfunc1 (BEGIN  RMASK = @0x0010)
;---- Variable 'arg' assigned to Register 'R8' ----
; line 5:   return (1 + arg);
        MOV     R4,R8
        ADD     R4,#1
; line 6: }
        RET

; FUNCTION asmfunc1 (END    RMASK = @0x0010)
        asmfunc1  ENDP
        ?PR?T  ENDS

        END
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.