MEMORY PARTITIONS

4.2.2.5Using the Linker Locator to Set Up a Window

In this example, the linker locator is used to set up a window. The linker locator locates the win- dow in the upper register file and determines the value to load in the WSR for access to that win- dow. (Please consult the manual provided with the linker locator for details.)

********* mod1

**************

mod1 module main

;Main module for linker

public

function1

 

extrn

?WSR

;Must declare ?WSR as external

wsr equ 14h:byte sp equ 18h:word

oseg

 

 

 

var1:

dsw

1

;Allocate variables in an

var2:

dsw

1

;overlayable segment

var3:

dsw

1

 

cseg

 

 

 

function1:

 

 

 

push

wsr

 

;Prolog code for wsr

ldb

wsr, #?WSR

;Prolog code for wsr

add var1, var2, var3

;Use the variables as registers

;

 

 

 

;

 

 

 

;

 

 

 

ldb

wsr, [sp]

;Epilog code for wsr

add sp, #2

 

;Epilog code for wsr

ret

 

 

 

end

 

 

 

******** mod2 **************

public function2 extrn ?WSR

wsr

equ

14h:byte

sp

equ

18h:word

oseg

 

 

 

 

var1:

dsw

1

 

var2:

dsw

1

 

var3:

dsw

1

cseg

 

 

 

function2:

 

 

 

push

wsr

;Prolog code for wsr

4-17

Page 82
Image 82
Intel 8XC196MH, 8XC196MD, 8XC196MC manual Using the Linker Locator to Set Up a Window, ?Wsr