0
|
1 ;=============================================================================
|
|
2 ;
|
623
|
3 ; File varargs.inc combined next generation V3.0.1
|
0
|
4 ;
|
|
5 ; Utilities to pass multiple arguments in compact code stream.
|
|
6 ;
|
|
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
|
|
8 ;=============================================================================
|
|
9 ; HISTORY
|
|
10 ; 2011-05-27 : [jDG] Creation.
|
|
11 ;
|
|
12
|
604
|
13 VARARGS_BEGIN macro
|
|
14 movff TOSL, TBLPTRL
|
|
15 movff TOSH, TBLPTRH
|
|
16 movff TOSU, TBLPTRU
|
|
17 endm
|
0
|
18
|
604
|
19 VARARGS_GET8 macro register
|
|
20 tblrd*+
|
|
21 movff TABLAT, register
|
|
22 endm
|
0
|
23
|
604
|
24 VARARGS_GET16 macro register
|
|
25 tblrd*+
|
|
26 movff TABLAT, register+0
|
|
27 tblrd*+
|
|
28 movff TABLAT, register+1
|
|
29 endm
|
0
|
30
|
604
|
31 VARARGS_GET24 macro register
|
|
32 tblrd*+
|
|
33 movff TABLAT, register+0
|
|
34 tblrd*+
|
|
35 movff TABLAT, register+1
|
|
36 tblrd*+
|
|
37 movff TABLAT, register+2
|
|
38 endm
|
0
|
39
|
604
|
40 VARARGS_ALIGN macro
|
|
41 local no_tblptr_align
|
0
|
42
|
604
|
43 btfss TBLPTRL,0
|
|
44 bra no_tblptr_align
|
|
45 incf TBLPTRL
|
|
46 movlw 0
|
|
47 addwfc TBLPTRH
|
|
48 addwfc TBLPTRU
|
0
|
49 no_tblptr_align:
|
604
|
50 endm
|
0
|
51
|
|
52 VARARGS_END macro
|
604
|
53 ; compute string length (modulo 256):
|
|
54 movf TOSL,W
|
|
55 subwf TBLPTRL,W
|
0
|
56
|
604
|
57 ; then 24 bit add to return address
|
|
58 addwf TOSL,F
|
|
59 movlw 0 ; clear WREG, but keep carry
|
|
60 addwfc TOSH,F
|
|
61 addwfc TOSU,F
|
|
62 endm
|