1 ;;; Test
68HC11 FAR trampoline generation
2 ;;;
2 trampolines are generated
:
3 ;;;
- one for
'_far_bar'
4 ;;;
- one for
'_far_foo'
5 ;;;
'far_no_tramp' does
not have any trampoline generated.
16 bsr _far_bar ; Call to trampoline generated code
18 bne fail ; X
and D preserved
(swapped by _far_bar
)
22 cpx
#0xabcd ; Stack parameter preserved
24 ldd
#_far_foo ; Get address of trampoline handler
27 ldd
#_far_bar ; Likewise (unique trampoline check)
30 ldaa
#%page(_far_no_tramp)
31 ldy
#%addr(_far_no_tramp)
32 bsr __call_a16 ; No trampoline generated for _far_no_tramp
47 .far _far_bar ; Must mark symbol as far
77 .globl __far_trampoline
79 psha ;
(2) Save function parameter
(high
)
80 ;;
<Read current page in
A>
82 ;;
<Set currenge page from
B>
85 ldab
4,x ;
(4) Restore function parameter
(low
)
86 ldaa
2,x ;
(4) Get saved page number
87 staa
4,x ;
(4) Save it below return PC
90 pula ;
(3) Restore function parameter
(high
)
96 ;;
<Read current page in
A> ;
(3) ldaa _current_page
98 ;;
<Set current page from
B> ;
(4) staa _current_page