Example 10. Moving a Function from Slow to Fast Memory at Run Time
;---------------------------------------------------------
; define a section to be copied from SLOW_MEM to FAST_MEM
;---------------------------------------------------------
.sect ".fir"
.label fir_src ; load address of section
fir: ; run address of section
<code here> ; code for the section
.label fir_end ; load address of section end
;---------------------------------------------------------
; copy .fir section from SLOW_MEM to FAST_MEM
;---------------------------------------------------------
.text
MOV XAR6, fir_src
MOV XAR7, #fir
RPT #(fir_end - fir_src - 1)
k PWRITE *XAR7, *XAR6++
;---------------------------------------------------------
; jump to section, now in FAST_MEM
;---------------------------------------------------------
B fir