Keil Logo

SMALL Model

LOC  OBJ       LINE     SOURCE
                  1     ; A166 must be CASE sensitive for interfacing with C166.
                  2     $CASE
                  3     ; SMALL model works in SEGMENTED mode of the 80C166.
                  4     $SEGMENTED
                  5
                  6                     NAME    A166_modul
                  7     ;  /***********************************/
                  8     ;  /* Sample Assembler to C Interface */
                  9     ;  /***********************************/
                 10     ;
                 11     ;  extern int func1 (int a1, int a2, bit b);
                 12     ;
                 13     ;  extern bit flag;
                 14     ;  extern int near val;
                 15     ;
                 16     ;  int func2 (int *x1, int *x2)  {
                 17     ;    int y;
                 18     ;
                 19     ;    y = func1 (*x1, *x2, flag);
                 20     ;    val += y;
                 21     ;    return (y);
                 22     ;  }
                 23
                 24     EXTRN   func1 : NEAR
                 25     EXTRN   val   : WORD        ; near value based DPP2
                 26     EXTRN   flag  : BIT
                 27
                 28     ?PR?A166_modul  SECTION CODE 'NCODE'
                 29     NCODE           CGROUP  ?PR?A166_modul
                 30
                 31     PUBLIC          func2           ; entry point for func2
                 32
                 33     func2           PROC    NEAR
                 34     ;---- Variable 'x2' is passed in Register 'R9'.
                 35     ;---- Variable 'x1' is passed in Register 'R8'.
0000 ECFF        36                     PUSH    R15     ; Save R15 because of Bit Parameter
0002 A899        37                     MOV     R9,[R9]
0004 A888        38                     MOV     R8,[R8]
0006 4A??FF?0 E  39                     BMOV    R15.0,flag
000A CA00???? E  40                     CALLA   cc_UC,func1
                 41     ;---- The function value of 'func1' is returned in Register 'R4'.
                 42     ;---- temporary Variable 'y' is saved in Register 'R5'.
000E 04F4???? E  43                     ADD     DPP2:val,R4   ; NEAR variable requires DPP2
                 44
0012 FCFF        45                     POP     R15     ; restore R15
                 46     ;---- The function value 'y' is placed in 'R4'
0014 CB00        47                     RET
                 48     func2           ENDP
                 49
                 50     ?PR?A166_modul  ENDS
                 51
                 52                     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.