LARGE Model
LOC OBJ LINE SOURCE
1 ; A166 must be CASE sensitive for interfacing with C166.
2 $CASE
3 ; LARGE 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 : FAR
25 EXTRN val : WORD ; near value based DPP2
26 EXTRN flag : BIT
27
28 ?PR?A166_modul SECTION CODE 'NCODE'
29
30 PUBLIC func2 ; entry point for func2
31
32 ASSUME DPP3:SYSTEM ; required for SFR accesses
33
34 func2 PROC FAR
35 ;---- Variable 'x2' is a far * and passed in Register 'R10, R11'.
36 ;---- Variable 'x1' is a far * and passed in Register 'R8, R9'.
0000 ECFF 37 PUSH R15 ; Save R15 because of Bit Parameter
0002 F6F900FE 38 MOV DPP0,R9
0006 CC00 39 NOP
0008 A888 40 MOV R8,[R8]
000A F6FB00FE 41 MOV DPP0,R11
000E CC00 42 NOP
0010 A89A 43 MOV R9,[R10]
0012 4A??FF?0 E 44 BMOV R15.0,flag
0016 DA?????? E 45 CALLS SEG (func1), func1
46 ;---- The function value of 'func1' is returned in Register 'R4'.
47 ;---- temporary Variable 'y' is saved in Register 'R5'.
001A 04F4???? E 48 ADD DPP2:val,R4 ; NEAR variable requires DPP2
49
001E FCFF 50 POP R15 ; restore R15
51 ;---- The function value 'y' is placed in 'R4'
0020 DB00 52 RETS
53
54 func2 ENDP
55
56 ?PR?A166_modul ENDS
57
58 END