1
;;; Test 68HC12 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
call _far_no_tramp ; No trampoline generated for _far_no_tramp
41
.far _far_bar ; Must mark symbol as far
71
.globl __far_trampoline
73
movb 0,sp, 2,sp ; Copy page register below the caller's return
75
jmp 0,y ; We have a 'call/rtc' stack layout now
76
; and can jump to the far handler
77
; (whose memory bank is mapped due to the
78
; call to the trampoline).